2021-12-02 21:28:26 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
2022-09-17 11:35:52 +00:00
|
|
|
|
CORE.Init lda #SL._
|
|
|
|
|
>SYSCALL SListNew
|
2022-06-12 20:42:22 +00:00
|
|
|
|
bcs .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
>STA.G CC.hDefines
|
|
|
|
|
|
2022-09-17 11:35:52 +00:00
|
|
|
|
lda #SL._
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL SListNew
|
2022-06-12 20:42:22 +00:00
|
|
|
|
bcs .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
>STA.G CC.hTags
|
|
|
|
|
|
2022-09-17 11:35:52 +00:00
|
|
|
|
lda #SL._
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL SListNew
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
>STA.G CC.hSyms
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-06-22 06:26:44 +00:00
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPSymBufPtr
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hSymBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>LDYAI 256
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2023-01-06 22:07:00 +00:00
|
|
|
|
>STYA ScopeStk
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hScopeStk
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2023-01-06 22:07:00 +00:00
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
>STYA StmtStk
|
2021-12-02 21:28:26 +00:00
|
|
|
|
txa
|
2023-01-06 22:07:00 +00:00
|
|
|
|
>STA.G CC.hStmtStk
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-11 18:34:34 +00:00
|
|
|
|
lda #'_'
|
|
|
|
|
>STA.G CC.Label
|
|
|
|
|
|
2022-06-22 06:26:44 +00:00
|
|
|
|
lda #CC.LookupIdx
|
|
|
|
|
tay
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.Quit jsr FIO.FClose
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bne CORE.Quit
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
>LDA.G CC.hSyms
|
2021-12-02 21:28:26 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
|
|
|
|
.1 >LDA.G CC.hTags
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
|
|
|
|
.2 >LDA.G CC.hDefines
|
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
.4 >LDA.G CC.hDefineBuf
|
|
|
|
|
jsr .7
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>LDA.G CC.hSymBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.5 jsr SYM.LookupFree
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcc .5
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2023-01-06 22:07:00 +00:00
|
|
|
|
>LDA.G CC.hScopeStk
|
|
|
|
|
jsr .7
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2023-01-06 22:07:00 +00:00
|
|
|
|
>LDA.G CC.hStmtStk
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.7 beq .8
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
.8 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.CompileFile
|
|
|
|
|
>SLEEP
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.1 jsr FIO.FGetS
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.CompileLine
|
2022-12-30 16:29:57 +00:00
|
|
|
|
bcc CORE.CompileFile
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.CompileLine
|
|
|
|
|
jsr CC.GetCharNB
|
2023-01-21 21:53:55 +00:00
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cmp #C.CR EOL....
|
|
|
|
|
beq .8
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cmp #'#' directive ?
|
|
|
|
|
bne .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jmp DIR
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-27 13:32:13 +00:00
|
|
|
|
.1 tax
|
|
|
|
|
|
|
|
|
|
>LDA.G CC.DirState FALSE state
|
2023-01-23 18:33:37 +00:00
|
|
|
|
bmi .8
|
|
|
|
|
|
2023-01-27 13:32:13 +00:00
|
|
|
|
txa
|
|
|
|
|
|
2023-01-23 18:33:37 +00:00
|
|
|
|
cmp #'/'
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bne .2 comments ...
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jmp CORE.Comments
|
2023-01-21 21:53:55 +00:00
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.2 cmp #'}' End of CPStmt ?
|
2023-01-21 21:53:55 +00:00
|
|
|
|
beq .5
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
jsr CORE.CompileStmt
|
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .98
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
jsr CORE.GetNCharNBNL Skip '{'
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcc CORE.CompileLine
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.3 cmp #';' End of Stmt ?
|
|
|
|
|
bne .4
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr CORE.GetNCharNBNL Skip ';'
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
jsr STMT.Stmt.END
|
2023-01-21 21:53:55 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
.4 cmp #'}' End of CPStmt ?
|
|
|
|
|
bne CORE.CompileLine
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
.5 jsr CORE.GetNCharNBNL Skip '}'
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
jsr STMT.CPStmt.END
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
.98 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.8 clc
|
2023-01-21 21:53:55 +00:00
|
|
|
|
rts
|
2022-08-20 14:37:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* keyword : for, while ....
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.CompileStmt
|
|
|
|
|
>LDYA L.CC.KW
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr CC.LookupID
|
2022-09-11 19:11:32 +00:00
|
|
|
|
bcs .1 not an internal CC keyword....
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.CmdSave
|
|
|
|
|
jmp (J.CC.KW,x)
|
|
|
|
|
*--------------------------------------
|
2022-09-11 19:11:32 +00:00
|
|
|
|
* Declaration : typedef, type var or type func()
|
2022-08-20 14:37:37 +00:00
|
|
|
|
*--------------------------------------
|
2022-09-11 19:11:32 +00:00
|
|
|
|
.1 >LDYA L.CC.SCSPEC
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr CC.LookupID
|
2022-09-11 19:11:32 +00:00
|
|
|
|
bcs .2
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-11 19:11:32 +00:00
|
|
|
|
jmp (J.CC.SCSPEC,x)
|
|
|
|
|
|
|
|
|
|
.2 >LDYA L.CC.TYPEQUAL
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .3
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jmp DECL.X
|
2022-08-20 14:37:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Statement : ++var, var=, func();
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.3 jmp STMT.Get
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.99 lda #E.CSYN
|
2022-01-30 21:47:08 +00:00
|
|
|
|
sec
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2023-01-26 16:38:20 +00:00
|
|
|
|
CORE.Comments jsr CC.GetNextChar
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
cmp #'/'
|
2023-01-23 18:33:37 +00:00
|
|
|
|
beq .8 // skip line.....
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
|
|
|
|
cmp #'*'
|
|
|
|
|
bne .9 /* ....
|
|
|
|
|
|
|
|
|
|
.1 jsr CORE.GetNCharNBNL
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #'*' ....*/
|
|
|
|
|
bne .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
jsr CC.GetNextChar
|
|
|
|
|
bcs .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jmp CC.GetNextChar
|
2023-01-26 16:38:20 +00:00
|
|
|
|
|
2023-01-23 18:33:37 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
.9 lda #E.CSYN
|
2021-12-02 21:28:26 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.SkipLine jsr CC.GetNextChar
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bne CORE.SkipLine
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
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-08-20 14:37:37 +00:00
|
|
|
|
CC.LookupAOP >LDYA L.CC.AOPS
|
|
|
|
|
>STYA ZPLookupPtr
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPLineBufPtr),y
|
|
|
|
|
sec
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
jsr CC.IsOPChar
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #'='
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
.8 tya
|
|
|
|
|
bra CC.Lookup
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
|
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
|
2022-08-20 14:37:37 +00:00
|
|
|
|
rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.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
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 ldx #$FF
|
|
|
|
|
pla
|
2021-12-02 21:28:26 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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-06-22 06:26:44 +00:00
|
|
|
|
CC.GetDefine >LDA.G CC.hDefines
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.SListLookup
|
|
|
|
|
bcs .9
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
|
|
|
|
>LDYA ZPLineBufPtr
|
|
|
|
|
>STYA.G CC.SaveDefine
|
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G CC.hDefineBuf
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-06-22 06:26:44 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPLineBufPtr
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
CC.SListLookup >PUSHA hSList
|
|
|
|
|
>PUSHA ...for SListGetData
|
|
|
|
|
>PUSHW ZPLineBufPtr
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHWI 0 ScopeID
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>SYSCALL SListLookup
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>PUSHA KeyID.HI
|
|
|
|
|
tya
|
|
|
|
|
>PUSHA KeyID.LO
|
|
|
|
|
|
|
|
|
|
jsr CC.SkipX
|
|
|
|
|
|
|
|
|
|
>PUSHWZ allocate
|
|
|
|
|
>PUSHWI 65535 all
|
|
|
|
|
>PUSHWZ From Start
|
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
|
|
|
|
|
.9 rts Y,A = SymSize, X = hSymBuf
|
|
|
|
|
|
|
|
|
|
.99 inc pStack discard extra hSList
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
* CT Stack
|
|
|
|
|
*--------------------------------------
|
2023-01-06 14:02:35 +00:00
|
|
|
|
CC.Push ldy StmtPtr
|
2022-01-30 21:47:08 +00:00
|
|
|
|
dey
|
|
|
|
|
beq .9
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
sty StmtPtr
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
sta (StmtStk),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
|
|
|
|
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
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs CORE.GetNCharNB.RTS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.CheckCharNB
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcc CORE.GetNCharNB.RTS
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.GetNCharNB jsr CC.GetNextChar
|
|
|
|
|
bcs CORE.GetNCharNB.RTS
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.CheckCharNB
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs CORE.GetNCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.GetNCharNB.RTS
|
2022-01-30 21:47:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.GetCharNBNL
|
|
|
|
|
jsr CC.GetChar
|
|
|
|
|
bcs CORE.GetNCharNB.RTS
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
jsr CC.CheckCharNB
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs CORE.GetNCharNBNL
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
clc
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bne CORE.GetNCharNB.RTS
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr FIO.FGetS
|
2022-12-30 16:29:57 +00:00
|
|
|
|
bcc CORE.GetCharNBNL
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
rts
|
2022-08-20 14:37:37 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.GetNCharNBNL
|
2023-01-21 21:53:55 +00:00
|
|
|
|
jsr CC.GetChar
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
beq .1
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
|
|
|
|
bcs .9
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
clc
|
|
|
|
|
bne .9
|
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
.1 jsr FIO.FGetS
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcc CORE.GetCharNBNL
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
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
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcc .99
|
|
|
|
|
|
|
|
|
|
.90 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.CheckCharNB cmp #C.SPACE
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
cmp #C.TAB
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2022-10-18 05:56:59 +00:00
|
|
|
|
* https://riptutorial.com/c/example/16255/character-literals
|
|
|
|
|
* 'c', '\abefnrtv', '\123', '\xFF'
|
|
|
|
|
*--------------------------------------
|
2022-09-04 20:12:49 +00:00
|
|
|
|
CC.GetNextCharEsc
|
|
|
|
|
jsr CC.GetNextChar
|
|
|
|
|
bcs .9
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
cmp #'\'
|
|
|
|
|
bne .8
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
jsr CC.GetNextChar
|
|
|
|
|
bcs .8
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
ldx #CC.EscChars.Cnt-1
|
|
|
|
|
|
|
|
|
|
.1 cmp CC.EscChars,x
|
|
|
|
|
beq .6
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
|
|
|
|
* TODO : \123, \xFF
|
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.6 lda CC.EscCodes,x
|
|
|
|
|
bit .9
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
clv
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.9 rts
|
2022-09-04 20:12:49 +00:00
|
|
|
|
*--------------------------------------
|
2021-12-02 21:28:26 +00:00
|
|
|
|
CC.GetNextChar inc ZPLineBufPtr
|
|
|
|
|
bne CC.GetChar
|
|
|
|
|
|
|
|
|
|
inc ZPLineBufPtr+1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.GetChar lda (ZPLineBufPtr)
|
|
|
|
|
bne .8
|
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
phy
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>LDA.G CC.hDefineBuf
|
|
|
|
|
beq .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
phx
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>STZ.G CC.hDefineBuf
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>LDYA.G CC.SaveDefine
|
|
|
|
|
>STYA ZPLineBufPtr
|
|
|
|
|
|
|
|
|
|
plx
|
2022-06-12 20:42:22 +00:00
|
|
|
|
ply
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bra CC.GetChar
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
.1 ply
|
|
|
|
|
lda #C.CR
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
CC.IsEndArg cmp #']'
|
|
|
|
|
beq .8
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cmp #','
|
2022-01-30 21:47:08 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cmp #';'
|
2022-01-30 21:47:08 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
cmp #':'
|
|
|
|
|
beq .8
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
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
|