mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2025-03-16 06:29:43 +00:00
Use newer, more efficient ph2/ph4 macros throughout ORCALib.
These push DP values with pei, rather than lda+pha as in the old versions of the macros.
This commit is contained in:
parent
c95bfc19fb
commit
84f471474a
169
cc.macros
169
cc.macros
@ -1,3 +1,94 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&lab error &e
|
||||
&lab ph2 &e
|
||||
@ -300,84 +391,6 @@
|
||||
.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 PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PL4 &N1
|
||||
LCLC &C
|
||||
&LAB ANOP
|
||||
|
22
fcntl.asm
22
fcntl.asm
@ -99,7 +99,7 @@ err equ 1 error return code
|
||||
lda mode convert mode to ProDOS format
|
||||
jsr unixtoprodos
|
||||
sta siAccess
|
||||
ph4 path set the path name
|
||||
ph4 <path set the path name
|
||||
jsl ctoosstr
|
||||
sta siPathname
|
||||
stx siPathname+2
|
||||
@ -209,8 +209,8 @@ err equ 1 error return code
|
||||
csubroutine (4:path,2:mode),2
|
||||
|
||||
ph2 #O_WRONLY+O_TRUNC+O_CREAT
|
||||
ph2 mode
|
||||
ph4 path
|
||||
ph2 <mode
|
||||
ph4 <path
|
||||
jsl openfile
|
||||
sta err
|
||||
|
||||
@ -239,7 +239,7 @@ err equ 1 error return code
|
||||
|
||||
ph2 #0
|
||||
ph2 #F_DUPFD
|
||||
ph2 old
|
||||
ph2 <old
|
||||
jsl fcntl
|
||||
sta err
|
||||
|
||||
@ -453,9 +453,9 @@ err equ 1 error return code
|
||||
|
||||
csubroutine (4:path,2:oflag),2
|
||||
|
||||
ph2 oflag
|
||||
ph2 <oflag
|
||||
ph2 #$7180
|
||||
ph4 path
|
||||
ph4 <path
|
||||
jsl openfile
|
||||
sta err
|
||||
|
||||
@ -515,7 +515,7 @@ lb1 lda files,X
|
||||
brl lb11
|
||||
lb2 stx index save the index to the file
|
||||
|
||||
ph4 path convert the path to an OS string
|
||||
ph4 <path convert the path to an OS string
|
||||
jsl ctoosstr
|
||||
sta opPathname
|
||||
stx opPathname+2
|
||||
@ -546,8 +546,8 @@ lb4 sta crFileType
|
||||
lda #ENOENT
|
||||
sta >errno
|
||||
bra lb11
|
||||
lb4a ph2 mode set the access bits
|
||||
ph4 path
|
||||
lb4a ph2 <mode set the access bits
|
||||
ph4 <path
|
||||
jsl chmod
|
||||
bra lb8 else
|
||||
lb5 lda oflag if O_CREAT is not set then
|
||||
@ -827,7 +827,7 @@ lb0a move4 buf,wrDataBuffer set the location to write from
|
||||
and #O_BINARY
|
||||
bne lb0g
|
||||
pea 0 reserve a file buffer
|
||||
ph2 n
|
||||
ph2 <n
|
||||
jsl malloc
|
||||
sta nbuff
|
||||
stx nbuff+2
|
||||
@ -869,7 +869,7 @@ lb1 ldy wrTransferCount return the bytes read
|
||||
lda nbuff if nbuff <> NULL then
|
||||
ora nbuff+2
|
||||
beq lb2
|
||||
ph4 nbuff dispose of the buffer
|
||||
ph4 <nbuff dispose of the buffer
|
||||
jsl free
|
||||
lb2 anop
|
||||
|
||||
|
169
fcntl.macros
169
fcntl.macros
@ -1,3 +1,94 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&LAB MOVE4 &F,&T
|
||||
&LAB ~SETM
|
||||
@ -148,84 +239,6 @@
|
||||
.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 PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
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
|
||||
|
99
math2.macros
99
math2.macros
@ -1,3 +1,56 @@
|
||||
macro
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&lab csubroutine &parms,&work
|
||||
&lab anop
|
||||
@ -91,52 +144,6 @@
|
||||
.j
|
||||
rtl
|
||||
mend
|
||||
MACRO
|
||||
&LAB PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
||||
macro
|
||||
&l cmp4 &n1,&n2
|
||||
lclb &yistwo
|
||||
|
46
orca.macros
46
orca.macros
@ -1,46 +0,0 @@
|
||||
MACRO
|
||||
&LAB PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
@ -112,7 +112,7 @@ lb2 asl A get the signal handler address
|
||||
long M
|
||||
tya
|
||||
sta >jsl+1
|
||||
ph2 sig call the user signal handler
|
||||
ph2 <sig call the user signal handler
|
||||
jsl jsl jsl
|
||||
|
||||
lb3 creturn 2:val
|
||||
|
@ -1,3 +1,41 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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 csubroutine &parms,&work
|
||||
&lab anop
|
||||
@ -139,38 +177,6 @@
|
||||
.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
|
||||
|
130
stdio.asm
130
stdio.asm
@ -42,7 +42,7 @@ stream equ 4 input stream
|
||||
tsc
|
||||
phd
|
||||
tcd
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
bcs lb1
|
||||
ldy #FILE_flag clear the error flag
|
||||
@ -85,11 +85,11 @@ stdfile equ 7 is this a standard file?
|
||||
|
||||
lda #EOF assume we will get an error
|
||||
sta err
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs rts
|
||||
|
||||
ph4 stream do any pending I/O
|
||||
ph4 <stream do any pending I/O
|
||||
jsl fflush
|
||||
tax
|
||||
jne rts
|
||||
@ -156,7 +156,7 @@ cl3b sta dsPathname
|
||||
sta clRefNum
|
||||
OSClose cl
|
||||
DestroyGS ds DestroyGS(ds)
|
||||
cl3c ph4 p free(p)
|
||||
cl3c ph4 <p free(p)
|
||||
jsl free
|
||||
bra cl3e else
|
||||
cl3d ldy #FILE_file close the file
|
||||
@ -178,7 +178,7 @@ cl3e ldy #FILE_flag if the buffer was allocated by fopen the
|
||||
jsl free
|
||||
cl4 lda stdfile if this is not a standard file then
|
||||
bne cl5
|
||||
ph4 stream dispose of the file buffer
|
||||
ph4 <stream dispose of the file buffer
|
||||
jsl free
|
||||
bra cl7 else
|
||||
cl5 add4 stream,#sizeofFILE-4,p reset the standard out stuff
|
||||
@ -225,7 +225,7 @@ stream equ 4 input stream
|
||||
tsc
|
||||
phd
|
||||
tcd
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
ldx #_IOEOF
|
||||
bcs lb1
|
||||
@ -263,7 +263,7 @@ stream equ 4 input stream
|
||||
tsc
|
||||
phd
|
||||
tcd
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
ldx #_IOERR
|
||||
bcs lb1
|
||||
@ -316,7 +316,7 @@ sp equ 3 stream work pointer
|
||||
fa1 lda sp while sp <> nil
|
||||
ora sp+2
|
||||
jeq rts
|
||||
ph4 sp fflush(sp);
|
||||
ph4 <sp fflush(sp);
|
||||
jsl fflush
|
||||
tax if returned value <> 0 then
|
||||
beq fa2
|
||||
@ -331,7 +331,7 @@ fa2 ldy #2 sp = sp^.next
|
||||
|
||||
fa3 lda #EOF assume there is an error
|
||||
sta err
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs rts
|
||||
ldy #FILE_flag if the mode is not writing, quit
|
||||
@ -368,7 +368,7 @@ fa3 lda #EOF assume there is an error
|
||||
jsr ~ForceToEOF
|
||||
fa4 OSwrite wr write the info
|
||||
bcc fl1
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsr ~ioerror
|
||||
bra rts
|
||||
|
||||
@ -378,13 +378,13 @@ fl1a bit #_IORW
|
||||
beq fl3
|
||||
bit #_IOREAD if the file is being read then
|
||||
beq fl2
|
||||
ph4 stream use ftell to set the mark
|
||||
ph4 <stream use ftell to set the mark
|
||||
jsl ftell
|
||||
ldy #FILE_flag
|
||||
lda [stream],Y
|
||||
fl2 and #$FFFF-_IOWRT-_IOREAD turn off the reading and writing flags
|
||||
sta [stream],Y
|
||||
fl3 ph4 stream prepare file for output
|
||||
fl3 ph4 <stream prepare file for output
|
||||
jsl ~InitBuffer
|
||||
stz err no error found
|
||||
rts plb
|
||||
@ -424,7 +424,7 @@ p equ 3 work pointer
|
||||
phk
|
||||
plb
|
||||
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
bcs lb0
|
||||
ldy #FILE_flag quit with error if the end of file
|
||||
@ -467,7 +467,7 @@ lb2 ldy #FILE_file branch if this is a disk file
|
||||
st1 sta c
|
||||
brl gc9
|
||||
|
||||
gc1 ph4 stream else flag the error
|
||||
gc1 ph4 <stream else flag the error
|
||||
jsr ~ioerror
|
||||
lda #EOF
|
||||
sta c
|
||||
@ -661,10 +661,10 @@ disp equ 1 disp in s
|
||||
|
||||
csubroutine (4:s,2:n,4:stream),2
|
||||
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
bcs err1
|
||||
ph4 stream quit with NULL if at EOF
|
||||
ph4 <stream quit with NULL if at EOF
|
||||
jsl feof
|
||||
tax
|
||||
beq lb0
|
||||
@ -677,7 +677,7 @@ lb0 stz disp no characters processed so far
|
||||
dec n leave room for the null terminator
|
||||
bmi err
|
||||
beq err
|
||||
lb1 ph4 stream get a character
|
||||
lb1 ph4 <stream get a character
|
||||
jsl fgetc
|
||||
tax quit with error if it is an EOF
|
||||
bpl lb2
|
||||
@ -716,7 +716,7 @@ err equ 1 error code
|
||||
|
||||
csubroutine (4:stream,4:pos),2
|
||||
|
||||
ph4 stream get the position
|
||||
ph4 <stream get the position
|
||||
jsl ftell
|
||||
cmp #-1 if the position = -1 then
|
||||
bne lb1
|
||||
@ -786,7 +786,7 @@ OSname equ 11 pointer to the GS/OS file name
|
||||
; create a GS/OS file name
|
||||
;
|
||||
cn1 stx opAccess set the access flags
|
||||
ph4 filename get the length of the name buffer
|
||||
ph4 <filename get the length of the name buffer
|
||||
jsl ~osname
|
||||
sta OSname
|
||||
stx OSname+2
|
||||
@ -868,7 +868,7 @@ ar1 ph4 #sizeofFILE get space for the file record
|
||||
stx buffStart+2
|
||||
ora buffStart+2
|
||||
bne ar3
|
||||
ph4 fileBuff memory error
|
||||
ph4 <fileBuff memory error
|
||||
jsl free
|
||||
ar2 lda #ENOMEM
|
||||
sta >errno
|
||||
@ -950,7 +950,7 @@ ar6b sta [fileBuff],Y
|
||||
;
|
||||
; return the result
|
||||
;
|
||||
rt1 ph4 OSname dispose of the file name buffer
|
||||
rt1 ph4 <OSname dispose of the file name buffer
|
||||
jsl free
|
||||
rt2 plb restore caller's data bank
|
||||
creturn 4:fileBuff return
|
||||
@ -1040,7 +1040,7 @@ fileBuff equ 11 file buffer to return
|
||||
stz fileBuff the open is not legal, yet
|
||||
stz fileBuff+2
|
||||
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs rt2
|
||||
lda [type] make sure the file type is in ['a','r','w']
|
||||
@ -1062,7 +1062,7 @@ cl1 ldy #FILE_file branch if the file is not a disk file
|
||||
lda [stream],Y
|
||||
bmi cn1
|
||||
|
||||
ph4 stream do any pending I/O
|
||||
ph4 <stream do any pending I/O
|
||||
jsl fflush
|
||||
ldy #FILE_file close the file
|
||||
lda [stream],Y
|
||||
@ -1086,7 +1086,7 @@ cl1 ldy #FILE_file branch if the file is not a disk file
|
||||
cn1 lda filename bail out if filename is NULL
|
||||
ora filename+2 (reopening same file not supported)
|
||||
jeq rt2
|
||||
ph4 filename get the length of the name buffer
|
||||
ph4 <filename get the length of the name buffer
|
||||
jsl ~osname
|
||||
sta OSname
|
||||
stx OSname+2
|
||||
@ -1133,7 +1133,7 @@ nl3 OSopen op try to open an existing file
|
||||
lda fileType if the type is 'r', flag an error
|
||||
cmp #'r'
|
||||
bne of1
|
||||
errEIO ph4 stream
|
||||
errEIO ph4 <stream
|
||||
jsr ~ioerror
|
||||
brl rt1
|
||||
|
||||
@ -1142,7 +1142,7 @@ of1 move4 OSname,crPathName create the file
|
||||
bcc of1a
|
||||
cmp #$0047 check for dupPathname error=>file exists
|
||||
bne errEIO
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsr ~ioerror
|
||||
lda #EEXIST
|
||||
sta >errno
|
||||
@ -1240,7 +1240,7 @@ ar6b sta [fileBuff],Y
|
||||
;
|
||||
; return the result
|
||||
;
|
||||
rt1 ph4 OSname dispose of the file name buffer
|
||||
rt1 ph4 <OSname dispose of the file name buffer
|
||||
jsl free
|
||||
rt2 plb restore caller's data bank
|
||||
creturn 4:fileBuff return
|
||||
@ -1383,7 +1383,7 @@ p equ 1 work pointer
|
||||
|
||||
csubroutine (2:c,4:stream),6
|
||||
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
bcs lb0
|
||||
ldy #FILE_flag quit with error if the end of file
|
||||
@ -1408,7 +1408,7 @@ lb2 ldy #FILE_file branch if this is a disk file
|
||||
|
||||
cmp #stdoutID if stream = stdout then
|
||||
bne pc1
|
||||
ph2 c write the character
|
||||
ph2 <c write the character
|
||||
jsl ~stdout
|
||||
brl pc8
|
||||
pc1 cmp #stderrID else if stream = stderr then
|
||||
@ -1420,7 +1420,7 @@ pc1 cmp #stderrID else if stream = stderr then
|
||||
pc1a pha write to error out
|
||||
jsl SYSCHARERROUT
|
||||
brl pc8
|
||||
pc2 ph4 stream else stream = stdin; flag the error
|
||||
pc2 ph4 <stream else stream = stdin; flag the error
|
||||
jsr ~ioerror
|
||||
lda #EOF
|
||||
sta c
|
||||
@ -1446,7 +1446,7 @@ pc3a ldy #FILE_cnt if the buffer is full then
|
||||
pc3b ldy #FILE_flag purge it
|
||||
lda [stream],Y
|
||||
pha
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsl fflush
|
||||
ldy #FILE_flag
|
||||
pla
|
||||
@ -1502,7 +1502,7 @@ pc6 ldy #FILE_flag or is flag & _IONBF then
|
||||
pc7 ldy #FILE_flag flush the stream
|
||||
lda [stream],Y
|
||||
pha
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsl fflush
|
||||
ldy #FILE_flag
|
||||
pla
|
||||
@ -1525,7 +1525,7 @@ err equ 1 return code
|
||||
|
||||
csubroutine (4:s,4:stream),2
|
||||
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
lda #EOF
|
||||
sta err
|
||||
@ -1533,7 +1533,7 @@ err equ 1 return code
|
||||
stz err no error so far
|
||||
bra lb2 skip initial increment
|
||||
lb1 inc4 s next char
|
||||
lb2 ph4 stream push the stream, just in case...
|
||||
lb2 ph4 <stream push the stream, just in case...
|
||||
lda [s] exit loop if at end of string
|
||||
and #$00FF
|
||||
beq lb3
|
||||
@ -1583,7 +1583,7 @@ temp equ 1
|
||||
stz rdTransferCount set the # of elements read
|
||||
stz rdTransferCount+2
|
||||
stz pbkCount no putback characters read yet
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs lb6
|
||||
mul4 element_size,count,rdRequestCount set the # of bytes
|
||||
@ -1610,7 +1610,7 @@ pb1 lda rdRequestCount quit if the request count is 0
|
||||
sta [stream],Y
|
||||
bra pb1 loop to check for another putback chr
|
||||
|
||||
lb0 ph4 stream reset file pointer
|
||||
lb0 ph4 <stream reset file pointer
|
||||
jsl ~SetFilePointer
|
||||
ldy #FILE_file set the file ID number
|
||||
lda [stream],Y
|
||||
@ -1648,7 +1648,7 @@ lb2 sta rdRefNum set the reference number
|
||||
bne lb3
|
||||
jsr SetEOF set the EOF flag
|
||||
bra lb4
|
||||
lb3 ph4 stream I/O error
|
||||
lb3 ph4 <stream I/O error
|
||||
jsr ~ioerror
|
||||
lb4 clc rdTransferCount += pbkCount
|
||||
lda rdTransferCount
|
||||
@ -1790,10 +1790,10 @@ err equ 1 return value
|
||||
|
||||
lda #-1 assume we will get an error
|
||||
sta err
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs rts
|
||||
ph4 stream purge the file
|
||||
ph4 <stream purge the file
|
||||
jsl fflush
|
||||
ldy #FILE_file set the file reference
|
||||
lda [stream],Y
|
||||
@ -1809,7 +1809,7 @@ err equ 1 return value
|
||||
bra lb3
|
||||
lb2 cmp #SEEK_CUR else if relative to current position then
|
||||
bne lb3
|
||||
ph4 stream get the current position
|
||||
ph4 <stream get the current position
|
||||
jsl ftell
|
||||
clc add it to the offset
|
||||
adc offset
|
||||
@ -1864,7 +1864,7 @@ lb6 ldy #FILE_flag clear the EOF , READ, WRITE flags
|
||||
rts plb
|
||||
creturn 2:err
|
||||
|
||||
erEIO ph4 stream flag an IO error
|
||||
erEIO ph4 <stream flag an IO error
|
||||
jsr ~ioerror
|
||||
bra rts
|
||||
|
||||
@ -1903,7 +1903,7 @@ err equ 1 error code
|
||||
pha
|
||||
lda [pos]
|
||||
pha
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsl fseek
|
||||
sta err
|
||||
|
||||
@ -1937,14 +1937,14 @@ pos equ 1 position in the file
|
||||
lda #-1 assume an error
|
||||
sta pos
|
||||
sta pos+2
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs rts
|
||||
ldy #FILE_flag if the file is being written then
|
||||
lda [stream],Y
|
||||
bit #_IOWRT
|
||||
beq lb0
|
||||
ph4 stream do any pending writes
|
||||
ph4 <stream do any pending writes
|
||||
jsl fflush
|
||||
tax
|
||||
bne rts
|
||||
@ -1953,7 +1953,7 @@ lb0 ldy #FILE_file get the file's mark
|
||||
sta gmRefNum
|
||||
OSGet_Mark gm
|
||||
bcc lb1
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsr ~ioerror
|
||||
bra rts
|
||||
|
||||
@ -2030,7 +2030,7 @@ fwrite start
|
||||
|
||||
stz wrTransferCount set the # of elements written
|
||||
stz wrTransferCount+2
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs lb6
|
||||
mul4 element_size,count,wrRequestCount set the # of bytes
|
||||
@ -2068,7 +2068,7 @@ lb3 lda [ptr] write the bytes
|
||||
bra lb6
|
||||
|
||||
lb4 sta wrRefNum set the reference number
|
||||
ph4 stream purge the file
|
||||
ph4 <stream purge the file
|
||||
jsl fflush
|
||||
move4 ptr,wrDataBuffer set the start address
|
||||
ldy #FILE_flag if append mode, force to EOF
|
||||
@ -2079,7 +2079,7 @@ lb4 sta wrRefNum set the reference number
|
||||
jsr ~ForceToEOF
|
||||
lb4a OSWrite wr write the bytes
|
||||
bcc lb5
|
||||
ph4 stream I/O error
|
||||
ph4 <stream I/O error
|
||||
jsr ~ioerror
|
||||
! set the # records written
|
||||
lb5 div4 wrTransferCount,element_size,count
|
||||
@ -2222,7 +2222,7 @@ s equ 4 string address
|
||||
beq lb0
|
||||
|
||||
ph4 >stderr write the error string
|
||||
ph4 s
|
||||
ph4 <s
|
||||
jsl fputs
|
||||
ph4 >stderr write ': '
|
||||
pea ':'
|
||||
@ -2420,7 +2420,7 @@ err equ 1 return code
|
||||
phk
|
||||
plb
|
||||
|
||||
ph4 filename convert to a GS/OS file name
|
||||
ph4 <filename convert to a GS/OS file name
|
||||
jsl ~osname
|
||||
sta dsPathName
|
||||
stx dsPathName+2
|
||||
@ -2465,7 +2465,7 @@ err equ 1 return code
|
||||
phk
|
||||
plb
|
||||
|
||||
ph4 oldname convert oldname to a GS/OS file name
|
||||
ph4 <oldname convert oldname to a GS/OS file name
|
||||
jsl ~osname
|
||||
sta cpPathName
|
||||
stx cpPathName+2
|
||||
@ -2474,7 +2474,7 @@ err equ 1 return code
|
||||
lda #$FFFF
|
||||
sta err
|
||||
bra lb4
|
||||
lb1 ph4 newname convert newname to a GS/OS file name
|
||||
lb1 ph4 <newname convert newname to a GS/OS file name
|
||||
jsl ~osname
|
||||
sta cpNewPathName
|
||||
stx cpNewPathName+2
|
||||
@ -2513,13 +2513,13 @@ cpNewPathName ds 4
|
||||
rewind start
|
||||
csubroutine (4:stream),0
|
||||
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
bcs ret
|
||||
|
||||
ph2 #SEEK_SET
|
||||
ph4 #0
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsl __fseek
|
||||
|
||||
ldy #FILE_flag clear the error flag
|
||||
@ -2600,8 +2600,8 @@ err equ 1 return code
|
||||
bra lb2
|
||||
lb1 ph4 #BUFSIZ
|
||||
ph2 #_IOFBF
|
||||
lb2 ph4 buf
|
||||
ph4 stream
|
||||
lb2 ph4 <buf
|
||||
ph4 <stream
|
||||
jsl __setvbuf
|
||||
sta err
|
||||
|
||||
@ -2642,7 +2642,7 @@ err equ 1 return code
|
||||
plb
|
||||
lda #-1 assume we will get an error
|
||||
sta err
|
||||
ph4 stream verify that stream exists
|
||||
ph4 <stream verify that stream exists
|
||||
jsl ~VerifyStream
|
||||
jcs rts
|
||||
ldy #FILE_ptr make sure the buffer is not in use
|
||||
@ -2672,7 +2672,7 @@ lb1 lda type error if type is not one of these
|
||||
lb2 lda buf if the buffer is not supplied by the
|
||||
ora buf+2 caller then
|
||||
bne sb1
|
||||
ph4 size allocate a buffer
|
||||
ph4 <size allocate a buffer
|
||||
jsl malloc
|
||||
sta buf
|
||||
stx buf+2
|
||||
@ -3120,7 +3120,7 @@ lb4 long M append the two strings
|
||||
ora buf+2
|
||||
beq lb5
|
||||
ph4 #cname move the string
|
||||
ph4 buf
|
||||
ph4 <buf
|
||||
jsl strcpy
|
||||
bra lb6
|
||||
|
||||
@ -4129,7 +4129,7 @@ bcdnum ds 10
|
||||
using ~printfCommon
|
||||
argp equ 7 argument pointer
|
||||
|
||||
ph4 argp save the original argp
|
||||
ph4 <argp save the original argp
|
||||
ldy #2 dereference argp
|
||||
lda [argp],Y
|
||||
tax
|
||||
@ -4280,7 +4280,7 @@ al3 long I,M
|
||||
using ~printfCommon
|
||||
argp equ 7 argument pointer
|
||||
|
||||
ph4 argp save the original argp
|
||||
ph4 <argp save the original argp
|
||||
ldy #2 dereference argp
|
||||
lda [argp],Y
|
||||
tax
|
||||
@ -4298,7 +4298,7 @@ lb1 iny
|
||||
|
||||
~Format_b entry
|
||||
~Format_P entry
|
||||
ph4 argp save the original argp
|
||||
ph4 <argp save the original argp
|
||||
ldy #2 dereference argp
|
||||
lda [argp],Y
|
||||
tax
|
||||
@ -4637,7 +4637,7 @@ ptr equ 3 pointer to return
|
||||
|
||||
csubroutine (4:filename),6
|
||||
|
||||
ph4 filename get the length of the name buffer
|
||||
ph4 <filename get the length of the name buffer
|
||||
jsl strlen
|
||||
sta namelen
|
||||
inc A
|
||||
@ -4656,7 +4656,7 @@ lb1 lda namelen set the name length
|
||||
sta [ptr]
|
||||
pea 0 copy the file name to the OS name buffer
|
||||
pha
|
||||
ph4 filename
|
||||
ph4 <filename
|
||||
clc
|
||||
lda ptr
|
||||
ldx ptr+2
|
||||
@ -6227,7 +6227,7 @@ smDisplacement dc i4'0' displacement = 0
|
||||
beq lb1
|
||||
ph2 #SEEK_CUR fseek(stream, 0L, SEEK_CUR)
|
||||
ph4 #0
|
||||
ph4 stream
|
||||
ph4 <stream
|
||||
jsl fseek
|
||||
|
||||
lb1 anop
|
||||
|
169
stdio.macros
169
stdio.macros
@ -1,4 +1,95 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
macro
|
||||
&l negate8 &n1
|
||||
&l ~setm
|
||||
sec
|
||||
@ -569,84 +660,6 @@
|
||||
.I
|
||||
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 PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PL4 &N1
|
||||
LCLC &C
|
||||
&LAB ANOP
|
||||
|
58
stdlib.asm
58
stdlib.asm
@ -351,8 +351,8 @@ lb1 clc test = (left+right)/2
|
||||
ror test
|
||||
mul4 test,size,addr addr = test*size + base
|
||||
add4 addr,base
|
||||
ph4 addr compare the array elements
|
||||
ph4 key
|
||||
ph4 <addr compare the array elements
|
||||
ph4 <key
|
||||
jsl jsl jsl
|
||||
tax quit if *addr = *key
|
||||
beq lb6
|
||||
@ -588,8 +588,8 @@ addr equ 1
|
||||
phb use local addressing
|
||||
phk
|
||||
plb
|
||||
ph4 n do the divide
|
||||
ph4 d
|
||||
ph4 <n do the divide
|
||||
ph4 <d
|
||||
jsl ~DIV4
|
||||
pl4 div_t
|
||||
pl4 div_t+4
|
||||
@ -717,8 +717,8 @@ qsort start
|
||||
lda compar+1
|
||||
sta jsl1+2
|
||||
sta jsl2+2
|
||||
ph4 count do the sort
|
||||
ph4 base
|
||||
ph4 <count do the sort
|
||||
ph4 <base
|
||||
jsl rsort
|
||||
|
||||
done plb
|
||||
@ -781,8 +781,8 @@ sr1a move4 last,right right = last
|
||||
move4 first,left left = first
|
||||
bra sr3
|
||||
sr2 add4 left,lsize inc left until *left >= *last
|
||||
sr3 ph4 last
|
||||
ph4 left
|
||||
sr3 ph4 <last
|
||||
ph4 <left
|
||||
jsl1 entry
|
||||
jsl jsl1
|
||||
tax
|
||||
@ -794,14 +794,14 @@ sr4 lda right quit if right = first
|
||||
cmp first+2
|
||||
beq sr4b
|
||||
sr4a sub4 right,lsize dec right until *right <= *last
|
||||
ph4 last
|
||||
ph4 right
|
||||
ph4 <last
|
||||
ph4 <right
|
||||
jsl2 entry
|
||||
jsl jsl2
|
||||
dec A
|
||||
bpl sr4
|
||||
sr4b ph4 left swap left/right entries
|
||||
ph4 right
|
||||
sr4b ph4 <left swap left/right entries
|
||||
ph4 <right
|
||||
jsr swap
|
||||
lda left+2 loop if left < right
|
||||
cmp right+2
|
||||
@ -809,15 +809,15 @@ sr4b ph4 left swap left/right entries
|
||||
lda left
|
||||
cmp right
|
||||
sr5 blt sr2
|
||||
ph4 right swap left/right entries
|
||||
ph4 left
|
||||
ph4 <right swap left/right entries
|
||||
ph4 <left
|
||||
jsr swap
|
||||
ph4 left swap left/last entries
|
||||
ph4 last
|
||||
ph4 <left swap left/last entries
|
||||
ph4 <last
|
||||
jsr swap
|
||||
sub4 left,lsize,right sort left part of array
|
||||
ph4 right
|
||||
ph4 first
|
||||
ph4 <right
|
||||
ph4 <first
|
||||
jsl rsort
|
||||
add4 left,lsize,first sort right part of array
|
||||
brl sr0
|
||||
@ -1007,10 +1007,10 @@ cn1 cmp #'+' else if the char is '+' then
|
||||
bne cn3
|
||||
cn2 inc4 str ++str
|
||||
|
||||
cn3 ph4 str save the starting string
|
||||
ph2 base convert the unsigned number
|
||||
ph4 ptr
|
||||
ph4 str
|
||||
cn3 ph4 <str save the starting string
|
||||
ph2 <base convert the unsigned number
|
||||
ph4 <ptr
|
||||
ph4 <str
|
||||
jsl ~strtoul
|
||||
stx val+2
|
||||
sta val
|
||||
@ -1194,9 +1194,9 @@ cn3 cmp base branch if the digit is too big
|
||||
pha
|
||||
pha
|
||||
pha
|
||||
ph4 val
|
||||
ph4 <val
|
||||
pea 0
|
||||
ph2 base
|
||||
ph2 <base
|
||||
_LongMul
|
||||
pl4 val
|
||||
pla branch if there was an error
|
||||
@ -1329,10 +1329,10 @@ cn1 cmp #'+' else if the char is '+' then
|
||||
bne cn3
|
||||
cn2 inc4 str ++str
|
||||
|
||||
cn3 ph4 str save the starting string
|
||||
ph2 base convert the unsigned number
|
||||
ph4 ptr
|
||||
ph4 str
|
||||
cn3 ph4 <str save the starting string
|
||||
ph2 <base convert the unsigned number
|
||||
ph4 <ptr
|
||||
ph4 <str
|
||||
tdc
|
||||
clc
|
||||
adc #val
|
||||
@ -1539,7 +1539,7 @@ cn3 cmp base branch if the digit is too big
|
||||
pea 0
|
||||
pea 0
|
||||
pea 0
|
||||
ph2 base
|
||||
ph2 <base
|
||||
jsl ~UMUL8
|
||||
pl8 val
|
||||
pla get the saved digit
|
||||
|
169
stdlib.macros
169
stdlib.macros
@ -1,4 +1,95 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
macro
|
||||
&l negate8 &n1
|
||||
&l ~setm
|
||||
sec
|
||||
@ -459,84 +550,6 @@
|
||||
.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 PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PL4 &N1
|
||||
LCLC &C
|
||||
&LAB ANOP
|
||||
|
16
string.asm
16
string.asm
@ -295,7 +295,7 @@ rtl equ 1 return address
|
||||
phd
|
||||
tcd
|
||||
|
||||
ph4 p1 save the dest pointer
|
||||
ph4 <p1 save the dest pointer
|
||||
|
||||
lda len if there are an odd # of bytes then
|
||||
lsr A
|
||||
@ -377,7 +377,7 @@ rtl equ 1 return address
|
||||
phd
|
||||
tcd
|
||||
|
||||
ph4 p1 save the dest pointer
|
||||
ph4 <p1 save the dest pointer
|
||||
|
||||
lda p1+2 if p1 < p2 then
|
||||
cmp p2+2
|
||||
@ -480,7 +480,7 @@ rtl equ 1 return address
|
||||
phd
|
||||
tcd
|
||||
|
||||
ph4 p save the pointer
|
||||
ph4 <p save the pointer
|
||||
|
||||
short M
|
||||
lda val form a 2 byte value
|
||||
@ -1560,7 +1560,7 @@ rtl equ workLen+1 return address
|
||||
lda src if the string to search is null,
|
||||
ora src+2 return null
|
||||
beq fl2
|
||||
ph4 sub get the length of the search string
|
||||
ph4 <sub get the length of the search string
|
||||
jsl strlen
|
||||
stx strset+2
|
||||
sta strset
|
||||
@ -1568,7 +1568,7 @@ rtl equ workLen+1 return address
|
||||
sta lensub
|
||||
ora lensub+2 if the length is 0 then
|
||||
jeq rt1 return the search string
|
||||
ph4 src get the length of the string to search
|
||||
ph4 <src get the length of the string to search
|
||||
jsl strlen
|
||||
sec subtract off the length of the search
|
||||
sbc lensub string
|
||||
@ -1845,14 +1845,14 @@ strxfrm start
|
||||
csubroutine (4:s1,4:s2,4:n),4
|
||||
len equ 1 length of s2
|
||||
|
||||
ph4 s2 len = strlen(s2)
|
||||
ph4 <s2 len = strlen(s2)
|
||||
jsl strlen
|
||||
sta len
|
||||
stx len+2
|
||||
cmpl len,n if len < n
|
||||
bge ret
|
||||
ph4 s2
|
||||
ph4 s1
|
||||
ph4 <s2
|
||||
ph4 <s1
|
||||
jsl strcpy strcpy(s1,s2)
|
||||
ret creturn 4:len return len
|
||||
end
|
||||
|
@ -1,3 +1,56 @@
|
||||
macro
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&LAB MOVE4 &F,&T
|
||||
&LAB ~SETM
|
||||
@ -458,52 +511,6 @@
|
||||
.I
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
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
|
||||
|
2
time.asm
2
time.asm
@ -138,7 +138,7 @@ tm_wday equ 12
|
||||
phk
|
||||
plb
|
||||
|
||||
ph4 timeptr convert to a time record
|
||||
ph4 <timeptr convert to a time record
|
||||
jsl localtime
|
||||
sta timeptr
|
||||
stx timeptr+2
|
||||
|
175
time.macros
175
time.macros
@ -1,3 +1,94 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&LAB MOVE4 &F,&T
|
||||
&LAB ~SETM
|
||||
@ -418,52 +509,6 @@
|
||||
.D
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PL4 &N1
|
||||
LCLC &C
|
||||
&LAB ANOP
|
||||
@ -517,44 +562,6 @@
|
||||
&l blt &bp
|
||||
beq &bp
|
||||
mend
|
||||
macro
|
||||
&l ph2 &n1
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&l 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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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 _ReadBParam
|
||||
&lab ldx #$0C03
|
||||
|
48
toolglue.asm
48
toolglue.asm
@ -68,10 +68,10 @@ addr equ 1 work pointer
|
||||
pha
|
||||
pha
|
||||
pha
|
||||
ph2 aRegValue
|
||||
ph2 xRegValue
|
||||
ph2 yRegValue
|
||||
ph2 eModeEntryPt
|
||||
ph2 <aRegValue
|
||||
ph2 <xRegValue
|
||||
ph2 <yRegValue
|
||||
ph2 <eModeEntryPt
|
||||
_FWEntry
|
||||
sta >~TOOLERROR
|
||||
pl2 >yRegExit
|
||||
@ -278,8 +278,8 @@ addr equ 1
|
||||
sec
|
||||
sbc #8
|
||||
tcs
|
||||
ph4 dividend
|
||||
ph4 divisor
|
||||
ph4 <dividend
|
||||
ph4 <divisor
|
||||
_LongDivide
|
||||
sta >~TOOLERROR
|
||||
pl4 >quotient
|
||||
@ -313,8 +313,8 @@ addr equ 1
|
||||
sec
|
||||
sbc #8
|
||||
tcs
|
||||
ph4 multiplicand
|
||||
ph4 multiplier
|
||||
ph4 <multiplicand
|
||||
ph4 <multiplier
|
||||
_LongMul
|
||||
sta >~TOOLERROR
|
||||
pl4 >lsResult
|
||||
@ -346,8 +346,8 @@ addr equ 1
|
||||
|
||||
pha
|
||||
pha
|
||||
ph2 dividend
|
||||
ph2 divisor
|
||||
ph2 <dividend
|
||||
ph2 <divisor
|
||||
_SDivide
|
||||
sta >~TOOLERROR
|
||||
pl2 >quotient
|
||||
@ -379,8 +379,8 @@ addr equ 1
|
||||
|
||||
pha
|
||||
pha
|
||||
ph2 dividend
|
||||
ph2 divisor
|
||||
ph2 <dividend
|
||||
ph2 <divisor
|
||||
_UDivide
|
||||
sta >~TOOLERROR
|
||||
pl2 >quotient
|
||||
@ -421,9 +421,9 @@ addr equ 1
|
||||
sec
|
||||
sbc #10
|
||||
tcs
|
||||
ph2 uID
|
||||
ph4 stAddr
|
||||
ph2 dpAddr
|
||||
ph2 <uID
|
||||
ph4 <stAddr
|
||||
ph2 <dpAddr
|
||||
_InitialLoad
|
||||
sta >~TOOLERROR
|
||||
pl2 >userID
|
||||
@ -464,10 +464,10 @@ addr equ 1
|
||||
sec
|
||||
sbc #10
|
||||
tcs
|
||||
ph2 uID
|
||||
ph4 buffAddr
|
||||
ph2 flagWord
|
||||
ph2 inputType
|
||||
ph2 <uID
|
||||
ph4 <buffAddr
|
||||
ph2 <flagWord
|
||||
ph2 <inputType
|
||||
_InitialLoad2
|
||||
sta >~TOOLERROR
|
||||
pl2 >userID
|
||||
@ -508,9 +508,9 @@ addr equ 1
|
||||
sec
|
||||
sbc #10
|
||||
tcs
|
||||
ph2 uID
|
||||
ph4 fName
|
||||
ph4 sName
|
||||
ph2 <uID
|
||||
ph4 <fName
|
||||
ph4 <sName
|
||||
_LoadSegName
|
||||
sta >~TOOLERROR
|
||||
pl4 >segAddr
|
||||
@ -551,7 +551,7 @@ addr equ 1
|
||||
sec
|
||||
sbc #10
|
||||
tcs
|
||||
ph2 uID
|
||||
ph2 <uID
|
||||
_Restart
|
||||
sta >~TOOLERROR
|
||||
pl2 >userID
|
||||
@ -590,7 +590,7 @@ addr equ 1
|
||||
pha
|
||||
pha
|
||||
pha
|
||||
ph4 segaddr
|
||||
ph4 <segaddr
|
||||
_UnloadSeg
|
||||
sta >~TOOLERROR
|
||||
pl2 >userID
|
||||
|
169
toolglue.macros
169
toolglue.macros
@ -1,3 +1,94 @@
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
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
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&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
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&LAB LLA &AD1,&AD2
|
||||
&LAB ANOP
|
||||
@ -26,38 +117,6 @@
|
||||
.D
|
||||
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 PL2 &N1
|
||||
LCLC &C
|
||||
&LAB ANOP
|
||||
@ -202,52 +261,6 @@
|
||||
rtl
|
||||
mend
|
||||
MACRO
|
||||
&LAB PH4 &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
|
||||
LDY #2
|
||||
LDA (&N1),Y
|
||||
PHA
|
||||
LDA (&N1)
|
||||
PHA
|
||||
AGO .E
|
||||
.B
|
||||
AIF "&C"<>"[",.C
|
||||
LDY #2
|
||||
LDA &N1,Y
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.C
|
||||
LDA &N1+2
|
||||
PHA
|
||||
LDA &N1
|
||||
PHA
|
||||
AGO .E
|
||||
.D
|
||||
&N1 AMID &N1,2,L:&N1-1
|
||||
PEA +(&N1)|-16
|
||||
PEA &N1
|
||||
AGO .F
|
||||
.E
|
||||
AIF S:LONGA=1,.F
|
||||
SEP #%00100000
|
||||
.F
|
||||
MEXIT
|
||||
.G
|
||||
MNOTE "Missing closing '}'",16
|
||||
MEND
|
||||
MACRO
|
||||
&LAB PL4 &N1
|
||||
LCLC &C
|
||||
&LAB ANOP
|
||||
|
Loading…
x
Reference in New Issue
Block a user