Quote:
Originally Posted by kerravon
Did amiga.lib exist in the first release of the Amiga SDK issued after the Amiga 1000 was released?
|
I think so. Although many compilers already provided their own amiga.lib (with the same functionality).
Quote:
In order to execute Read(), were you nominally required to
#include <clib/dos_protos.h>
|
Yes. It defines the prototypes for the dos.library functions as well as the data types and structures used in the calls.
Quote:
(and did that exist in the first SDK?)
|
No. The first SDK was long before C90 existed. So it wasn't that common to use prototypes for functions you call. The Kickstart 1.3 SDK was still missing them.
Quote:
I'm thinking that I would like to have the above header file, but make it:
#define Read(a, b, c) DOSBase->Read(a,b,c)
|
That wouldn't work. There is no "Read" in the DOSBase structure. If want to know the details: Every shared library has a Base structure, like DOSBase, which stores some, mostly internal, data for the library. Invisible for C there is a jump-table in front of this structure in memory. For example at offset -42 relative to DOSBase you will find the vector "jmp ReadFunctionInROM", which jumps to the actual Read() function which is valid for your current OS version. Each vector has 6 bytes (jmp-instruction and 32-bit destination address). That's where amiga.lib comes into play. It defines assembler stub functions like:
Code:
xref _DOSBase
xdef _Read
_Read:
movem.l d2-d3/a6,-(sp)
movem.l 16(sp),d1-d3
move.l _DOSBase,a6
jsr -42(a6)
movem.l (sp)+,d2-d3/a6
rts
Which saves/restores non-volatile registers for the function call (d2, d3, a6), loads the C arguments from stack into the required registers for the Read() function, and finally calls its vector relative to DOSBase in register a6.
Quote:
Originally Posted by kerravon
vbccm68k -gas -I . -I ../src -S -o amistrt.s amistrt.c
error 5: Unknown Flag <-S>
|
-S is a frontend option for vc to generate assembler code. The compiler itself always generates assembler output. So not needed here.
Quote:
vbccm68k -gas -I . -I ../src -o amistrt.s amistrt.c
error 3: Flag <-o> needs string
|
That would be the frontend syntax again. The option in the compiler is different. It is "-o=name". Also note that you may want to enable optimisations at some point (-O=991 would be -O1 from the frontend, refer to the documentation for all optimiser flags).