mirror of
https://github.com/GnoConsortium/gno.git
synced 2025-01-03 15:29:45 +00:00
264 lines
3.2 KiB
Plaintext
264 lines
3.2 KiB
Plaintext
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 LD2 &val,&adr
|
|
&lab lcla &count
|
|
lda #&val
|
|
&count seta 1
|
|
.loop
|
|
sta &adr(&count)
|
|
&count seta &count+1
|
|
aif &count>c:&adr,.done
|
|
ago ^loop
|
|
.done
|
|
mend
|
|
macro
|
|
&lab MV4 &src,&adr
|
|
&lab lcla &count
|
|
lda &src
|
|
&count seta 1
|
|
.loop1
|
|
sta &adr(&count)
|
|
&count seta &count+1
|
|
aif &count>c:&adr,.part2
|
|
ago ^loop1
|
|
.part2
|
|
lda &src+2
|
|
&count seta 1
|
|
.loop2
|
|
sta &adr(&count)+2
|
|
&count seta &count+1
|
|
aif &count>c:&adr,.done
|
|
ago ^loop2
|
|
.done
|
|
mend
|
|
macro
|
|
&lab long &stat
|
|
&lab anop
|
|
lcla &t
|
|
lcla &len
|
|
lclc &ch
|
|
&t seta 0
|
|
&len seta l:&stat
|
|
.a
|
|
aif &len=0,.b
|
|
&ch amid &stat,&len,1
|
|
aif ("&ch"="x").or.("&ch"="y").or.("&ch"="i"),.i
|
|
aif ("&ch"="a").or.("&ch"="m"),.m
|
|
.c
|
|
&len seta &len-1
|
|
ago ^a
|
|
.i
|
|
longi on
|
|
&t seta &t+16
|
|
ago ^c
|
|
.m
|
|
longa on
|
|
&t seta &t+32
|
|
ago ^c
|
|
.b
|
|
aif &t=0,.d
|
|
rep #&t
|
|
.d
|
|
mend
|
|
macro
|
|
&lab short &stat
|
|
&lab anop
|
|
lcla &t
|
|
lcla &len
|
|
lclc &ch
|
|
&t seta 0
|
|
&len seta l:&stat
|
|
.a
|
|
aif &len=0,.b
|
|
&ch amid &stat,&len,1
|
|
aif ("&ch"="x").or.("&ch"="y").or.("&ch"="i"),.i
|
|
aif ("&ch"="a").or.("&ch"="m"),.m
|
|
.c
|
|
&len seta &len-1
|
|
ago ^a
|
|
.i
|
|
longi off
|
|
&t seta &t+16
|
|
ago ^c
|
|
.m
|
|
longa off
|
|
&t seta &t+32
|
|
ago ^c
|
|
.b
|
|
aif &t=0,.d
|
|
sep #&t
|
|
.d
|
|
mend
|
|
macro
|
|
&lab asl2 &a
|
|
&lab asl &a
|
|
asl &a
|
|
mend
|
|
macro
|
|
&lab iny2
|
|
&lab iny
|
|
iny
|
|
mend
|
|
macro
|
|
&lab and2 &arg1,&arg2,&dest
|
|
&lab anop
|
|
lclc &char
|
|
&char amid &arg1,1,1
|
|
aif "&char"="@",.at1
|
|
lda &arg1
|
|
ago .add
|
|
.at1
|
|
&char amid &arg1,2,1
|
|
aif "&char"="x",.x1
|
|
aif "&char"="X",.x1
|
|
aif "&char"="y",.y1
|
|
aif "&char"="Y",.y1
|
|
ago .add
|
|
.x1
|
|
txa
|
|
ago .add
|
|
.y1
|
|
tya
|
|
.add
|
|
and &arg2
|
|
&char amid &dest,1,1
|
|
aif "&char"="@",.at2
|
|
sta &dest
|
|
ago .b
|
|
.at2
|
|
&char amid &dest,2,1
|
|
aif "&char"="x",.x2
|
|
aif "&char"="X",.x2
|
|
aif "&char"="y",.y2
|
|
aif "&char"="Y",.y2
|
|
ago .b
|
|
.x2
|
|
tax
|
|
ago .b
|
|
.y2
|
|
tay
|
|
.b
|
|
mend
|
|
macro
|
|
&lab if2 &var,&rel,&val,&label
|
|
&lab ago .skip
|
|
ble
|
|
bgt
|
|
.skip
|
|
lclc &char1
|
|
lclc &char2
|
|
&char1 amid &var,1,1
|
|
&char2 amid &var,2,1
|
|
aif "&char1"="@",.index
|
|
lda &var
|
|
.cmp
|
|
cmp &val
|
|
ago .branch
|
|
.index
|
|
aif "&char2"="x",.x1
|
|
aif "&char2"="X",.x1
|
|
aif "&char2"="y",.y1
|
|
aif "&char2"="Y",.y1
|
|
ago ^cmp
|
|
.x1
|
|
cpx &val
|
|
ago .branch
|
|
.y1
|
|
cpy &val
|
|
.branch
|
|
&char1 amid &rel,1,1
|
|
aif "&char1"="@",.done
|
|
b&rel &label
|
|
.done
|
|
mend
|
|
macro
|
|
&lab bgt &loc
|
|
&lab beq *+4
|
|
bcs &loc
|
|
mend
|
|
macro
|
|
&lab ble &loc
|
|
&lab bcc &loc
|
|
beq &loc
|
|
mend
|
|
macro
|
|
&lab jeq &loc
|
|
&lab bne *+5
|
|
jmp &loc
|
|
mend
|
|
macro
|
|
&lab add4 &arg1,&arg2,&dest
|
|
&lab anop
|
|
lclc &ch
|
|
&ch amid &arg2,1,1
|
|
clc
|
|
lda &arg1
|
|
adc &arg2
|
|
sta &dest
|
|
lda &arg1+2
|
|
aif "&ch"="#",.a
|
|
adc &arg2+2
|
|
ago .b
|
|
.a
|
|
adc &arg2|-16
|
|
.b
|
|
sta &dest+2
|
|
mend
|