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