mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2024-06-08 11:32:04 +00:00
Merge branch 'master' into gno-version
This commit is contained in:
commit
1fd1de0be8
57
cc.asm
57
cc.asm
|
@ -372,6 +372,63 @@ start ds 2 start of the command line string
|
||||||
targv ds 4
|
targv ds 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
****************************************************************
|
||||||
|
*
|
||||||
|
* ~CUMul2 - unsigned multiply
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* X,A - operands
|
||||||
|
*
|
||||||
|
* Outputs:
|
||||||
|
* A - result
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* This routine is used for array index calculations and
|
||||||
|
* for unsigned multiplies. It returns the low-order
|
||||||
|
* 16 bits of the true result in case of overflow.
|
||||||
|
*
|
||||||
|
****************************************************************
|
||||||
|
*
|
||||||
|
~CUMul2 start
|
||||||
|
n1 equ 3
|
||||||
|
n2 equ 5
|
||||||
|
;
|
||||||
|
; Initialization
|
||||||
|
;
|
||||||
|
phx save the operands
|
||||||
|
pha
|
||||||
|
phd set up our DP
|
||||||
|
tsc
|
||||||
|
tcd
|
||||||
|
cpx n1 make sure n1 is the smaller argument
|
||||||
|
bge in1
|
||||||
|
lda n1
|
||||||
|
stx n1
|
||||||
|
sta n2
|
||||||
|
in1 anop
|
||||||
|
;
|
||||||
|
; Do the multiply
|
||||||
|
;
|
||||||
|
lda #0
|
||||||
|
|
||||||
|
lsr n1
|
||||||
|
lb0 bcc lb1
|
||||||
|
clc
|
||||||
|
adc n2
|
||||||
|
lb1 asl n2
|
||||||
|
|
||||||
|
lsr n1
|
||||||
|
bne lb0
|
||||||
|
bcc aa1
|
||||||
|
clc
|
||||||
|
adc n2
|
||||||
|
|
||||||
|
aa1 pld return the result
|
||||||
|
plx
|
||||||
|
plx
|
||||||
|
rtl
|
||||||
|
end
|
||||||
|
|
||||||
****************************************************************
|
****************************************************************
|
||||||
*
|
*
|
||||||
* ~Exit - call exit routines and clean up open files
|
* ~Exit - call exit routines and clean up open files
|
||||||
|
|
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
|
||||||
|
|
|
@ -63,6 +63,7 @@ _IOEOF gequ $0080 has an EOF been found?
|
||||||
_IOERR gequ $0100 has an error occurred?
|
_IOERR gequ $0100 has an error occurred?
|
||||||
_IOTEXT gequ $0200 is this file a text file?
|
_IOTEXT gequ $0200 is this file a text file?
|
||||||
_IOTEMPFILE gequ $0400 was this file created by tmpfile()?
|
_IOTEMPFILE gequ $0400 was this file created by tmpfile()?
|
||||||
|
_IOAPPEND gequ $0800 is this file open in append mode?
|
||||||
|
|
||||||
! record structure
|
! record structure
|
||||||
! ----------------
|
! ----------------
|
||||||
|
@ -73,7 +74,7 @@ FILE_end gequ FILE_base+4 end of the file buffer
|
||||||
FILE_size gequ FILE_end+4 size of the file buffer
|
FILE_size gequ FILE_end+4 size of the file buffer
|
||||||
FILE_cnt gequ FILE_size+4 # chars that can be read/written to buffer
|
FILE_cnt gequ FILE_size+4 # chars that can be read/written to buffer
|
||||||
FILE_pbk gequ FILE_cnt+4 put back character
|
FILE_pbk gequ FILE_cnt+4 put back character
|
||||||
FILE_flag gequ FILE_pbk+2 buffer flags
|
FILE_flag gequ FILE_pbk+4 buffer flags
|
||||||
FILE_file gequ FILE_flag+2 GS/OS file ID
|
FILE_file gequ FILE_flag+2 GS/OS file ID
|
||||||
|
|
||||||
sizeofFILE gequ FILE_file+2 size of the record
|
sizeofFILE gequ FILE_file+2 size of the record
|
||||||
|
|
96
fcntl.asm
96
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
|
||||||
|
@ -148,7 +148,6 @@ err equ 1 error return code
|
||||||
|
|
||||||
stz err err = 0 {no error}
|
stz err err = 0 {no error}
|
||||||
lda filds error if there are too many open files
|
lda filds error if there are too many open files
|
||||||
bmi lb2
|
|
||||||
cmp #OPEN_MAX
|
cmp #OPEN_MAX
|
||||||
bge lb2
|
bge lb2
|
||||||
asl A get the file reference number
|
asl A get the file reference number
|
||||||
|
@ -209,8 +208,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 +238,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
|
||||||
|
|
||||||
|
@ -280,7 +279,6 @@ flags equ 5 file flags
|
||||||
bra lb7
|
bra lb7
|
||||||
|
|
||||||
lb1 lda filds error if there are too many open files
|
lb1 lda filds error if there are too many open files
|
||||||
bmi lb2
|
|
||||||
cmp #OPEN_MAX
|
cmp #OPEN_MAX
|
||||||
bge lb2
|
bge lb2
|
||||||
asl A get the file reference number
|
asl A get the file reference number
|
||||||
|
@ -297,7 +295,6 @@ lb3 sta refnum
|
||||||
sta flags
|
sta flags
|
||||||
|
|
||||||
lda arg find a new filds
|
lda arg find a new filds
|
||||||
bmi lb5
|
|
||||||
cmp #OPEN_MAX
|
cmp #OPEN_MAX
|
||||||
bge lb5
|
bge lb5
|
||||||
asl A
|
asl A
|
||||||
|
@ -376,7 +373,6 @@ mark equ 1 new file mark
|
||||||
sta mark
|
sta mark
|
||||||
sta mark+2
|
sta mark+2
|
||||||
lda filds get the file refnum
|
lda filds get the file refnum
|
||||||
bmi lb1
|
|
||||||
cmp #OPEN_MAX
|
cmp #OPEN_MAX
|
||||||
bge lb1
|
bge lb1
|
||||||
asl A
|
asl A
|
||||||
|
@ -384,43 +380,56 @@ mark equ 1 new file mark
|
||||||
tax
|
tax
|
||||||
lda >files,X
|
lda >files,X
|
||||||
bne lb2
|
bne lb2
|
||||||
lb1 lda #EBADF bad refnum error
|
lb1 bra lb4a bad refnum error
|
||||||
sta >errno
|
|
||||||
bra lb4
|
|
||||||
|
|
||||||
lb2 sta >smRefnum set the file refnum
|
lb2 sta >smRefnum set the file refnum
|
||||||
sta >gmRefnum
|
sta >gmRefnum
|
||||||
lda whence convert from UNIX whence to GS/OS base
|
lda whence convert from UNIX whence to GS/OS base
|
||||||
beq lb3
|
cmp #SEEK_SET if whence == 0 (SEEK_SET)
|
||||||
eor #$0003
|
bne lb2a
|
||||||
cmp #4
|
lda offset+2 if offset is negative
|
||||||
bge lb2a
|
bmi lb4 fail with EINVAL
|
||||||
cmp #2
|
lda #0 set mark to offset
|
||||||
bne lb3
|
|
||||||
sta >smBase
|
|
||||||
lda offset+2
|
|
||||||
bpl lb3a
|
|
||||||
sub4 #0,offset,offset
|
|
||||||
lda #3
|
|
||||||
bra lb3
|
bra lb3
|
||||||
lb2a lda #EINVAL invalid whence flag
|
lb2a cmp #SEEK_END else if whence == 2 (SEEK_END)
|
||||||
sta >errno
|
bne lb2c
|
||||||
bra lb4
|
lda offset+2 if offset > 0
|
||||||
|
bmi lb2b
|
||||||
|
ora offset
|
||||||
|
bne lb4 fail with EINVAL
|
||||||
|
lb2b sub4 #0,offset,offset negate offset
|
||||||
|
lda #1 set mark to EOF - offset
|
||||||
|
bra lb3
|
||||||
|
lb2c cmp #SEEK_CUR else if whence == 1 (SEEK_CUR)
|
||||||
|
bne lb4
|
||||||
|
lda offset if offset is positive or 0
|
||||||
|
bmi lb2d
|
||||||
|
lda #2 set mark to old mark + offset
|
||||||
|
bra lb3 else
|
||||||
|
lb2d sub4 #0,offset,offset negate offset
|
||||||
|
lda #3 set mark to old mark - offset
|
||||||
lb3 sta >smBase save the base parameter
|
lb3 sta >smBase save the base parameter
|
||||||
lb3a lda offset set the displacement
|
lb3a lda offset set the displacement
|
||||||
sta >smDisplacement
|
sta >smDisplacement
|
||||||
lda offset+2
|
lda offset+2
|
||||||
sta >smDisplacement+2
|
sta >smDisplacement+2
|
||||||
OSSet_Mark smRec set the file mark
|
OSSet_Mark smRec set the file mark
|
||||||
bcs lb1
|
bcc lb5
|
||||||
OSGet_Mark gmRec get the new mark
|
cmp #$4D out of range error => fail with EINVAL
|
||||||
bcs lb1
|
bne lb4a
|
||||||
|
lb4 lda #EINVAL
|
||||||
|
bra lb4b
|
||||||
|
lb4a lda #EBADF bad refnum error
|
||||||
|
lb4b sta >errno
|
||||||
|
bra lb6
|
||||||
|
lb5 OSGet_Mark gmRec get the new mark
|
||||||
|
bcs lb4a
|
||||||
lda >gmDisplacement
|
lda >gmDisplacement
|
||||||
sta mark
|
sta mark
|
||||||
lda >gmDisplacement+2
|
lda >gmDisplacement+2
|
||||||
sta mark+2
|
sta mark+2
|
||||||
|
|
||||||
lb4 creturn 4:mark
|
lb6 creturn 4:mark
|
||||||
|
|
||||||
smRec dc i'3' SetMark record
|
smRec dc i'3' SetMark record
|
||||||
smRefnum ds 2
|
smRefnum ds 2
|
||||||
|
@ -453,9 +462,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 +524,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 +555,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
|
||||||
|
@ -634,7 +643,6 @@ err equ 1 error return code
|
||||||
phk
|
phk
|
||||||
plb
|
plb
|
||||||
lda filds error if the file has not been opened
|
lda filds error if the file has not been opened
|
||||||
bmi lb0
|
|
||||||
cmp #OPEN_MAX
|
cmp #OPEN_MAX
|
||||||
bge lb0
|
bge lb0
|
||||||
asl A get the file reference number
|
asl A get the file reference number
|
||||||
|
@ -797,7 +805,6 @@ nbuff equ 3 new buffer pointer
|
||||||
phk
|
phk
|
||||||
plb
|
plb
|
||||||
lda filds error if the file has not been opened
|
lda filds error if the file has not been opened
|
||||||
bmi lb0
|
|
||||||
cmp #OPEN_MAX
|
cmp #OPEN_MAX
|
||||||
bge lb0
|
bge lb0
|
||||||
asl A get the file reference number
|
asl A get the file reference number
|
||||||
|
@ -806,6 +813,7 @@ nbuff equ 3 new buffer pointer
|
||||||
lda files,X
|
lda files,X
|
||||||
beq lb0
|
beq lb0
|
||||||
sta wrRefnum
|
sta wrRefnum
|
||||||
|
sta smRefnum
|
||||||
stx filds
|
stx filds
|
||||||
lda files+2,X make sure the file is open for writing
|
lda files+2,X make sure the file is open for writing
|
||||||
and #O_WRONLY+O_RDWR
|
and #O_WRONLY+O_RDWR
|
||||||
|
@ -827,7 +835,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
|
||||||
|
@ -857,7 +865,12 @@ lb0e sta [nbuff]
|
||||||
long M
|
long M
|
||||||
lb0f move4 nbuff,wrDataBuffer set the data buffer start
|
lb0f move4 nbuff,wrDataBuffer set the data buffer start
|
||||||
|
|
||||||
lb0g OSWrite wrRec write the bytes
|
lb0g ldx filds if the file is in O_APPEND mode then
|
||||||
|
lda files+2,X
|
||||||
|
and #O_APPEND
|
||||||
|
beq lb0h
|
||||||
|
OSSet_Mark smRec set mark to EOF
|
||||||
|
lb0h OSWrite wrRec write the bytes
|
||||||
bcc lb1 if an error occurred then
|
bcc lb1 if an error occurred then
|
||||||
lda #EIO errno = EIO
|
lda #EIO errno = EIO
|
||||||
sta >errno
|
sta >errno
|
||||||
|
@ -869,7 +882,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
|
||||||
|
|
||||||
|
@ -881,4 +894,9 @@ wrRefnum ds 2
|
||||||
wrDataBuffer ds 4
|
wrDataBuffer ds 4
|
||||||
wrRequestCount ds 4
|
wrRequestCount ds 4
|
||||||
wrTransferCount ds 4
|
wrTransferCount ds 4
|
||||||
|
|
||||||
|
smRec dc i'3' SetMark record
|
||||||
|
smRefnum ds 2
|
||||||
|
smBase dc i'1' EOF-displacement mode
|
||||||
|
smDisplacement dc i4'0' displacement = 0
|
||||||
end
|
end
|
||||||
|
|
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
|
||||||
|
|
32
fpextra.asm
32
fpextra.asm
|
@ -26,8 +26,8 @@ fpextra private dummy segment
|
||||||
~SinglePrecision start
|
~SinglePrecision start
|
||||||
tsc
|
tsc
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
ldy #0
|
ldy #0
|
||||||
phy
|
phy
|
||||||
pha
|
pha
|
||||||
phy
|
phy
|
||||||
|
@ -53,8 +53,8 @@ fpextra private dummy segment
|
||||||
~DoublePrecision start
|
~DoublePrecision start
|
||||||
tsc
|
tsc
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
ldy #0
|
ldy #0
|
||||||
phy
|
phy
|
||||||
pha
|
pha
|
||||||
phy
|
phy
|
||||||
|
@ -83,19 +83,19 @@ fpextra private dummy segment
|
||||||
~CompPrecision start
|
~CompPrecision start
|
||||||
tsc round to integer
|
tsc round to integer
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
FRINTX
|
FRINTX
|
||||||
lda 4+8,s
|
lda 4+8,s
|
||||||
pha save original sign
|
pha save original sign
|
||||||
asl a force sign to positive
|
asl a force sign to positive
|
||||||
lsr a
|
lsr a
|
||||||
sta 6+8,s
|
sta 6+8,s
|
||||||
tsc limit precision
|
tsc limit precision
|
||||||
clc
|
clc
|
||||||
adc #6
|
adc #6
|
||||||
ldy #0
|
ldy #0
|
||||||
phy
|
phy
|
||||||
pha
|
pha
|
||||||
phy
|
phy
|
||||||
|
@ -107,10 +107,10 @@ fpextra private dummy segment
|
||||||
FX2C
|
FX2C
|
||||||
FC2X
|
FC2X
|
||||||
pla restore original sign
|
pla restore original sign
|
||||||
bpl ret
|
bpl ret
|
||||||
lda 4+8,s
|
lda 4+8,s
|
||||||
ora #$8000
|
ora #$8000
|
||||||
sta 4+8,s
|
sta 4+8,s
|
||||||
ret rtl
|
ret rtl
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
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
|
||||||
|
|
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
|
||||||
|
|
2598
string.asm
2598
string.asm
File diff suppressed because it is too large
Load Diff
|
@ -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