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-08-26 06:29:18 +00:00
|
|
|
|
CSH.Init >SYSCALL SListNew
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bcs .9
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
>STA.G CSH.hDefines
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
>SYSCALL SListNew
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
>STA.G CSH.hTags
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListNew
|
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-21 16:31:46 +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
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
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
|
|
|
|
|
|
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
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
>STYA ZPCSHData
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CSH.hData
|
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
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
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
lda #0
|
2019-02-13 16:20:44 +00:00
|
|
|
|
>STA.G CSH.ConstPtr
|
|
|
|
|
>STA.G CSH.StackPtr
|
2020-02-23 20:01:48 +00:00
|
|
|
|
* sta (ZPCSHConst)
|
|
|
|
|
* sta (ZPCSHStack)
|
2020-02-21 13:24:16 +00:00
|
|
|
|
|
|
|
|
|
* >DEC.G bTrace
|
|
|
|
|
* >DEC.G bDebug
|
2017-07-13 15:22:13 +00:00
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
2017-07-12 15:25:23 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.Quit >LDA.G CSH.hSymbols
|
2020-01-23 14:48:22 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
2020-02-18 15:34:56 +00:00
|
|
|
|
>PUSHA
|
2019-08-26 06:29:18 +00:00
|
|
|
|
>SYSCALL SListFree
|
2018-10-16 15:48:03 +00:00
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
.1 >LDA.G CSH.hTags
|
2020-01-25 18:56:36 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
2020-02-18 15:34:56 +00:00
|
|
|
|
>PUSHA
|
2020-01-25 18:56:36 +00:00
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
.2 >LDA.G CSH.hDefines
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
>PUSHA
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
|
|
|
|
.3 lda ZPhMacro
|
2020-01-26 19:36:49 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G hFileBuf
|
2019-08-26 06:29:18 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G CSH.hStack
|
|
|
|
|
jsr .7
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
>LDA.G CSH.hData
|
|
|
|
|
jsr .7
|
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
>LDA.G CSH.hConst
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
.7 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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
CSH.Run.1 cmp #C.CR empty line....
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
cmp #'/'
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bne .3 comments ...
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
|
|
|
|
jmp CSH.COMMENTS
|
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.2 jmp CSH.GetNextChar Skip CR and exit
|
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
.3 cmp #'#' directive ?
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bne .4
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
jmp CSH.DIR
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
|
|
|
|
.4 cmp #'}' End of block ?
|
|
|
|
|
bne .40
|
|
|
|
|
|
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
|
2019-09-05 15:49:05 +00:00
|
|
|
|
jsr CSH.GetNextCharNB Skip '}'
|
|
|
|
|
jsr CSH.Pop was expected....
|
|
|
|
|
jsr CSH.Pop get stacked Cmd...
|
2017-07-13 15:22:13 +00:00
|
|
|
|
tax
|
2020-01-25 18:56:36 +00:00
|
|
|
|
jmp (J.CSH.KW.END,x)
|
|
|
|
|
|
|
|
|
|
.40 jsr CSH.IsLetter
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bcc .5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bra .99 error, todo : PREOPS ++ --.....
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-09-05 06:43:09 +00:00
|
|
|
|
.5 jsr CSH.SavePtr Save Ptr, in case of while,for....
|
|
|
|
|
>LDYA L.CSH.KW
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.LookupID
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bcs .6 not an internal CSH keyword....
|
2020-02-18 15:34:56 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
jsr CSH.KW.JMP
|
|
|
|
|
bcs .9
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bra .8
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.6 jsr CSH.GetVar
|
|
|
|
|
bcs .7
|
2019-02-13 16:20:44 +00:00
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
>STYA ZPVarID
|
2020-02-21 13:24:16 +00:00
|
|
|
|
jsr CSH.GetVarDef Get Type & ptr...
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-07-25 14:37:19 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-09-06 12:50:27 +00:00
|
|
|
|
cmp #'=' TODO: all AOPS
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bne .99
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
jsr CSH.GetNextChar Skip =
|
2017-08-01 19:41:01 +00:00
|
|
|
|
bcs .99
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
lda ZPVarType
|
2017-07-25 14:37:19 +00:00
|
|
|
|
jsr CSH.ExpEval
|
|
|
|
|
bcs .9
|
2019-09-06 12:50:27 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
jsr CSH.SetVarValueFromStack X = Exp Type
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
jsr CSH.GetChar
|
2017-07-25 14:37:19 +00:00
|
|
|
|
cmp #';'
|
2020-01-25 18:56:36 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.99 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.7 lda #0 no return value type check required
|
2019-09-02 06:09:28 +00:00
|
|
|
|
jsr CSH.fCall
|
2019-02-13 16:20:44 +00:00
|
|
|
|
bcs .9
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
jsr CSH.GetVarSize X = returned value type
|
2020-01-23 14:48:22 +00:00
|
|
|
|
clc A = Sizeof
|
|
|
|
|
adc pStack
|
|
|
|
|
sta pStack Discard value on stack
|
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.8 jsr CSH.GetNextCharNB Skip ;
|
2019-08-27 15:13:00 +00:00
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
cmp #C.CR
|
2019-09-03 15:35:13 +00:00
|
|
|
|
beq .80
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
jmp CSH.Run.1
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
.80 jmp CSH.GetNextChar Skip CR
|
2020-01-25 18:56:36 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.COMMENTS jsr CSH.GetNextChar
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
jmp CSH.SkipLine skip line.....
|
|
|
|
|
|
|
|
|
|
.90 lda #CSH.E.SYNTAX
|
2017-07-25 14:37:19 +00:00
|
|
|
|
sec
|
2020-01-25 18:56:36 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-02-19 16:42:05 +00:00
|
|
|
|
CSH.DIR jsr CSH.GetNextCharNB
|
2020-01-25 18:56:36 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #'!' #!/bin/csh
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
bra CSH.SkipLine
|
|
|
|
|
|
|
|
|
|
.1 >LDYA L.CSH.DIRS
|
|
|
|
|
jsr CSH.LookupID
|
|
|
|
|
bcs .91
|
|
|
|
|
|
|
|
|
|
jmp (J.CSH.DIRS,x)
|
|
|
|
|
|
|
|
|
|
.91 lda #CSH.E.INVDIR
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.DIR.DEFINE jsr CSH.CheckSpace
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CSH.IsLetter
|
|
|
|
|
bcs .90
|
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
>LDA.G CSH.hDefines
|
|
|
|
|
jsr CSH.NewKey
|
2020-01-25 18:56:36 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STYA ZPVarID
|
|
|
|
|
|
|
|
|
|
jsr CSH.CheckSpace
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2020-01-26 19:36:49 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPFileBufPtr),y
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
|
|
|
|
|
lda #0
|
2020-02-18 15:34:56 +00:00
|
|
|
|
pha
|
|
|
|
|
phy
|
|
|
|
|
|
|
|
|
|
>PUSHB.G CSH.hDefines
|
|
|
|
|
>PUSHW ZPVarID
|
|
|
|
|
>PUSHW ZPFileBufPtr
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
pla
|
2020-01-26 19:36:49 +00:00
|
|
|
|
>PUSHYA DataLen
|
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
>SYSCALL SListAddData
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
bra CSH.SkipLine
|
|
|
|
|
|
|
|
|
|
.90 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.SkipLine jsr CSH.GetNextChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne CSH.SkipLine
|
2020-02-21 16:31:46 +00:00
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
clc
|
2020-02-21 16:31:46 +00:00
|
|
|
|
.9 rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-26 06:29:18 +00:00
|
|
|
|
* Built in Keywords
|
|
|
|
|
*--------------------------------------
|
2019-08-29 15:49:03 +00:00
|
|
|
|
CSH.KW.JMP txa
|
2019-09-05 15:49:05 +00:00
|
|
|
|
>STA.G CSH.CmdSave
|
2019-08-29 15:49:03 +00:00
|
|
|
|
jmp (J.CSH.KW,x)
|
2019-09-05 15:49:05 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-25 15:34:23 +00:00
|
|
|
|
CSH.WHILE
|
|
|
|
|
CSH.IF jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-08-29 15:49:03 +00:00
|
|
|
|
lda #0 Any var type
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.ExpEval
|
|
|
|
|
bcs .99
|
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
2019-09-06 12:50:27 +00:00
|
|
|
|
jsr CSH.GetNextCharNB skip ')'
|
2017-10-25 15:34:23 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .9
|
|
|
|
|
jsr CSH.GetNextCharNB Skip '{'
|
|
|
|
|
bcs .99
|
2019-09-05 15:49:05 +00:00
|
|
|
|
|
2019-09-05 06:43:09 +00:00
|
|
|
|
jsr CSH.IsValue0 X = var type from ExpEval
|
|
|
|
|
bcc .6 Value=0, skip {{....}}
|
|
|
|
|
|
2019-09-05 15:49:05 +00:00
|
|
|
|
>LDA.G CSH.CmdSave
|
|
|
|
|
beq .1 IF
|
2019-09-05 06:43:09 +00:00
|
|
|
|
|
2019-09-05 15:49:05 +00:00
|
|
|
|
pha
|
|
|
|
|
>LDA.G CSH.BufPtrSave+1 WHILE : push loop address...
|
|
|
|
|
jsr CSH.Push
|
|
|
|
|
>LDA.G CSH.BufPtrSave
|
|
|
|
|
jsr CSH.Push
|
|
|
|
|
pla
|
|
|
|
|
.1 jsr CSH.Push
|
|
|
|
|
bcs .99
|
2017-10-25 15:34:23 +00:00
|
|
|
|
lda #'}' Tell '}' is expected at the end of block
|
|
|
|
|
jsr CSH.Push
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
rts
|
2019-09-05 15:49:05 +00:00
|
|
|
|
.6 jsr CSH.SkipBlock
|
|
|
|
|
|
|
|
|
|
bcc .99
|
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
|
2019-08-29 15:49:03 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-05 15:49:05 +00:00
|
|
|
|
*CSH.Keyword.Start
|
|
|
|
|
* >LDA.G CSH.CmdSave get back Token ("IF" or "WHILE")
|
|
|
|
|
* tax
|
|
|
|
|
* jmp (J.CSH.KW.START,x)
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-05 15:49:05 +00:00
|
|
|
|
*CSH.IF.START jmp CSH.Push Push "IF" Token
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-05 15:49:05 +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
|
|
|
|
|
* jmp CSH.Push Push "WHILE" Token
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-05 15:49:05 +00:00
|
|
|
|
CSH.IF.END clc
|
2017-10-25 15:34:23 +00:00
|
|
|
|
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
|
2019-09-05 06:43:09 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-25 15:34:23 +00:00
|
|
|
|
CSH.DO
|
|
|
|
|
CSH.FOR
|
|
|
|
|
CSH.SWITCH
|
|
|
|
|
CSH.CASE
|
|
|
|
|
CSH.BREAK
|
|
|
|
|
CSH.CONTINUE
|
2020-02-21 16:31:46 +00:00
|
|
|
|
CSH.TYPEDEF
|
|
|
|
|
CSH.SIZEOF
|
2017-10-25 15:34:23 +00:00
|
|
|
|
lda #CSH.E.SYNTAX
|
2017-10-20 15:42:24 +00:00
|
|
|
|
sec
|
2017-07-11 15:53:52 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-02-23 20:01:48 +00:00
|
|
|
|
CSH.STRUCT >ENTER 4
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetCharNB
|
2020-02-21 16:31:46 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>LDA.G CSH.hTags
|
|
|
|
|
jsr CSH.NewKey
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
sta (pStack)
|
|
|
|
|
|
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
.1 jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
cmp #'}'
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB skip }
|
|
|
|
|
|
|
|
|
|
clc
|
2020-02-23 20:01:48 +00:00
|
|
|
|
.99 >LEAVE
|
|
|
|
|
rts
|
2020-02-21 16:31:46 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-26 06:29:18 +00:00
|
|
|
|
* Built in Types
|
|
|
|
|
*--------------------------------------
|
2020-01-25 18:56:36 +00:00
|
|
|
|
CSH.SIGNED sec
|
|
|
|
|
.HS 90 BCC
|
2017-11-10 15:55:13 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-25 18:56:36 +00:00
|
|
|
|
CSH.UNSIGNED clc
|
|
|
|
|
php
|
|
|
|
|
|
|
|
|
|
jsr CSH.CheckSpace
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
>LDYA L.CSH.STYPES
|
|
|
|
|
jsr CSH.LookupID
|
|
|
|
|
|
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
bcs .8
|
2017-11-10 15:55:13 +00:00
|
|
|
|
jmp (J.CSH.UTYPES,x)
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
|
|
|
|
.8 jmp (J.CSH.STYPES,x)
|
|
|
|
|
|
|
|
|
|
.9 plp
|
|
|
|
|
lda #CSH.E.SYNTAX
|
2017-11-10 15:55:13 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-01-22 16:31:48 +00:00
|
|
|
|
CSH.VOID ldx #CSH.T.VOID
|
|
|
|
|
bra CSH.TYPE
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.CHAR ldx #CSH.T.CHAR
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bra CSH.TYPE
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.UCHAR ldx #CSH.T.UCHAR
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra CSH.TYPE
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.INT ldx #CSH.T.INT
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra CSH.TYPE
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.UINT ldx #CSH.T.UINT
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bra CSH.TYPE
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.LONG ldx #CSH.T.LONG
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bra CSH.TYPE
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.ULONG ldx #CSH.T.ULONG
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bra CSH.TYPE
|
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.FLOAT ldx #CSH.T.FLOAT
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
CSH.TYPE stx ZPVarType
|
2020-01-25 18:56:36 +00:00
|
|
|
|
jsr CSH.CheckSpace
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bcs .9
|
2020-01-22 16:31:48 +00:00
|
|
|
|
|
2020-01-25 18:56:36 +00:00
|
|
|
|
.11 cmp #'*'
|
2020-01-22 16:31:48 +00:00
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
lda #CSH.Q.POINTER
|
|
|
|
|
tsb ZPVarType
|
2020-01-25 18:56:36 +00:00
|
|
|
|
jsr CSH.GetNextCharNB Skip *
|
2020-01-22 16:31:48 +00:00
|
|
|
|
bra .11
|
|
|
|
|
|
|
|
|
|
.10 jsr CSH.IsLetter
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
jsr CSH.AddVar add with undef value...
|
2019-08-26 06:29:18 +00:00
|
|
|
|
bcs .99 OOM or DUP
|
2019-09-03 15:35:13 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #';'
|
2020-02-19 16:42:05 +00:00
|
|
|
|
beq .8
|
2019-09-03 15:35:13 +00:00
|
|
|
|
|
|
|
|
|
.2 cmp #'='
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bne .9
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
jsr CSH.GetNextCharNB Skip =
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bcs .9
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
lda ZPVarType
|
2017-10-23 15:39:19 +00:00
|
|
|
|
jsr CSH.ExpEval
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bcs .99
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
|
|
|
|
.7 jsr CSH.SetVarValueFromStack X= Type, Set value to this var
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bcs .99
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
jsr CSH.GetChar
|
|
|
|
|
bcs .9
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
cmp #';'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
.8 clc
|
2017-10-23 15:39:19 +00:00
|
|
|
|
rts
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2019-08-26 06:29:18 +00:00
|
|
|
|
* Input:
|
|
|
|
|
* ZPFileBufPtr, A = Expected type
|
|
|
|
|
* Output:
|
|
|
|
|
* CS, A = EC
|
2019-09-02 06:09:28 +00:00
|
|
|
|
* CC, Result on Stack, X = Type
|
2019-08-26 06:29:18 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-29 15:49:03 +00:00
|
|
|
|
CSH.fCall ldx ZPPtr1
|
2019-08-26 06:29:18 +00:00
|
|
|
|
phx
|
2020-02-20 16:54:51 +00:00
|
|
|
|
ldx ZPPtr1+1 local : fdef
|
2019-08-26 06:29:18 +00:00
|
|
|
|
phx
|
2019-08-29 15:49:03 +00:00
|
|
|
|
ldx ZPPtr2 local : type
|
|
|
|
|
phx
|
|
|
|
|
ldx ZPPtr2+1 local : variadic size
|
2019-08-26 06:29:18 +00:00
|
|
|
|
phx
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
sta ZPPtr2 save Type
|
2019-08-29 15:49:03 +00:00
|
|
|
|
stz ZPPtr2+1 Reset VARIADIC byte count
|
2019-08-26 06:29:18 +00:00
|
|
|
|
>LDYA L.CSH.FN
|
2020-02-28 07:21:46 +00:00
|
|
|
|
jsr CSH.LookupFN
|
2019-08-26 06:29:18 +00:00
|
|
|
|
phx X = function index
|
2019-08-29 15:49:03 +00:00
|
|
|
|
bcs .10
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1 f() definition, starting at returned type
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetCharNB
|
2019-09-02 06:09:28 +00:00
|
|
|
|
bcs .10
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
|
|
|
|
cmp #'('
|
2019-09-06 12:50:27 +00:00
|
|
|
|
bne .52
|
2019-08-26 06:29:18 +00:00
|
|
|
|
jsr CSH.GetNextCharNB skip '('
|
2019-08-29 15:49:03 +00:00
|
|
|
|
.10 bcs .90
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
lda ZPPtr2
|
|
|
|
|
bne .11
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
bra .1 expected type is 0, no check
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
.11 cmp (ZPPtr1) Get Return value Type
|
2019-08-26 06:29:18 +00:00
|
|
|
|
bne .91
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2020-01-24 14:21:08 +00:00
|
|
|
|
.1 jsr CSH.ZPPtr1Next advance to arg list type
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2020-01-24 14:21:08 +00:00
|
|
|
|
lda (ZPPtr1) get type of first arg
|
2019-08-26 06:29:18 +00:00
|
|
|
|
beq .7 end of list, go check ending ')'
|
2019-09-02 06:09:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-26 06:29:18 +00:00
|
|
|
|
.3 eor #CSH.T.VARIADIC if VARIADIC, don't advance to next arg and assume type = 0
|
|
|
|
|
beq .4
|
2019-09-02 06:09:28 +00:00
|
|
|
|
eor #CSH.T.VARIADIC restore type...
|
2019-08-29 15:49:03 +00:00
|
|
|
|
.4 jsr CSH.ExpEval A=0 if VARIADIC
|
|
|
|
|
bcs .9 X = Var Type
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
lda (ZPPtr1) get current arg type
|
2019-08-29 15:49:03 +00:00
|
|
|
|
eor #CSH.T.VARIADIC
|
|
|
|
|
bne .5
|
2020-02-21 16:31:46 +00:00
|
|
|
|
jsr CSH.GetVarSize X = Var Type
|
2019-08-29 15:49:03 +00:00
|
|
|
|
* clc
|
2019-09-02 06:09:28 +00:00
|
|
|
|
|
2019-08-29 15:49:03 +00:00
|
|
|
|
adc ZPPtr2+1
|
|
|
|
|
sta ZPPtr2+1 Add to byte count
|
2019-09-02 06:09:28 +00:00
|
|
|
|
bra .51
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
|
|
|
|
.5 jsr CSH.ZPPtr1Next
|
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
.51 jsr CSH.GetCharNB
|
2019-08-29 15:49:03 +00:00
|
|
|
|
bcs .90
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
cmp #','
|
2019-08-28 15:21:42 +00:00
|
|
|
|
bne .6
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB Skip ,
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
bne .3 Another ARG....
|
|
|
|
|
|
2019-09-06 12:50:27 +00:00
|
|
|
|
.52 bra .90 extra args....error
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.6 cmp #')'
|
|
|
|
|
bne .90
|
|
|
|
|
lda (ZPPtr1)
|
2019-09-02 06:09:28 +00:00
|
|
|
|
beq .8 no more arg after ')', exit
|
2019-08-28 15:21:42 +00:00
|
|
|
|
eor #CSH.T.VARIADIC
|
2019-08-29 15:49:03 +00:00
|
|
|
|
bne .90 missing arg
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2019-08-29 15:49:03 +00:00
|
|
|
|
>PUSHB ZPPtr2+1 push VARIADIC byte count
|
|
|
|
|
bra .8
|
2019-08-26 06:29:18 +00:00
|
|
|
|
.7 jsr CSH.GetCharNB
|
|
|
|
|
bcs .90
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .90
|
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.8 jsr CSH.GetNextCharNB Skip )
|
2019-08-27 15:13:00 +00:00
|
|
|
|
|
|
|
|
|
plx restore X = function index
|
2019-09-06 12:50:27 +00:00
|
|
|
|
ldy ZPPtr2 get type in Y
|
2019-08-29 15:49:03 +00:00
|
|
|
|
pla
|
|
|
|
|
sta ZPPtr2+1
|
2019-08-27 15:13:00 +00:00
|
|
|
|
pla
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
pla
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
pla
|
|
|
|
|
sta ZPPtr1
|
2019-09-06 12:50:27 +00:00
|
|
|
|
phy
|
|
|
|
|
jsr .80
|
|
|
|
|
plx
|
|
|
|
|
rts
|
2019-08-26 06:29:18 +00:00
|
|
|
|
.90 lda #CSH.E.SYNTAX
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
.91 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
|
2019-08-28 15:21:42 +00:00
|
|
|
|
.9 plx Discard function index
|
|
|
|
|
|
2019-08-29 15:49:03 +00:00
|
|
|
|
plx
|
|
|
|
|
stx ZPPtr2+1
|
2019-08-28 15:21:42 +00:00
|
|
|
|
plx
|
2019-08-26 06:29:18 +00:00
|
|
|
|
stx ZPPtr2
|
|
|
|
|
plx
|
|
|
|
|
stx ZPPtr1+1
|
|
|
|
|
plx
|
|
|
|
|
stx ZPPtr1
|
2019-08-28 15:21:42 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
.99 rts
|
2019-09-06 12:50:27 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.80 jmp (J.CSH.EXEC,x)
|
2019-08-26 06:29:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Input:
|
|
|
|
|
* ZPFileBufPtr, A = Expected type
|
|
|
|
|
* Output:
|
|
|
|
|
* CS, A = EC
|
2019-08-29 15:49:03 +00:00
|
|
|
|
* CC, X = Var Type, Value on Stack
|
2019-08-26 06:29:18 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-27 15:13:00 +00:00
|
|
|
|
CSH.ExpEval ldx ZPPtr1
|
|
|
|
|
phx
|
2020-02-20 16:54:51 +00:00
|
|
|
|
ldx ZPPtr1+1 local : used by lookup
|
2019-08-27 15:13:00 +00:00
|
|
|
|
phx
|
2019-08-28 15:21:42 +00:00
|
|
|
|
ldx ZPPtr2 local : VarType
|
2019-08-26 06:29:18 +00:00
|
|
|
|
phx
|
2020-02-21 07:35:49 +00:00
|
|
|
|
ldx ZPPtr2+1 local : BOP
|
2019-08-26 06:29:18 +00:00
|
|
|
|
phx
|
2019-08-28 15:21:42 +00:00
|
|
|
|
|
2020-01-23 14:48:22 +00:00
|
|
|
|
sta ZPPtr2 local : expected type
|
2019-02-08 16:13:43 +00:00
|
|
|
|
|
2020-02-21 07:35:49 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
pha
|
2020-02-21 13:24:16 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-25 18:56:36 +00:00
|
|
|
|
.10 jsr CSH.GetCharNB
|
|
|
|
|
bcs .19
|
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.11 cmp #'('
|
2020-01-25 18:56:36 +00:00
|
|
|
|
bne .20
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB skip (
|
|
|
|
|
bcs .19
|
|
|
|
|
|
|
|
|
|
lda ZPPtr2
|
|
|
|
|
|
|
|
|
|
jsr CSH.ExpEval
|
|
|
|
|
bcs .19
|
|
|
|
|
stx ZPPtr2
|
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
2020-01-25 18:56:36 +00:00
|
|
|
|
bcs .19
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .19
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB skip )
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bcc .31
|
2020-01-25 18:56:36 +00:00
|
|
|
|
.19 jmp .90
|
2020-02-21 07:35:49 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-25 18:56:36 +00:00
|
|
|
|
.20 jsr CSH.IsLetter define, Fnc or Var ?
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bcs .22
|
2017-10-24 15:44:12 +00:00
|
|
|
|
|
2020-01-26 19:36:49 +00:00
|
|
|
|
jsr CSH.GetDefine
|
|
|
|
|
bcc .10
|
2020-02-20 16:54:51 +00:00
|
|
|
|
|
2020-01-26 19:36:49 +00:00
|
|
|
|
jsr CSH.GetVar
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bcs .21
|
2019-09-02 06:09:28 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
ldx ZPPtr2 YA=VarID, X=expected var type (or 0=any)
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-09-04 15:35:50 +00:00
|
|
|
|
jsr CSH.GetVarValueOnStack Y,A = VarID, Get value on stack
|
2019-09-06 12:50:27 +00:00
|
|
|
|
bcs .29
|
2019-09-02 06:09:28 +00:00
|
|
|
|
|
|
|
|
|
stx ZPPtr2 store real var type
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bra .30
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.21 lda ZPPtr2 var type
|
2019-08-29 15:49:03 +00:00
|
|
|
|
jsr CSH.fCall X = function index
|
2020-02-21 07:35:49 +00:00
|
|
|
|
bcs .29
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-09-06 12:50:27 +00:00
|
|
|
|
stx ZPPtr2 store real var type
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bra .30
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.22 jsr CSH.IsDigit10 number ?
|
|
|
|
|
bcs .24
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-09-04 15:35:50 +00:00
|
|
|
|
ldx ZPPtr2
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bne .23
|
2019-09-06 12:50:27 +00:00
|
|
|
|
|
|
|
|
|
ldx #CSH.T.INT
|
|
|
|
|
stx ZPPtr2
|
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.23 jsr CSH.GetNumOnStack
|
|
|
|
|
bcs .29
|
|
|
|
|
bra .30
|
|
|
|
|
|
|
|
|
|
.24 cmp #'"' String literal
|
|
|
|
|
bne .90
|
|
|
|
|
jsr CSH.AddContCharP
|
2019-09-06 12:50:27 +00:00
|
|
|
|
.29 bcs .99
|
2020-02-20 16:54:51 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.30 jsr CSH.GetCharNB
|
2019-08-27 15:13:00 +00:00
|
|
|
|
bcs .90
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.31 cmp #','
|
|
|
|
|
beq .80
|
2017-10-26 06:41:57 +00:00
|
|
|
|
cmp #')'
|
2020-02-21 13:24:16 +00:00
|
|
|
|
beq .80
|
2017-10-26 06:41:57 +00:00
|
|
|
|
cmp #';'
|
2020-02-21 13:24:16 +00:00
|
|
|
|
beq .80
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2017-10-24 15:44:12 +00:00
|
|
|
|
jsr CSH.IsOPChar
|
2020-01-25 18:56:36 +00:00
|
|
|
|
bcs .90
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
>LDYA L.CSH.BOPS we are at V1 op1 V2 op2...
|
2017-10-25 15:34:23 +00:00
|
|
|
|
jsr CSH.LookupOP
|
2019-08-27 15:13:00 +00:00
|
|
|
|
bcs .90
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
stx ZPPtr2+1 save OP(n)
|
|
|
|
|
|
|
|
|
|
.32 pla get OP(n-1)
|
|
|
|
|
bmi .33 $ff....
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
|
|
|
|
cmp ZPPtr2+1
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bcc .33 OP(n) has precedence, on stack : V1,V2
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
tax OP(n-1) has precedence...
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
|
|
|
|
lda ZPPtr2 Var Type
|
2020-02-21 13:24:16 +00:00
|
|
|
|
jsr CSH.BOP.EXEC compute V(n-1) <OP(n-1)> V(n)
|
|
|
|
|
bcc .32
|
|
|
|
|
|
2020-02-21 07:35:49 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.33 pha push back OP(n-1)
|
|
|
|
|
lda ZPPtr2+1 get OP(n)
|
|
|
|
|
pha push OP(n) on stack
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
jmp .10 go check for next token
|
2020-02-20 16:54:51 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.80 plx any OP on stack ?
|
|
|
|
|
bmi .88
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
2019-09-04 15:35:50 +00:00
|
|
|
|
lda ZPPtr2 Var Type
|
2020-01-26 19:36:49 +00:00
|
|
|
|
jsr CSH.BOP.EXEC
|
2020-02-21 13:24:16 +00:00
|
|
|
|
bcc .80
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
bcs .99
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
.90 lda #CSH.E.SYNTAX
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.99 plx
|
|
|
|
|
bpl .99
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
|
|
|
|
sec
|
2019-08-27 15:13:00 +00:00
|
|
|
|
.HS 90 BCC
|
2020-02-21 13:24:16 +00:00
|
|
|
|
.88 clc
|
2019-08-27 15:13:00 +00:00
|
|
|
|
|
2019-08-29 15:49:03 +00:00
|
|
|
|
ldx ZPPtr2 X = Var Type
|
2020-02-21 07:35:49 +00:00
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
ply
|
|
|
|
|
sty ZPPtr2+1
|
|
|
|
|
ply
|
|
|
|
|
sty ZPPtr2
|
|
|
|
|
ply
|
|
|
|
|
sty ZPPtr1+1
|
|
|
|
|
ply
|
|
|
|
|
sty ZPPtr1
|
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
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-02-13 16:20:44 +00:00
|
|
|
|
.1 jsr CSH.GetNextChar
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #'"'
|
|
|
|
|
beq .2
|
|
|
|
|
sta (ZPCSHConst),y
|
|
|
|
|
iny
|
|
|
|
|
bra .1
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
.2 lda #0
|
2019-02-13 16:20:44 +00:00
|
|
|
|
sta (ZPCSHConst),y
|
2019-08-27 15:13:00 +00:00
|
|
|
|
>PUSHW ZPCSHConst Push PTR on stack
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2019-08-27 15:13:00 +00:00
|
|
|
|
tya
|
2019-02-13 16:20:44 +00:00
|
|
|
|
sec
|
|
|
|
|
adc ZPCSHConst
|
|
|
|
|
sta ZPCSHConst
|
|
|
|
|
bcc .3
|
|
|
|
|
inc ZPCSHConst+1
|
2019-08-27 15:13:00 +00:00
|
|
|
|
.3 jsr CSH.GetNextChar Skip "
|
2019-02-13 16:20:44 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
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-08-26 06:29:18 +00:00
|
|
|
|
tay
|
2019-02-13 16:20:44 +00:00
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
adc #0
|
2019-08-26 06:29:18 +00:00
|
|
|
|
clc Y,A = F() def, X = F() index
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
|
|
|
|
|
.4 inx
|
|
|
|
|
inx
|
2019-08-26 06:29:18 +00:00
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
jsr CSH.ZPPtr1AddAp1
|
|
|
|
|
>LDA.G CSH.LookupOpt
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bpl .1
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
|
|
|
|
ldy #$0 Start at Y=1 for VOID func()
|
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
.6 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .6
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
2017-11-10 15:55:13 +00:00
|
|
|
|
tya
|
2019-08-26 06:29:18 +00:00
|
|
|
|
jsr CSH.ZPPtr1AddAp1
|
2017-10-26 16:01:54 +00:00
|
|
|
|
bra .1
|
2020-01-24 14:21:08 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.9 pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-24 14:21:08 +00:00
|
|
|
|
CSH.ZPPtr1Next inc ZPPtr1
|
|
|
|
|
bne .8
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2019-02-13 16:20:44 +00:00
|
|
|
|
CSH.ZPPtr1AddAp1
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.1 rts
|
|
|
|
|
*--------------------------------------
|
2019-08-26 15:27:28 +00:00
|
|
|
|
CSH.GetNumOnStack
|
2019-09-06 12:50:27 +00:00
|
|
|
|
txa
|
|
|
|
|
beq .99
|
2019-02-07 16:52:25 +00:00
|
|
|
|
|
2019-09-06 12:50:27 +00:00
|
|
|
|
.10 cpx #CSH.T.FLOAT
|
|
|
|
|
bcc .1
|
|
|
|
|
bne .99
|
2020-01-26 19:36:49 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>PUSHWI ZPFileBufPtr
|
|
|
|
|
>LDYA ZPFileBufPtr
|
2017-10-20 15:42:24 +00:00
|
|
|
|
>SYSCALL StrToF
|
2019-08-27 15:13:00 +00:00
|
|
|
|
clc
|
2017-10-20 15:42:24 +00:00
|
|
|
|
rts
|
2020-01-26 19:36:49 +00:00
|
|
|
|
|
2020-02-14 16:32:52 +00:00
|
|
|
|
.1 >PUSHW ZPFileBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>PUSHWI ZPFileBufPtr
|
2020-02-14 16:32:52 +00:00
|
|
|
|
>PUSHBI 10
|
2019-09-04 15:35:50 +00:00
|
|
|
|
phx
|
2019-09-02 15:34:10 +00:00
|
|
|
|
cpx #CSH.T.UCHAR
|
|
|
|
|
bcc .2
|
|
|
|
|
>SYSCALL StrToUL
|
|
|
|
|
bra .3
|
2020-02-14 16:32:52 +00:00
|
|
|
|
|
2019-09-02 15:34:10 +00:00
|
|
|
|
.2 >SYSCALL StrToL
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
2019-09-04 15:35:50 +00:00
|
|
|
|
.3 plx
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
lda CSH.TYPESIZE,x
|
2019-09-02 15:34:10 +00:00
|
|
|
|
cmp #4
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #2
|
|
|
|
|
bne .4
|
|
|
|
|
ldy #1
|
|
|
|
|
>PULLA
|
|
|
|
|
sta (pStack),y
|
|
|
|
|
>PULLA
|
|
|
|
|
sta (pStack),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-02 15:34:10 +00:00
|
|
|
|
.4 >PULLA
|
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
|
|
|
|
sta (pStack)
|
|
|
|
|
.8 clc
|
2019-09-06 12:50:27 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.99 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-04 15:35:50 +00:00
|
|
|
|
* Input : ZPFileBufPtr
|
2020-02-20 16:54:51 +00:00
|
|
|
|
* Output : Y,A = VarID
|
2017-07-21 14:46:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-25 18:56:36 +00:00
|
|
|
|
CSH.AddVar >LDA.G CSH.hSymbols
|
2020-02-19 16:42:05 +00:00
|
|
|
|
jsr CSH.NewKey
|
|
|
|
|
bcs .9
|
2020-01-25 18:56:36 +00:00
|
|
|
|
|
2020-02-20 07:41:52 +00:00
|
|
|
|
>STYA ZPVarID
|
2020-02-19 16:42:05 +00:00
|
|
|
|
ldx ZPVarType
|
2020-02-21 16:31:46 +00:00
|
|
|
|
jsr CSH.GetVarSize
|
2020-02-19 16:42:05 +00:00
|
|
|
|
sta ZPVarSizeOf
|
|
|
|
|
|
|
|
|
|
lda ZPCSHData
|
|
|
|
|
sta ZPVarDataPtr
|
|
|
|
|
clc
|
|
|
|
|
adc ZPVarSizeOf
|
|
|
|
|
sta ZPCSHData
|
|
|
|
|
|
|
|
|
|
lda ZPCSHData+1
|
|
|
|
|
sta ZPVarDataPtr+1
|
|
|
|
|
adc ZPVarSizeOf+1
|
|
|
|
|
sta ZPCSHData+1
|
|
|
|
|
|
|
|
|
|
>LDA.G CSH.DataPtr
|
|
|
|
|
clc
|
|
|
|
|
adc ZPVarSizeOf
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>PUSHB.G CSH.hSymbols
|
|
|
|
|
>PUSHW ZPVarID
|
|
|
|
|
>PUSHWI ZPVarDef
|
|
|
|
|
>PUSHWI 6
|
|
|
|
|
>SYSCALL SListAddData
|
2020-02-20 16:54:51 +00:00
|
|
|
|
* bcs .9
|
2020-02-20 07:41:52 +00:00
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
* lda #'*'
|
|
|
|
|
* jsr DEBUG.VAR
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
|
2020-02-20 07:41:52 +00:00
|
|
|
|
.99 lda #CSH.E.OOM
|
|
|
|
|
.HS 2C BIT ABS
|
2020-02-19 16:42:05 +00:00
|
|
|
|
CSH.TMISMATCH lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.NewKey >PUSHA
|
2020-01-25 18:56:36 +00:00
|
|
|
|
>PUSHW ZPFileBufPtr
|
2019-08-26 06:29:18 +00:00
|
|
|
|
>SYSCALL SListNewKey
|
|
|
|
|
bcs .9
|
2020-02-18 15:34:56 +00:00
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
pha
|
2019-08-26 06:29:18 +00:00
|
|
|
|
txa
|
|
|
|
|
* clc
|
|
|
|
|
adc ZPFileBufPtr
|
|
|
|
|
sta ZPFileBufPtr
|
2017-10-20 15:42:24 +00:00
|
|
|
|
bcc .1
|
2020-02-18 15:34:56 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
inc ZPFileBufPtr+1
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
|
|
|
|
.1 clc
|
2020-02-20 16:54:51 +00:00
|
|
|
|
pla
|
2019-09-03 15:35:13 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2020-02-19 16:42:05 +00:00
|
|
|
|
* X=Type
|
2019-09-03 15:35:13 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-04 15:35:50 +00:00
|
|
|
|
CSH.SetVarValueFromStack
|
2020-02-19 16:42:05 +00:00
|
|
|
|
cpx ZPVarType X = type
|
|
|
|
|
bne .99
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 lda (pStack)
|
|
|
|
|
sta (ZPVarDataPtr),y
|
|
|
|
|
inc pStack
|
2019-09-03 15:35:13 +00:00
|
|
|
|
iny
|
2020-02-19 16:42:05 +00:00
|
|
|
|
cpy ZPVarSizeOf
|
2019-09-03 15:35:13 +00:00
|
|
|
|
bne .1
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2020-02-21 07:35:49 +00:00
|
|
|
|
* lda #'>'
|
|
|
|
|
* jsr DEBUG.VAR
|
2020-02-19 16:42:05 +00:00
|
|
|
|
clc
|
2019-09-03 15:35:13 +00:00
|
|
|
|
rts
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
|
|
|
|
.99 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2017-07-21 14:46:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-18 15:34:56 +00:00
|
|
|
|
CSH.GetDefine >PUSHB.G CSH.hDefines
|
|
|
|
|
|
2020-01-26 19:36:49 +00:00
|
|
|
|
jsr CSH.Get
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
pha
|
2020-02-18 15:34:56 +00:00
|
|
|
|
phy
|
|
|
|
|
>PUSHB.G CSH.hDefines
|
|
|
|
|
ply
|
2020-01-26 19:36:49 +00:00
|
|
|
|
pla
|
|
|
|
|
>PUSHYA KeyID
|
|
|
|
|
|
2020-02-18 15:34:56 +00:00
|
|
|
|
>PUSHWZ Allocate..
|
|
|
|
|
>PUSHWZ len = 0 (string mode)
|
|
|
|
|
>PUSHWZ From Start
|
2020-01-26 19:36:49 +00:00
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
stx ZPhMacro
|
|
|
|
|
|
|
|
|
|
lda ZPFileBufPtr
|
|
|
|
|
sta ZPFileBufPtrBak
|
|
|
|
|
lda ZPFileBufPtr+1
|
|
|
|
|
sta ZPFileBufPtrBak+1
|
|
|
|
|
|
|
|
|
|
txa
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2020-01-26 19:36:49 +00:00
|
|
|
|
>STYA ZPFileBufPtr
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2020-02-18 15:34:56 +00:00
|
|
|
|
CSH.GetVar >PUSHB.G CSH.hSymbols
|
|
|
|
|
|
|
|
|
|
CSH.Get >PUSHW ZPFileBufPtr
|
|
|
|
|
>SYSCALL SListLookup
|
2019-08-26 06:29:18 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
pha
|
2019-08-26 06:29:18 +00:00
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
* clc
|
|
|
|
|
adc ZPFileBufPtr
|
|
|
|
|
sta ZPFileBufPtr
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPFileBufPtr+1
|
2019-08-26 15:27:28 +00:00
|
|
|
|
clc
|
2019-09-03 15:35:13 +00:00
|
|
|
|
.1 pla Y,A = VarID
|
|
|
|
|
.9 rts
|
2019-08-26 15:27:28 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-21 13:24:16 +00:00
|
|
|
|
CSH.GetVarDef phy
|
|
|
|
|
pha
|
|
|
|
|
>PUSHB.G CSH.hSymbols
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA KeyID
|
|
|
|
|
|
|
|
|
|
>PUSHWI ZPVarDef
|
|
|
|
|
>PUSHWI 6 6 bytes
|
|
|
|
|
>PUSHWI 0 From Start
|
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-02-19 16:42:05 +00:00
|
|
|
|
* Input :
|
|
|
|
|
* X=Var Type (or 0)
|
|
|
|
|
* YA=VarID
|
|
|
|
|
* Output : Stack, X = Var Type
|
2019-08-26 15:27:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-09-04 15:35:50 +00:00
|
|
|
|
CSH.GetVarValueOnStack
|
2020-02-19 16:42:05 +00:00
|
|
|
|
phx
|
2020-02-18 15:34:56 +00:00
|
|
|
|
phy
|
2020-02-19 16:42:05 +00:00
|
|
|
|
pha
|
2020-02-18 15:34:56 +00:00
|
|
|
|
>PUSHB.G CSH.hSymbols
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
pla
|
2020-02-19 16:42:05 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA KeyID
|
2020-02-18 15:34:56 +00:00
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>PUSHEA.G CSH.VarDef
|
2020-02-18 15:34:56 +00:00
|
|
|
|
>PUSHWI 6 6 bytes
|
|
|
|
|
>PUSHWI 0 From Start
|
2019-08-26 15:27:28 +00:00
|
|
|
|
>SYSCALL SListGetData
|
2020-02-19 16:42:05 +00:00
|
|
|
|
plx
|
|
|
|
|
|
2019-09-03 15:35:13 +00:00
|
|
|
|
bcs .9
|
2019-08-28 15:21:42 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
txa
|
2020-01-23 14:48:22 +00:00
|
|
|
|
beq .1 any type
|
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>CMP.G CSH.VarDef Type
|
2020-01-23 14:48:22 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
and #CSH.Q.PPPOINTER
|
|
|
|
|
beq .99 not pointer....mismatch
|
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>EOR.G CSH.VarDef
|
2020-01-23 14:48:22 +00:00
|
|
|
|
and #CSH.Q.PPPOINTER
|
|
|
|
|
bne .99 compare only pointer depth
|
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
.1 >LDA.G CSH.VarDef
|
2019-09-03 15:35:13 +00:00
|
|
|
|
beq *
|
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
.2 tax
|
2020-02-21 16:31:46 +00:00
|
|
|
|
jsr CSH.GetVarSize
|
2020-02-20 16:54:51 +00:00
|
|
|
|
pha
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>LDA.G CSH.VarDef+4
|
|
|
|
|
sta ZPPtr3
|
|
|
|
|
iny
|
|
|
|
|
lda (pData),y
|
|
|
|
|
sta ZPPtr3+1
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
.3 dey
|
2020-02-20 16:54:51 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2019-08-26 15:27:28 +00:00
|
|
|
|
>PUSHA
|
2020-02-19 16:42:05 +00:00
|
|
|
|
tya
|
2020-01-23 14:48:22 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>LDA.G CSH.VarDef
|
|
|
|
|
tax
|
2019-09-02 06:09:28 +00:00
|
|
|
|
clc X = Var Type
|
2019-09-05 15:49:05 +00:00
|
|
|
|
.9 rts
|
2019-08-28 15:21:42 +00:00
|
|
|
|
|
2020-02-19 16:42:05 +00:00
|
|
|
|
.99 lda #CSH.E.TMISMATCH
|
2019-08-26 15:27:28 +00:00
|
|
|
|
sec
|
2019-09-05 15:49:05 +00:00
|
|
|
|
rts
|
2017-10-24 15:44:12 +00:00
|
|
|
|
*--------------------------------------
|
2019-08-29 15:49:03 +00:00
|
|
|
|
* Input : Value on Stack, X = Var Type
|
|
|
|
|
* Output : CC = true, CS = false
|
|
|
|
|
*--------------------------------------
|
2019-09-05 15:49:05 +00:00
|
|
|
|
CSH.IsValue0 cpx #CSH.T.FLOAT
|
2019-08-29 15:49:03 +00:00
|
|
|
|
bcc .1 char,int,long
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
ldy CSH.TYPESIZE,x
|
2020-02-19 16:42:05 +00:00
|
|
|
|
lda (ZPVarDataPtr),y
|
2017-10-25 15:34:23 +00:00
|
|
|
|
bne .9
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2020-02-21 16:31:46 +00:00
|
|
|
|
.1 jsr CSH.GetVarSize
|
2017-10-25 15:34:23 +00:00
|
|
|
|
tax
|
2019-09-05 06:43:09 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
lda #0
|
|
|
|
|
|
2019-09-05 06:43:09 +00:00
|
|
|
|
.2 ora (pStack)
|
|
|
|
|
inc pStack
|
2017-10-25 15:34:23 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
tax
|
|
|
|
|
beq .8
|
2020-02-19 16:42:05 +00:00
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
* Stack
|
|
|
|
|
*--------------------------------------
|
2019-09-05 06:43:09 +00:00
|
|
|
|
CSH.CheckStack tax
|
|
|
|
|
>LDA.G CSH.StackPtr
|
|
|
|
|
beq .9
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-05 06:43:09 +00:00
|
|
|
|
tay
|
|
|
|
|
txa
|
|
|
|
|
cmp (ZPCSHStack),y
|
|
|
|
|
bne .9
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-05 06:43:09 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-05 06:43:09 +00:00
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSH.Push pha
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G CSH.StackPtr
|
2020-01-23 14:48:22 +00:00
|
|
|
|
dec
|
2017-11-09 16:39:01 +00:00
|
|
|
|
beq .9
|
|
|
|
|
sta (pData),y
|
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
|
2020-01-23 14:48:22 +00:00
|
|
|
|
pha
|
|
|
|
|
inc
|
2017-07-12 15:25:23 +00:00
|
|
|
|
sta (pData),y
|
2020-01-23 14:48:22 +00:00
|
|
|
|
ply
|
2017-07-13 15:22:13 +00:00
|
|
|
|
lda (ZPCSHStack),y
|
2017-07-12 15:25:23 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2020-01-23 14:48:22 +00:00
|
|
|
|
.9 lda #CSH.E.STACKERR
|
2017-07-12 15:25:23 +00:00
|
|
|
|
sec
|
2019-10-03 06:25:27 +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
|
|
|
|
*--------------------------------------
|
2019-09-05 15:49:05 +00:00
|
|
|
|
CSH.SkipStatement
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.SkipBlock ldy #0 not in "", TOTO:skip comments
|
|
|
|
|
|
|
|
|
|
ldx #1 starting with 1 '{' for now....
|
2019-09-05 06:43:09 +00:00
|
|
|
|
|
|
|
|
|
.1 jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .2
|
2019-09-05 15:49:05 +00:00
|
|
|
|
tya
|
|
|
|
|
bmi .1
|
2019-09-05 06:43:09 +00:00
|
|
|
|
inx
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 cmp #'}'
|
2019-09-05 15:49:05 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
bmi .1
|
2019-09-05 06:43:09 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2019-09-06 12:50:27 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-09-05 15:49:05 +00:00
|
|
|
|
.3 cmp #'"'
|
|
|
|
|
bne .1
|
|
|
|
|
tya
|
|
|
|
|
eor #$ff
|
|
|
|
|
tay
|
|
|
|
|
bra .1
|
2019-09-05 06:43:09 +00:00
|
|
|
|
jmp CSH.GetNextCharNB skip '}'
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2019-09-05 06:43:09 +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
|
|
|
|
|
*--------------------------------------
|
2020-01-25 18:56:36 +00:00
|
|
|
|
CSH.CheckSpace jsr CSH.GetChar
|
|
|
|
|
bcs .90
|
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bcc CSH.GetNextCharNB.RTS
|
|
|
|
|
|
|
|
|
|
.90 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
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.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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2017-07-13 15:22:13 +00:00
|
|
|
|
*--------------------------------------
|
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)
|
2020-01-26 19:36:49 +00:00
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
lda ZPhMacro
|
2017-10-19 15:27:38 +00:00
|
|
|
|
beq .9
|
2020-01-26 19:36:49 +00:00
|
|
|
|
|
|
|
|
|
stz ZPhMacro
|
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
phy
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-01-26 19:36:49 +00:00
|
|
|
|
ply
|
|
|
|
|
plx
|
|
|
|
|
|
|
|
|
|
lda ZPFileBufPtrBak
|
|
|
|
|
sta ZPFileBufPtr
|
|
|
|
|
|
|
|
|
|
lda ZPFileBufPtrBak+1
|
|
|
|
|
sta ZPFileBufPtr+1
|
|
|
|
|
|
|
|
|
|
bra CSH.GetChar
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2017-07-13 15:22:13 +00:00
|
|
|
|
rts
|
2020-01-26 19:36:49 +00:00
|
|
|
|
|
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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2017-10-24 15:44:12 +00:00
|
|
|
|
*---------------------------------------
|
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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
CSH.IsLetterRTS rts
|
2017-07-13 15:22:13 +00:00
|
|
|
|
*---------------------------------------
|
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
|
|
|
|
*--------------------------------------
|
2019-09-03 15:35:13 +00:00
|
|
|
|
* in : X = type, out : X = type, A = size
|
|
|
|
|
*--------------------------------------
|
2020-02-21 16:31:46 +00:00
|
|
|
|
CSH.GetVarSize txa
|
2019-09-02 06:09:28 +00:00
|
|
|
|
and #CSH.Q.PPPOINTER
|
|
|
|
|
bne .2
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
txa
|
|
|
|
|
and #$f
|
2019-09-03 15:35:13 +00:00
|
|
|
|
phx
|
|
|
|
|
tax
|
|
|
|
|
lda CSH.TYPESIZE,x
|
|
|
|
|
plx
|
2019-09-02 06:09:28 +00:00
|
|
|
|
rts
|
2020-01-23 14:48:22 +00:00
|
|
|
|
|
2019-09-02 06:09:28 +00:00
|
|
|
|
.2 lda #2
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-02-28 07:21:46 +00:00
|
|
|
|
DEBUG.VAR >SYSCALL PutChar
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>PUSHW L.MSG.DBGVAR
|
2020-02-20 07:41:52 +00:00
|
|
|
|
>PUSHW ZPVarID
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>PUSHW ZPVarType
|
|
|
|
|
>PUSHW ZPVarSizeOf
|
2020-02-20 07:41:52 +00:00
|
|
|
|
>PUSHW ZPVarDataPtr
|
|
|
|
|
ldy #3
|
|
|
|
|
.1 >PUSHB (ZPVarDataPtr),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2020-02-20 16:54:51 +00:00
|
|
|
|
>PUSHBI 12
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2020-02-20 07:41:52 +00:00
|
|
|
|
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
|