mirror of
https://github.com/byteworksinc/Linker.git
synced 2024-11-21 13:31:57 +00:00
1 line
9.2 KiB
Plaintext
1 line
9.2 KiB
Plaintext
|
macro
&lab da &op
&lab dc a3"&op"
dc i1'0'
mend
macro
&lab cmpl &n1,&n2
&lab lda 2+&n1
cmp 2+&n2
bne ~&syscnt
lda &n1
cmp &n2
~&syscnt anop
mend
MACRO
&LAB DOS &ADR
&LAB DC I"L:~&SYSNAME&SYSCNT"
~&SYSNAME&SYSCNT DC C"&ADR"
MEND
MACRO
&LAB MOVE4 &F,&T
&LAB ~SETM
LDA 2+&F
STA 2+&T
LDA &F
STA &T
~RESTM
MEND
MACRO
&LAB MOVE &AD1,&AD2,&LEN
&LAB ANOP
LCLB &LA
LCLB &LI
LCLC &C
AIF C:&LEN,.A1
LCLC &LEN
&LEN SETC #2
.A1
&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
&C AMID &LEN,1,1
AIF "&C"<>"#",.D
&C AMID &LEN,2,L:&LEN-1
AIF &C<>2,.D
&C AMID &AD1,1,1
AIF "&C"<>"{",.B
&AD1 AMID &AD1,2,L:&AD1-2
&AD1 SETC (&AD1)
.B
LDA &AD1
&C AMID &AD2,1,1
AIF "&C"<>"{",.C
&AD2 AMID &AD2,2,L:&AD2-2
&AD2 SETC (&AD2)
.C
STA &AD2
AGO .G
.D
&C AMID &AD1,1,1
AIF "&C"="#",.F
&C AMID &LEN,1,1
AIF "&C"<>"{",.E
&LEN AMID &LEN,2,L:&LEN-2
&LEN SETC (&LEN)
.E
&C AMID &LEN,1,1
AIF "&C"="#",.E1
LDA &LEN
DEC A
AGO .E2
.E1
LDA &LEN-1
.E2
LDX #&AD1
LDY #&AD2
MVN &AD1,&AD2
AGO .G
.F
LDA &AD1
STA &AD2
LDA &LEN-2
LDX #&AD2
LDY #&AD2+1
MVN &AD2,&AD2
.G
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 put2 &n1,&f1,&cr,&errout
aif c:&f1,.a
lclc &f1
&f1 setc #0
.a
&l ~setm
ph2 &n1
ph2 &f1
ph2 #c:&cr
ph2 #c:&errout
jsl ~put2
~restm
mend
macro
&l puts &n1,&f1,&cr,&errout
&l ~setm
lclc &c
&c amid "&n1",1,1
aif "&c"<>"#",.c
aif l:&n1>127,.a
bra ~&SYSCNT
ago .b
.a
brl ~&SYSCNT
.b
&n1 amid "&n1",2,l:&n1-1
~l&SYSCNT dc i1"l:~s&SYSCNT"
~s&SYSCNT dc c&n1
~&SYSCNT anop
&n1 setc ~l&SYSCNT-1
.c
~pusha &n1
aif c:&f1,.c1
pea 0
ago .c2
.c1
ph2 &f1
.c2
ph2 #c:&cr
ph2 #c:&errout
jsl ~puts
~restm
mend
macro
&l putc &n1,&f1,&cr,&errout
&l ~setm
ph2 &n1
aif c:&f1,.a
pea 0
ago .b
.a
ph2 &f1
.b
ph2 #c:&cr
ph2 #c:&errout
jsl ~putc
~restm
mend
macro
&l putcr &errout
&l ~setm
pea $0D
aif c:&errout,.a
jsl SysCharOut
~restm
mexit
.a
jsl SysCharErrout
~restm
mend
macro
&l add2 &n1,&n2,&n3
aif c:&n3,.a
lclc &n3
&n3 setc &n1
.a
&l ~setm
clc
~lda &n1
~op adc,&n2
~sta &n3
~restm
mend
macro
&l sub2 &n1,&n2,&n3
aif c:&n3,.a
lclc &n3
&n3 setc &n1
.a
&l ~setm
sec
~lda &n1
~op sbc,&n2
~sta &n3
~restm
mend
macro
&l add4 &m1,&m2,&m3
lclb &yistwo
lclc &c
&l ~setm
aif c:&m3,.a
&c amid "&m2",1,1
aif "&c"<>"#",.a
&c amid "&m1",1,1
aif "&c"="{",.a
aif "&c"="[",.a
&c amid "&m2",2,l:&m2-1
aif &c>=65536,.a
clc
~lda &m1
~op adc,&m2
~sta &m1
bcc ~&SYSCNT
~op.h inc,&m1
~&SYSCNT anop
ago .c
.a
aif c:&m3,.b
lclc &m3
&m3 setc &m1
.b
clc
~lda &m1
~op adc,&m2
~sta &m3
~lda.h &m1
~op.h adc,&m2
~sta.h &m3
.c
~restm
mend
macro
&l mul4 &n1,&n2,&n3
&l ~setm
ph4 &n1
ph4 &n2
jsl ~mul4
aif c:&n3,.a
pl4 &n1
ago .b
.a
pl4 &n3
.b
~restm
mend
macro
&l sub4 &m1,&m2,&m3
lclb &yistwo
lclc &c
&l ~setm
aif c:&m3,.a
&c amid "&m2",1,1
aif "&c"<>"#",.a
&c amid "&m1",1,1
aif "&c"="{",.a
aif "&c"="[",.a
&c amid "&m2",2,l:&m2-1
aif &c>=65536,.a
sec
~lda &m1
~op sbc,&m2
~sta &m1
bcs ~&SYSCNT
~op.h dec,&m1
~&SYSCNT anop
ago .c
.a
aif c:&m3,.b
lclc &m3
&m3 setc &m1
.b
sec
~lda &m1
~op sbc,&m2
~sta &m3
~lda.h &m1
~op.h sbc,&m2
~sta.h &m3
.c
~restm
mend
macro
&l inc4 &a
&l ~setm
inc &a
bne ~&SYSCNT
inc 2+&a
~&SYSCNT ~restm
mend
macro
&l jcs &bp
&l bcc *+5
brl &bp
mend
macro
&l jeq &bp
&l bne *+5
brl &bp
mend
macro
&l jge &bp
&l blt *+5
brl &bp
mend
macro
&l jne &bp
&l beq *+5
brl &bp
mend
macro
&l la &ad1,&ad2
&l anop
lcla &lb
lclb &la
aif s:longa,.a
rep #%00100000
longa on
&la setb 1
.a
lda #&ad2
&lb seta c:&ad1
.b
sta &ad1(&lb)
&lb seta &lb-1
aif &lb,^b
aif &la=0,.d
sep #%00100000
longa off
.d
mend
macro
&l lla &ad1,&ad2
&l anop
lcla &lb
lclb &la
aif s:longa,.a
rep #%00100000
longa on
&la setb 1
.a
lda #&ad2
&lb seta c:&ad1
.b
sta &ad1(&lb)
&lb seta &lb-1
aif &lb,^b
lda #^&ad2
&lb seta c:&ad1
.c
sta 2+&ad1(&lb)
&lb seta &lb-1
aif &lb,^c
aif &la=0,.d
sep #%00100000
longa off
.d
mend
macro
&
|