 MACRO
&lab ph4 &parm
 lclc &char
 lclc &char1
 lclc &char2
&lab anop
&char amid &parm,1,1
 aif "&char"="#",.immediate
 aif "&char"="@",.at
 aif s:longa=1,.chk1
 rep #%00100000
.chk1
 aif "&char"<>"{",.chk2
&char amid &parm,l:&parm,1
 aif "&char"<>"}",.error
&parm amid &parm,2,l:&parm-2
 ldy #2
 lda (&parm),y
 pha
 lda (&parm)
 pha
 ago .shorten
.chk2
 aif "&char"<>"[",.absolute
 ldy #2
 lda &parm,y
 pha
 lda &parm
 pha
 ago .shorten
.absolute
 lda &parm+2
 pha
 lda &parm
 pha
 ago .shorten
.at
&char1 amid &parm,2,1
&char2 setc &char1
 ph&char1
 aif l:&parm<3,.chk2a
&char2 amid &parm,3,1
.chk2a
 ph&char2
 ago .shorten
.immediate
&parm amid &parm,2,l:&parm-1
 pea +(&parm)|-16
 pea &parm
 ago .done
.shorten
 aif s:longa=1,.done
 sep #%00100000
.done
 mexit
.error
 mnote "Missing closing '}'",16
 mend
 MACRO
&lab unlock &a1
&lab stz &a1
 MEND
 MACRO
&lab key
&lab dc i2'0'
 MEND
 MACRO
&lab lock &a1
&lab lda #1
 tsb &a1
 beq *+6
 cop $7F
 bra *-7
 MEND
 MACRO
&lab WriteCString &a1
&lab ph4 &a1
 Tool $200c
 mend
 MACRO
&lab tool &a1
&lab ldx #&a1
 jsl $e10000
 mend
