2018-05-04 14:55:29 +00:00
|
|
|
|
NEW
|
2019-06-28 15:15:58 +00:00
|
|
|
|
AUTO 3,1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2019-02-13 16:20:44 +00:00
|
|
|
|
CSH.Q.CONST .EQ %10000000
|
|
|
|
|
CSH.Q.POINTER .EQ %10000001
|
2019-02-08 16:13:43 +00:00
|
|
|
|
CSH.T.CHAR .EQ 1
|
|
|
|
|
CSH.T.INT .EQ 2
|
|
|
|
|
CSH.T.LONG .EQ 3
|
|
|
|
|
CSH.T.UCHAR .EQ 4
|
|
|
|
|
CSH.T.UINT .EQ 5
|
|
|
|
|
CSH.T.ULONG .EQ 6
|
|
|
|
|
CSH.T.FLOAT .EQ 7
|
|
|
|
|
CSH.T.VARIADIC .EQ $F
|
|
|
|
|
*--------------------------------------
|
2019-02-13 16:20:44 +00:00
|
|
|
|
CSH.Init >LDYAI 256
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMem0
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bcs .9
|
2019-02-13 16:20:44 +00:00
|
|
|
|
>STYA ZPCSHSymbols
|
2017-07-21 14:46:25 +00:00
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.hSymbols
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMem
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bcs .9
|
2019-02-13 16:20:44 +00:00
|
|
|
|
>STYA ZPCSHConst
|
2017-07-21 14:46:25 +00:00
|
|
|
|
txa
|
2019-02-13 16:20:44 +00:00
|
|
|
|
>STA.G CSH.hConst
|
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>STYA ZPCSHData
|
2019-02-13 16:20:44 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G CSH.hData
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMem
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bcs .9
|
2019-02-13 16:20:44 +00:00
|
|
|
|
>STYA ZPCSHStack
|
2017-07-13 15:22:13 +00:00
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.hStack
|
2019-02-13 16:20:44 +00:00
|
|
|
|
|
|
|
|
|
lda #$0
|
|
|
|
|
>STA.G CSH.SymbolsPtr
|
|
|
|
|
>STA.G CSH.ConstPtr
|
|
|
|
|
>STA.G CSH.DataPtr
|
|
|
|
|
>STA.G CSH.StackPtr
|
|
|
|
|
|
|
|
|
|
sta (ZPCSHSymbols)
|
|
|
|
|
sta (ZPCSHConst)
|
|
|
|
|
sta (ZPCSHData)
|
|
|
|
|
sta (ZPCSHStack)
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
2017-07-12 15:25:23 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CSH.Quit >LDA.G hFileBuf
|
2018-10-16 15:48:03 +00:00
|
|
|
|
beq .1
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
.1 >LDA.G CSH.hStack
|
|
|
|
|
beq .2
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
.2 >LDA.G CSH.hData
|
|
|
|
|
beq .3
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
.3 >LDA.G CSH.hSymbols
|
2019-02-13 16:20:44 +00:00
|
|
|
|
beq CSH.Quit.RTS
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
2019-02-13 16:20:44 +00:00
|
|
|
|
CSH.Quit.RTS rts
|
2018-10-16 15:48:03 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CSH.Run jsr CSH.GetCharNB
|
2019-02-13 16:20:44 +00:00
|
|
|
|
bcs CSH.Quit.RTS
|
2018-11-08 16:45:05 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
cmp #'}' End of block ?
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bne .1
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.CheckStack must be something on stack....
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.Pop was expected, get stacked Cmd...
|
|
|
|
|
tax
|
2017-11-10 15:55:13 +00:00
|
|
|
|
jmp (J.CSH.KW.END,x)
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
.1 cmp #$0D
|
|
|
|
|
bne .2
|
2017-07-10 15:50:32 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
jmp CSH.GetNextCharNB Skip CR and exit
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
.2 pha
|
|
|
|
|
jsr CSH.SavePtr Save Ptr, in case of while,for....
|
|
|
|
|
pla
|
|
|
|
|
jsr CSH.IsLetter
|
|
|
|
|
bcc .3
|
2017-07-10 15:50:32 +00:00
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
cmp #'#'
|
2019-01-26 16:33:03 +00:00
|
|
|
|
beq .80 comments ...
|
2017-07-10 15:50:32 +00:00
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bra .9 error, todo : PREOPS ++ --.....
|
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
.3 >LDYA L.CSH.KW
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.LookupID
|
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bcs .4 not an internal CSH keyword....
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G CSH.CmdSave
|
2017-10-19 15:27:38 +00:00
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
jmp (J.CSH.KW,x)
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
.4 jsr CSH.GetVar
|
2019-02-13 16:20:44 +00:00
|
|
|
|
bcs .5
|
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'='
|
|
|
|
|
bne .99
|
|
|
|
|
|
2017-08-22 06:37:03 +00:00
|
|
|
|
jsr CSH.GetNextCharNB Skip =
|
2017-08-01 19:41:01 +00:00
|
|
|
|
bcs .99
|
2017-08-22 06:37:03 +00:00
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
jsr CSH.ExpEval
|
|
|
|
|
bcs .9
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
jsr CSH.StoreACCToVar
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bcs .9
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.GetChar
|
2017-07-25 14:37:19 +00:00
|
|
|
|
cmp #';'
|
|
|
|
|
bne .99
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
jmp CSH.GetNextCharNB Skip ;
|
2017-07-10 15:50:32 +00:00
|
|
|
|
|
2019-02-13 16:20:44 +00:00
|
|
|
|
.5 >LDYA L.CSH.FN
|
|
|
|
|
jsr CSH.LookupFn
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STZ.G CSH.ACCT no retrun value type check required
|
|
|
|
|
|
|
|
|
|
jsr CSH.FnEval
|
|
|
|
|
bcs .9
|
|
|
|
|
jmp CSH.GetNextCharNB Skip ;
|
|
|
|
|
|
2017-09-01 15:40:26 +00:00
|
|
|
|
.99 lda #CSH.E.SYNTAX
|
2017-07-25 14:37:19 +00:00
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
|
2017-07-10 15:50:32 +00:00
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
.80 jsr CSH.GetNextChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne .80
|
|
|
|
|
|
|
|
|
|
clc
|
2017-07-25 14:37:19 +00:00
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-25 15:34:23 +00:00
|
|
|
|
CSH.WHILE
|
|
|
|
|
CSH.IF jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
2017-10-19 15:27:38 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.ExpEval
|
|
|
|
|
bcs .99
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .9
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.IsACC0
|
|
|
|
|
bcc .6 eval returned ACC=0, skip {{....}}
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetNextCharNB Skip '{'
|
|
|
|
|
bcs .99
|
2017-10-19 15:27:38 +00:00
|
|
|
|
|
2017-11-14 16:57:34 +00:00
|
|
|
|
>LDA.G CSH.CmdSave get back Token ("IF" or "WHILE")
|
2017-10-25 15:34:23 +00:00
|
|
|
|
tax
|
|
|
|
|
jsr CSH.Keyword.start
|
|
|
|
|
bcs .99
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
lda #'}' Tell '}' is expected at the end of block
|
|
|
|
|
jsr CSH.Push
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
rts
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.6 ldx #1 expecting 1 '}' for now....
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.7 jsr CSH.GetNextChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .71
|
|
|
|
|
inx
|
|
|
|
|
bra .7
|
|
|
|
|
|
|
|
|
|
.71 cmp #'}'
|
|
|
|
|
bne .7
|
|
|
|
|
txa
|
|
|
|
|
beq .9
|
|
|
|
|
dex
|
|
|
|
|
bne .7
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextChar
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-19 15:27:38 +00:00
|
|
|
|
clc
|
2017-10-25 15:34:23 +00:00
|
|
|
|
rts
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
2017-07-11 15:53:52 +00:00
|
|
|
|
sec
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
CSH.Keyword.Start
|
2017-11-10 15:55:13 +00:00
|
|
|
|
jmp (J.CSH.KW.START,x)
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2017-11-14 16:57:34 +00:00
|
|
|
|
CSH.IF.START jmp CSH.Push Push "IF" Token
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.WHILE.START pha
|
|
|
|
|
>LDA.G CSH.BufPtrSave+1 WHILE : push loop address...
|
|
|
|
|
jsr CSH.Push
|
|
|
|
|
>LDA.G CSH.BufPtrSave
|
|
|
|
|
jsr CSH.Push
|
|
|
|
|
pla
|
2017-11-14 16:57:34 +00:00
|
|
|
|
jmp CSH.Push Push "WHILE" Token
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.IF.END jsr CSH.GetNextChar just skip ending '}'
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.WHILE.END jsr CSH.Pop
|
2018-11-10 14:30:09 +00:00
|
|
|
|
sta ZPFileBufPtr
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.Pop
|
2018-11-10 14:30:09 +00:00
|
|
|
|
sta ZPFileBufPtr+1
|
2017-10-25 15:34:23 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.ELSE
|
|
|
|
|
CSH.DO
|
|
|
|
|
CSH.FOR
|
|
|
|
|
CSH.SWITCH
|
|
|
|
|
CSH.CASE
|
|
|
|
|
CSH.BREAK
|
|
|
|
|
CSH.CONTINUE
|
|
|
|
|
|
|
|
|
|
lda #CSH.E.SYNTAX
|
2017-10-20 15:42:24 +00:00
|
|
|
|
sec
|
2017-07-11 15:53:52 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-11-10 15:55:13 +00:00
|
|
|
|
CSH.SIGNED jsr CSH.GetChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYA L.CSH.STYPES
|
|
|
|
|
jsr CSH.LookupID
|
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jmp (J.CSH.STYPES,x)
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.UNSIGNED jsr CSH.GetChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYA L.CSH.STYPES
|
|
|
|
|
jsr CSH.LookupID
|
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jmp (J.CSH.UTYPES,x)
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CSH.CHAR lda #CSH.T.CHAR
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bra CSH.TYPE
|
2017-11-15 07:27:12 +00:00
|
|
|
|
CSH.UCHAR lda #CSH.T.UCHAR
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra CSH.TYPE
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CSH.INT lda #CSH.T.INT
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra CSH.TYPE
|
2017-11-15 07:27:12 +00:00
|
|
|
|
CSH.UINT lda #CSH.T.UINT
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bra CSH.TYPE
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CSH.LONG lda #CSH.T.LONG
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bra CSH.TYPE
|
2017-11-15 07:27:12 +00:00
|
|
|
|
CSH.ULONG lda #CSH.T.ULONG
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra CSH.TYPE
|
|
|
|
|
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CSH.FLOAT lda #CSH.T.FLOAT
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
|
|
|
|
CSH.TYPE >STA.G CSH.ACCT
|
|
|
|
|
jsr CSH.GetChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.IsLetter
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetVar Already exists ?
|
|
|
|
|
bcc .90
|
|
|
|
|
|
|
|
|
|
jsr CSH.AddVar No, add with undefined value...
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #';'
|
|
|
|
|
beq .8 end of declaration, no value...
|
|
|
|
|
|
|
|
|
|
cmp #'='
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.ExpEval
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bcs .99
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
jsr CSH.StoreACCToVar Update value to this var
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.GetChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #';'
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
.8 jsr CSH.GetNextCharNB Skip ;
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.90 lda #CSH.E.DUP
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
CSH.ExpEval jsr CSH.ZeroACC
|
2018-06-15 15:15:48 +00:00
|
|
|
|
|
2019-02-08 16:13:43 +00:00
|
|
|
|
.10 lda #$ff
|
|
|
|
|
>STA.G CSH.EXPBOP1 Reset BOP1
|
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-02-08 16:13:43 +00:00
|
|
|
|
jsr CSH.IsLetter Fnc or Var ?
|
2017-10-26 06:41:57 +00:00
|
|
|
|
bcs .2
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.GetVar
|
2017-10-26 06:41:57 +00:00
|
|
|
|
bcs .1
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.LoadACCFromVar
|
|
|
|
|
bcs .9
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra .11
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
.1 >LDYA L.CSH.FN
|
|
|
|
|
jsr CSH.LookupFn
|
|
|
|
|
bcs .9
|
2019-02-13 16:20:44 +00:00
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
jsr CSH.FnEval
|
|
|
|
|
bcs .99
|
|
|
|
|
bra .11
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
|
|
|
|
.2 jsr CSH.IsDigit10 number ?
|
2019-02-13 16:20:44 +00:00
|
|
|
|
bcs .3
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.GetNumInACC
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.11 jsr CSH.GetCharNB
|
2017-10-24 15:44:12 +00:00
|
|
|
|
bcs .9
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
|
|
|
|
cmp #')'
|
|
|
|
|
beq .8
|
|
|
|
|
cmp #';'
|
|
|
|
|
beq .8
|
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
jsr CSH.IsOPChar
|
|
|
|
|
bcs .9
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
>LDYA L.CSH.BOPS
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.LookupOP
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDA.G CSH.EXPBOP1 previous OP...
|
2017-10-26 16:01:54 +00:00
|
|
|
|
bpl .5 go check precedence
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CSH.EXPBOP1
|
|
|
|
|
jsr CSH.ACC2ARG
|
|
|
|
|
jsr CSH.GetCharNB
|
2017-10-26 16:01:54 +00:00
|
|
|
|
bcc .10 go check for an ARG
|
2019-02-13 16:20:44 +00:00
|
|
|
|
bra .9
|
|
|
|
|
|
|
|
|
|
.3 >DEBUG
|
|
|
|
|
|
|
|
|
|
cmp #'"' String litteral
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsr CSH.AddContCharP
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jmp .11
|
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
.5 txa
|
2017-10-25 15:34:23 +00:00
|
|
|
|
>STA.G CSH.EXPBOP2
|
|
|
|
|
>CMP.G CSH.EXPBOP1
|
2019-02-13 16:20:44 +00:00
|
|
|
|
bcs .6
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
* new OP has precedence, stack ACC
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
|
|
|
|
|
2019-02-13 16:20:44 +00:00
|
|
|
|
jmp .10
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
|
|
|
|
* Old OP has precedence, compute ACC=ARG <BOP> ACC
|
2019-02-13 16:20:44 +00:00
|
|
|
|
.6 >LDA.G CSH.EXPBOP1
|
2019-02-08 16:13:43 +00:00
|
|
|
|
jsr CSH.Compute
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
2019-02-08 16:13:43 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
jmp .10
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
|
|
|
|
.8 >LDA.G CSH.EXPBOP1
|
|
|
|
|
bmi .80
|
|
|
|
|
|
2019-02-08 16:13:43 +00:00
|
|
|
|
jmp CSH.Compute
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
|
|
|
|
.80 clc
|
2017-07-17 05:59:30 +00:00
|
|
|
|
rts
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-13 16:20:44 +00:00
|
|
|
|
CSH.AddContCharP
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 jsr CSH.GetNextChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
cmp #'"'
|
|
|
|
|
beq .2
|
|
|
|
|
sta (ZPCSHConst),y
|
|
|
|
|
iny
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 lda #0
|
|
|
|
|
sta (ZPCSHConst),y
|
|
|
|
|
|
|
|
|
|
lda ZPCSHConst
|
|
|
|
|
pha
|
|
|
|
|
lda ZPCSHConst+1
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPCSHConst
|
|
|
|
|
sta ZPCSHConst
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
inc ZPCSHConst+1
|
|
|
|
|
|
|
|
|
|
.3 pla
|
|
|
|
|
ply
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.FnEval jsr CSH.GetCharNB
|
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
>LDA.G CSH.ACCT Match with ACC ?
|
|
|
|
|
beq .10 ACC is VOID
|
|
|
|
|
|
|
|
|
|
cmp (ZPFnDefPtr) Get Return value Type
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
.10 jsr CSH.GetNextCharNB skip '('
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CSH.PushACCT Save Acc & T on stack
|
|
|
|
|
|
|
|
|
|
.1 inc ZPFnDefPtr advance to arg list type
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPFnDefPtr+1
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPFnDefPtr)
|
|
|
|
|
beq .7 end of list, go check no more
|
|
|
|
|
|
|
|
|
|
.20 jsr CSH.ExpEval
|
|
|
|
|
bcs .90
|
|
|
|
|
|
|
|
|
|
lda (ZPFnDefPtr)
|
|
|
|
|
cmp #CSH.T.VARIADIC
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
bra *
|
|
|
|
|
|
|
|
|
|
.3 >CMP.G CSH.ACCT Match with ACC ?
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
inc ZPFnDefPtr advance to next arg
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPFnDefPtr+1
|
|
|
|
|
.4 lda (ZPFnDefPtr) no more arg in fn definition
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #','
|
|
|
|
|
bne .9
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bra .20
|
|
|
|
|
|
|
|
|
|
.7 jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
|
|
|
|
jsr CSH.GetNextCharNB Skip )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* TO DO : Execute
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.90 rts
|
|
|
|
|
|
|
|
|
|
.99 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CSH.SavePtr >LDYA ZPFileBufPtr
|
2017-10-26 16:01:54 +00:00
|
|
|
|
>STYA.G CSH.BufPtrSave
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.RestorePtr >LDYA.G CSH.BufPtrSave
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>STYA ZPFileBufPtr
|
2017-10-26 16:01:54 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-11-10 15:55:13 +00:00
|
|
|
|
CSH.LookupFN sec
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
CSH.LookupID clc
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
ror
|
|
|
|
|
>STA.G CSH.LookupOpt
|
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
jsr CSH.GetIDLen
|
|
|
|
|
bra CSH.Lookup
|
|
|
|
|
|
|
|
|
|
CSH.LookupOP >STYA ZPPtr1
|
2017-11-10 15:55:13 +00:00
|
|
|
|
>STZ.G CSH.LookupOpt
|
2017-10-26 16:01:54 +00:00
|
|
|
|
jsr CSH.GetOPLen
|
|
|
|
|
|
|
|
|
|
CSH.Lookup phy Y = len
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr1)
|
|
|
|
|
beq .9 Ending 0, not found....
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
pha Get Back Len
|
|
|
|
|
|
|
|
|
|
cmp (ZPPtr1) Same Len ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
.3 dey
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp (ZPFileBufPtr),y
|
2017-10-26 16:01:54 +00:00
|
|
|
|
bne .4
|
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
pla Found keyword...
|
|
|
|
|
clc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
adc ZPFileBufPtr ..advance Ptr to char after it..
|
|
|
|
|
sta ZPFileBufPtr
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bcc .31
|
2018-11-10 14:30:09 +00:00
|
|
|
|
inc ZPFileBufPtr+1
|
2017-11-10 15:55:13 +00:00
|
|
|
|
|
|
|
|
|
.31 lda ZPPtr1
|
|
|
|
|
sec
|
|
|
|
|
adc (ZPPtr1)
|
2019-02-13 16:20:44 +00:00
|
|
|
|
sta ZPFnDefPtr
|
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
adc #0
|
|
|
|
|
inc ZPFnDefPtr+1
|
2017-11-10 15:55:13 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
clc
|
|
|
|
|
.8 rts
|
|
|
|
|
|
|
|
|
|
.4 inx
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
sec
|
|
|
|
|
adc (ZPPtr1)
|
|
|
|
|
sta ZPPtr1
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bcc .5
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.5 >LDA.G CSH.LookupOpt
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
.6 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
2017-10-26 16:01:54 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-13 16:20:44 +00:00
|
|
|
|
CSH.ZPPtr1AddAp1
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.1 rts
|
|
|
|
|
*--------------------------------------
|
2017-10-20 15:42:24 +00:00
|
|
|
|
CSH.GetNumInACC >LDA.G CSH.ACCT
|
2017-11-09 16:39:01 +00:00
|
|
|
|
cmp #CSH.T.FLOAT
|
2017-10-20 15:42:24 +00:00
|
|
|
|
bcc .1
|
2019-02-07 16:52:25 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>PUSHWI ZPFileBufPtr
|
|
|
|
|
>LDYA ZPFileBufPtr
|
2018-06-15 15:15:48 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
>SYSCALL StrToF
|
2018-06-14 15:31:36 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
>PULLF.G CSH.ACC
|
2018-06-15 15:15:48 +00:00
|
|
|
|
clc
|
2017-10-20 15:42:24 +00:00
|
|
|
|
rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
.1 >PUSHBI 10
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>PUSHWI ZPFileBufPtr
|
|
|
|
|
>LDYA ZPFileBufPtr
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
>SYSCALL StrToL
|
2018-06-14 15:31:36 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
>PULLL.G CSH.ACC
|
2018-06-15 15:15:48 +00:00
|
|
|
|
clc
|
2018-06-14 15:31:36 +00:00
|
|
|
|
.9 rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-17 15:40:21 +00:00
|
|
|
|
CSH.ZeroACC lda #0
|
2017-10-20 15:42:24 +00:00
|
|
|
|
ldx #5
|
|
|
|
|
ldy #CSH.ACC
|
|
|
|
|
|
|
|
|
|
.1 sta (pData),y
|
2017-10-17 15:40:21 +00:00
|
|
|
|
iny
|
2017-10-20 15:42:24 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-26 16:01:54 +00:00
|
|
|
|
CSH.ACC2ARG >LEA.G CSH.ACCT
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
>LEA.G CSH.ARGT
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
ldy #5
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr1),y
|
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
rts
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
* Vars...
|
|
|
|
|
*--------------------------------------
|
2017-10-25 15:34:23 +00:00
|
|
|
|
CSH.AddVar jsr CSH.GetIDLen
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
sec
|
2017-10-23 15:39:19 +00:00
|
|
|
|
>ADC.G CSH.SymbolsPtr Enough room to store this symbol ?
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
adc #1 Add One Byte for storing Ptr to DATA
|
|
|
|
|
bcs .99 Out of Symbols space
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G CSH.DataPtr
|
2017-07-21 14:46:25 +00:00
|
|
|
|
pha
|
|
|
|
|
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>LDA.G CSH.ACCT
|
|
|
|
|
tax
|
2017-10-20 15:42:24 +00:00
|
|
|
|
sec +1 for Type
|
2017-07-21 14:46:25 +00:00
|
|
|
|
adc CSH.TSIZE,x
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bcs .98 Out of Data Space
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G CSH.SymbolsPtr
|
2017-10-23 15:39:19 +00:00
|
|
|
|
pha
|
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetIDLen
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
sta (ZPCSHSymbols),y
|
|
|
|
|
iny
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-19 15:27:38 +00:00
|
|
|
|
jsr CSH.GetChar
|
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.1 sta (ZPCSHSymbols),y Store this symbol....
|
2017-07-21 14:46:25 +00:00
|
|
|
|
iny
|
2017-10-19 15:27:38 +00:00
|
|
|
|
jsr CSH.GetNextChar
|
|
|
|
|
|
|
|
|
|
jsr CSH.IsLetterOrDigit
|
2017-10-20 15:42:24 +00:00
|
|
|
|
bcc .1
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
pla Get Back Data Ptr
|
2017-07-21 14:46:25 +00:00
|
|
|
|
pha
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
sta (ZPCSHSymbols),y
|
2017-07-21 14:46:25 +00:00
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
tya
|
2017-10-23 15:39:19 +00:00
|
|
|
|
>STA.G CSH.SymbolsPtr Mark new end of Symbols
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
pla Get again Data Ptr
|
2017-07-21 14:46:25 +00:00
|
|
|
|
clc
|
2017-10-23 15:39:19 +00:00
|
|
|
|
adc ZPCSHData
|
|
|
|
|
sta ZPCSHValue
|
|
|
|
|
lda #0
|
|
|
|
|
adc ZPCSHData+1
|
|
|
|
|
sta ZPCSHValue+1
|
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
>LDA.G CSH.ACCT
|
|
|
|
|
sta (ZPCSHValue)
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* clc
|
2017-07-21 14:46:25 +00:00
|
|
|
|
rts
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
.98 pla
|
2017-09-01 15:40:26 +00:00
|
|
|
|
.99 lda #CSH.E.OOM
|
2017-07-21 14:46:25 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-20 15:42:24 +00:00
|
|
|
|
CSH.GetVar >LDYA ZPCSHSymbols
|
|
|
|
|
>STYA ZPPtr1
|
2017-07-25 14:37:19 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.GetIDLen
|
2017-10-26 06:41:57 +00:00
|
|
|
|
tax Save len
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
.1 lda (ZPPtr1)
|
2017-07-21 14:46:25 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
txa Get back len
|
2017-10-20 15:42:24 +00:00
|
|
|
|
cmp (ZPPtr1)
|
|
|
|
|
bne .3
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-19 15:27:38 +00:00
|
|
|
|
tay
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
.2 lda (ZPPtr1),y
|
|
|
|
|
dey
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp (ZPFileBufPtr),y
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
tya
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
inc
|
|
|
|
|
tay
|
|
|
|
|
lda (ZPPtr1),y Get Ptr to DATA
|
|
|
|
|
clc
|
|
|
|
|
adc ZPCSHData
|
|
|
|
|
sta ZPCSHValue
|
|
|
|
|
lda #0
|
|
|
|
|
adc ZPCSHData+1
|
|
|
|
|
sta ZPCSHValue+1
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
txa Get back len
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
adc ZPFileBufPtr
|
|
|
|
|
sta ZPFileBufPtr
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bcc .8
|
2018-11-10 14:30:09 +00:00
|
|
|
|
inc ZPFileBufPtr+1
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
clc
|
|
|
|
|
.8 rts
|
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.3 lda (ZPPtr1)
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .4
|
|
|
|
|
inc ZPPtr1+1
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.4 inc ZPPtr1 Skip Pointer to TYPE/DATA
|
2017-10-20 15:42:24 +00:00
|
|
|
|
bne .1
|
|
|
|
|
inc ZPPtr1+1
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
.9 sec
|
2017-07-21 14:46:25 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-24 15:44:12 +00:00
|
|
|
|
CSH.LoadACCFromVar
|
|
|
|
|
>LDA.G CSH.ACCT
|
|
|
|
|
cmp (ZPCSHValue)
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
lda CSH.TSIZE,x
|
|
|
|
|
tax Byte count to transfer
|
|
|
|
|
|
|
|
|
|
>LEA.G CSH.ACC
|
|
|
|
|
>STYA ZPPtr1
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
ldy #1
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
|
|
|
|
.1 lda (ZPCSHValue),y
|
|
|
|
|
sta (ZPPtr1)
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.StoreACCToVar
|
|
|
|
|
>LDA.G CSH.ACCT
|
|
|
|
|
cmp (ZPCSHValue)
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
lda CSH.TSIZE,x
|
|
|
|
|
tax Byte count to transfer
|
|
|
|
|
|
|
|
|
|
>LEA.G CSH.ACC
|
|
|
|
|
>STYA ZPPtr1
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
ldy #1 do not trash TYPE byte
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr1)
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.2 sta (ZPCSHValue),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-25 15:34:23 +00:00
|
|
|
|
CSH.IsACC0 >LDA.G CSH.ACCT
|
2017-11-09 16:39:01 +00:00
|
|
|
|
cmp #CSH.T.FLOAT
|
2017-10-25 15:34:23 +00:00
|
|
|
|
bne .1 char,int,long
|
2017-11-10 15:55:13 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
>LDA.G CSH.ACC
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 tax
|
|
|
|
|
lda CSH.TSIZE,x
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
ldy #CSH.ACC
|
|
|
|
|
|
|
|
|
|
.2 ora (pData),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-02-08 16:13:43 +00:00
|
|
|
|
CSH.Compute tax
|
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
jmp (J.CSH.BOPS,x)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.BOPS.ADD
|
2017-11-08 16:09:52 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CSH.BOPS.SUB >LDA.G CSH.ACCT
|
2017-11-09 16:39:01 +00:00
|
|
|
|
cmp #CSH.T.FLOAT
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2018-06-14 15:31:36 +00:00
|
|
|
|
.8 >PUSHF.G CSH.ACC
|
|
|
|
|
>PUSHF.G CSH.ARG
|
2017-11-08 16:09:52 +00:00
|
|
|
|
>SYSCALL FSUB
|
2018-06-14 15:31:36 +00:00
|
|
|
|
bcs .9
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2018-06-14 15:31:36 +00:00
|
|
|
|
>PULLF.G CSH.ACC
|
|
|
|
|
.9 rts
|
2017-10-26 06:41:57 +00:00
|
|
|
|
CSH.BOPS.MUL
|
2017-11-14 16:57:34 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
CSH.BOPS.DIV >LDA.G CSH.ACCT
|
|
|
|
|
cmp #CSH.T.FLOAT
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 >PUSHEA.G CSH.ACC
|
|
|
|
|
>PUSHEA.G CSH.ARG
|
|
|
|
|
>LEA.G CSH.ACC
|
|
|
|
|
>SYSCALL FDIV
|
|
|
|
|
|
|
|
|
|
rts
|
2017-10-26 06:41:57 +00:00
|
|
|
|
CSH.BOPS.MOD
|
|
|
|
|
CSH.BOPS.SHL
|
|
|
|
|
CSH.BOPS.SHR
|
|
|
|
|
CSH.BOPS.L
|
|
|
|
|
CSH.BOPS.G
|
|
|
|
|
CSH.BOPS.LE
|
|
|
|
|
CSH.BOPS.GE
|
|
|
|
|
CSH.BOPS.EQ
|
|
|
|
|
CSH.BOPS.NE
|
|
|
|
|
CSH.BOPS.AND
|
|
|
|
|
CSH.BOPS.OR
|
|
|
|
|
CSH.BOPS.EOR
|
|
|
|
|
CSH.BOPS.LAND
|
|
|
|
|
CSH.BOPS.LOR
|
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
* Stack
|
|
|
|
|
*--------------------------------------
|
2017-11-14 16:57:34 +00:00
|
|
|
|
CSH.PushACCT
|
|
|
|
|
|
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSH.Push pha
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G CSH.StackPtr
|
2017-11-09 16:39:01 +00:00
|
|
|
|
inc
|
|
|
|
|
beq .9
|
|
|
|
|
sta (pData),y
|
|
|
|
|
dec
|
2017-07-13 15:22:13 +00:00
|
|
|
|
tay
|
|
|
|
|
pla
|
|
|
|
|
sta (ZPCSHStack),y
|
2017-07-12 15:25:23 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-11-09 16:39:01 +00:00
|
|
|
|
.9 pla
|
|
|
|
|
lda #CSH.E.SOVERFLW
|
2017-07-12 15:25:23 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
CSH.Pop >LDA.G CSH.StackPtr
|
2017-07-12 15:25:23 +00:00
|
|
|
|
beq .9
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
2017-11-09 16:39:01 +00:00
|
|
|
|
tay
|
2017-07-13 15:22:13 +00:00
|
|
|
|
lda (ZPCSHStack),y
|
2017-07-12 15:25:23 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-09-01 15:40:26 +00:00
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
2017-07-12 15:25:23 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CSH.CheckStack tax
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G CSH.StackPtr
|
2017-07-12 15:25:23 +00:00
|
|
|
|
beq .9
|
2017-07-13 15:22:13 +00:00
|
|
|
|
dec
|
2017-07-12 15:25:23 +00:00
|
|
|
|
tay
|
2017-11-09 16:39:01 +00:00
|
|
|
|
txa
|
2017-07-13 15:22:13 +00:00
|
|
|
|
cmp (ZPCSHStack),y
|
2017-07-12 15:25:23 +00:00
|
|
|
|
bne .9
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
|
|
|
|
tya
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.StackPtr
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2017-07-11 15:53:52 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
2017-09-01 15:40:26 +00:00
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
2017-07-12 15:25:23 +00:00
|
|
|
|
sec
|
2017-07-13 15:22:13 +00:00
|
|
|
|
rts
|
2017-07-12 15:25:23 +00:00
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
* CHAR related Subs.....
|
|
|
|
|
*--------------------------------------
|
2017-10-24 15:44:12 +00:00
|
|
|
|
CSH.GetOPLen ldy #0
|
|
|
|
|
|
|
|
|
|
.1 iny
|
2018-11-10 14:30:09 +00:00
|
|
|
|
lda (ZPFileBufPtr),y
|
2017-10-24 15:44:12 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
jsr CSH.IsOPChar
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.8 tya
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-25 15:34:23 +00:00
|
|
|
|
CSH.GetIDLen ldy #0
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
|
|
|
|
.1 iny
|
2018-11-10 14:30:09 +00:00
|
|
|
|
lda (ZPFileBufPtr),y
|
2017-10-20 15:42:24 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
jsr CSH.IsLetterOrDigit
|
|
|
|
|
bcc .1
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
|
|
|
|
.8 tya
|
|
|
|
|
rts
|
2017-10-20 15:42:24 +00:00
|
|
|
|
*--------------------------------------
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSH.GetCharNB jsr CSH.GetChar
|
|
|
|
|
bcs CSH.GetNextCharNB.RTS
|
|
|
|
|
jsr CSH.CheckCharNB
|
|
|
|
|
bcc CSH.GetNextCharNB.RTS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.GetNextCharNB
|
|
|
|
|
jsr CSH.GetNextChar
|
|
|
|
|
bcs CSH.GetNextCharNB.RTS
|
|
|
|
|
jsr CSH.CheckCharNB
|
|
|
|
|
bcs CSH.GetNextCharNB
|
|
|
|
|
CSH.GetNextCharNB.RTS
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CSH.CheckCharNB cmp #C.SPACE
|
2017-07-13 15:22:13 +00:00
|
|
|
|
beq .9
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp #C.CR
|
2017-07-13 15:22:13 +00:00
|
|
|
|
beq .9
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp #C.LF
|
2017-07-13 15:22:13 +00:00
|
|
|
|
beq .9
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp #C.TAB
|
2017-07-13 15:22:13 +00:00
|
|
|
|
beq .9
|
2017-07-12 15:25:23 +00:00
|
|
|
|
clc
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CSH.GetNextChar inc ZPFileBufPtr
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bne CSH.GetChar
|
2018-11-10 14:30:09 +00:00
|
|
|
|
inc ZPFileBufPtr+1
|
2017-07-13 15:22:13 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CSH.GetChar lda (ZPFileBufPtr)
|
2017-10-19 15:27:38 +00:00
|
|
|
|
beq .9
|
|
|
|
|
clc
|
2017-07-13 15:22:13 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.9 lda #MLI.E.EOF
|
2017-10-19 15:27:38 +00:00
|
|
|
|
sec
|
2017-07-13 15:22:13 +00:00
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2019-02-07 16:52:25 +00:00
|
|
|
|
CSH.IsOPChar ldx #CSH.OPChars.Cnt-1
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
|
|
|
|
.1 cmp CSH.OPChars,x
|
|
|
|
|
beq .8
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2017-07-17 05:59:30 +00:00
|
|
|
|
CSH.IsLetterOrDigit
|
2017-07-25 14:37:19 +00:00
|
|
|
|
jsr CSH.IsDigit10
|
2017-07-17 05:59:30 +00:00
|
|
|
|
bcc CSH.IsLetterRTS
|
|
|
|
|
*---------------------------------------
|
2017-07-25 14:37:19 +00:00
|
|
|
|
CSH.IsLetter cmp #'_'
|
|
|
|
|
bne .1
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 cmp #'A'
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bcc .9
|
|
|
|
|
|
|
|
|
|
cmp #'Z'+1
|
|
|
|
|
bcc CSH.IsLetterRTS
|
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
rts CC if lowercase
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
|
|
|
|
|
CSH.IsLetterRTS rts
|
|
|
|
|
*---------------------------------------
|
2017-07-25 14:37:19 +00:00
|
|
|
|
CSH.IsDigit10 cmp #'0'
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
rts cc if ok, cs if not
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2019-01-26 16:33:03 +00:00
|
|
|
|
SAVE USR/SRC/BIN/CSH.S.CORE
|
|
|
|
|
LOAD USR/SRC/BIN/CSH.S
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ASM
|