PROCEDURE CALLS


SYNTAX

NAME:sym[SIZE:jsize] "[" [["sav:"] PARAMETERS:args] "]"


MEANING

  1. If sav: is declared, stores the RL1 registers (declared in the procedure definition) in the stack.
  2. Loads PARAMETERS into RL1.
  3. Executes the procedure NAME.
  4. If sav: is declared, the RL1 registers are restored.


NOTES

  1. A procedure can be called only from the instruction field.
  2. SIZE is the size to be used for the bsr (default: none).
  3. When SIZE is .l, the jsr instruction is used instead of bsr.l to easily allow calls to other code sections.
  4. Normally the speed overhead is very little (sometimes there is none at all).


EXAMPLE 1

ESA
           WaitMouse.s[]
           ...
           procedure loc:WaitMouse[]
.w         btst.b     #6,$bfe001
           bne.s      .w
           eproc
assembly
           bsr.s      .0000000
           ...
.0000000
.w         btst.b     #6,$bfe001
           bne.s      .w
.0000001   rts


EXAMPLE 2

ESA
           SlowClr[sav: #buffer,d1]
           ...
           procedure SlowClr[a0/d0.b],a0/d1
           move.l     d0,d1
           lsr.l      #2,d1
           subq.l     #1,d1
.c         clr.l      (a0)+
           dbra       d1,.c
           eproc
assembly
           movem.l    a0/d0,-(sp)      ;preserve RL1 registers
           move.l     #buffer,a0       ;load
           move.b     d1,d0            ;parameters
           bsr        p0000000         ;execute procedure
           movem.l    (sp)+,a0/d0      ;restore RL1 registers
           ...
p0000000   movem.l    a0/d1,-(sp)
           move.l     d0,d1
           lsr.l      #2,d1
           subq.l     #1,d1
.c         clr.l      (a0)+
           dbra       d1,.c
p0000001   movem.l    (sp)+,a0/d1
           rts


EXAMPLE 3

ESA
           SlowClr.l[sav: #buffer,d0]
assembly
           movem.l  a0/d0,-(sp)
           move.l   #buffer,a0
           jsr      p0000000
           movem.l  (sp)+,a0/d0
(SlowClr[] is defined in the previous example.)



home