Kernel 0.92+

This commit is contained in:
Rémy GIBERT 2019-02-07 16:52:25 +00:00
parent 4f34d9e7c1
commit 086ceb7f8f
6 changed files with 199 additions and 56 deletions

Binary file not shown.

View File

@ -4,6 +4,7 @@ AUTO 4,1
.LIST OFF
*--------------------------------------
CSH.OPChars .AS "!~+-*/%=&|^&<>"
CSH.OPChars.Cnt .EQ *-CSH.OPChars
*--------------------------------------
* Pre Operators: + - ! ~ ++ --
*--------------------------------------

View File

@ -371,12 +371,12 @@ CSH.FnEval jsr CSH.GetCharNB
bne .99
inc ZPPtr1 advance to next arg
beq .7
bne .4
inc ZPPtr1+1
lda (ZPPtr1)
.4 lda (ZPPtr1) no more arg in fn definition
beq .7
.4 jsr CSH.GetNextCharNB
jsr CSH.GetNextCharNB
bcs .9
cmp #','
@ -388,10 +388,11 @@ CSH.FnEval jsr CSH.GetCharNB
bcs .9
cmp #')'
bne .9
jsr CSH.GetNextCharNB Skip )
* TO DO : Execute
jsr CSH.GetNextCharNB Skip )
clc
rts
@ -585,7 +586,7 @@ CSH.Lookup phy Y = len
CSH.GetNumInACC >LDA.G CSH.ACCT
cmp #CSH.T.FLOAT
bcc .1
>PUSHWI ZPFileBufPtr
>LDYA ZPFileBufPtr
@ -1028,7 +1029,7 @@ CSH.GetChar lda (ZPFileBufPtr)
sec
rts
*---------------------------------------
CSH.IsOPChar ldx #13
CSH.IsOPChar ldx #CSH.OPChars.Cnt-1
.1 cmp CSH.OPChars,x
beq .8

View File

@ -200,7 +200,7 @@ CORE.ExecCmd ldy #$ff
bra .12
.11 >PUSHW ZPArgVBuf
>LDYA L.CORE.INT
>LDYA L.CORE.CMD
jsr Lookup no / found, search internal...
bcc .13 not internal
@ -228,11 +228,53 @@ CORE.ExecCmd ldy #$ff
bmi CORE.ExecExtCmd
tax
jmp (J.CMD,x)
jmp (J.CORE.CMD,x)
.8 clc
.9 rts
*--------------------------------------
CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
>STYA ZPInputCmdPtr
jsr CORE.GetCharNB
bcs CORE.Run.RTS Ending 0, CS,A=0
cmp #'#' commented line?
bne .2
.1 jsr CORE.GetNextCharNB
bcs CORE.Run.RTS A=0, CS
eor #C.CR
bne .1
rts EOL, CC,A=0
.2 cmp #'.'
bne .3
ldy #1
lda (ZPInputBufPtr),y
cmp #C.SPACE
bne .1
>LDA.G CORE.PSFlags yes, child process will run in same ENV
and #$ff^S.PS.F.DUPENV
sta (pData),y
jsr CORE.GetNextCharNB skip ". "
bcs CORE.Run.RTS nothing to execute...
.3 >LDYA L.CORE.CMD internal command ?
jsr CORE.Lookup
bcs .4
jmp (J.CORE.CMD,x)
.4
.8 clc
CORE.Run.RTS rts
*--------------------------------------
CORE.ExecExtCmd >PUSHB.G CORE.PSFlags
>LDYA ZPArgVBuf
>SYSCALL execv
@ -305,6 +347,116 @@ CORE.GetArgX >LDYA ZPArgVBuf
.8 clc
rts
.9 sec
rts
*--------------------------------------
* search ZPInputBufPtr in Y,A table
*
*--------------------------------------
CORE.Lookup >STYA ZPPtr1
ldx #0
.1 phx
ldy #$ff
.2 iny
lda (ZPInputBufPtr),y
beq .3 Src Keyword end
jsr CORE.IsSep
bcc .3 Src Keyword end
lda (ZPPtr1),y
beq .4 Table Keyword end
cmp (ZPInputBufPtr),y
beq .2
bra .4
.3 lda (ZPPtr1),y
bne .4
plx
tya
sec
adc ZPInputBufPtr
sta ZPInputBufPtr
bcc .8
clc
inc ZPInputBufPtr+1
.8 rts
.4 inc ZPPtr1
bne .5
inc ZPPtr1+1
.5 lda (ZPPtr1)
bne .4
inc ZPPtr1
bne .6
inc ZPPtr1+1
.6 plx
inx
inx
lda (ZPPtr1) Array Ending 0, must be an external Cmd....
bne .1
lda #E.CSYN
sec
rts
*--------------------------------------
CORE.IsSep cmp #C.SPACE
beq .8
cmp #';'
beq .8
cmp #'|'
beq .8
sec
rts
.8 clc
rts
*--------------------------------------
CORE.GetCharNB jsr CORE.GetChar
bcs CORE.GetNextCharNB.RTS
jsr CORE.CheckCharNB
bcc CORE.GetNextCharNB.RTS
*--------------------------------------
CORE.GetNextCharNB
jsr CORE.GetNextChar
bcs CORE.GetNextCharNB.RTS
jsr CORE.CheckCharNB
bcs CORE.GetNextCharNB
CORE.GetNextCharNB.RTS
rts
*--------------------------------------
CORE.CheckCharNB
cmp #C.SPACE
beq .9
cmp #C.LF
beq .9
cmp #C.TAB
beq .9
clc
.9 rts
*--------------------------------------
CORE.GetNextChar
inc ZPInputBufPtr
bne CORE.GetChar
inc ZPInputBufPtr+1
*--------------------------------------
CORE.GetChar lda (ZPInputBufPtr)
beq .9
clc
rts
.9 sec
rts
*--------------------------------------

View File

@ -4,7 +4,7 @@ AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/SHELL
.TF BIN/SH
*--------------------------------------
History.MAX .EQ 256
CORE.STACK.MAX .EQ 64
@ -110,17 +110,8 @@ J.ESC .DA CL.BS left arrow
.DA HIS.GetNext
.DA HIS.GetPrev
.DA CL.NAK right arow
L.CORE.IO .DA CORE.IO
J.CORE.IO .DA CORE.IO.AMP
.DA CORE.IO.IN
.DA CORE.IO.OUTA
.DA CORE.IO.OUT
.DA CORE.IO.1OUTA
.DA CORE.IO.1OUT
.DA CORE.IO.2OUTA
.DA CORE.IO.2OUT
L.CORE.INT .DA CORE.INT
J.CMD .DA CMD.NOHUP
L.CORE.CMD .DA CORE.CMD
J.CORE.CMD .DA CMD.NOHUP
.DA CMD.CD
.DA CMD.DATE
.DA CMD.ECHO
@ -147,6 +138,15 @@ J.CMD .DA CMD.NOHUP
.DA CMD.IF
.DA CMD.ELSE
.DA CMD.FI
L.CORE.IO .DA CORE.IO
J.CORE.IO .DA CORE.IO.AMP
.DA CORE.IO.IN
.DA CORE.IO.OUTA
.DA CORE.IO.OUT
.DA CORE.IO.1OUTA
.DA CORE.IO.1OUT
.DA CORE.IO.2OUTA
.DA CORE.IO.2OUT
L.EXP.BEGIN .DA EXP.BEGIN
L.EXP.OP.UNARY .DA EXP.OP.UNARY
J.EXP.OP.UNARY .DA EXP.OP.UNARY.D
@ -313,14 +313,7 @@ CS.RUN.INTERACTIVE
txa
>STA.G hInputBuf
.7 jsr CORE.GetCmd
bcs .8
lda (ZPArgVBuf)
beq .8
jsr CORE.Exec
bcc .7
.7 jsr CORE.Run
.8 jmp CS.RUN.LOOP.END
*--------------------------------------
@ -380,7 +373,7 @@ CS.RUN.BATCH >SYSCALL GetChar
clc
jmp CS.RUN.LOOP.END
.2 jsr CORE.GetCmd
.2 jsr CORE.Run
bcc .7
lda #$ff
@ -389,20 +382,15 @@ CS.RUN.BATCH >SYSCALL GetChar
clc
bra CS.RUN.LOOP.END
.7 lda (ZPArgVBuf)
beq CS.RUN.LOOP.80
.7 >LDA.G bSET.X
* beq .8
>LDA.G bSET.X
beq .8
* >PUSHW ZPArgVBuf
* >PUSHBI 2
* >LDYA L.MSG.TRACE
* >SYSCALL printf
>PUSHW ZPArgVBuf
>PUSHBI 2
>LDYA L.MSG.TRACE
>SYSCALL printf
bcs .9
.8 jsr CORE.Exec
* bcs .9
CS.RUN.LOOP.END ldy #S.PS.RC
sta (pPs),y
@ -576,19 +564,7 @@ ENV.PS1 .AZ "PS1"
ENV.HOME .AZ "HOME"
HOME.PROFILE .AZ "${HOME}PROFILE"
*--------------------------------------
* https://www.tldp.org/LDP/abs/html/io-redirection.html
*--------------------------------------
CORE.IO .AZ "&"
.AZ "<"
.AZ ">>"
.AZ ">"
.AZ "1>>"
.AZ "1>"
.AZ "2>>"
.AZ "2>"
.HS 00
*--------------------------------------
CORE.INT .AZ "NOHUP"
CORE.CMD .AZ "NOHUP"
.AZ "CD"
.AZ "DATE"
.AZ "ECHO"
@ -617,6 +593,18 @@ CORE.INT .AZ "NOHUP"
.AZ "FI"
.HS 00
*--------------------------------------
* https://www.tldp.org/LDP/abs/html/io-redirection.html
*--------------------------------------
CORE.IO .AZ "&"
.AZ "<"
.AZ ">>"
.AZ ">"
.AZ "1>>"
.AZ "1>"
.AZ "2>>"
.AZ "2>"
.HS 00
*--------------------------------------
EXP.BEGIN .AZ "!["
.AZ "["
.HS 00

View File

@ -14,10 +14,11 @@ AUTO 4,1
* ## RETURN VALUE
* On stack (float)
*\--------------------------------------
K.strtof jsr K.AToF.I
K.strtof >STYA TXTPTR Ptr to source string
>PULLW ZPPtr1
jsr K.AToF.I
lda TXTPTR
sta (ZPPtr1)
ldy #1