Trinity in Trouble
Note
Based on Free Pascal branch "fixes 3.0"
Feel free to add delete or change status.
Our trinity consist of Amiga, AROS and MorphOS.
Unfortunately, there are (still) some incompatibilities and/or some lack of consistency here and there. The idea is to have a list here that mentions them all. Layout may change, i simply had to start somewhere.
NOTE: I thought there is no use to mention the Tag, Tags, Taglist, etc. inconsistency and additional incompatibilities that this causes. We are all aware of those and will hopefully get some unity in the future
Table of units
The triforce repo introduced the usage of unit trinitypes in order to fight the type inconsistencies (at least for the new units, not the examples). The contents of trinitype will be extended as things progresses. A simple load-search-replace-save routine/program can be applied since the used types are fairly unique.
Unit | Category | OS3.x | AROS | MorphOS | Remark(s) |
---|---|---|---|---|---|
#agraphics | graphics.library | yes | yes | yes | |
ahi | ahi.device | yes | MAG | yes | |
ahi_sub | ahi_sub.library | yes | no | no | |
akeyboard | keyboard.device | yes | test | test | |
amarquee | amarquee.library | yes | n/a | n/a | |
#amigados | dos.library | yes | yes | yes | |
amigaguide | amigaguide.library | yes | MAG | no | No use though, AROS' lib functions are not implemented |
#amigalib | amigalib | yes | no | yes | |
amigaprinter | printer.device | yes | test | test | |
#asl | asl.library | yes | yes | yes | |
audio | audio.device | yes | MAG | no | |
bootblock | bootblock.device | yes | no | no | |
bullet | bullet.library | yes | no | no | |
cd | cd.device | yes | no | no | |
clipboard | clipboard.device | yes | yes | yes | |
colorwheel | colorwheel.gadget | yes | no | no | |
#commodities | commodities.library | yes | test | test | |
configregs | see expansion | yes | no | no | |
configvars | see expansion | yes | no | no | |
console | console.device | yes | no | no | |
conunit | console.device | yes | no | no | |
cgxvideo | no | no | yes | Recently added to MorphOS by Chain-Q | |
cybergraphics | cybergraphics.library | yes | yes | yes | Recently added to MorphOS by Chain-Q |
datatypes | datatypes.library | yes | test | yes | Unit source (AROS) is still a bit of a mess. Amiga version needs an overhaul (no PObject_ being used where it should -> concerns most if not all of declared functions). |
diskfont | diskfont.library | yes | yes | test | A diskfont unit was added to MorphOS by Chain-Q |
#exec | exec.library | yes | yes | yes | MorphOS: noticed some things missing in comparison to SDK 3.9 (this is meant as a reminder to verify this unit) |
expansion | expansion.library | yes | no | no | |
expansionbase | yes | no | no | ||
#gadtools | gadtools.library | yes | yes | test | |
gameport | gameport.device | yes | no | no | |
get9 | ? | no | no | yes | |
gradientslider | gradientslider.gadget | yes | no | no | |
gtlayout | gtlayout.library | yes | no | no | |
guigfx | guigfx.library | yes | no | no | |
hardblocks | hardblocks.device | yes | no | no | |
hardware | hardware.resource | yes | yes | yes | |
icon | icon.library | yes | yes | test | |
identify | identify.lbrary | yes | no | no | |
iffparse | iffparse.library | yes | yes | yes | |
input | input.device | yes | test | test | |
inputevent | see input.device | yes | yes | yes | |
#intuition | intuition.library | yes | yes | yes | |
keymap | keymap.library | yes | yes | yes | |
kvm | ? | no | no | yes | |
layers | layers.library | yes | yes | yes | |
locale | locale.library | yes | test | test | |
lowlevel | lowlevel.library | yes | MAG | no | |
lucyplay | lucyplay.library | yes | no | no | |
mui | mui.library (ZUNE) | yes | yes | yes | |
muihelper | see mui.library | no | no | yes | |
mysticview | mysticview.library | yes | no | no | |
nonvolatile | nonvolatile.library | yes | no | no | |
parallel | parallel.device | yes | no | no | |
picasso96api | picasso library | yes | no | no | |
preferences | preferences.library | yes | n/a | no | |
prefs | see preferences | yes | test | test | |
prtbase | printer.device | yes | no | no | |
prtgfx | ? | yes | no | no | |
ptreplay | ptreplay.library | yes | MAG | no | |
realtime | realtime.library | yes | no | no | |
render | render.library | yes | no | no | |
reqtools | reqtools.library | yes | no | no | |
rexx | rexx.library | yes | ??? | no | |
romboot_base | yes | no | no | ||
scsidisk | scscidisk.device | yes | no | no | |
serial | serial.device | yes | no | no | |
tapedeck | tapedeck.gadget | yes | no | no | |
timer | timer.device | yes | yes | yes | |
tinygl | tinygl library | no | no | yes | |
trackdisk | trackdisk.device | yes | no | no | |
translator | translator.library | yes | no | no | |
triton | triton.library | yes | no | no | |
tritonmacros | macros for triton | yes | no | no | |
ttengine | ttengine.library | yes | MAG | no | |
utility | utility.library | yes | yes | yes | |
#workbench | workbench.library | yes | yes | test | |
xadmaster | xadmaster.library | yes | MAG | no | |
zlib | zlib.library | yes | no | no | |
amigautils | amigautils | yes | no | no | |
amsgbox | msgbox using easyasl | yes | no | no | |
consoleio | crt using console | yes | no | no | |
deadkeys | console deadkeys | yes | no | no | |
doublebuffer | yes | no | no | ||
easyasl | easyasl.library | yes | no | no | |
hisoft | yes | no | no | ||
linklist | yes | no | no | ||
longarray | yes | yes | no | ||
pastoc | yes | no | no | ||
pcq | yes | no | no | ||
systemvartags | yes | no | no | NOTE: this unit cannot be used when trying to create executables to be run on AROS-m68k because AROS misses bullet.library. | |
tagsarray | yes | yes | no | ||
timerutils | yes | no | no | ||
vartags | yes | no | no | ||
wbargs | yes | no | no |
List of issues
amigados
amigalib
- function: CreatePort()
- Missing for AROS and MorphOS
- function: DeletePort()
- Missing for AROS and MorphOS
- function: CreateExtIO()
- Missing for AROS and MorphOS
- function: DeleteExtIO()
- Missing for AROS and MorphOS
- function: DoMethod()
- Amiga version seems missing completely.
- Implemented versions for AROS and MorphOS don't follow autodocs 100% and are inconsistent.
- function: CoerceMethod()
- MorphOS version seems missing completely (including CoerceMethodA().
- Amiga version has CoerceMethodA() implemented but no CoerceMethod()
- Implemented versions for AROS and Amiga don't follow autodocs 100% and are inconsistent.
asl
AROS' implementation of asl uses 'modern' function names, ending with or without an A depending whether it's a varargs version or not. Amiga and MorphOS implementations uses 'old-style' naming scheme as dictated by classic autodocs. In order to 'fix' this, unit trinity re-declares asl functions using the 'old-style' naming scheme (it was the quickest fix).
- function: ASLRequestTags()
- AROS implementation seems missing.
- Amiga implements it in utility unit systemvartags (see also unit: systemvartags)
- MorphOS implements it in unit ASL
- function: AslRequest()
- autodocs: BOOL AslRequest( APTR,struct TagItem * );
- Amiga: FUNCTION AslRequest(requester : POINTER location 'a0'; tagList : pTagItem location 'a1') : LongInt; syscall AslBase 060;
- AROS: function AslRequest(Requester: Pointer; const Tags: array of const): LongBool;
- MorphOS: function AslRequest(requester: Pointer location 'a0'; tagList : pTagItem location 'a1'): LongBool; SysCall AslBase 060;
- function: RequestFile()
- Autodocs: BOOL RequestFile(struct FileRequester *);
- Amiga: FUNCTION RequestFile(fileReq : pFileRequester location 'a0') : LongInt; syscall AslBase 042;
- Remark: Here the boolean return type is allowed (as is used on the other platforms)
- function: AslRequest()
- Autodocs: BOOL AslRequest(APTR,struct TagItem *);
- Amiga: FUNCTION AslRequest(requester: POINTER location 'a0'; tagList: pTagItem location 'a1'): LongInt; syscall AslBase 060;
- Remark: Here the boolean return type is allowed (as is used on the other platforms)
exec
- type: Tag
- Autodocs: "typedef ULONG Tag;"
- Amiga: "Type Tag = LongInt;"
- record field: ti_Data of record tTagItem
- Autodocs: "ULONG ti_Data;"
- Amiga: "ti_Data : LongInt;"
- structure: Hook
- AROS version, entries are not IPTR rather APTR. Amiga version uses ULONG's for h_entry and h_subentry, but that doesn't comply on 64-bit. AROS version can be found here.
- Remark: In case it's compatibility holding back the change, i'm willing to create a multiplatform advanced record solution
commodities
- record: TNewBroker
- Amiga: This structure seems aligned wrongly.
- Note1: Packrecords c failed, packrecords 2 seems to work, but its influence on other record structure (InputXpression) was not tested (it uses two bytes as first entry in its structure).
- Note2: Amiga and morphos sdk seems to use pragmapack #2, so also for the second structure.
- function CxBroker()
- AutoDocs: CxObj *CxBroker(struct NewBroker *,LONG *);
- Amiga: 238 FUNCTION CxBroker(nb : pNewBroker location 'a0'; error : pCxObj location 'd0') : pCxObj; syscall CxBase 036;
- Note: according to autodocs, error is a pointer to a generic LONG, not pCxObj;
- function CreateCxObj()
- AutoDocs: co = CreateCxObj(type,arg1,arg2); D0 = D0 A0 A1
- Amiga: 237 FUNCTION CreateCxObj(typ : ULONG location 'd0'; arg1 : LONGINT location 'a1'; arg2 : LONGINT location 'a2') : pCxObj; syscall CxBase 030;
- Note: notice different use of address registers. I have not faintest idea why they don't match. Maybe there's a valid reason ? (although aros and mos also uses same registers as stated by autodocs).
gadtools
- unit: gadtools
MorphOS: unit missingAvailable in fpc-triforce repo (for link see unit table). Waiting for testing/approval.
- varargs function: CreateGadget()
- AROS: missing
- varargs function: CreateMenus()
- AROS: missing
- varargs function: DrawBevelBox()
- AROS: missing
- varargs function: GetVisualInfo()
- AROS: missing
- varargs function: GT_GetGadgetAttrs()
- AROS: missing
- varargs function: GT_SetGadgetAttrs()
- AROS: missing
- varargs function: LayoutMenuItems()
- AROS: missing
- varargs function: LayoutMenus()
- AROS: missing
- function: CreateContext()
- Amiga SDK: struct Gadget *CreateContext(struct Gadget **);
- AROS SDK: struct Gadget *CreateContext(struct Gadget **glistpointer) (A0)
- Amiga: FUNCTION CreateContext(glistptr : pGadget location 'a0'): pGadget; syscall GadToolsBase 114;
- AROS: function CreateContext(GListPtr: PGadget): PGadget; syscall GadToolsBase 19;
- Note: glistpointer is a pointer to a pointer
workbench
- function: AddAppIconA()
- Autodocs: struct AppIcon *AddAppIconA(ULONG, ULONG, char *, struct MsgPort *, BPTR, struct DiskObject *, struct TagItem *);
- Amiga: FUNCTION AddAppIconA(id : ULONG location 'd0'; userdata : ULONG location 'd1'; text_ : pCHAR location 'a0'; msgport : pMsgPort location 'a1'; lock : pFileLock location 'a2'; diskobj : pDiskObject location 'a3'; const taglist : pTagItem location 'a4') : pAppIcon; syscall WorkbenchBase 060;
- Note: lock parameter is of type BPTR not pFileLock
- varargs function: AddAppIcon()
- Amiga: Missing
uncategorized
- unit: systemvartags
- This utility unit is Amiga specific and implements most if not all vartags versions of library-calls rendering it incompatible with AROS and MorphOS
- function: WriteStr()
- On MorphOS this function seems declared as Amiga-function, which clashes with Free Pascal build-in function WriteStr. Strange as WriteStr seems only declared as dos/stdio.h macro.
Fixed in triforce
Additional units, added to triforce repo. Note that all issues listed above are already addressed with using unit trinity.
unit: akeyboard
unit: diskfont
- MorphOS: missing | fixed in triforce[3]
unit: prefs
unit: AmigaPrinter
unit: Datatypes
- AROS: missing | fixed in triforce[8]
unit: input
unit: workbench
- MorphOS: missing | fixed in triforce[11]
unit: icon
- MorphOS: missing | fixed in triforce[12]
unit: locale
unit: gadtools
- MorphOS: missing | fixed in triforce[15]
unit: commodities
Fixed in current trunk
function: GetAttr()fixed in trunk [18]
- MorphOS uses a var for parameter Return-Value while Amiga + AROS uses a pointer. Autodocs states it to be a pointer.
function: AllocMem() (high priority)Fixed in trunk [19]
- MorphOS implemented it as ExecAllocMem
- Amiga + AROS version have this function declared as AllocMem(), which is ambiguous with Free Pascal's AllocMem function.
function: Info()fixed in trunk [20]
- AutoDocs: BOOL = Info( BPTR, struct InfoData * )
- Amiga declaration: FUNCTION Info(lock : LONGINT location 'd1'; parameterBlock : pInfoData location 'd2') : LongBool; syscall _DOSBase 114;
- AROS declaration: function Info(Lock: BPTR; ParameterBlock: PInfoData): LongInt; syscall AOS_DOSBase 19;
- MorphOS declaration: function Info(lock : LongInt location 'd1'; parameterBlock: PInfoData location 'd2'): LongInt; SysCall MOS_DOSBase 114;
macros: All MUI macrosfixed in trunk [21]
- Amiga: The OBJ_xxx() macros are not implemented as macro's at all, rather as a cast to a particular structure in order to obtain information -> that is totally completely wickedly wrong.
- MorphOS: See Amiga.
Constants: MUIX_R, MUIX_C, MUIX_L, MUIX_N, MUIX_B, MUIX_I, MUIX_U, MUIX_PT and MUIX_PHfixed in trunk [22]
- AMIGA + AROS: these MUI constants uses c-language escape code characters, which won't work for Free Pascal.
- MorphOS: declared them as they should.
function: NextTagItem()fixed in trunk [23]
- autodocs: struct TagItem *NextTagItem(struct TagItem **);
- Amiga: function NextTagItem(Item : ppTagItem location 'a0') : pTagItem; syscall _UtilityBase 048;
- AROS: function NextTagItem(var Item: PTagItem): PTagItem; syscall AOS_UtilityBase 8;
- MorphOS: function NextTagItem(tagListPtr: pPTagItem location 'a0'): PTagItem; SysCall MOS_UtilityBase 048;
function: ReadPixelArray8()fixed in [24]
- autodocs: LONG ReadPixelArray8(struct RastPort *, UWORD, UWORD, UWORD, UWORD, UBYTE *, struct RastPort *);
- Amiga: FUNCTION ReadPixelArray8(rp: pRastPort location 'a0'; xstart: ULONG location 'd0'; ystart: ULONG location 'd1'; xstop: ULONG location 'd2'; ystop: ULONG location 'd3'; array_: pointer location 'a2'; temprp: pRastPort location 'a1'): LONGINT; syscall GfxBase 780;
- AROS: function ReadPixelArray8(Rp: PRastPort; xStart, yStart, xStop, yStop: LongWord; Array_: PByte; TempRp: PRastPort): LongInt; syscall GfxBase 130;
- MorphOS: function ReadPixelArray8(rp: pRastPort location 'a0'; xstart: CARDINAL location 'd0'; ystart: CARDINAL location 'd1'; xstop: CARDINAL location 'd2'; ystop: CARDINAL location 'd3'; array1: pCHAR location 'a2'; temprp: pRastPort location 'a1'): LongInt; SysCall GfxBase 780;
- Remark: PChar for pointing to Array data ?
function: WritePixelArray8()
- See: ReadPixelArray8()
function: PolyDraw()fixed in trunk [25]
- Autodocs: void PolyDraw( struct RastPort *, WORD, WORD * );
- Amiga: PROCEDURE PolyDraw(rp : pRastPort location 'a1'; count : LONGINT location 'd0';const polyTable : pLongint location 'a0'); syscall GfxBase 336;
- AROS: procedure PolyDraw(Rp: PRastPort; Count: LongInt; PolyTable: PSmallInt); syscall GfxBase 56;
- MorphOS: procedure PolyDraw(rp : pRastPort location 'a1'; count : LongInt location 'd0'; VAR polyTable : INTEGER location 'a0'); SysCall GfxBase 336;
- Remark: MorphOS' use of var for argument polyTable is imho just plain weird and also dictates the array to consist out of integers. Amiga version dictates using LongInt for the PolyTable array.
type: PPObject_fixed in trunk[26]
- Missing for Amiga and MorphOS
function: TextLength()fixed in trunk[27]
- MorphOS: types the string parameter as pShortInt. Autodocs/Amiga/AROS uses type STRPTR.
function: Text()fixed in trunk[28]
- MorphOS: still called Text() while Amiga and AROS named it GfxText(). Also the string parameter for MorphOS is declared as pShortInt. Autodocs/Amiga/AROS uses type STRPTR.
const: ACTION_READfixed in trunk[29]
- MorphOS: Defines this constant as 'R', which is incompatible with TDOSPacket.dp_Type (LONG)
- Remark: Amiga + AROS defines this constant as ACTION_READ = $52; // 'R'
const: ACTION_WRITEfixed in trunk[30]
- MorphOS: Defines this constant as 'W', which is incompatible with TDOSPacket.dp_Type (LONG)
- Remark: Amiga + AROS defines this constant as ACTION_WRITE = $57; // 'W'
Function: ReadArgs()fixed in trunk[31]
- autodocs: struct RDArgs * ReadArgs(STRPTR, LONG *, struct RDArgs *)
- Amiga: FUNCTION ReadArgs(const arg_template : pCHAR location 'd1'; arra : pLONGINT location 'd2'; args : pRDArgs location 'd3') : pRDArgs; syscall _DOSBase 798;
- AROS: function ReadArgs(const Template: STRPTR; var Array_: IPTR; RdArgs: PRDArgs): PRDArgs; syscall AOS_DOSBase 133;
- MorphOS: function ReadArgs(arg_template: PChar location 'd1'; var array1: LongInt location 'd2'; args: PRDArgs location 'd3'): PRDArgs; SysCall MOS_DOSBase 798;
- Remark: using var for Array_ parameter is ok, but restricts when attempting to pass f.i. a record structure. Why not declare both variants in such cases ?
macro: RASSIZE()fixed in trunk[32]
- Amiga: missing
- MorphOS: missing
Const: MIDDLEUPfixed in trunk[33]
- Amiga: Missing
- MorphOS: Missing
Const: MIDDLEDOWNfixed in trunk[34]
- Amiga: Missing
- MorphOS: Missing
- MorphOS: missing
unit: CyberGraphicsfixed in trunk[37]
- MorphOS: Missing
function: ObtainBestPen()fixed in trunk[38]
- MorphOS: Missing
macro: DrawCirclefixed in trunk[39]
- Amiga: missing
- MorphOS: missing
varargs function: BestModeID()fixed in trunk[40]
- MorphOS: missing
function: AllocDosObjectTags()fixed in trunk[41]
- MorphOS: Function missing.
function FPuts()fixed in trunk[42]
- Autodocs: LONG FPuts(BPTR, STRPTR)
- Amiga1: FUNCTION FPuts(fh : LONGINT location 'd1';const str : pCHAR location 'd2') : LongBool; syscall _DOSBase 342;
- Amiga2: FUNCTION FPuts(fh : LONGINT;const str : string) : BOOLEAN;
- AROS: function FPuts(File_: BPTR; const String_: STRPTR): LongInt; syscall AOS_DOSBase 57;
- MorphOS: function FPuts(fh : LongInt location 'd1'; str: PChar location 'd2'): LongInt; SysCall MOS_DOSBase 342;
- Remark: note the use of different return-types as well as not using BPTR for filehandle type.
- Note: returns zero on success, -1 if an error occurs, so please forget using a boolean return type.
function: VFPrintf()fixed in trunk[43]
- AutoDocs: LONG = VFPrintf(BPTR, STRPTR, LONG *)
- Amiga declaration: FUNCTION VFPrintf(fh : LONGINT location 'd1';const format : pCHAR location 'd2';const argarray : POINTER location 'd3') : LONGINT; syscall _DOSBase 354;
- AROS declaration: function VFPrintf(Fh: BPTR; const format: STRPTR; const ArgArray: PLongInt): LongInt; syscall AOS_DOSBase 59;
- MorphOS declaration: function VFPrintf(fh : LongInt location 'd1'; format: PChar location 'd2'; argarray: Pointer location 'd3'): LongInt; SysCall MOS_DOSBase 354;
- NOTE: the generic pointer declaration prevents using "VFPrintf(nil/0, 'text', vargs );" where vargs = array of long.
- Remark: AFAIK for AROS it is theoretically possible to pass 64-bit formatted values.
function: SetAttrs()fixed in trunk[44]
- Amiga + MorphOS implementations seems missing
function: SetGadgetAttrs()fixed in trunk[45]
- MorphOS version seems missing
function: EasyRequest()fixed in trunk[46]
- Amiga: Missing
- AROS: version with no array of const is missing -> forced to use [TAG_END, 0] <- extra 0 required for AROS due to small issue
- MorphOS: Missing
field: dri_pens of structure tDrawInfofixed in trunk[47]
- Autodocs: UWORD *dri_Pens; /* pointer to pen array */
- Amiga: dri_Pens : Pointer; { pointer to pen array }
- AROS: dri_Pens : PWord; // pointer to pen array
- MorphOS: dri_Pens : Pointer; { pointer to pen array }
- Remark: afaik the pen array is an array of word (for all platforms), so the only really practical type for dri_pens would then be a Pointer to an unsigned word
varargs function: SetWindowPointer()fixed in trunk[48]
- Amiga: Seems missing
- MorphOS: Seems missing
function: CloseScreen()fixed in trunk[49]
- Amiga: Amiga declaration is still pre v36 (procedure), and does not return a boolean value (function) on success/failure which is the case on v36+ systems.
structure: TWindow field WScreenfixed in trunk[50]
- Autodocs: struct Screen *WScreen;
- Amiga: WScreen : Pointer;
- AROS: WScreen : PScreen;
- MorphOS: WScreen : Pointer;
- Status: Needs complete rewrite of intuition unit
type: TDateTimefixed in trunk[51]
- Amiga + AROS: declares this structure (and accompanied pointer) as TDateTime,
- MorphOS: declares this structure _TDateTime and accompanied pointer _PDateTime
- Remark: TDateTime declared in AmigaDOS conflicts with Free Pascal's declared TDateTime structure.
function: DateToStr()fixed in trunk[52]
- All: This function conflicts with Free Pascal own DateToStr function. Renamed to DOSSateToStr (and StrToDate to DOSStrToDate)
record TmemChunkfixed in trunk[53]
- MorphOS: the field names right now are nc_Next and nc_Bytes -> should read mc_Next and mc_Bytes
vararg function: SystemTags()fixed in trunk[54]
- MorphOS: missing.
Some of your finest
- AslRequest()
{$IFDEF AMIGA}
if (AslRequest(fr, nil) <> 0) then
{$ENDIF}
{$IFDEF AROS}
if (AslRequestA(fr, nil)) then
{$ENDIF}
{$IFDEF MORPHOS}
if (AslRequest(fr, nil)) then
{$ENDIF}
begin
// Could we now please check what the requester returned ?
end;
Hardening trinity
In order to circumvent some of the inconsistencies and incompatibilities, there was need for a solution without tempering with the RTL and/or default support units.
That's were unit trinity comes into play, which solves some of the encountered issues (the unit itself is a work in progress). It provides the user with a way to solve things and let sources compile without too much hassle/workarounds.
The latest version of unit trinity is kindly provided by Magorium and can be found here.