function
" ["loc:
"] NAME
:sym "[
" [RL1
:regslist] "]
" [",
" RL2
:regslist] ":" OUT
:var...
efunc
" [",
" RESULT
:val]
NAME
.
RL2
is declared, the specified registers are stored in the stack.
...
" is processed.
RESULT
is declared, it is copied to OUT
(with OUT
's size).
RL2
is declared, the registers are restored from the stack.
RL1
tells how to assign the arguments when the function is called.
OUT
indicates where the result is returned.
RL2
must not contain OUT
(if OUT
is a register).
loc:
is declared, the function definition will be local, i.e. its labels will start with '.'.
NAME
can be up to 30 characters long.
function...
.
OUT
is used only inside boolean expressions.
move.l MyLabel(a0),d0
" could mean both a) load in d0
the value at the address calculated as a0
+MyLabel
; b) load in d0
the value returned by the function MyLabel()
with the parameter a0
.
function SetDMA[d0.w],d1:d0
move.w $dff002,d1
ori.w #$8000,d0
move.w d0,$dff096
move.w d1,d0
efunc
assembly
f0000000 movem.l d1,-(sp) ;store RL2 registers
move.w $dff002,d1
ori.w #$8000,d0
move.w d0,$dff096
move.w d1,d0
f0000001 movem.l (sp)+,d1 ;restore registers
rts
function GetMess[],d0-d7/a0-a6:MessAmount.b
lea.l TileTable,a0
bsr MessWithRegs
move.b (a5),MessAmount
efunc
assembly
f0000000 movem.l d0-d7/a0-a6,-(sp)
lea.l TileTable,a0
bsr MessWithRegs
move.b (a5),MessAmount
f0000001 movem.l (sp)+,d0-d7/a0-a6
rts
function MessWithDMA[],d0:d1
move.l $dff004,d1
move.l d1,d0
andi.l #$3ff00,d1
when.s eq
move.l $dff004,d1
ewhen
efunc,SetDMA[d1]
assembly
f0000002 movem.l d0,-(sp)
move.l $dff004,d1
move.l d1,d0
andi.l #$3ff00,d1
bne.s .0000002
move.l $dff004,d1
.0000002
move.w d1,d0
bsr f0000000
move.l d0,d1
f0000003 movem.l (sp)+,d0
rts