Kernel version 0.9 : KERNEL.S.ENV.txt, SHELL.....bugfix in ENV & CMD line params

This commit is contained in:
Rémy GIBERT 2017-04-03 08:01:52 +02:00
parent 0d5e4282f2
commit e868cab63d
6 changed files with 112 additions and 54 deletions

View File

@ -8,6 +8,29 @@ AUTO 6
* Y,A -> Command line (formatted & not empty)
*--------------------------------------
Cmd.ExecYA stz Cmd.Exec.Mode
pha
phy
lda #'<'
>SYSCALL PutCA
ply
pla
pha
phy
>SYSCALL PPrintFYA
lda #'>'
>SYSCALL PutCA
lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
ply
pla
Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
>STYA ZPPtr1
phx
@ -49,6 +72,17 @@ Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
pla
>SYSCALL FreeMemA
lda #'|'
>SYSCALL PutCA
>LDYA L.ARGS
>SYSCALL PPrintFYA
lda #'|'
>SYSCALL PutCA
lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
>LDYA L.CMDS
>STYA ZPPtr2
@ -63,15 +97,17 @@ Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
tay
.2 lda CMD,y
.3 cmp (ZPPtr2),y
cmp (ZPPtr2),y
bne .4
dey
bne .2
jsr .5 Found an internal Cmd...
bcs .31
bcs .3
lda #0
.31 ldy #S.PS.RC
.3 ldy #S.PS.RC
sta (pPS),y
rts
@ -86,7 +122,21 @@ Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
inc ZPPtr2+1
bra .1
.5 jmp (J.INTCMDS,x)
.5 phx
lda #'{'
>SYSCALL PutCA
>LDYA L.ARGS
>SYSCALL PPrintFYA
lda #'}'
>SYSCALL PutCA
lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
plx
jmp (J.INTCMDS,x)
*--------------------------------------
Cmd.Exec.EXT ldy #1
lda CMD,y
@ -344,7 +394,7 @@ Cmd.Exec.SET lda ARGS
>PUSHW ZPPTR1 Push name
>LDYA L.MSG.PRINTENV
>SYSCALL CPrintFYA
>SYSCALL PPrintFYA
bcs .9
lda ZPPTR2
@ -392,7 +442,7 @@ Cmd.Exec.SETVAR tax
>PUSHYA push value
>PUSHW L.ARGS push name
>LDYA L.MSG.PRINTENV
>SYSCALL CPrintFYA
>SYSCALL PPrintFYA
.8 clc
.9 rts

View File

@ -38,7 +38,7 @@ ERR.Print >PUSHA Save EC for PrintF
.8 >PUSHW ZPPTR1
>LDYA L.MSG.ERROR
>SYSCALL CPrintFYA
>SYSCALL PPrintFYA
rts
*--------------------------------------
MAN

View File

@ -173,7 +173,9 @@ HIS.SetBuf jsr CmdBuffer.CLR
dey
bpl .1
jmp CmdBuffer.PRINT
>LDYA pData
>SYSCALL PPrintfYA
rts
*--------------------------------------
HIS.Quit ldy #hCmdHistory
lda (pData),y

View File

@ -51,7 +51,7 @@ TXT.ReadFile >PUSHWI UsrBuf256+1
>PUSHW pData
>LDYA L.MSG.ECHO
>SYSCALL CPrintFYA
>SYSCALL PPrintFYA
.8 clc
.9 rts
*--------------------------------------

View File

@ -90,7 +90,7 @@ CS.INIT.INTERACTIVE
bcs .9
>LDYA L.MSG.GREETINGS
>SYSCALL CPrintFYA
>SYSCALL PPrintFYA
lda (pPs)
ora #S.PS.F.EVENT Now accept events
@ -394,12 +394,21 @@ PrintPrompt >LDYA L.ENV.PS1
pla
>SYSCALL FreeMemA
>LDYA L.MSG.PROMPT
>SYSCALL CPrintFYA
>SYSCALL PPrintFYA
.9 rts
*--------------------------------------
* Remove extra SPACE & comment
*--------------------------------------
CmdBuffer.Normalize
>LDYA pData
>SYSCALL PPrintFYA
lda #'\'
>SYSCALL PutCA
lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
>LDYA pData
>STYA ZPPtr1
@ -439,7 +448,17 @@ CmdBuffer.Normalize
.8 tya
sta (pData)
.9 rts
.9 >LDYA pData
>SYSCALL PPrintFYA
lda #'%'
>SYSCALL PutCA
lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
rts
CmdBuffer.Normalize.Next
txa
@ -451,15 +470,6 @@ CmdBuffer.Normalize.Next
.1 lda (ZPPtr1)
.8 rts
*--------------------------------------
CmdBuffer.PRINT ldy #0
.1 iny
lda (pData),y
>SYSCALL PutCA
tya
cmp (pData)
bne .1
rts
*--------------------------------------
CmdBuffer.CLR jsr CmdBuffer.DEL
bne CmdBuffer.CLR
rts
@ -495,13 +505,13 @@ CMDS >PSTR "CD"
>PSTR "TIME"
.HS 00
*--------------------------------------
MSG.GREETINGS >CSTR "\r\nA2osX-Shell\r\n\r\n"
MSG.PROMPT >CSTR "%S$ "
MSG.ECHO >CSTR ">%S\r\n"
MSG.ERROR >CSTR "Err:%S [%h]\r\n"
MSG.GREETINGS >PSTR "\r\nA2osX-Shell\r\n\r\n"
MSG.PROMPT >PSTR "%S$ "
MSG.ECHO >PSTR ">%S\r\n"
MSG.ERROR >PSTR "Err:%S [%h]\r\n"
MSG.PRINTENV >PSTR "%S=%S\r\n"
FMT.DATE >PSTR "%A, %B %d %Y"
FMT.TIME >PSTR "%H:%M:%S (%I:%M:%S%p)"
MSG.PRINTENV >CSTR "%S=%S\r\n"
*--------------------------------------
.INB /A2OSX.SRC/X.ERRORS.S
*--------------------------------------

View File

@ -383,39 +383,35 @@ ENV.SysVarsJmp .DA ENV.SysVarsArgs
.DA ENV.SysVarsPID
.DA ENV.SysVarsCPID
*--------------------------------------
ENV.SysVarsArgs
lda #1
jsr K.GetArgA Trash Ptr1
ENV.SysVarsArgs lda #1
jsr K.GetArgA
bcs ENV.SysVarsExit2
ldx KrnBuf256
>STYA ZPPtr3
.1 lda (ZPPtr1)
bcs ENV.SysVarsExit
.1 lda (ZPPtr3)
beq ENV.SysVarsExit2
ldy #0
.2 iny
inx
beq ENV.SysVarsExit make sure not overlapping buf 256
lda (ZPPtr1),y
sta KrnBuf256,x
tya
cmp (ZPPtr1)
bne .2
adc ZPPtr1 CS from beq .2
sta ZPPtr1
.2 jsr ENV.AppendPtr3ToBuf
lda (ZPPtr3)
sec
adc ZPPtr3
sta ZPPtr3
bcc .3
inc ZPPtr1+1
.3 lda #' '
inx
beq ENV.SysVarsExit make sure not overlapping buf 256
sta KrnBuf256,x
bra .1
inc ZPPtr3+1
.3 lda (ZPPtr3)
beq ENV.SysVarsExit2
ldx KrnBuf256
inx
beq ENV.SysVarsExit2 make sure not overlapping buf 256
stx KrnBuf256
lda #' '
sta KrnBuf256,x
bra .2
*--------------------------------------
ENV.SysVarsArgC jsr K.GetArgC Trash Ptr1
bra ENV.SysVarsA