Change all text/source files to LF line endings.

This commit is contained in:
Stephen Heumann 2017-10-21 18:40:19 -05:00
parent 0c71404b58
commit 46b6aa389f
559 changed files with 83353 additions and 559 deletions

668
Asm.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

180
CC.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

15
CC.rez Executable file → Normal file
View File

@ -1 +1,14 @@
#include "types.rez" resource rVersion(1) { { 2, /* Major revision */ 1, /* Minor revision */ 1, /* Bug version */ beta, /* Release stage */ 3, /* Non-final release # */ }, verUS, /* Region code */ "ORCA/C", /* Short version number */ "Copyright 1997, Byte Works, Inc." /* Long version number */ };
#include "types.rez"
resource rVersion(1) {
{
2, /* Major revision */
1, /* Minor revision */
1, /* Bug version */
beta, /* Release stage */
3, /* Non-final release # */
},
verUS, /* Region code */
"ORCA/C", /* Short version number */
"Copyright 1997, Byte Works, Inc." /* Long version number */
};

15
CC.rez2 Executable file → Normal file
View File

@ -1 +1,14 @@
#include "types.rez" resource rVersion(1) { { 2, /* Major revision */ 0, /* Minor revision */ 3, /* Bug version */ release, /* Release stage */ 0, /* Non-final release # */ }, verUS, /* Region code */ "ORCA/C (small memory)", /* Short version number */ "Copyright 1994, Byte Works, Inc." /* Long version number */ };
#include "types.rez"
resource rVersion(1) {
{
2, /* Major revision */
0, /* Minor revision */
3, /* Bug version */
release, /* Release stage */
0, /* Non-final release # */
},
verUS, /* Region code */
"ORCA/C (small memory)", /* Short version number */
"Copyright 1994, Byte Works, Inc." /* Long version number */
};

81
CCommon.asm Executable file → Normal file
View File

@ -1 +1,80 @@
mcopy ccommon.macros **************************************************************** * * CopyString - copy a string * * Inputs: * toPtr - location to copy to * fromPtr - location to copy from * **************************************************************** * CopyString start subroutine (4:toPtr,4:fromPtr),0 short I,M lda [fromPtr] sta [toPtr] tay lb1 lda [fromPtr],Y sta [toPtr],Y dey bne lb1 long I,M return end **************************************************************** * * Hash - find hash displacement * * Finds the displacement into an array of pointers using a * hash function. * * Inputs: * sPtr - points to string to find hash for * * Outputs: * Returns the disp into the hash table * **************************************************************** * Hash start hashSize equ 876 # hash buckets - 1 sum equ 0 hash length equ 2 length of string subroutine (4:sPtr),4 stz sum default to bucket 0 lda [sPtr] set the length of the string and #$00FF sta length ldy #1 start with char 1 lda [sPtr] if 1st char is '~', start with char 6 and #$FF00 cmp #'~'*256 bne lb1 ldy #6 lb1 lda [sPtr],Y get the value to add in and #$3F3F cpy length if there is only 1 char left then bne lb2 and #$00FF and out the high byte lb2 clc add it to the sum adc sum sta sum iny next char iny cpy length ble lb1 mod2 sum,#hashSize+1 return disp asl sum asl sum return 2:sum end
mcopy ccommon.macros
****************************************************************
*
* CopyString - copy a string
*
* Inputs:
* toPtr - location to copy to
* fromPtr - location to copy from
*
****************************************************************
*
CopyString start
subroutine (4:toPtr,4:fromPtr),0
short I,M
lda [fromPtr]
sta [toPtr]
tay
lb1 lda [fromPtr],Y
sta [toPtr],Y
dey
bne lb1
long I,M
return
end
****************************************************************
*
* Hash - find hash displacement
*
* Finds the displacement into an array of pointers using a
* hash function.
*
* Inputs:
* sPtr - points to string to find hash for
*
* Outputs:
* Returns the disp into the hash table
*
****************************************************************
*
Hash start
hashSize equ 876 # hash buckets - 1
sum equ 0 hash
length equ 2 length of string
subroutine (4:sPtr),4
stz sum default to bucket 0
lda [sPtr] set the length of the string
and #$00FF
sta length
ldy #1 start with char 1
lda [sPtr] if 1st char is '~', start with char 6
and #$FF00
cmp #'~'*256
bne lb1
ldy #6
lb1 lda [sPtr],Y get the value to add in
and #$3F3F
cpy length if there is only 1 char left then
bne lb2
and #$00FF and out the high byte
lb2 clc add it to the sum
adc sum
sta sum
iny next char
iny
cpy length
ble lb1
mod2 sum,#hashSize+1 return disp
asl sum
asl sum
return 2:sum
end

258
CCommon.macros Executable file → Normal file
View File

@ -1 +1,257 @@
MACRO &lab subroutine &parms,&work &lab anop aif c:&work,.a lclc &work &work setc 0 .a gbla &totallen gbla &worklen &worklen seta &work &totallen seta 0 aif c:&parms=0,.e lclc &len lclc &p lcla &i &i seta c:&parms .b &p setc &parms(&i) &len amid &p,2,1 aif "&len"=":",.c &len amid &p,1,2 &p amid &p,4,l:&p-3 ago .d .c &len amid &p,1,1 &p amid &p,3,l:&p-2 .d &p equ &totallen+3+&work &totallen seta &totallen+&len &i seta &i-1 aif &i,^b .e tsc sec sbc #&work tcs inc a phd tcd mend MACRO &lab return &r &lab anop lclc &len aif c:&r,.a lclc &r &r setc 0 &len setc 0 ago .h .a &len amid &r,2,1 aif "&len"=":",.b &len amid &r,1,2 &r amid &r,4,l:&r-3 ago .c .b &len amid &r,1,1 &r amid &r,3,l:&r-2 .c aif &len<>2,.d ldy &r ago .h .d aif &len<>4,.e ldx &r+2 ldy &r ago .h .e aif &len<>10,.g aif &totallen=0,.f lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .f pld tsc clc adc #&worklen+&totallen tcs phb plx ply lda &r+8 pha lda &r+6 pha lda &r+4 pha lda &r+2 pha lda &r pha phy phx plb rtl mexit .g mnote 'Not a valid return length',16 mexit .h aif &totallen=0,.i lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .i pld tsc clc adc #&worklen+&totallen tcs aif &len=0,.j tya .j rtl mend MACRO &LAB MOD2 &N1,&N2,&N3 AIF C:&N3,.A LCLC &N3 &N3 SETC &N1 .A &LAB ~SETM LCLC &C &C AMID "&N2",1,1 AIF "{"="&C",.B AIF "["="&C",.B ~OP LDX,&N2 AGO .C .B ~LDA &N2 TAX .C ~LDA &N1 JSL ~MOD2 ~STA &N3 ~RESTM MEND MACRO &LAB ~SETM &LAB ANOP AIF C:&~LA,.B GBLB &~LA GBLB &~LI .B &~LA SETB S:LONGA &~LI SETB S:LONGI AIF S:LONGA.AND.S:LONGI,.A REP #32*(.NOT.&~LA)+16*(.NOT.&~LI) LONGA ON LONGI ON .A MEND MACRO &LAB ~RESTM &LAB ANOP AIF (&~LA+&~LI)=2,.I SEP #32*(.NOT.&~LA)+16*(.NOT.&~LI) AIF &~LA,.H LONGA OFF .H AIF &~LI,.I LONGI OFF .I MEND MACRO &LAB ~LDA &OP LCLC &C &C AMID "&OP",1,1 AIF "&C"<>"{",.B &C AMID "&OP",L:&OP,1 AIF "&C"="}",.A MNOTE "Missing closing '}'",2 &OP SETC &OP} .A &OP AMID "&OP",2,L:&OP-2 &OP SETC (&OP) .B &LAB LDA &OP MEND MACRO &LAB ~STA &OP LCLC &C &C AMID "&OP",1,1 AIF "&C"<>"{",.B &C AMID "&OP",L:&OP,1 AIF "&C"="}",.A MNOTE "Missing closing '}'",2 &OP SETC &OP} .A &OP AMID "&OP",2,L:&OP-2 &OP SETC (&OP) .B &LAB STA &OP MEND MACRO &LAB ~OP &OPC,&OP LCLC &C &C AMID "&OP",1,1 AIF "&C"<>"{",.B &C AMID "&OP",L:&OP,1 AIF "&C"="}",.A MNOTE "Missing closing '}'",2 &OP SETC &OP} .A &OP AMID "&OP",2,L:&OP-2 &OP SETC (&OP) .B &LAB &OPC &OP MEND MACRO &LAB BLE &BP &LAB BLT &BP BEQ &BP MEND MACRO &LAB LONG &A,&B LCLB &I LCLB &M &A AMID &A,1,1 &M SETB ("&A"="M").OR.("&A"="m") &I SETB ("&A"="I").OR.("&A"="i") AIF C:&B=0,.A &B AMID &B,1,1 &M SETB ("&B"="M").OR.("&B"="m").OR.&M &I SETB ("&B"="I").OR.("&B"="i").OR.&I .A &LAB REP #&M*32+&I*16 AIF .NOT.&M,.B LONGA ON .B AIF .NOT.&I,.C LONGI ON .C MEND MACRO &LAB SHORT &A,&B LCLB &I LCLB &M &A AMID &A,1,1 &M SETB ("&A"="M").OR.("&A"="m") &I SETB ("&A"="I").OR.("&A"="i") AIF C:&B=0,.A &B AMID &B,1,1 &M SETB ("&B"="M").OR.("&B"="m").OR.&M &I SETB ("&B"="I").OR.("&B"="i").OR.&I .A &LAB SEP #&M*32+&I*16 AIF .NOT.&M,.B LONGA OFF .B AIF .NOT.&I,.C LONGI OFF .C MEND
MACRO
&lab subroutine &parms,&work
&lab anop
aif c:&work,.a
lclc &work
&work setc 0
.a
gbla &totallen
gbla &worklen
&worklen seta &work
&totallen seta 0
aif c:&parms=0,.e
lclc &len
lclc &p
lcla &i
&i seta c:&parms
.b
&p setc &parms(&i)
&len amid &p,2,1
aif "&len"=":",.c
&len amid &p,1,2
&p amid &p,4,l:&p-3
ago .d
.c
&len amid &p,1,1
&p amid &p,3,l:&p-2
.d
&p equ &totallen+3+&work
&totallen seta &totallen+&len
&i seta &i-1
aif &i,^b
.e
tsc
sec
sbc #&work
tcs
inc a
phd
tcd
mend
MACRO
&lab return &r
&lab anop
lclc &len
aif c:&r,.a
lclc &r
&r setc 0
&len setc 0
ago .h
.a
&len amid &r,2,1
aif "&len"=":",.b
&len amid &r,1,2
&r amid &r,4,l:&r-3
ago .c
.b
&len amid &r,1,1
&r amid &r,3,l:&r-2
.c
aif &len<>2,.d
ldy &r
ago .h
.d
aif &len<>4,.e
ldx &r+2
ldy &r
ago .h
.e
aif &len<>10,.g
aif &totallen=0,.f
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.f
pld
tsc
clc
adc #&worklen+&totallen
tcs
phb
plx
ply
lda &r+8
pha
lda &r+6
pha
lda &r+4
pha
lda &r+2
pha
lda &r
pha
phy
phx
plb
rtl
mexit
.g
mnote 'Not a valid return length',16
mexit
.h
aif &totallen=0,.i
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.i
pld
tsc
clc
adc #&worklen+&totallen
tcs
aif &len=0,.j
tya
.j
rtl
mend
MACRO
&LAB MOD2 &N1,&N2,&N3
AIF C:&N3,.A
LCLC &N3
&N3 SETC &N1
.A
&LAB ~SETM
LCLC &C
&C AMID "&N2",1,1
AIF "{"="&C",.B
AIF "["="&C",.B
~OP LDX,&N2
AGO .C
.B
~LDA &N2
TAX
.C
~LDA &N1
JSL ~MOD2
~STA &N3
~RESTM
MEND
MACRO
&LAB ~SETM
&LAB ANOP
AIF C:&~LA,.B
GBLB &~LA
GBLB &~LI
.B
&~LA SETB S:LONGA
&~LI SETB S:LONGI
AIF S:LONGA.AND.S:LONGI,.A
REP #32*(.NOT.&~LA)+16*(.NOT.&~LI)
LONGA ON
LONGI ON
.A
MEND
MACRO
&LAB ~RESTM
&LAB ANOP
AIF (&~LA+&~LI)=2,.I
SEP #32*(.NOT.&~LA)+16*(.NOT.&~LI)
AIF &~LA,.H
LONGA OFF
.H
AIF &~LI,.I
LONGI OFF
.I
MEND
MACRO
&LAB ~LDA &OP
LCLC &C
&C AMID "&OP",1,1
AIF "&C"<>"{",.B
&C AMID "&OP",L:&OP,1
AIF "&C"="}",.A
MNOTE "Missing closing '}'",2
&OP SETC &OP}
.A
&OP AMID "&OP",2,L:&OP-2
&OP SETC (&OP)
.B
&LAB LDA &OP
MEND
MACRO
&LAB ~STA &OP
LCLC &C
&C AMID "&OP",1,1
AIF "&C"<>"{",.B
&C AMID "&OP",L:&OP,1
AIF "&C"="}",.A
MNOTE "Missing closing '}'",2
&OP SETC &OP}
.A
&OP AMID "&OP",2,L:&OP-2
&OP SETC (&OP)
.B
&LAB STA &OP
MEND
MACRO
&LAB ~OP &OPC,&OP
LCLC &C
&C AMID "&OP",1,1
AIF "&C"<>"{",.B
&C AMID "&OP",L:&OP,1
AIF "&C"="}",.A
MNOTE "Missing closing '}'",2
&OP SETC &OP}
.A
&OP AMID "&OP",2,L:&OP-2
&OP SETC (&OP)
.B
&LAB &OPC &OP
MEND
MACRO
&LAB BLE &BP
&LAB BLT &BP
BEQ &BP
MEND
MACRO
&LAB LONG &A,&B
LCLB &I
LCLB &M
&A AMID &A,1,1
&M SETB ("&A"="M").OR.("&A"="m")
&I SETB ("&A"="I").OR.("&A"="i")
AIF C:&B=0,.A
&B AMID &B,1,1
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
.A
&LAB REP #&M*32+&I*16
AIF .NOT.&M,.B
LONGA ON
.B
AIF .NOT.&I,.C
LONGI ON
.C
MEND
MACRO
&LAB SHORT &A,&B
LCLB &I
LCLB &M
&A AMID &A,1,1
&M SETB ("&A"="M").OR.("&A"="m")
&I SETB ("&A"="I").OR.("&A"="i")
AIF C:&B=0,.A
&B AMID &B,1,1
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
.A
&LAB SEP #&M*32+&I*16
AIF .NOT.&M,.B
LONGA OFF
.B
AIF .NOT.&I,.C
LONGI OFF
.C
MEND

970
CCommon.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

116
CGC.asm Executable file → Normal file
View File

@ -1 +1,115 @@
mcopy cgc.macros **************************************************************** * * CnvSX - Convert floating point to SANE extended * * Inputs: * rec - pointer to a record * **************************************************************** * CnvSX start rec equ 4 record containing values rec_real equ 0 disp to real value rec_ext equ 8 disp to extended (SANE) value tsc set up DP phd tcd ph4 rec push addr of real number clc push addr of SANE number lda rec adc #rec_ext tax lda rec+2 adc #0 pha phx fd2x convert TOS to extended move4 0,4 return pld pla pla rtl end **************************************************************** * * CnvSC - Convert floating point to SANE comp * * Inputs: * rec - pointer to a record * **************************************************************** * CnvSC start rec equ 4 record containing values rec_real equ 0 disp to real value rec_ext equ 8 disp to extended (SANE) value rec_cmp equ 18 disp to comp (SANE) value tsc set up DP phd tcd ph4 rec push addr of real number clc push addr of SANE number lda rec adc #rec_ext tax lda rec+2 adc #0 pha phx fd2x convert TOS to extended clc push addr of SANE number lda rec adc #rec_ext tax lda rec+2 adc #0 pha phx clc push addr of COMP number lda rec adc #rec_cmp tax lda rec+2 adc #0 pha phx fx2c convert TOS to extended move4 0,4 return pld pla pla rtl end **************************************************************** * * InitLabels - initialize the labels array * * Outputs: * labelTab - initialized * intLabel - initialized * **************************************************************** * InitLabels start maxLabel equ 2400 ! with labelTab[0] do begin lda #-1 val := -1; sta labelTab+6 sta labelTab+8 stz labelTab defined := false; stz labelTab+2 chain := nil; stz labelTab+4 ! end; {with} ldx #labelTab for i := 1 to maxLabel do ldy #labelTab+10 labelTab[i] := labelTab[0]; lda #maxLabel*10-1 mvn labelTab,labelTab stz intLabel intLabel := 0; rtl end
mcopy cgc.macros
****************************************************************
*
* CnvSX - Convert floating point to SANE extended
*
* Inputs:
* rec - pointer to a record
*
****************************************************************
*
CnvSX start
rec equ 4 record containing values
rec_real equ 0 disp to real value
rec_ext equ 8 disp to extended (SANE) value
tsc set up DP
phd
tcd
ph4 rec push addr of real number
clc push addr of SANE number
lda rec
adc #rec_ext
tax
lda rec+2
adc #0
pha
phx
fd2x convert TOS to extended
move4 0,4 return
pld
pla
pla
rtl
end
****************************************************************
*
* CnvSC - Convert floating point to SANE comp
*
* Inputs:
* rec - pointer to a record
*
****************************************************************
*
CnvSC start
rec equ 4 record containing values
rec_real equ 0 disp to real value
rec_ext equ 8 disp to extended (SANE) value
rec_cmp equ 18 disp to comp (SANE) value
tsc set up DP
phd
tcd
ph4 rec push addr of real number
clc push addr of SANE number
lda rec
adc #rec_ext
tax
lda rec+2
adc #0
pha
phx
fd2x convert TOS to extended
clc push addr of SANE number
lda rec
adc #rec_ext
tax
lda rec+2
adc #0
pha
phx
clc push addr of COMP number
lda rec
adc #rec_cmp
tax
lda rec+2
adc #0
pha
phx
fx2c convert TOS to extended
move4 0,4 return
pld
pla
pla
rtl
end
****************************************************************
*
* InitLabels - initialize the labels array
*
* Outputs:
* labelTab - initialized
* intLabel - initialized
*
****************************************************************
*
InitLabels start
maxLabel equ 2400
! with labelTab[0] do begin
lda #-1 val := -1;
sta labelTab+6
sta labelTab+8
stz labelTab defined := false;
stz labelTab+2 chain := nil;
stz labelTab+4
! end; {with}
ldx #labelTab for i := 1 to maxLabel do
ldy #labelTab+10 labelTab[i] := labelTab[0];
lda #maxLabel*10-1
mvn labelTab,labelTab
stz intLabel intLabel := 0;
rtl
end

189
CGC.macros Executable file → Normal file
View File

@ -1 +1,188 @@
macro &l move4 &m1,&m2 lclb &yistwo &l ~setm ~lda &m1 ~sta &m2 ~lda.h &m1 ~sta.h &m2 ~restm mend macro &l ph4 &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 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 ~lda &op lclc &c &c amid "&op",1,1 aif "&c"<>"{",.b &c amid "&op",l:&op,1 aif "&c"="}",.a mnote "Missing closing '}'",2 &op setc &op} .a &op amid "&op",2,l:&op-2 &op setc (&op) .b &l lda &op mend macro &l ~lda.h &op &l anop lclc &c &c amid "&op",1,1 aif "&c"="[",.b aif "&c"<>"{",.d &c amid "&op",l:&op,1 aif "&c"="}",.a mnote "Missing closing '}'",2 &op setc &op} .a &op amid "&op",2,l:&op-2 &op setc (&op) .b aif &yistwo,.c &yistwo setb 1 ldy #2 .c &op setc "&op,y" lda &op mexit .d aif "&c"<>"#",.e &op amid "&op",2,l:&op-1 &op setc "#^&op" lda &op mexit .e lda 2+&op mend macro &l ~restm &l anop aif (&~la+&~li)=2,.i sep #32*(.not.&~la)+16*(.not.&~li) aif &~la,.h longa off .h aif &~li,.i longi off .i mend macro &l ~setm &l anop aif c:&~la,.b gblb &~la gblb &~li .b &~la setb s:longa &~li setb s:longi aif s:longa.and.s:longi,.a rep #32*(.not.&~la)+16*(.not.&~li) longa on longi on .a mend macro &l ~sta &op lclc &c &c amid "&op",1,1 aif "&c"<>"{",.b &c amid "&op",l:&op,1 aif "&c"="}",.a mnote "Missing closing '}'",2 &op setc &op} .a &op amid "&op",2,l:&op-2 &op setc (&op) .b &l sta &op mend macro &l ~sta.h &op &l anop lclc &c &c amid "&op",1,1 aif "&c"="[",.b aif "&c"<>"{",.d &c amid "&op",l:&op,1 aif "&c"="}",.a mnote "Missing closing '}'",2 &op setc &op} .a &op amid "&op",2,l:&op-2 &op setc (&op) .b aif &yistwo,.c &yistwo setb 1 ldy #2 .c &op setc "&op,y" sta &op mexit .d sta 2+&op mend MACRO &LAB FD2X &LAB PEA $010E LDX #$090A JSL $E10000 MEND MACRO &LAB FX2C &LAB PEA $0510 LDX #$090A JSL $E10000 MEND
macro
&l move4 &m1,&m2
lclb &yistwo
&l ~setm
~lda &m1
~sta &m2
~lda.h &m1
~sta.h &m2
~restm
mend
macro
&l ph4 &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
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 ~lda &op
lclc &c
&c amid "&op",1,1
aif "&c"<>"{",.b
&c amid "&op",l:&op,1
aif "&c"="}",.a
mnote "Missing closing '}'",2
&op setc &op}
.a
&op amid "&op",2,l:&op-2
&op setc (&op)
.b
&l lda &op
mend
macro
&l ~lda.h &op
&l anop
lclc &c
&c amid "&op",1,1
aif "&c"="[",.b
aif "&c"<>"{",.d
&c amid "&op",l:&op,1
aif "&c"="}",.a
mnote "Missing closing '}'",2
&op setc &op}
.a
&op amid "&op",2,l:&op-2
&op setc (&op)
.b
aif &yistwo,.c
&yistwo setb 1
ldy #2
.c
&op setc "&op,y"
lda &op
mexit
.d
aif "&c"<>"#",.e
&op amid "&op",2,l:&op-1
&op setc "#^&op"
lda &op
mexit
.e
lda 2+&op
mend
macro
&l ~restm
&l anop
aif (&~la+&~li)=2,.i
sep #32*(.not.&~la)+16*(.not.&~li)
aif &~la,.h
longa off
.h
aif &~li,.i
longi off
.i
mend
macro
&l ~setm
&l anop
aif c:&~la,.b
gblb &~la
gblb &~li
.b
&~la setb s:longa
&~li setb s:longi
aif s:longa.and.s:longi,.a
rep #32*(.not.&~la)+16*(.not.&~li)
longa on
longi on
.a
mend
macro
&l ~sta &op
lclc &c
&c amid "&op",1,1
aif "&c"<>"{",.b
&c amid "&op",l:&op,1
aif "&c"="}",.a
mnote "Missing closing '}'",2
&op setc &op}
.a
&op amid "&op",2,l:&op-2
&op setc (&op)
.b
&l sta &op
mend
macro
&l ~sta.h &op
&l anop
lclc &c
&c amid "&op",1,1
aif "&c"="[",.b
aif "&c"<>"{",.d
&c amid "&op",l:&op,1
aif "&c"="}",.a
mnote "Missing closing '}'",2
&op setc &op}
.a
&op amid "&op",2,l:&op-2
&op setc (&op)
.b
aif &yistwo,.c
&yistwo setb 1
ldy #2
.c
&op setc "&op,y"
sta &op
mexit
.d
sta 2+&op
mend
MACRO
&LAB FD2X
&LAB PEA $010E
LDX #$090A
JSL $E10000
MEND
MACRO
&LAB FX2C
&LAB PEA $0510
LDX #$090A
JSL $E10000
MEND

125
CGC.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

799
CGI.Comments Executable file → Normal file

File diff suppressed because one or more lines are too long

369
CGI.Debug Executable file → Normal file

File diff suppressed because one or more lines are too long

1297
CGI.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

4735
DAG.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

266
DAG2.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

165
Exp.macros Executable file → Normal file
View File

@ -1 +1,164 @@
MACRO &lab subroutine &parms,&work &lab anop aif c:&work,.a lclc &work &work setc 0 .a gbla &totallen gbla &worklen &worklen seta &work &totallen seta 0 aif c:&parms=0,.e lclc &len lclc &p lcla &i &i seta c:&parms .b &p setc &parms(&i) &len amid &p,2,1 aif "&len"=":",.c &len amid &p,1,2 &p amid &p,4,l:&p-3 ago .d .c &len amid &p,1,1 &p amid &p,3,l:&p-2 .d &p equ &totallen+3+&work &totallen seta &totallen+&len &i seta &i-1 aif &i,^b .e tsc sec sbc #&work tcs inc a phd tcd mend MACRO &lab return &r &lab anop lclc &len aif c:&r,.a lclc &r &r setc 0 &len setc 0 ago .h .a &len amid &r,2,1 aif "&len"=":",.b &len amid &r,1,2 &r amid &r,4,l:&r-3 ago .c .b &len amid &r,1,1 &r amid &r,3,l:&r-2 .c aif &len<>2,.d ldy &r ago .h .d aif &len<>4,.e ldx &r+2 ldy &r ago .h .e aif &len<>10,.g aif &totallen=0,.f lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .f pld tsc clc adc #&worklen+&totallen tcs phb plx ply lda &r+8 pha lda &r+6 pha lda &r+4 pha lda &r+2 pha lda &r pha phy phx plb rtl mexit .g mnote 'Not a valid return length',16 mexit .h aif &totallen=0,.i lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .i pld tsc clc adc #&worklen+&totallen tcs aif &len=0,.j tya .j rtl mend MACRO &LAB BGT &BP &LAB BEQ *+4 BGE &BP MEND MACRO &LAB BLE &BP &LAB BLT &BP BEQ &BP MEND MACRO &LAB MOVE4 &F,&T &LAB ~SETM LDA 2+&F STA 2+&T LDA &F STA &T ~RESTM MEND MACRO &LAB ~SETM &LAB ANOP AIF C:&~LA,.B GBLB &~LA GBLB &~LI .B &~LA SETB S:LONGA &~LI SETB S:LONGI AIF S:LONGA.AND.S:LONGI,.A REP #32*(.NOT.&~LA)+16*(.NOT.&~LI) LONGA ON LONGI ON .A MEND MACRO &LAB ~RESTM &LAB ANOP AIF (&~LA+&~LI)=2,.I SEP #32*(.NOT.&~LA)+16*(.NOT.&~LI) AIF &~LA,.H LONGA OFF .H AIF &~LI,.I LONGI OFF .I MEND
MACRO
&lab subroutine &parms,&work
&lab anop
aif c:&work,.a
lclc &work
&work setc 0
.a
gbla &totallen
gbla &worklen
&worklen seta &work
&totallen seta 0
aif c:&parms=0,.e
lclc &len
lclc &p
lcla &i
&i seta c:&parms
.b
&p setc &parms(&i)
&len amid &p,2,1
aif "&len"=":",.c
&len amid &p,1,2
&p amid &p,4,l:&p-3
ago .d
.c
&len amid &p,1,1
&p amid &p,3,l:&p-2
.d
&p equ &totallen+3+&work
&totallen seta &totallen+&len
&i seta &i-1
aif &i,^b
.e
tsc
sec
sbc #&work
tcs
inc a
phd
tcd
mend
MACRO
&lab return &r
&lab anop
lclc &len
aif c:&r,.a
lclc &r
&r setc 0
&len setc 0
ago .h
.a
&len amid &r,2,1
aif "&len"=":",.b
&len amid &r,1,2
&r amid &r,4,l:&r-3
ago .c
.b
&len amid &r,1,1
&r amid &r,3,l:&r-2
.c
aif &len<>2,.d
ldy &r
ago .h
.d
aif &len<>4,.e
ldx &r+2
ldy &r
ago .h
.e
aif &len<>10,.g
aif &totallen=0,.f
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.f
pld
tsc
clc
adc #&worklen+&totallen
tcs
phb
plx
ply
lda &r+8
pha
lda &r+6
pha
lda &r+4
pha
lda &r+2
pha
lda &r
pha
phy
phx
plb
rtl
mexit
.g
mnote 'Not a valid return length',16
mexit
.h
aif &totallen=0,.i
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.i
pld
tsc
clc
adc #&worklen+&totallen
tcs
aif &len=0,.j
tya
.j
rtl
mend
MACRO
&LAB BGT &BP
&LAB BEQ *+4
BGE &BP
MEND
MACRO
&LAB BLE &BP
&LAB BLT &BP
BEQ &BP
MEND
MACRO
&LAB MOVE4 &F,&T
&LAB ~SETM
LDA 2+&F
STA 2+&T
LDA &F
STA &T
~RESTM
MEND
MACRO
&LAB ~SETM
&LAB ANOP
AIF C:&~LA,.B
GBLB &~LA
GBLB &~LI
.B
&~LA SETB S:LONGA
&~LI SETB S:LONGI
AIF S:LONGA.AND.S:LONGI,.A
REP #32*(.NOT.&~LA)+16*(.NOT.&~LI)
LONGA ON
LONGI ON
.A
MEND
MACRO
&LAB ~RESTM
&LAB ANOP
AIF (&~LA+&~LI)=2,.I
SEP #32*(.NOT.&~LA)+16*(.NOT.&~LI)
AIF &~LA,.H
LONGA OFF
.H
AIF &~LI,.I
LONGI OFF
.I
MEND

389
Expression.asm Executable file → Normal file

File diff suppressed because one or more lines are too long

3727
Expression.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

5649
Gen.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

1944
Header.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

150
Header2.pas Executable file → Normal file
View File

@ -1 +1,149 @@
{$optimize 7} {---------------------------------------------------------------} { } { Header } { } { Handles saving and reading precompiled headers. } { } {---------------------------------------------------------------} unit Header; {$LibPrefix '0/obj/'} interface uses CCommon, MM, Scanner, Symbol, CGI; {$segment 'scanner'} var inhibitHeader: boolean; {should .sym includes be blocked?} procedure EndInclude (chPtr: ptr); { Saves symbols created by the include file } { } { Parameters: } { chPtr - chPtr when the file returned } { } { Notes: } { 1. Call this subroutine right after processing an } { include file. } { 2. Declared externally in Symbol.pas } procedure FlagPragmas (pragma: pragmas); { record the effects of a pragma } { } { parameters: } { pragma - pragma to record } { } { Notes: } { 1. Defined as extern in Scanner.pas } { 2. For the purposes of this unit, the segment statement is } { treated as a pragma. } procedure InitHeader (var fName: gsosOutString); { look for a header file, reading it if it exists } { } { parameters: } { fName - source file name (var for efficiency) } procedure TermHeader; { Stop processing the header file } { } { Note: This is called when the first code-generating } { subroutine is found, and again when the compile ends. It } { closes any open symbol file, and should take no action if } { called twice. } procedure StartInclude (name: gsosOutStringPtr); { Marks the start of an include file } { } { Notes: } { 1. Call this subroutine right after opening an include } { file. } { 2. Defined externally in Scanner.pas } {---------------------------------------------------------------} implementation procedure EndInclude {chPtr: ptr}; { Saves symbols created by the include file } { } { Parameters: } { chPtr - chPtr when the file returned } { } { Notes: } { 1. Call this subroutine right after processing an } { include file. } { 2. Declared externally in Symbol.pas } begin {EndInclude} end; {EndInclude} procedure FlagPragmas {pragma: pragmas}; { record the effects of a pragma } { } { parameters: } { pragma - pragma to record } { } { Notes: } { 1. Defined as extern in Scanner.pas } { 2. For the purposes of this unit, the segment statement is } { treated as a pragma. } begin {FlagPragmas} end; {FlagPragmas} procedure InitHeader {var fName: gsosOutString}; { look for a header file, reading it if it exists } { } { parameters: } { fName - source file name (var for efficiency) } begin {InitHeader} end; {InitHeader} procedure StartInclude {name: gsosOutStringPtr}; { Marks the start of an include file } { } { Notes: } { 1. Call this subroutine right after opening an include } { file. } { 2. Defined externally in Scanner.pas } begin {StartInclude} end; {StartInclude} procedure TermHeader; { Stop processing the header file } { } { Note: This is called when the first code-generating } { subroutine is found, and again when the compile ends. It } { closes any open symbol file, and should take no action if } { called twice. } begin {TermHeader} end; {TermHeader} end.
{$optimize 7}
{---------------------------------------------------------------}
{ }
{ Header }
{ }
{ Handles saving and reading precompiled headers. }
{ }
{---------------------------------------------------------------}
unit Header;
{$LibPrefix '0/obj/'}
interface
uses CCommon, MM, Scanner, Symbol, CGI;
{$segment 'scanner'}
var
inhibitHeader: boolean; {should .sym includes be blocked?}
procedure EndInclude (chPtr: ptr);
{ Saves symbols created by the include file }
{ }
{ Parameters: }
{ chPtr - chPtr when the file returned }
{ }
{ Notes: }
{ 1. Call this subroutine right after processing an }
{ include file. }
{ 2. Declared externally in Symbol.pas }
procedure FlagPragmas (pragma: pragmas);
{ record the effects of a pragma }
{ }
{ parameters: }
{ pragma - pragma to record }
{ }
{ Notes: }
{ 1. Defined as extern in Scanner.pas }
{ 2. For the purposes of this unit, the segment statement is }
{ treated as a pragma. }
procedure InitHeader (var fName: gsosOutString);
{ look for a header file, reading it if it exists }
{ }
{ parameters: }
{ fName - source file name (var for efficiency) }
procedure TermHeader;
{ Stop processing the header file }
{ }
{ Note: This is called when the first code-generating }
{ subroutine is found, and again when the compile ends. It }
{ closes any open symbol file, and should take no action if }
{ called twice. }
procedure StartInclude (name: gsosOutStringPtr);
{ Marks the start of an include file }
{ }
{ Notes: }
{ 1. Call this subroutine right after opening an include }
{ file. }
{ 2. Defined externally in Scanner.pas }
{---------------------------------------------------------------}
implementation
procedure EndInclude {chPtr: ptr};
{ Saves symbols created by the include file }
{ }
{ Parameters: }
{ chPtr - chPtr when the file returned }
{ }
{ Notes: }
{ 1. Call this subroutine right after processing an }
{ include file. }
{ 2. Declared externally in Symbol.pas }
begin {EndInclude}
end; {EndInclude}
procedure FlagPragmas {pragma: pragmas};
{ record the effects of a pragma }
{ }
{ parameters: }
{ pragma - pragma to record }
{ }
{ Notes: }
{ 1. Defined as extern in Scanner.pas }
{ 2. For the purposes of this unit, the segment statement is }
{ treated as a pragma. }
begin {FlagPragmas}
end; {FlagPragmas}
procedure InitHeader {var fName: gsosOutString};
{ look for a header file, reading it if it exists }
{ }
{ parameters: }
{ fName - source file name (var for efficiency) }
begin {InitHeader}
end; {InitHeader}
procedure StartInclude {name: gsosOutStringPtr};
{ Marks the start of an include file }
{ }
{ Notes: }
{ 1. Call this subroutine right after opening an include }
{ file. }
{ 2. Defined externally in Scanner.pas }
begin {StartInclude}
end; {StartInclude}
procedure TermHeader;
{ Stop processing the header file }
{ }
{ Note: This is called when the first code-generating }
{ subroutine is found, and again when the compile ends. It }
{ closes any open symbol file, and should take no action if }
{ called twice. }
begin {TermHeader}
end; {TermHeader}
end.

116
MM.asm Executable file → Normal file
View File

@ -1 +1,115 @@
mcopy mm.macros **************************************************************** * * Calloc - Allocate memory from a pool and set it to 0. * * Inputs: * bytes - number of bytes to allocate * useGlobalPool - should the memory come from the global * (or local) pool * * Outputs: * ptr - points to the first byte of the allocated memory * **************************************************************** * Calloc start ptr equ 0 pointer to reserved memory subroutine (2:bytes),4 ph2 bytes reserve the memory jsl Malloc sta ptr save the pointer to the memory stx ptr+2 lda bytes if there are an odd number of bytes then tay lsr a bcc lb1 short M zero the first byte lda #0 dey sta [ptr],Y long M lb1 tyx done if there are no more bytes beq lb4 lda #0 dey branch if the next word is the zeroth dey beq lb3 lb2 sta [ptr],Y zero full words dey dey bne lb2 lb3 sta [ptr] zero the last word lb4 return 4:ptr return the pointer end **************************************************************** * * GCalloc - Allocate and clear memory from the global pool. * * Inputs: * bytes - number of bytes to allocate * * Outputs: * ptr - points to the first byte of the allocated memory * **************************************************************** * GCalloc start ptr equ 0 pointer to reserved memory subroutine (2:bytes),4 ph2 bytes reserve the memory jsl GMalloc sta ptr save the pointer to the memory stx ptr+2 lda bytes if there are an odd number of bytes then tay lsr a bcc lb1 short M zero the first byte lda #0 dey sta [ptr],Y long M lb1 tyx done if there are no more bytes beq lb4 lda #0 dey branch if the next word is the zeroth dey beq lb3 lb2 sta [ptr],Y zero full words dey dey bne lb2 lb3 sta [ptr] zero the last word lb4 return 4:ptr return the pointer end **************************************************************** * * Malloc - Allocate memory from a pool. * * Inputs: * bytes - number of bytes to allocate * useGlobalPool - should the memory come from the global * (or local) pool * * Outputs: * ptr - points to the first byte of the allocated memory * **************************************************************** * Malloc start lda useGlobalPool jne GMalloc jmp LMalloc end
mcopy mm.macros
****************************************************************
*
* Calloc - Allocate memory from a pool and set it to 0.
*
* Inputs:
* bytes - number of bytes to allocate
* useGlobalPool - should the memory come from the global
* (or local) pool
*
* Outputs:
* ptr - points to the first byte of the allocated memory
*
****************************************************************
*
Calloc start
ptr equ 0 pointer to reserved memory
subroutine (2:bytes),4
ph2 bytes reserve the memory
jsl Malloc
sta ptr save the pointer to the memory
stx ptr+2
lda bytes if there are an odd number of bytes then
tay
lsr a
bcc lb1
short M zero the first byte
lda #0
dey
sta [ptr],Y
long M
lb1 tyx done if there are no more bytes
beq lb4
lda #0
dey branch if the next word is the zeroth
dey
beq lb3
lb2 sta [ptr],Y zero full words
dey
dey
bne lb2
lb3 sta [ptr] zero the last word
lb4 return 4:ptr return the pointer
end
****************************************************************
*
* GCalloc - Allocate and clear memory from the global pool.
*
* Inputs:
* bytes - number of bytes to allocate
*
* Outputs:
* ptr - points to the first byte of the allocated memory
*
****************************************************************
*
GCalloc start
ptr equ 0 pointer to reserved memory
subroutine (2:bytes),4
ph2 bytes reserve the memory
jsl GMalloc
sta ptr save the pointer to the memory
stx ptr+2
lda bytes if there are an odd number of bytes then
tay
lsr a
bcc lb1
short M zero the first byte
lda #0
dey
sta [ptr],Y
long M
lb1 tyx done if there are no more bytes
beq lb4
lda #0
dey branch if the next word is the zeroth
dey
beq lb3
lb2 sta [ptr],Y zero full words
dey
dey
bne lb2
lb3 sta [ptr] zero the last word
lb4 return 4:ptr return the pointer
end
****************************************************************
*
* Malloc - Allocate memory from a pool.
*
* Inputs:
* bytes - number of bytes to allocate
* useGlobalPool - should the memory come from the global
* (or local) pool
*
* Outputs:
* ptr - points to the first byte of the allocated memory
*
****************************************************************
*
Malloc start
lda useGlobalPool
jne GMalloc
jmp LMalloc
end

196
MM.macros Executable file → Normal file
View File

@ -1 +1,195 @@
MACRO &lab subroutine &parms,&work &lab anop aif c:&work,.a lclc &work &work setc 0 .a gbla &totallen gbla &worklen &worklen seta &work &totallen seta 0 aif c:&parms=0,.e lclc &len lclc &p lcla &i &i seta c:&parms .b &p setc &parms(&i) &len amid &p,2,1 aif "&len"=":",.c &len amid &p,1,2 &p amid &p,4,l:&p-3 ago .d .c &len amid &p,1,1 &p amid &p,3,l:&p-2 .d &p equ &totallen+3+&work &totallen seta &totallen+&len &i seta &i-1 aif &i,^b .e tsc sec sbc #&work tcs inc a phd tcd mend MACRO &lab return &r &lab anop lclc &len aif c:&r,.a lclc &r &r setc 0 &len setc 0 ago .h .a &len amid &r,2,1 aif "&len"=":",.b &len amid &r,1,2 &r amid &r,4,l:&r-3 ago .c .b &len amid &r,1,1 &r amid &r,3,l:&r-2 .c aif &len<>2,.d ldy &r ago .h .d aif &len<>4,.e ldx &r+2 ldy &r ago .h .e aif &len<>10,.g aif &totallen=0,.f lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .f pld tsc clc adc #&worklen+&totallen tcs phb plx ply lda &r+8 pha lda &r+6 pha lda &r+4 pha lda &r+2 pha lda &r pha phy phx plb rtl mexit .g mnote 'Not a valid return length',16 mexit .h aif &totallen=0,.i lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .i pld tsc clc adc #&worklen+&totallen tcs aif &len=0,.j tya .j rtl mend MACRO &LAB JNE &BP &LAB BEQ *+5 BRL &BP MEND MACRO &LAB LONG &A,&B LCLB &I LCLB &M &A AMID &A,1,1 &M SETB ("&A"="M").OR.("&A"="m") &I SETB ("&A"="I").OR.("&A"="i") AIF C:&B=0,.A &B AMID &B,1,1 &M SETB ("&B"="M").OR.("&B"="m").OR.&M &I SETB ("&B"="I").OR.("&B"="i").OR.&I .A &LAB REP #&M*32+&I*16 AIF .NOT.&M,.B LONGA ON .B AIF .NOT.&I,.C LONGI ON .C MEND MACRO &LAB PH2 &N1 LCLC &C &LAB ANOP &C AMID &N1,1,1 AIF "&C"="#",.D AIF S:LONGA=1,.A REP #%00100000 .A AIF "&C"<>"{",.B &C AMID &N1,L:&N1,1 AIF "&C"<>"}",.G &N1 AMID &N1,2,L:&N1-2 LDA (&N1) PHA AGO .E .B LDA &N1 PHA AGO .E .D &N1 AMID &N1,2,L:&N1-1 PEA &N1 AGO .F .E AIF S:LONGA=1,.F SEP #%00100000 .F MEXIT .G MNOTE "Missing closing '}'",16 MEND MACRO &LAB SHORT &A,&B LCLB &I LCLB &M &A AMID &A,1,1 &M SETB ("&A"="M").OR.("&A"="m") &I SETB ("&A"="I").OR.("&A"="i") AIF C:&B=0,.A &B AMID &B,1,1 &M SETB ("&B"="M").OR.("&B"="m").OR.&M &I SETB ("&B"="I").OR.("&B"="i").OR.&I .A &LAB SEP #&M*32+&I*16 AIF .NOT.&M,.B LONGA OFF .B AIF .NOT.&I,.C LONGI OFF .C MEND
MACRO
&lab subroutine &parms,&work
&lab anop
aif c:&work,.a
lclc &work
&work setc 0
.a
gbla &totallen
gbla &worklen
&worklen seta &work
&totallen seta 0
aif c:&parms=0,.e
lclc &len
lclc &p
lcla &i
&i seta c:&parms
.b
&p setc &parms(&i)
&len amid &p,2,1
aif "&len"=":",.c
&len amid &p,1,2
&p amid &p,4,l:&p-3
ago .d
.c
&len amid &p,1,1
&p amid &p,3,l:&p-2
.d
&p equ &totallen+3+&work
&totallen seta &totallen+&len
&i seta &i-1
aif &i,^b
.e
tsc
sec
sbc #&work
tcs
inc a
phd
tcd
mend
MACRO
&lab return &r
&lab anop
lclc &len
aif c:&r,.a
lclc &r
&r setc 0
&len setc 0
ago .h
.a
&len amid &r,2,1
aif "&len"=":",.b
&len amid &r,1,2
&r amid &r,4,l:&r-3
ago .c
.b
&len amid &r,1,1
&r amid &r,3,l:&r-2
.c
aif &len<>2,.d
ldy &r
ago .h
.d
aif &len<>4,.e
ldx &r+2
ldy &r
ago .h
.e
aif &len<>10,.g
aif &totallen=0,.f
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.f
pld
tsc
clc
adc #&worklen+&totallen
tcs
phb
plx
ply
lda &r+8
pha
lda &r+6
pha
lda &r+4
pha
lda &r+2
pha
lda &r
pha
phy
phx
plb
rtl
mexit
.g
mnote 'Not a valid return length',16
mexit
.h
aif &totallen=0,.i
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.i
pld
tsc
clc
adc #&worklen+&totallen
tcs
aif &len=0,.j
tya
.j
rtl
mend
MACRO
&LAB JNE &BP
&LAB BEQ *+5
BRL &BP
MEND
MACRO
&LAB LONG &A,&B
LCLB &I
LCLB &M
&A AMID &A,1,1
&M SETB ("&A"="M").OR.("&A"="m")
&I SETB ("&A"="I").OR.("&A"="i")
AIF C:&B=0,.A
&B AMID &B,1,1
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
.A
&LAB REP #&M*32+&I*16
AIF .NOT.&M,.B
LONGA ON
.B
AIF .NOT.&I,.C
LONGI ON
.C
MEND
MACRO
&LAB PH2 &N1
LCLC &C
&LAB ANOP
&C AMID &N1,1,1
AIF "&C"="#",.D
AIF S:LONGA=1,.A
REP #%00100000
.A
AIF "&C"<>"{",.B
&C AMID &N1,L:&N1,1
AIF "&C"<>"}",.G
&N1 AMID &N1,2,L:&N1-2
LDA (&N1)
PHA
AGO .E
.B
LDA &N1
PHA
AGO .E
.D
&N1 AMID &N1,2,L:&N1-1
PEA &N1
AGO .F
.E
AIF S:LONGA=1,.F
SEP #%00100000
.F
MEXIT
.G
MNOTE "Missing closing '}'",16
MEND
MACRO
&LAB SHORT &A,&B
LCLB &I
LCLB &M
&A AMID &A,1,1
&M SETB ("&A"="M").OR.("&A"="m")
&I SETB ("&A"="I").OR.("&A"="i")
AIF C:&B=0,.A
&B AMID &B,1,1
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
.A
&LAB SEP #&M*32+&I*16
AIF .NOT.&M,.B
LONGA OFF
.B
AIF .NOT.&I,.C
LONGI OFF
.C
MEND

233
MM.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

163
Native.asm Executable file → Normal file

File diff suppressed because one or more lines are too long

119
Native.macros Executable file → Normal file
View File

@ -1 +1,118 @@
MACRO &lab subroutine &parms,&work &lab anop aif c:&work,.a lclc &work &work setc 0 .a gbla &totallen gbla &worklen &worklen seta &work &totallen seta 0 aif c:&parms=0,.e lclc &len lclc &p lcla &i &i seta c:&parms .b &p setc &parms(&i) &len amid &p,2,1 aif "&len"=":",.c &len amid &p,1,2 &p amid &p,4,l:&p-3 ago .d .c &len amid &p,1,1 &p amid &p,3,l:&p-2 .d &p equ &totallen+3+&work &totallen seta &totallen+&len &i seta &i-1 aif &i,^b .e tsc sec sbc #&work tcs inc a phd tcd mend MACRO &lab return &r &lab anop lclc &len aif c:&r,.a lclc &r &r setc 0 &len setc 0 ago .h .a &len amid &r,2,1 aif "&len"=":",.b &len amid &r,1,2 &r amid &r,4,l:&r-3 ago .c .b &len amid &r,1,1 &r amid &r,3,l:&r-2 .c aif &len<>2,.d ldy &r ago .h .d aif &len<>4,.e ldx &r+2 ldy &r ago .h .e aif &len<>10,.g aif &totallen=0,.f lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .f pld tsc clc adc #&worklen+&totallen tcs phb plx ply lda &r+8 pha lda &r+6 pha lda &r+4 pha lda &r+2 pha lda &r pha phy phx plb rtl mexit .g mnote 'Not a valid return length',16 mexit .h aif &totallen=0,.i lda &worklen+1 sta &worklen+&totallen+1 lda &worklen sta &worklen+&totallen .i pld tsc clc adc #&worklen+&totallen tcs aif &len=0,.j tya .j rtl mend
MACRO
&lab subroutine &parms,&work
&lab anop
aif c:&work,.a
lclc &work
&work setc 0
.a
gbla &totallen
gbla &worklen
&worklen seta &work
&totallen seta 0
aif c:&parms=0,.e
lclc &len
lclc &p
lcla &i
&i seta c:&parms
.b
&p setc &parms(&i)
&len amid &p,2,1
aif "&len"=":",.c
&len amid &p,1,2
&p amid &p,4,l:&p-3
ago .d
.c
&len amid &p,1,1
&p amid &p,3,l:&p-2
.d
&p equ &totallen+3+&work
&totallen seta &totallen+&len
&i seta &i-1
aif &i,^b
.e
tsc
sec
sbc #&work
tcs
inc a
phd
tcd
mend
MACRO
&lab return &r
&lab anop
lclc &len
aif c:&r,.a
lclc &r
&r setc 0
&len setc 0
ago .h
.a
&len amid &r,2,1
aif "&len"=":",.b
&len amid &r,1,2
&r amid &r,4,l:&r-3
ago .c
.b
&len amid &r,1,1
&r amid &r,3,l:&r-2
.c
aif &len<>2,.d
ldy &r
ago .h
.d
aif &len<>4,.e
ldx &r+2
ldy &r
ago .h
.e
aif &len<>10,.g
aif &totallen=0,.f
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.f
pld
tsc
clc
adc #&worklen+&totallen
tcs
phb
plx
ply
lda &r+8
pha
lda &r+6
pha
lda &r+4
pha
lda &r+2
pha
lda &r
pha
phy
phx
plb
rtl
mexit
.g
mnote 'Not a valid return length',16
mexit
.h
aif &totallen=0,.i
lda &worklen+1
sta &worklen+&totallen+1
lda &worklen
sta &worklen+&totallen
.i
pld
tsc
clc
adc #&worklen+&totallen
tcs
aif &len=0,.j
tya
.j
rtl
mend

2317
Native.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

1242
Native2.pas Executable file → Normal file

File diff suppressed because one or more lines are too long

229
ObjOut.asm Executable file → Normal file

File diff suppressed because one or more lines are too long

254
ObjOut.macros Executable file → Normal file
View File

@ -1 +1,253 @@
MACRO &LAB LONG &A,&B LCLB &I LCLB &M &A AMID &A,1,1 &M SETB ("&A"="M").OR.("&A"="m") &I SETB ("&A"="I").OR.("&A"="i") AIF C:&B=0,.A &B AMID &B,1,1 &M SETB ("&B"="M").OR.("&B"="m").OR.&M &I SETB ("&B"="I").OR.("&B"="i").OR.&I .A &LAB REP #&M*32+&I*16 AIF .NOT.&M,.B LONGA ON .B AIF .NOT.&I,.C LONGI ON .C MEND MACRO &LAB PH4 &N1 LCLC &C &LAB ANOP &C AMID &N1,1,1 AIF "&C"="#",.D AIF S:LONGA=1,.A REP #%00100000 .A AIF "&C"<>"{",.B &C AMID &N1,L:&N1,1 AIF "&C"<>"}",.G &N1 AMID &N1,2,L:&N1-2 LDY #2 LDA (&N1),Y PHA LDA (&N1) PHA AGO .E .B AIF "&C"<>"[",.C LDY #2 LDA &N1,Y PHA LDA &N1 PHA AGO .E .C LDA &N1+2 PHA LDA &N1 PHA AGO .E .D &N1 AMID &N1,2,L:&N1-1 PEA +(&N1)|-16 PEA &N1 AGO .F .E AIF S:LONGA=1,.F SEP #%00100000 .F MEXIT .G MNOTE "Missing closing '}'",16 MEND MACRO &LAB SHORT &A,&B LCLB &I LCLB &M &A AMID &A,1,1 &M SETB ("&A"="M").OR.("&A"="m") &I SETB ("&A"="I").OR.("&A"="i") AIF C:&B=0,.A &B AMID &B,1,1 &M SETB ("&B"="M").OR.("&B"="m").OR.&M &I SETB ("&B"="I").OR.("&B"="i").OR.&I .A &LAB SEP #&M*32+&I*16 AIF .NOT.&M,.B LONGA OFF .B AIF .NOT.&I,.C LONGI OFF .C MEND MACRO &LAB INC4 &A &LAB ~SETM INC &A BNE ~&SYSCNT INC 2+&A ~&SYSCNT ~RESTM MEND MACRO &LAB ~SETM &LAB ANOP AIF C:&~LA,.B GBLB &~LA GBLB &~LI .B &~LA SETB S:LONGA &~LI SETB S:LONGI AIF S:LONGA.AND.S:LONGI,.A REP #32*(.NOT.&~LA)+16*(.NOT.&~LI) LONGA ON LONGI ON .A MEND MACRO &LAB ~RESTM &LAB ANOP AIF (&~LA+&~LI)=2,.I SEP #32*(.NOT.&~LA)+16*(.NOT.&~LI) AIF &~LA,.H LONGA OFF .H AIF &~LI,.I LONGI OFF .I MEND MACRO &LAB PUT2 &N1,&F1,&CR,&ERROUT AIF C:&F1,.A LCLC &F1 &F1 SETC #0 .A &LAB ~SETM PH2 &N1 PH2 &F1 PH2 #C:&CR PH2 #C:&ERROUT JSL ~PUT2 ~RESTM MEND MACRO &LAB PUT4 &N1,&F1,&CR,&ERROUT AIF C:&F1,.A LCLC &F1 &F1 SETC #0 .A &LAB ~SETM PH4 &N1 PH2 &F1 PH2 #C:&CR PH2 #C:&ERROUT JSL ~PUT4 ~RESTM MEND MACRO &LAB PUTS &N1,&F1,&CR,&ERROUT &LAB ~SETM LCLC &C &C AMID "&N1",1,1 AIF "&C"<>"#",.C AIF L:&N1>127,.A BRA ~&SYSCNT AGO .B .A BRL ~&SYSCNT .B &N1 AMID "&N1",2,L:&N1-1 ~L&SYSCNT DC I1"L:~S&SYSCNT" ~S&SYSCNT DC C&N1 ~&SYSCNT ANOP &N1 SETC ~L&SYSCNT-1 AIF C:&F1=0,.D .C ~PUSHA &N1 AIF C:&F1,.C1 PEA 0 AGO .C2 .C1 PH2 &F1 .C2 PH2 #C:&CR PH2 #C:&ERROUT JSL ~PUTS ~RESTM MEXIT .D PEA ~L&SYSCNT|-16 PEA ~L&SYSCNT LDX #$1C0C+(C:&ERROUT*256)-(512*C:&CR) JSL $E10000 ~RESTM MEND MACRO &LAB ~PUSHA &N1 LCLC &C &LAB ANOP &C AMID &N1,1,1 AIF "&C"<>"{",.B &C AMID &N1,L:&N1,1 AIF "&C"<>"}",.G &N1 AMID &N1,2,L:&N1-2 SEP #$20 LONGA OFF LDA #0 PHA REP #$20 LONGA ON PHK LDA &N1 PHA MEXIT .B AIF "&C"<>"[",.C &N1 AMID &N1,2,L:&N1-2 LDA &N1+2 PHA LDA &N1 PHA MEXIT .C PEA +(&N1)|-16 PEA &N1 MEXIT .G MNOTE "Missing closing '}'",16 MEND MACRO &LAB PH2 &N1 LCLC &C &LAB ANOP &C AMID &N1,1,1 AIF "&C"="#",.D AIF S:LONGA=1,.A REP #%00100000 .A AIF "&C"<>"{",.B &C AMID &N1,L:&N1,1 AIF "&C"<>"}",.G &N1 AMID &N1,2,L:&N1-2 LDA (&N1) PHA AGO .E .B LDA &N1 PHA AGO .E .D &N1 AMID &N1,2,L:&N1-1 PEA &N1 AGO .F .E AIF S:LONGA=1,.F SEP #%00100000 .F MEXIT .G MNOTE "Missing closing '}'",16 MEND
MACRO
&LAB LONG &A,&B
LCLB &I
LCLB &M
&A AMID &A,1,1
&M SETB ("&A"="M").OR.("&A"="m")
&I SETB ("&A"="I").OR.("&A"="i")
AIF C:&B=0,.A
&B AMID &B,1,1
&M SETB ("&B"="M").OR.("&B"="m").OR.&M
&I SETB ("&B"="I").OR.("&B"="i").OR.&I
.A
&LAB REP #&M*32+&I*16
AIF .NOT.&