Kernel 0.9.1 : SHELL, CSH style scripting.....(wip), bug fix in AToL

This commit is contained in:
Rémy GIBERT 2017-10-24 17:44:12 +02:00
parent b028f95781
commit 0c36c71384
6 changed files with 120 additions and 26 deletions

Binary file not shown.

Binary file not shown.

View File

@ -88,7 +88,7 @@ CSH.Run lda #0
bra .9 error, todo : PREOPS ++ --.....
.3 >LDYA L.CSH.KEYWORDS
jsr CSH.IsKeyword
jsr CSH.Lookup
bcs .4 not an internal CSH keyword....
txa
@ -96,7 +96,7 @@ CSH.Run lda #0
jmp (J.CSH.KEYWORDS,x)
.4 jsr CSH.GetVar Y=Ptr To Value
.4 jsr CSH.GetVar
bcs .5
@ -113,7 +113,7 @@ CSH.Run lda #0
ply
bcs .9
jsr CSH.SetVarValue
jsr CSH.StoreACCToVar
bcs .9
cmp #';'
bne .99
@ -192,7 +192,7 @@ CSH.RestorePtr >LDYA.G CSH.BufPtrSave
>STYA ZPCSHBufPtr
rts
*--------------------------------------
CSH.IsKeyword >STYA ZPPtr1
CSH.Lookup >STYA ZPPtr1
jsr CSH.GetIdentLen
@ -288,7 +288,7 @@ CSH.TYPE >STA.G CSH.ACCT
bcs .9
jsr CSH.SetVarValue Update value to this var
jsr CSH.StoreACCToVar Update value to this var
jsr CSH.GetChar
bcs .9
@ -315,7 +315,7 @@ CSH.IF jsr CSH.GetCharNB
jsr CSH.GetNextCharNB
bcs .9
jsr CSH.ExpEval
bcs .99
@ -341,6 +341,7 @@ CSH.IF jsr CSH.GetCharNB
jsr CSH.GetNextCharNB Skip '{'
>LDA.G CSH.CmdSave Push "IF" or "WHILE"
cmp #10 WHILE
beq .1 if "IF", no need to push Saved Ptr
pha
@ -417,11 +418,31 @@ CSH.ExpEval jsr CSH.ZeroACC
beq .8
jsr CSH.IsLetter Fnc or Var ?
bcs .1
bcs .5
jsr CSH.GetVar
bcs .1
jsr CSH.LoadACCFromVar
bcs .9
jsr CSH.GetCharNB
bcs .9
jsr CSH.IsOPChar
bcs .9
>LDYA L.CSH.BOPS
jsr CSH.Lookup
bra .8
.1
bra .9
.1 jsr CSH.IsDigit10 number ?
.5 jsr CSH.IsDigit10 number ?
bcs .9
jsr CSH.GetNumInACC
@ -522,6 +543,8 @@ CSH.AddVar jsr CSH.GetIdentLen
adc ZPCSHData+1
sta ZPCSHValue+1
>LDA.G CSH.ACCT
sta (ZPCSHValue)
* clc
rts
@ -530,22 +553,6 @@ CSH.AddVar jsr CSH.GetIdentLen
sec
rts
*--------------------------------------
CSH.SetVarValue >LDA.G CSH.ACCT
tax
lda CSH.TSIZE,x
tax
>LDA.G CSH.ACCT
tay
.1 lda (pData),y
sta (ZPCSHValue),y
iny
dex
bpl .1 +1 for ACCT
clc
rts
*--------------------------------------
CSH.GetVar >LDYA ZPCSHSymbols
>STYA ZPPtr1
@ -608,6 +615,63 @@ CSH.GetVar >LDYA ZPCSHSymbols
sec
rts
*--------------------------------------
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
.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
.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
*--------------------------------------
* Stack
*--------------------------------------
CSH.Push pha
@ -662,6 +726,18 @@ CSH.CheckStack pha
*--------------------------------------
* CHAR related Subs.....
*--------------------------------------
CSH.GetOPLen ldy #0
.1 iny
lda (ZPCSHBufPtr),y
beq .8
jsr CSH.IsOPChar
bcc .1
.8 tya
rts
*--------------------------------------
CSH.GetIdentLen ldy #0
.1 iny
@ -711,6 +787,18 @@ CSH.GetChar lda (ZPCSHBufPtr)
sec
rts
*---------------------------------------
CSH.IsOPChar ldx #OPChars.Count-1
.1 cmp CSH.OPChars,x
beq .8
dex
bpl .1
sec
rts
.8 clc
rts
*---------------------------------------
CSH.IsLetterOrDigit
jsr CSH.IsDigit10
bcc CSH.IsLetterRTS

View File

@ -34,6 +34,7 @@ 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
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -83,6 +84,7 @@ J.INTCMDS .DA Cmd.Exec.CD
.DA Cmd.Exec.SLEEP
.DA Cmd.Exec.STARTPROC
.DA Cmd.Exec.TIME
L.CSH.BOPS .DA CSH.BOPS
L.CSH.KEYWORDS .DA CSH.KEYWORDS
J.CSH.KEYWORDS .DA CSH.CHAR
.DA CSH.INT
@ -549,6 +551,7 @@ CSH.KEYWORDS >PSTR "char"
>PSTR "case"
.HS 00
*--------------------------------------
OPChars.Count .EQ 14
CSH.OPChars >PSTR "!~+-*/%=&|^&<>"
*--------------------------------------
MSG.GREETINGS >CSTR "\r\nA2osX-Shell 0.9.1\r\n\r\n"
@ -565,7 +568,7 @@ FMT.TIME >CSTR "%H:%M:%S (%I:%M:%S%p)"
EscChars.Count .EQ 4
EscChars .AS 'DBAC'
CSH.TSIZE .HS 0001020405 00,CHAR,INT,LONG,FLOAT....
CSH.TSIZE .HS 0001020405 VOID,CHAR,INT,LONG,FLOAT....
*--------------------------------------
.DUMMY
.OR 0

View File

@ -48,7 +48,8 @@ K.IrqHandlerAuxLC
rti
.2
* bra * BRK
pla pull P
bra *
lda .12+1

View File

@ -169,6 +169,7 @@ STDLIB.32.T10 ldx #3
bcs .9 overflow!!!
ldx #0
phy
ldy #4
* clc
@ -179,6 +180,7 @@ STDLIB.32.T10 ldx #3
inx
dey
bne .2
ply
bcs .99 overflow!!!