mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-05 02:07:22 +00:00
d66f6b27b7
This winds up calling functions for these operations in ORCALib, so an up-to-date version of that must now be available to build the ORCA/C compiler.
269 lines
2.9 KiB
Plaintext
269 lines
2.9 KiB
Plaintext
MACRO
|
|
&lab subroutine &parms,&work
|
|
&lab anop
|
|
aif c:&work,.a
|
|
lclc &work
|
|
&work setc 0
|
|
.a
|
|
gbla &totallen
|
|
gbla &worklen
|
|
&worklen seta &work
|
|
&totallen seta 0
|
|
aif c:&parms=0,.e
|
|
lclc &len
|
|
lclc &p
|
|
lcla &i
|
|
&i seta c:&parms
|
|
.b
|
|
&p setc &parms(&i)
|
|
&len amid &p,2,1
|
|
aif "&len"=":",.c
|
|
&len amid &p,1,2
|
|
&p amid &p,4,l:&p-3
|
|
ago .d
|
|
.c
|
|
&len amid &p,1,1
|
|
&p amid &p,3,l:&p-2
|
|
.d
|
|
&p equ &totallen+3+&work
|
|
&totallen seta &totallen+&len
|
|
&i seta &i-1
|
|
aif &i,^b
|
|
.e
|
|
tsc
|
|
sec
|
|
sbc #&work
|
|
tcs
|
|
inc a
|
|
phd
|
|
tcd
|
|
mend
|
|
MACRO
|
|
&lab return &r
|
|
&lab anop
|
|
lclc &len
|
|
aif c:&r,.a
|
|
lclc &r
|
|
&r setc 0
|
|
&len setc 0
|
|
ago .h
|
|
.a
|
|
&len amid &r,2,1
|
|
aif "&len"=":",.b
|
|
&len amid &r,1,2
|
|
&r amid &r,4,l:&r-3
|
|
ago .c
|
|
.b
|
|
&len amid &r,1,1
|
|
&r amid &r,3,l:&r-2
|
|
.c
|
|
aif &len<>2,.d
|
|
ldy &r
|
|
ago .h
|
|
.d
|
|
aif &len<>4,.e
|
|
ldx &r+2
|
|
ldy &r
|
|
ago .h
|
|
.e
|
|
aif &len<>10,.g
|
|
aif &totallen=0,.f
|
|
lda &worklen+1
|
|
sta &worklen+&totallen+1
|
|
lda &worklen
|
|
sta &worklen+&totallen
|
|
.f
|
|
pld
|
|
tsc
|
|
clc
|
|
adc #&worklen+&totallen
|
|
tcs
|
|
phb
|
|
plx
|
|
ply
|
|
lda &r+8
|
|
pha
|
|
lda &r+6
|
|
pha
|
|
lda &r+4
|
|
pha
|
|
lda &r+2
|
|
pha
|
|
lda &r
|
|
pha
|
|
phy
|
|
phx
|
|
plb
|
|
rtl
|
|
mexit
|
|
.g
|
|
mnote 'Not a valid return length',16
|
|
mexit
|
|
.h
|
|
aif &totallen=0,.i
|
|
lda &worklen+1
|
|
sta &worklen+&totallen+1
|
|
lda &worklen
|
|
sta &worklen+&totallen
|
|
.i
|
|
pld
|
|
tsc
|
|
clc
|
|
adc #&worklen+&totallen
|
|
tcs
|
|
aif &len=0,.j
|
|
tya
|
|
.j
|
|
rtl
|
|
mend
|
|
MACRO
|
|
&LAB BGT &BP
|
|
&LAB BEQ *+4
|
|
BGE &BP
|
|
MEND
|
|
MACRO
|
|
&LAB BLE &BP
|
|
&LAB BLT &BP
|
|
BEQ &BP
|
|
MEND
|
|
MACRO
|
|
&LAB MOVE4 &F,&T
|
|
&LAB ~SETM
|
|
LDA 2+&F
|
|
STA 2+&T
|
|
LDA &F
|
|
STA &T
|
|
~RESTM
|
|
MEND
|
|
MACRO
|
|
&LAB ~SETM
|
|
&LAB ANOP
|
|
AIF C:&~LA,.B
|
|
GBLB &~LA
|
|
GBLB &~LI
|
|
.B
|
|
&~LA SETB S:LONGA
|
|
&~LI SETB S:LONGI
|
|
AIF S:LONGA.AND.S:LONGI,.A
|
|
REP #32*(.NOT.&~LA)+16*(.NOT.&~LI)
|
|
LONGA ON
|
|
LONGI ON
|
|
.A
|
|
MEND
|
|
MACRO
|
|
&LAB ~RESTM
|
|
&LAB ANOP
|
|
AIF (&~LA+&~LI)=2,.I
|
|
SEP #32*(.NOT.&~LA)+16*(.NOT.&~LI)
|
|
AIF &~LA,.H
|
|
LONGA OFF
|
|
.H
|
|
AIF &~LI,.I
|
|
LONGI OFF
|
|
.I
|
|
MEND
|
|
macro
|
|
&l ph8 &n1
|
|
lclc &c
|
|
&l anop
|
|
&c amid &n1,1,1
|
|
aif s:longa=1,.a
|
|
rep #%00100000
|
|
.a
|
|
aif "&c"="#",.d
|
|
aif "&c"="[",.b
|
|
aif "&c"<>"{",.c
|
|
&c amid &n1,l:&n1,1
|
|
aif "&c"<>"}",.g
|
|
&n1 amid &n1,2,l:&n1-2
|
|
&n1 setc (&n1)
|
|
.b
|
|
ldy #6
|
|
~&SYSCNT lda &n1,y
|
|
pha
|
|
dey
|
|
dey
|
|
bpl ~&SYSCNT
|
|
ago .e
|
|
.c
|
|
ldx #6
|
|
~&SYSCNT lda &n1,x
|
|
pha
|
|
dex
|
|
dex
|
|
bpl ~&SYSCNT
|
|
ago .e
|
|
.d
|
|
&n1 amid &n1,2,l:&n1-1
|
|
bra ~b&SYSCNT
|
|
~a&SYSCNT dc i8"&n1"
|
|
~b&SYSCNT ldx #6
|
|
~c&SYSCNT lda ~a&SYSCNT,x
|
|
pha
|
|
dex
|
|
dex
|
|
bpl ~c&SYSCNT
|
|
.e
|
|
aif s:longa=1,.f
|
|
sep #%00100000
|
|
.f
|
|
mexit
|
|
.g
|
|
mnote "Missing closing '}'",16
|
|
mend
|
|
macro
|
|
&l pl8 &n1
|
|
lclc &c
|
|
&l anop
|
|
aif s:longa=1,.a
|
|
rep #%00100000
|
|
.a
|
|
&c amid &n1,1,1
|
|
aif "&c"<>"{",.b
|
|
&c amid &n1,l:&n1,1
|
|
aif "&c"<>"}",.f
|
|
&n1 amid &n1,2,l:&n1-2
|
|
pla
|
|
sta (&n1)
|
|
ldy #2
|
|
pla
|
|
sta (&n1),y
|
|
ldy #4
|
|
pla
|
|
sta (&n1),y
|
|
ldy #6
|
|
pla
|
|
sta (&n1),y
|
|
ago .d
|
|
.b
|
|
aif "&c"<>"[",.c
|
|
pla
|
|
sta &n1
|
|
ldy #2
|
|
pla
|
|
sta &n1,y
|
|
ldy #4
|
|
pla
|
|
sta &n1,y
|
|
ldy #6
|
|
pla
|
|
sta &n1,y
|
|
ago .d
|
|
.c
|
|
pla
|
|
sta &n1
|
|
pla
|
|
sta &n1+2
|
|
pla
|
|
sta &n1+4
|
|
pla
|
|
sta &n1+6
|
|
.d
|
|
aif s:longa=1,.e
|
|
sep #%00100000
|
|
.e
|
|
mexit
|
|
.f
|
|
mnote "Missing closing '}'",16
|
|
mend
|