mirror of
https://github.com/antoinevignau/source.git
synced 2024-10-31 22:06:40 +00:00
1 line
48 KiB
Plaintext
1 line
48 KiB
Plaintext
|
*-------------------------------------------------------------------------*
* Xtool
*
* Xtool functions like the macro tool but its input/output/err parameters
* are defined before the macro call with the macros in, out, and err.
*-------------------------------------------------------------------------*
MACRO
xtool &toolname,&err
lcla &outnum
lcla &innum
lclc &size
lclc &parm
lcla &count
gbla &xincnt
gblc &xin[20]
gbla &xoutcnt
gblc &xout[20]
gbla &xerrflag
gblc &xerr
&count seta &xoutcnt+1
WHILE (&count>1) DO
&count seta &count-1
&size setc &substr(&xout[&count],&len(&xout[&count])-1,2)
IF (&size=':r') or (&size=':R') GOTO .rect
IF (&size=':l') or (&size=':L') GOTO .long
IF (&size=':a') or (&size=':A') GOTO .addr
IF (&size=':w') or (&size=':W') GOTO .word
IF (&size=':b') or (&size=':B') GOTO .byte
macerr 'XTool macro: Output parameter size improperly specified: <20>',&xout[&count],'<27>'
MEXIT
.addr
pha
.byte
phb
CYCLE
.rect pha
pha
.long
pha
.word
pha
ENDWHILE
&count seta 0
WHILE (&count<&xincnt) DO
&count seta &count+1
&size setc &substr(&xin[&count],&len(&xin[&count])-1,2)
&parm setc &substr(&xin[&count],1,&len(&xin[&count])-2)
IF (&size=':r') or (&size=':R') GOTO .rect
IF (&size=':l') or (&size=':L') GOTO .long
IF (&size=':a') or (&size=':A') GOTO .addr
IF (&size=':w') or (&size=':W') GOTO .word
IF (&size=':b') or (&size=':B') GOTO .byte
macerr 'XTool macro: Input parameter size improperly specified: <20>',&xin[&count],'<27>'
MEXIT
.rect
pushrect &parm
CYCLE
.long
PushLong &parm
CYCLE
.addr
PushAdr &parm
CYCLE
.word
PushWord &parm
CYCLE
.byte
PushByte &parm
ENDWHILE
&toolname
IF &len(&err)=0 GOTO .noname
moveword a,&err
GOTO .noerr
.noname
IF &xerrflag=0 GOTO .noerr
sta &xerr
.noerr
&count seta &xoutcnt+1
WHILE (&count>1) DO
&count seta &count-1
IF &len(&xout[&count])<3 THEN ; leave it on the stack.
CYCLE
ENDIF
&size setc &substr(&xout[&count],&len(&xout[&count])-1,2)
&parm setc &substr(&xout[&count],1,&len(&xout[&count])-2)
IF (&size=':r') or (&size=':R') GOTO .rect
IF (&size=':l') or (&size=':L') GOTO .long
IF (&size=':a') or (&size=':A') GOTO .addr
IF (&size=':w') or (&size=':W') GOTO .word
IF (&size=':b') or (&size=':B') GOTO .byte
macerr 'XTool macro: Output parameter size improperly specified: <20>',&xout[&count],'<27>'
MEXIT
.rect
pullrect &parm
CYCLE
.long
PullLong &parm
CYCLE
.addr
PullAdr &parm
CYCLE
.word
PullWord &parm
CYCLE
.byte
PullByte &parm
ENDWHILE
.quit
&xerrflag seta 0
&xoutcnt seta 0
&xincnt seta 0
&xerr setc ''
MEND
*-------------------------------------------------------------------------*
* XCall
*
* XCall functions like the macro Call but its input/output/err parameters
* are defined before the macro call with the macros in, out, and err.
*-------------------------------------------------------------------------*
MACRO
xcall &name,&err
lcla &outnum
lcla &innum
lclc &size
lclc &parm
lcla &count
gbla &xincnt
gblc &xin[20]
gbla &xoutcnt
gblc &xout[20]
gbla &xerrflag
gblc &xerr
&count seta &xoutcnt+1
WHILE (&count>1) DO
&count seta &count-1
&size setc &substr(&xout[&count],&len(&xout[&count])-1,2)
IF (&size=':r') or (&size=':R') GOTO .rect
IF (&size=':l') or (&size=':L') GOTO .long
IF (&size=':a') or (&size=':A') GOTO .addr
IF (&size=':w') or (&size=':W') GOTO .word
IF (&size=':b') or (&size=':B') GOTO .byte
macerr 'XCall macro: Output parameter size improperly specified: <20>',&xout[&count],'<27>'
MEXIT
.addr
pha
.byte
phb
CYCLE
.rect
pha
pha
.long
pha
.word
pha
ENDWHILE
&count seta 0
WHILE (&count<&xincnt) DO
&count seta &count+1
&size setc &substr(&xin[&count],&len(&xin[&count])-1,2)
&parm setc &
|