2021-12-02 21:28:26 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.Init >SYSCALL SListNew
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STA.G CC.hDefines
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListNew
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STA.G CC.hTags
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListNew
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STA.G CC.hSymbols
|
2022-01-30 21:47:08 +00:00
|
|
|
|
sty ScopePtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI 4096
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
.99 bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPCCCode
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hCode
|
|
|
|
|
|
|
|
|
|
>LDYAI 1024
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPCCConst
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hConst
|
|
|
|
|
|
|
|
|
|
>LDYAI 1024
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPCCData
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hData
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>LDYAI 256
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPCCStack
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hStack
|
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.Quit ldy ScopePtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.10 lda (pData),y
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ldy ScopePtr
|
|
|
|
|
cpy #CC.hSymbols
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
dec ScopePtr
|
|
|
|
|
dey
|
|
|
|
|
bra .10
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.1 >LDA.G CC.hTags
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
|
|
|
|
.2 >LDA.G CC.hDefines
|
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.4 lda hDefineBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
.5 jsr CS.RUN.FClose
|
|
|
|
|
bne .5
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda hSymBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G CC.hStack
|
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G CC.hData
|
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G CC.hConst
|
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G CC.hCode
|
|
|
|
|
|
|
|
|
|
.7 beq CC.Quit.RTS
|
|
|
|
|
>SYSCALL FreeMem
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.Quit.RTS rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.CompileFile >SLEEP
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL FEOF
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .9 I/O err
|
|
|
|
|
|
|
|
|
|
cmp #3 Ctrl-C
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
.1 jsr CS.RUN.FGetS
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CC.CompileLine
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDA.G bDebug
|
|
|
|
|
bpl CC.CompileFile
|
|
|
|
|
|
|
|
|
|
jsr PrintDebugMsg
|
|
|
|
|
|
|
|
|
|
bra CC.CompileFile
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.CompileLine jsr CC.GetCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs CC.Quit.RTS
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.CompileLine.1
|
|
|
|
|
cmp #C.CR empty line....
|
2021-12-02 21:28:26 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .3 comments ...
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jmp CC.Comments
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.2 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 cmp #'#' directive ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
jmp CC.DIR
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.4 cmp #'}' End of CPStmt ?
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB Skip '}'
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jmp CC.STMT.CPStmt.END
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.10 jsr CC.IsLetter
|
|
|
|
|
bcc .20
|
|
|
|
|
|
|
|
|
|
* TODO: PREOPS ++ --.....
|
|
|
|
|
|
|
|
|
|
bcs .29
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.20 >LDYA L.CC.TYPEQUAL
|
2021-12-02 21:28:26 +00:00
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .50
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.TYPE.Decl
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .59
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ldx #SYM.SC.STATIC Y,A = Type/Qual
|
|
|
|
|
bit ScopenCnt
|
|
|
|
|
bpl .25
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bit #SYM.Q.FUNC someone wants to add a local f() ?
|
|
|
|
|
sec
|
|
|
|
|
bne .29
|
|
|
|
|
|
|
|
|
|
ldx #SYM.SC.AUTO
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.25 jsr CC.SYM.New Y,A=T/Q, add with undef value...
|
|
|
|
|
bcs .29 OOM or DUP
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .69
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
cmp #';'
|
2022-01-30 21:47:08 +00:00
|
|
|
|
beq .28
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .26
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB skip '{'
|
|
|
|
|
bcs .69
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.Store
|
|
|
|
|
bcs .29
|
|
|
|
|
|
|
|
|
|
jmp CC.SYM.FreeBuf
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
|
|
|
|
|
* TODO: AOPS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.26 cmp #'='
|
|
|
|
|
sec
|
|
|
|
|
bne .69
|
|
|
|
|
*--------------------------------------
|
2021-12-02 21:28:26 +00:00
|
|
|
|
jsr CC.GetNextCharNB skip '='
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .69
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.GetTypeInYA expected T/Q
|
|
|
|
|
jsr CC.EXP.Eval
|
|
|
|
|
bcs .59
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.PopValue Y,A = T/Q, Set value to this var
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.29 bcs .9
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.28 jsr CC.SYM.Store
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.FreeBuf
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bra .68
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.21 jsr CC.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #';'
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB skip '{'
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jmp CC.CompileLine.1
|
|
|
|
|
*--------------------------------------
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.50 >LDYA L.CC.KW
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .6 not an internal CC keyword....
|
|
|
|
|
|
|
|
|
|
jsr CC.KW.JMP
|
|
|
|
|
.59 bcs .9
|
|
|
|
|
|
|
|
|
|
bra .8
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.6 jsr CC.SYM.Lookup var= or func() ?
|
|
|
|
|
.69 bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
bit #SYM.Q.FUNC
|
2021-12-02 21:28:26 +00:00
|
|
|
|
beq .60
|
|
|
|
|
|
|
|
|
|
ldy #0 func( ... );
|
|
|
|
|
lda #0
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.F.CallNoRetV
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.FreeBufPop
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bra .8
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.60 jsr CC.GetCharNB var = ?
|
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
cmp #'=' TODO: all AOPS
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextChar Skip =
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.GetTypeInYA
|
|
|
|
|
jsr CC.EXP.Eval
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.PopValue
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SYM.FreeBufPop
|
|
|
|
|
*--------------------------------------
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.68 jsr CC.GetCharNB
|
|
|
|
|
cmp #';'
|
2022-01-30 21:47:08 +00:00
|
|
|
|
beq .8
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.99 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.8 jsr CC.GetNextCharNB Skip ;
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
beq .80
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jmp CC.CompileLine.1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.80 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.Comments jsr CC.GetNextChar
|
2021-12-02 21:28:26 +00:00
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
jmp CC.SkipLine skip line.....
|
|
|
|
|
|
|
|
|
|
.90 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SkipLine jsr CC.GetNextChar
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne CC.SkipLine
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.LookupID >STYA ZPLookupPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
jsr CC.GetIDLen
|
|
|
|
|
bra CC.Lookup
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.LookupOP >STYA ZPLookupPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
jsr CC.GetOPLen
|
|
|
|
|
|
|
|
|
|
CC.Lookup phy Y = len
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.1 lda (ZPLookupPtr)
|
2021-12-02 21:28:26 +00:00
|
|
|
|
beq .9 Ending 0, not found....
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
pha Get Back Len
|
2022-01-30 21:47:08 +00:00
|
|
|
|
cmp (ZPLookupPtr) Same Len ?
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tay
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.2 lda (ZPLookupPtr),y
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.3 dey
|
|
|
|
|
cmp (ZPLineBufPtr),y
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
pla Found keyword...
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SkipA ..advance Ptr to char after it..
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda ZPLookupPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
sec
|
2022-01-30 21:47:08 +00:00
|
|
|
|
adc (ZPLookupPtr)
|
2021-12-02 21:28:26 +00:00
|
|
|
|
tay
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda ZPLookupPtr+1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
adc #0
|
|
|
|
|
clc Y,A = F() def, X = F() index
|
|
|
|
|
.8 rts
|
|
|
|
|
|
|
|
|
|
.4 inx
|
|
|
|
|
inx
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda (ZPLookupPtr)
|
|
|
|
|
jsr CC.ZPLookupPtrAddAp1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.SListLookup >PUSHA hSList
|
|
|
|
|
>PUSHA ...for SListGetData
|
|
|
|
|
>PUSHW ZPLineBufPtr
|
|
|
|
|
>SYSCALL SListLookup
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
pha save KeyID
|
|
|
|
|
phy
|
|
|
|
|
|
|
|
|
|
>PUSHA KeyID.HI
|
|
|
|
|
tya
|
|
|
|
|
>PUSHA KeyID.LO
|
|
|
|
|
|
|
|
|
|
jsr CC.SkipX
|
|
|
|
|
|
|
|
|
|
.1 >PUSHWZ allocate
|
|
|
|
|
>PUSHWI 65535 all
|
|
|
|
|
>PUSHWZ From Start
|
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
pla X = hSymScope, Y,A = SymID
|
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 plx
|
|
|
|
|
plx
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 inc pStack
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-12-02 21:28:26 +00:00
|
|
|
|
* int main(int argc, char *argv[]) ;
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.MainExec lda #$EEEE
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>PUSHA
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>PUSHA int ret value
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda #0
|
|
|
|
|
>PUSHA
|
2021-12-02 21:28:26 +00:00
|
|
|
|
ldy #S.PS.ARGC
|
|
|
|
|
lda (pPS),y
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>PUSHA push int ARGC (int)
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>PUSHW ZPCCConst push int ARGV *char[]
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
stz ArgIndex
|
|
|
|
|
|
|
|
|
|
.1 lda ArgIndex
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
inc ArgIndex
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
sta (ZPCCConst)
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
sta (ZPCCConst),y
|
|
|
|
|
|
|
|
|
|
lda ZPCCConst
|
|
|
|
|
* clc
|
|
|
|
|
adc #2
|
|
|
|
|
sta ZPCCConst
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
inc ZPCCConst+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.2 >PUSHB.G CC.hSymbols
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>PUSHW L.CC.MAIN
|
|
|
|
|
>SYSCALL SListLookup
|
|
|
|
|
bcs .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
phy
|
2021-12-02 21:28:26 +00:00
|
|
|
|
pha
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>PUSHB.G CC.hSymbols
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA KeyID
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>PUSHWZ allocate
|
|
|
|
|
>PUSHWI 65535 all
|
|
|
|
|
>PUSHWZ From Start
|
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
bcs .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
stx hSymBuf
|
|
|
|
|
txa
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPSymBufPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ldy #SYM.Addr
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
sta ZPCCCode
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
sta ZPCCCode+1
|
|
|
|
|
|
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.7 jmp (ZPCCCode)
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.ZPLookupPtrAddAp1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
sec
|
2022-01-30 21:47:08 +00:00
|
|
|
|
adc ZPLookupPtr
|
|
|
|
|
sta ZPLookupPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
inc ZPLookupPtr+1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.1 rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.GetDefine >LDA.G CC.hDefines
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SListLookup
|
|
|
|
|
bcs .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
stx hDefineBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>LDYA ZPLineBufPtr
|
|
|
|
|
>STYA.G CC.SaveDefine
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
txa
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPLineBufPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
* CT Stack
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.PushTQ ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
jsr CC.Push
|
|
|
|
|
bcs CC.Push.RTS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda (ZPSymBufPtr) SYM.T
|
|
|
|
|
bra CC.Push
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.PushCS lda ZPCCCode+1
|
|
|
|
|
jsr CC.Push
|
|
|
|
|
bcs CC.Push.RTS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda ZPCCCode
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.Push ldy CStackPtr
|
|
|
|
|
dey
|
|
|
|
|
beq .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
sty CStackPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
sta (ZPCCStack),y
|
2021-12-02 21:28:26 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.9 lda #E.STKOVERFLOW
|
2021-12-02 21:28:26 +00:00
|
|
|
|
sec
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.Push.RTS rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.PopYA ldy CStackPtr
|
|
|
|
|
beq .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda (ZPCCStack),y
|
|
|
|
|
pha
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
iny
|
|
|
|
|
beq .90
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda (ZPCCStack),y
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
iny
|
|
|
|
|
sty CStackPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ply
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.90 pla
|
|
|
|
|
.9 lda #E.STACKERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.Pop ldy CStackPtr
|
|
|
|
|
beq .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda (ZPCCStack),y
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
inc CStackPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.9 lda #E.STACKERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ZPLineBufPtr related Subs.....
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SkipX txa
|
|
|
|
|
CC.SkipA clc
|
|
|
|
|
adc ZPLineBufPtr
|
|
|
|
|
sta ZPLineBufPtr
|
|
|
|
|
bcc .8
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
inc ZPLineBufPtr+1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetOPLen ldy #0
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPLineBufPtr),y
|
|
|
|
|
beq .8
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.IsOPChar
|
|
|
|
|
bcc .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.8 tya
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetIDLen ldy #0
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPLineBufPtr),y
|
|
|
|
|
beq .8
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.IsLetterOrDigit
|
|
|
|
|
bcc .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.8 tya
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetCharNB jsr CC.GetChar
|
|
|
|
|
bcs CC.GetNextCharNB.RTS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.CheckCharNB
|
|
|
|
|
bcc CC.GetNextCharNB.RTS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetNextCharNB
|
|
|
|
|
jsr CC.GetNextChar
|
|
|
|
|
bcs CC.GetNextCharNB.RTS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.CheckCharNB
|
|
|
|
|
bcs CC.GetNextCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.GetNextCharNB.RTS
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.CheckSpace jsr CC.GetChar
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .90
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
cmp #C.SPACE
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB
|
|
|
|
|
bcc .99
|
|
|
|
|
|
|
|
|
|
.90 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.CheckCharNB cmp #C.SPACE
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
cmp #C.TAB
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetNextChar inc ZPLineBufPtr
|
|
|
|
|
bne CC.GetChar
|
|
|
|
|
|
|
|
|
|
inc ZPLineBufPtr+1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetChar lda (ZPLineBufPtr)
|
|
|
|
|
bne .8
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda hDefineBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
stz hDefineBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
phy
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
>LDYA.G CC.SaveDefine
|
|
|
|
|
>STYA ZPLineBufPtr
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
plx
|
|
|
|
|
bra CC.GetChar
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.1 lda #C.CR
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #MLI.E.EOF
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*---------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.IsEndArg cmp #']'
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #';'
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #','
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #')'
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*---------------------------------------
|
|
|
|
|
CC.IsOPChar ldx #CC.OPChars.Cnt-1
|
|
|
|
|
|
|
|
|
|
.1 cmp CC.OPChars,x
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
CC.IsLetterOrDigit
|
|
|
|
|
jsr CC.IsDigit10
|
|
|
|
|
bcc CC.IsLetterRTS
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
CC.IsLetter cmp #'_'
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 cmp #'A'
|
|
|
|
|
bcc .9
|
|
|
|
|
|
|
|
|
|
cmp #'Z'+1
|
|
|
|
|
bcc CC.IsLetterRTS
|
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .9
|
|
|
|
|
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
|
|
|
|
|
rts CC if lowercase
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
CC.IsLetterRTS rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
CC.IsDigit10 cmp #'0'
|
|
|
|
|
bcc .9
|
|
|
|
|
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
rts cc if ok, cs if not
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/cc.s.core
|
|
|
|
|
LOAD usr/src/bin/cc.s
|
|
|
|
|
ASM
|