mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-28 16:30:59 +00:00
196 lines
2.3 KiB
Plaintext
196 lines
2.3 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 JNE &BP
|
|
&LAB BEQ *+5
|
|
BRL &BP
|
|
MEND
|
|
MACRO
|
|
&LAB LONG &A,&B
|
|
LCLB &I
|
|
LCLB &M
|
|
&A AMID &A,1,1
|
|
&M SETB ("&A"="M").OR.("&A"="m")
|
|
&I SETB ("&A"="I").OR.("&A"="i")
|
|
AIF C:&B=0,.A
|
|
&B AMID &B,1,1
|
|
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
|
|
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
|
|
.A
|
|
&LAB REP #&M*32+&I*16
|
|
AIF .NOT.&M,.B
|
|
LONGA ON
|
|
.B
|
|
AIF .NOT.&I,.C
|
|
LONGI ON
|
|
.C
|
|
MEND
|
|
MACRO
|
|
&LAB PH2 &N1
|
|
LCLC &C
|
|
&LAB ANOP
|
|
&C AMID &N1,1,1
|
|
AIF "&C"="#",.D
|
|
AIF S:LONGA=1,.A
|
|
REP #%00100000
|
|
.A
|
|
AIF "&C"<>"{",.B
|
|
&C AMID &N1,L:&N1,1
|
|
AIF "&C"<>"}",.G
|
|
&N1 AMID &N1,2,L:&N1-2
|
|
LDA (&N1)
|
|
PHA
|
|
AGO .E
|
|
.B
|
|
LDA &N1
|
|
PHA
|
|
AGO .E
|
|
.D
|
|
&N1 AMID &N1,2,L:&N1-1
|
|
PEA &N1
|
|
AGO .F
|
|
.E
|
|
AIF S:LONGA=1,.F
|
|
SEP #%00100000
|
|
.F
|
|
MEXIT
|
|
.G
|
|
MNOTE "Missing closing '}'",16
|
|
MEND
|
|
MACRO
|
|
&LAB SHORT &A,&B
|
|
LCLB &I
|
|
LCLB &M
|
|
&A AMID &A,1,1
|
|
&M SETB ("&A"="M").OR.("&A"="m")
|
|
&I SETB ("&A"="I").OR.("&A"="i")
|
|
AIF C:&B=0,.A
|
|
&B AMID &B,1,1
|
|
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
|
|
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
|
|
.A
|
|
&LAB SEP #&M*32+&I*16
|
|
AIF .NOT.&M,.B
|
|
LONGA OFF
|
|
.B
|
|
AIF .NOT.&I,.C
|
|
LONGI OFF
|
|
.C
|
|
MEND
|