2016-08-17 06:25:58 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-10-26 06:41:57 +00:00
|
|
|
|
LOMEM $A00
|
2016-08-17 06:25:58 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2017-11-10 15:55:13 +00:00
|
|
|
|
CSH.E.SYNTAX .EQ $7F
|
|
|
|
|
CSH.E.SOVERFLW .EQ $7E
|
|
|
|
|
CSH.E.NOVERFLW .EQ $7D
|
|
|
|
|
CSH.E.OOM .EQ $7C
|
|
|
|
|
CSH.E.DUP .EQ $7B
|
|
|
|
|
CSH.E.UNDEF .EQ $7A
|
|
|
|
|
CSH.E.TMISMATCH .EQ $79
|
|
|
|
|
|
2017-11-14 16:57:34 +00:00
|
|
|
|
CSH.Q.CONST .EQ %11000000
|
|
|
|
|
CSH.Q.ARRAY .EQ %10001100 max 3 bounds
|
|
|
|
|
CSH.Q.POINTER1 .EQ %10000001 max 3 depth
|
|
|
|
|
CSH.Q.POINTER2 .EQ %10000010
|
|
|
|
|
CSH.Q.POINTER3 .EQ %10000011
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CSH.T.CHAR .EQ 1
|
|
|
|
|
CSH.T.INT .EQ 2
|
|
|
|
|
CSH.T.LONG .EQ 3
|
2017-11-10 15:55:13 +00:00
|
|
|
|
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
|
2017-07-21 14:46:25 +00:00
|
|
|
|
*--------------------------------------
|
2017-11-10 15:55:13 +00:00
|
|
|
|
CSH.Init lda #$0
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>STA.G CSH.SymbolsPtr
|
|
|
|
|
>STA.G CSH.DataPtr
|
|
|
|
|
>STA.G CSH.StackPtr
|
2017-09-07 15:32:27 +00:00
|
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
|
>SYSCALL GetArg.A
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>SYSCALL LoadTxtFile.YA
|
2017-09-07 15:32:27 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.hBuf
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
|
|
|
|
>STYA ZPCSHBufPtr
|
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
>LDYAI 256
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem0.YA
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.hSymbols
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
|
|
|
|
>STYA ZPCSHSymbols
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem.YA
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.hData
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
|
|
|
|
>STYA ZPCSHData
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem.YA
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CSH.hStack
|
2017-10-19 15:27:38 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
|
|
|
|
>STYA 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
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CSH.Run jsr CL.RESET
|
2017-07-13 15:22:13 +00:00
|
|
|
|
jsr CSH.GetCharNB
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
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 #'#'
|
|
|
|
|
beq .5 comments : pass line to shell
|
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
|
2017-07-25 14:37:19 +00:00
|
|
|
|
bcs .5
|
2017-10-20 15:42:24 +00:00
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-09-01 15:40:26 +00:00
|
|
|
|
.99 lda #CSH.E.SYNTAX
|
2017-07-25 14:37:19 +00:00
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.5
|
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
jsr CSH.RestorePtr Restore ptr to get full cmd line to execute
|
2017-07-25 14:37:19 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
ldy #$0
|
2017-07-25 14:37:19 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.6 lda (ZPCSHBufPtr),y
|
|
|
|
|
beq .7
|
2017-07-25 14:37:19 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
cmp #13
|
2017-07-25 14:37:19 +00:00
|
|
|
|
beq .7
|
2017-09-07 15:32:27 +00:00
|
|
|
|
sta (ZPCMDBuf),y
|
2017-07-25 14:37:19 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #CmdLine.MAX
|
2017-10-23 15:39:19 +00:00
|
|
|
|
bne .6
|
|
|
|
|
bra .99 Line Too long !!!
|
2017-07-25 14:37:19 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
.7 lda #0
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
|
|
|
|
|
tya
|
2017-10-23 15:39:19 +00:00
|
|
|
|
clc
|
|
|
|
|
adc ZPCSHBufPtr
|
|
|
|
|
sta ZPCSHBufPtr
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPCSHBufPtr+1
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-10-26 06:41:57 +00:00
|
|
|
|
.8 tya
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CmdBuflen
|
2017-09-07 15:32:27 +00:00
|
|
|
|
lda #$ff
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G bCmdBufexec
|
2017-07-10 15:50:32 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G bEcho
|
2017-11-05 21:23:21 +00:00
|
|
|
|
beq .80
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
>PUSHW ZPCMDBuf
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG.ECHO
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-07-25 14:37:19 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.80 clc
|
2017-07-25 14:37:19 +00:00
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
CSH.Quit >LDA.G CSH.hBuf
|
2017-07-21 14:46:25 +00:00
|
|
|
|
beq .1
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.1 >LDA.G CSH.hStack
|
2017-07-21 14:46:25 +00:00
|
|
|
|
beq .2
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.2 >LDA.G CSH.hData
|
2017-07-21 14:46:25 +00:00
|
|
|
|
beq .3
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.3 >LDA.G CSH.hSymbols
|
2017-07-21 14:46:25 +00:00
|
|
|
|
beq .8
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-07-21 14:46:25 +00:00
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
sta ZPCSHBufPtr
|
|
|
|
|
jsr CSH.Pop
|
|
|
|
|
sta ZPCSHBufPtr+1
|
|
|
|
|
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
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
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-11-14 16:57:34 +00:00
|
|
|
|
CSH.FnEval jsr CSH.GetCharNB
|
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1) Get Return value Type
|
|
|
|
|
>CMP.G CSH.ACCT Match with ACC ?
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
jsr CSH.PushACCT Save Acc & T on stack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.1 inc ZPPtr1 advance to arg list type
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr1)
|
|
|
|
|
beq .7 end of list, go check no more
|
|
|
|
|
|
|
|
|
|
jsr CSH.ExpEval
|
|
|
|
|
bcs .90
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #CSH.T.VARIADIC
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
>CMP.G CSH.ACCT Match with ACC ?
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #CSH.T.VARIADIC
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
.4 jsr CSH.GetNextCharNB
|
|
|
|
|
cmp #','
|
|
|
|
|
bne .7
|
|
|
|
|
jsr CSH.GetNextCharNB
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.5 inc ZPPtr1 advance to next arg
|
|
|
|
|
beq .7
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
.7 jsr CSH.GetNextCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
* TO DO : Execute
|
|
|
|
|
|
|
|
|
|
jsr CSH.GetNextCharNB Skip )
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #CSH.E.SYNTAX
|
|
|
|
|
sec
|
|
|
|
|
.90 rts
|
|
|
|
|
|
|
|
|
|
.99 lda #CSH.E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
CSH.ExpEval jsr CSH.ZeroACC
|
2017-10-26 16:01:54 +00:00
|
|
|
|
dec A=0
|
|
|
|
|
>STA.G CSH.EXPBOP1
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-10-25 15:34:23 +00:00
|
|
|
|
.10 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
|
|
|
|
|
jsr CSH.FnEval
|
|
|
|
|
bcs .99
|
|
|
|
|
bra .11
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
|
|
|
|
.2 jsr CSH.IsDigit10 number ?
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
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
|
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
|
|
|
|
|
bcs .3
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bra .10
|
|
|
|
|
|
|
|
|
|
* Old OP has precedence, compute ACC=ARG <BOP> ACC
|
|
|
|
|
.3 >LDA.G CSH.EXPBOP1
|
|
|
|
|
jsr CSA.Compute
|
|
|
|
|
bcs .9
|
|
|
|
|
jsr CSH.GetCharNB
|
|
|
|
|
bcc .10
|
2017-07-17 05:59:30 +00:00
|
|
|
|
bra .9
|
2017-10-26 16:01:54 +00:00
|
|
|
|
|
|
|
|
|
.8 >LDA.G CSH.EXPBOP1
|
|
|
|
|
bmi .80
|
|
|
|
|
|
|
|
|
|
jmp CSA.Compute
|
|
|
|
|
|
|
|
|
|
.80 clc
|
2017-07-17 05:59:30 +00:00
|
|
|
|
rts
|
2017-10-25 15:34:23 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-26 16:01:54 +00:00
|
|
|
|
CSH.SavePtr >LDYA ZPCSHBufPtr
|
|
|
|
|
>STYA.G CSH.BufPtrSave
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.RestorePtr >LDYA.G CSH.BufPtrSave
|
|
|
|
|
>STYA ZPCSHBufPtr
|
|
|
|
|
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
|
|
|
|
|
cmp (ZPCSHBufPtr),y
|
|
|
|
|
bne .4
|
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
pla Found keyword...
|
|
|
|
|
clc
|
|
|
|
|
adc ZPCSHBufPtr ..advance Ptr to char after it..
|
|
|
|
|
sta ZPCSHBufPtr
|
2017-11-10 15:55:13 +00:00
|
|
|
|
bcc .31
|
|
|
|
|
inc ZPCSHBufPtr+1
|
|
|
|
|
|
|
|
|
|
.31 lda ZPPtr1
|
|
|
|
|
sec
|
|
|
|
|
adc (ZPPtr1)
|
|
|
|
|
sta ZPPtr1
|
2017-10-26 16:01:54 +00:00
|
|
|
|
bcc .8
|
2017-11-10 15:55:13 +00:00
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
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
|
|
|
|
*--------------------------------------
|
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
|
2017-10-26 06:41:57 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
>PUSHWI ZPCSHBufPtr
|
|
|
|
|
>PUSHW ZPCSHBufPtr
|
|
|
|
|
>PUSHEA.G CSH.ACC
|
2017-10-17 15:40:21 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
>SYSCALL StrToF
|
|
|
|
|
rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
.1 >PUSHBI 10
|
|
|
|
|
|
|
|
|
|
>PUSHWI ZPCSHBufPtr
|
|
|
|
|
>PUSHW ZPCSHBufPtr
|
|
|
|
|
>PUSHEA.G CSH.ACC
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
>SYSCALL StrToL
|
2017-07-17 05:59:30 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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
|
2017-10-19 15:27:38 +00:00
|
|
|
|
cmp (ZPCSHBufPtr),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
|
|
|
|
|
adc ZPCSHBufPtr
|
|
|
|
|
sta ZPCSHBufPtr
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPCSHBufPtr+1
|
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-10-26 16:01:54 +00:00
|
|
|
|
CSA.Compute tax
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
.8 >PUSHEA.G CSH.ACC
|
|
|
|
|
>PUSHEA.G CSH.ARG
|
|
|
|
|
>LEA.G CSH.ACC
|
|
|
|
|
>SYSCALL FSUB
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
lda (ZPCSHBufPtr),y
|
|
|
|
|
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
|
|
|
|
|
lda (ZPCSHBufPtr),y
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CSH.CheckCharNB cmp #32 SPACE
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #13 CR
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #10 LF
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #8 TAB
|
|
|
|
|
beq .9
|
2017-07-12 15:25:23 +00:00
|
|
|
|
clc
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-10-19 15:27:38 +00:00
|
|
|
|
CSH.GetNextChar inc ZPCSHBufPtr
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bne CSH.GetChar
|
2017-09-07 15:32:27 +00:00
|
|
|
|
inc ZPCSHBufPtr+1
|
2017-07-13 15:22:13 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-19 15:27:38 +00:00
|
|
|
|
CSH.GetChar lda (ZPCSHBufPtr)
|
|
|
|
|
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
|
|
|
|
|
*---------------------------------------
|
2017-11-10 15:55:13 +00:00
|
|
|
|
CSH.IsOPChar ldx #13
|
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
|
|
|
|
*--------------------------------------
|
2017-10-20 15:42:24 +00:00
|
|
|
|
CSH.ErrorMsg >LDA.G CSH.hBuf
|
|
|
|
|
>SYSCALL GetMemPtr.A
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
>STA.G CSH.LineNum
|
|
|
|
|
iny
|
|
|
|
|
>STA.G CSH.LineNum+1
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
.1 >LDYA ZPPtr1
|
|
|
|
|
>STYA ZPPtr2 Save actual line start
|
|
|
|
|
|
|
|
|
|
>INCW.G CSH.LineNum
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr1)
|
|
|
|
|
beq .6 EoF
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.3 cmp #$0D
|
|
|
|
|
bne .2 Scan until EoL
|
|
|
|
|
|
|
|
|
|
ldx ZPPtr1
|
|
|
|
|
cpx ZPCSHBufPtr
|
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
sbc ZPCSHBufPtr+1
|
|
|
|
|
bcc .1 not this line....
|
|
|
|
|
|
|
|
|
|
.4 ldy #0
|
|
|
|
|
|
|
|
|
|
.5 lda (ZPPtr2),y
|
|
|
|
|
beq .6
|
|
|
|
|
iny
|
|
|
|
|
cmp #$0D
|
|
|
|
|
beq .6
|
|
|
|
|
phy
|
|
|
|
|
>SYSCALL PutChar.A
|
|
|
|
|
ply
|
|
|
|
|
bra .5
|
|
|
|
|
|
|
|
|
|
.6 lda #$0D
|
|
|
|
|
>SYSCALL PutChar.A
|
|
|
|
|
lda #$0A
|
|
|
|
|
>SYSCALL PutChar.A
|
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
lda ZPCSHBufPtr
|
|
|
|
|
sec
|
|
|
|
|
sbc ZPPtr2
|
|
|
|
|
beq .8
|
|
|
|
|
tay
|
2017-10-23 15:39:19 +00:00
|
|
|
|
|
2017-10-20 15:42:24 +00:00
|
|
|
|
.7 phy
|
|
|
|
|
lda #'-'
|
|
|
|
|
>SYSCALL PutChar.A
|
|
|
|
|
ply
|
|
|
|
|
dey
|
|
|
|
|
bne .7
|
|
|
|
|
|
|
|
|
|
.8 >PUSHW.G CSH.LineNum
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.CSHERR
|
|
|
|
|
>SYSCALL PrintF.YA
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
MAN
|
2017-07-13 15:22:13 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/SHELL.S.CSH
|
2017-03-29 15:48:15 +00:00
|
|
|
|
LOAD /A2OSX.SRC/SBIN/SHELL.S
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ASM
|