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

View File

@ -34,6 +34,7 @@ CSH.E.NOVERFLW .EQ $7D
CSH.E.OOM .EQ $7C CSH.E.OOM .EQ $7C
CSH.E.DUP .EQ $7B CSH.E.DUP .EQ $7B
CSH.E.UNDEF .EQ $7A CSH.E.UNDEF .EQ $7A
CSH.E.TMISMATCH .EQ $79
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -83,6 +84,7 @@ J.INTCMDS .DA Cmd.Exec.CD
.DA Cmd.Exec.SLEEP .DA Cmd.Exec.SLEEP
.DA Cmd.Exec.STARTPROC .DA Cmd.Exec.STARTPROC
.DA Cmd.Exec.TIME .DA Cmd.Exec.TIME
L.CSH.BOPS .DA CSH.BOPS
L.CSH.KEYWORDS .DA CSH.KEYWORDS L.CSH.KEYWORDS .DA CSH.KEYWORDS
J.CSH.KEYWORDS .DA CSH.CHAR J.CSH.KEYWORDS .DA CSH.CHAR
.DA CSH.INT .DA CSH.INT
@ -549,6 +551,7 @@ CSH.KEYWORDS >PSTR "char"
>PSTR "case" >PSTR "case"
.HS 00 .HS 00
*-------------------------------------- *--------------------------------------
OPChars.Count .EQ 14
CSH.OPChars >PSTR "!~+-*/%=&|^&<>" CSH.OPChars >PSTR "!~+-*/%=&|^&<>"
*-------------------------------------- *--------------------------------------
MSG.GREETINGS >CSTR "\r\nA2osX-Shell 0.9.1\r\n\r\n" 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.Count .EQ 4
EscChars .AS 'DBAC' EscChars .AS 'DBAC'
CSH.TSIZE .HS 0001020405 00,CHAR,INT,LONG,FLOAT.... CSH.TSIZE .HS 0001020405 VOID,CHAR,INT,LONG,FLOAT....
*-------------------------------------- *--------------------------------------
.DUMMY .DUMMY
.OR 0 .OR 0

View File

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

View File

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