S:User-Startup
:; BEGIN SAS/C ASSIGN SC: PATH:To/sasc ; END SAS/C
smake
won't work out of the box as smake
needs LIBS:icon.library
.
icon.library
in a libs
folder somewherelibs
volume in the [volumes]
section of your .vamosrc
and point at that libs
folderfar
on an struct if you get link errors about data > 32768Custom
struct seems to trigger thatuint8_t
is unsigned char
BOOL
is int
Handy if you don't want to hard code all the custom chip register values.
https://stackoverflow.com/a/39805594
#define offsetof(s,m) &((struct s *)0)->m
From http://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node0196.html:
#ifdef LATTICE int CXBRK(void) { return(0); } /* Disable SAS CTRL/C handling */ int chkabort(void) { return(0); } /* really */ #endif
XDEF
to expose a label. Function labels start with _
in SAS/C. Standard calling convention is placing items on the stack after the return value:; wow.s XDEF _wow ; SAS/C function link symbol convention _wow: ; wow is int wow(char what) MOVE.L A5,-(SP) ; preserve A5 MOVE.L A7,A5 ; put current stack onto A5 to use as reference to args MOVEQ #0,D0 MOVE.B 11(A7),D0 ; move the char into D0 MOVE.L (SP)+,A5 RTS ; D0 is return value
In SAS/C:
// main,c extern int wow(char what); int main(void) { printf("%d\n", wow(30)) ; => 30 return 0; }
At the command line:
genam -l wow.s sc link to main main.c wow.o
The more things you preserve on the stack during the parameter extraction, the farther up you'll have to look:
_InitializeCopperlist: MOVEM.L A0/A5,-(SP) MOVE.L A7,A5 MOVE.L 12(A5),A0 MOVE.L #$FFFFFFFE,(A0) MOVEM.L (SP)+,A0/A5 RTS
For more details on calling convention, search https://retro-commodore.eu/files/downloads/amigamanuals-xiik.net/Applications/SAS_C_Compiler_v6.5x___Manual_ENG/SASC6V2.txt for Communicating between Assembl.