Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-09-17 08:16:45 +02:00
parent 5ce201567b
commit 5916df2322
6 changed files with 195 additions and 85 deletions

Binary file not shown.

Binary file not shown.

View File

@ -300,6 +300,7 @@ C.FF .EQ 12
C.CR .EQ 13 C.CR .EQ 13
C.FS .EQ 21 C.FS .EQ 21
C.ESC .EQ 27 C.ESC .EQ 27
C.SPACE .EQ 32
C.DEL .EQ 127 C.DEL .EQ 127
*-------------------------------------- *--------------------------------------
DEVID.NULL .EQ 0 DEVID.NULL .EQ 0

View File

@ -128,6 +128,11 @@ CL.Insert >LDA.G CmdBuflen
txa txa
sta (ZPCMDBuf),y sta (ZPCMDBuf),y
>LDA.G bSecureRead
bpl .2
ldx #'*'
.2 txa
>SYSCALL PutChar >SYSCALL PutChar
>INC.G CmdBufPtr >INC.G CmdBufPtr
@ -156,7 +161,6 @@ CL.RESET lda #0
>STA.G bCmdBufexec >STA.G bCmdBufexec
>STA.G CmdBufPtr >STA.G CmdBufPtr
>STA.G CmdBuflen >STA.G CmdBuflen
>STA.G bSecureRead Clear password mode
rts rts
*-------------------------------------- *--------------------------------------
CL.BS >LDA.G CmdBufPtr CL.BS >LDA.G CmdBufPtr

View File

@ -71,7 +71,7 @@ Cmd.Parse.NextC lda (ZPPtr1)
*-------------------------------------- *--------------------------------------
* ZPCMDBuf-> Command line (formatted & not empty) * ZPCMDBuf-> Command line (formatted & not empty)
*-------------------------------------- *--------------------------------------
Cmd.Exec lda #0 CMD.Exec lda #0
>STA.G CMD.bStartProc >STA.G CMD.bStartProc
>STA.G CMD.hFullpath >STA.G CMD.hFullpath
@ -88,7 +88,7 @@ Cmd.Exec lda #0
txa txa
>STA.G CMD.hCmdLine >STA.G CMD.hCmdLine
>LDYA L.INTCMDS >LDYA L.CMD.INT
>STYA ZPPtr2 >STYA ZPPtr2
ldx #0 ldx #0
@ -136,8 +136,8 @@ Cmd.Exec lda #0
inc ZPPtr2+1 inc ZPPtr2+1
bra .3 bra .3
.8 jsr Cmd.Exec.Split X unmodified .8 jsr Cmd.Exec.GetArgs X unmodified
jmp (J.INTCMDS,x) Found an internal Cmd... jmp (J.CMD.INT,x) Found an internal Cmd...
*-------------------------------------- *--------------------------------------
Cmd.Exec.Done php Cmd.Exec.Done php
pha pha
@ -152,7 +152,7 @@ Cmd.Exec.Done php
plp plp
rts rts
*-------------------------------------- *--------------------------------------
Cmd.Exec.EXT jsr Cmd.Exec.Split Cmd.Exec.EXT jsr Cmd.Exec.GetArgs
lda (ZPPtr1) lda (ZPPtr1)
cmp #'/' Command line is already full path, no search cmp #'/' Command line is already full path, no search
@ -490,7 +490,8 @@ Cmd.Exec.READ lda (ZPPtr2)
lda #0 lda #0
>STA.G bSecureRead >STA.G bSecureRead
>STA.G CMD.VarName.LEN
lda pData lda pData
clc clc
adc #CMD.VarName adc #CMD.VarName
@ -499,85 +500,100 @@ Cmd.Exec.READ lda (ZPPtr2)
adc #0 adc #0
sta ZPPTR1+1 sta ZPPTR1+1
ldy #0 .1 lda (ZPPtr2)
.1 lda (ZPPtr2),y
beq .8 beq .8
iny
cmp #' ' cmp #' '
beq .1 bne .11
cmp #'-' jsr Cmd.Exec.GetNextP2
bra .1
.11 cmp #'-'
bne .7 bne .7
lda (ZPPtr2),y jsr Cmd.Exec.GetNextP2
beq .9 beq .9
iny
cmp #'S' cmp #'S'
bne .2 bne .2
lda #$80 lda #$80
>STA.G bSecureRead >STA.G bSecureRead
jsr Cmd.Exec.GetNextP2
beq .8
cmp #' '
bne .9
bra .1 bra .1
.2 cmp #'P' .2 cmp #'P'
bne .9 bne .9
lda (ZPPtr2),y jsr Cmd.Exec.GetNextP2
beq .9 beq .9
iny
cmp #' ' cmp #' '
bne .9 bne .9
lda (ZPPtr2),y jsr Cmd.Exec.GetNextP2
beq .9 beq .9
iny
cmp #'"' cmp #'"'
bne .9 bne .9
.3 lda (ZPPtr2),y .3 jsr Cmd.Exec.GetNextP2
beq .9 beq .9
iny
cmp #'"' cmp #'"'
beq .1 beq .1
phy
>SYSCALL PutChar >SYSCALL PutChar
ply
bcs .99 bcs .99
bra .3 bra .3
.9 jmp Cmd.Exec.ERRSYN .9 jmp Cmd.Exec.ERRSYN
.70 lda (ZPPtr2),y .7 >LDA.G CMD.VarName.LEN
cmp #VarLen.MAX
beq .9
pha
inc
sta (pData),y
ply
lda (ZPPtr2)
sta (ZPPTR1),y
iny
lda #0
sta (ZPPTR1),y
jsr Cmd.Exec.GetNextP2
beq .1
cmp #' ' cmp #' '
beq .1 beq .1
.7 lda (ZPPTR1) bra .7
cmp #VarLen.MAX
beq .9
inc
sta (ZPPTR1)
tay
lda (ZPPtr2),y
sta (ZPPTR1),y
bne .70
.8 lda (ZPPTR1) No var name ? SYNERR .8 >LDA.G CMD.VarName.LEN No var name ? SYNERR
beq .9 beq .9
lda #$ff
>STA.G bReadMode
clc clc
.99 jmp Cmd.Exec.Done .99 jmp Cmd.Exec.Done
*-------------------------------------- *--------------------------------------
Cmd.Exec.SLEEP lda (ZPPtr2) Cmd.Exec.SLEEP lda (ZPPtr2)
beq .9 beq .9
>PUSHW ZPPtr2 >LDYA ZPPtr2
>PUSHEA.G Sleep
>SYSCALL AToL >SYSCALL AToL
bcs .9 bcs .9
>PULLL.G Sleep
jmp Cmd.Exec.Done jmp Cmd.Exec.Done
.9 jmp Cmd.Exec.ERRSYN .9 jmp Cmd.Exec.ERRSYN
*-------------------------------------- *--------------------------------------
@ -591,7 +607,48 @@ Cmd.Exec.EXIT lda #$FF
clc clc
jmp Cmd.Exec.Done jmp Cmd.Exec.Done
*-------------------------------------- *--------------------------------------
Cmd.Exec.Split ldy #$ff CMD Len Cmd.Exec.IF >STZ.G CMD.IFNOT
lda (ZPPtr2)
beq .9
cmp #'!'
bne .1
lda #$ff
sta (pData),y Y = #CMD.IFNOT
jsr Cmd.Exec.GetNextP2NB
beq .9
cmp #'('
bne .9
jsr Cmd.Exec.GetNextP2NB
beq .9
cmp #'-' -d -e -f
bne .1
jsr Cmd.Exec.GetNextP2NB
beq .9
.1 >DEBUG
>LDYA ZPPtr2
>SYSCALL puts
jmp Cmd.Exec.Done
.9 jmp Cmd.Exec.ERRSYN
*--------------------------------------
Cmd.Exec.GetArgs
ldy #$ff CMD Len
.1 iny .1 iny
lda (ZPPtr1),y Get CMD char... lda (ZPPtr1),y Get CMD char...
@ -611,8 +668,36 @@ Cmd.Exec.Split ldy #$ff CMD Len
lda ZPPtr1+1 lda ZPPtr1+1
adc #0 adc #0
sta ZPPtr2+1 ZPPtr2->ARGS or CMD ending 0 if empty sta ZPPtr2+1 ZPPtr2->ARGS or CMD ending 0 if empty
* >LDYA L.CMD.IOR
* >STYA ZPPtr2
* ldx #0
*.3 lda (ZPPtr2)
rts rts
*-------------------------------------- *--------------------------------------
Cmd.Exec.GetArg1
*--------------------------------------
Cmd.Exec.GetNextP2NB
.1 jsr Cmd.Exec.GetNextP2
beq .9
cmp #C.SPACE
beq .1
.9 rts
*--------------------------------------
Cmd.Exec.GetNextP2
inc ZPPtr2
bne .1
inc ZPPtr2+1
.1 lda (ZPPtr2)
rts
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/SBIN/SHELL.S.CMD SAVE /A2OSX.SRC/SBIN/SHELL.S.CMD
LOAD /A2OSX.SRC/SBIN/SHELL.S LOAD /A2OSX.SRC/SBIN/SHELL.S

View File

@ -13,11 +13,13 @@ AUTO 4,1
ZPPtr1 .EQ ZPBIN ZPPtr1 .EQ ZPBIN
ZPPtr2 .EQ ZPBIN+2 ZPPtr2 .EQ ZPBIN+2
ZPCMDBuf .EQ ZPBIN+4 ZPCMDBuf .EQ ZPBIN+4
ZPCSHBufPtr .EQ ZPBIN+6 ZPArg1Buf .EQ ZPBIN+6
ZPCSHSymbols .EQ ZPBIN+8 ZPArg2Buf .EQ ZPBIN+8
ZPCSHData .EQ ZPBIN+10 ZPCSHBufPtr .EQ ZPBIN+10
ZPCSHValue .EQ ZPBIN+12 ZPCSHSymbols .EQ ZPBIN+12
ZPCSHStack .EQ ZPBIN+14 ZPCSHData .EQ ZPBIN+14
ZPCSHValue .EQ ZPBIN+16
ZPCSHStack .EQ ZPBIN+18
*-------------------------------------- *--------------------------------------
CmdLine.MAX .EQ 255 CmdLine.MAX .EQ 255
VarLen.MAX .EQ 15 VarLen.MAX .EQ 15
@ -29,11 +31,12 @@ CS.START cld
jmp (.1,x) jmp (.1,x)
.DA #$61 6502,Level 1 (65c02) .DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1 .DA #1 BIN Layout Version 1
.DA 0 .DA #S.PS.F.EVENT S.PS.F
.DA #0
.DA CS.END-CS.START CS .DA CS.END-CS.START CS
.DA DS.END-DS.START DS .DA DS.END-DS.START DS
.DA #64 SS .DA #64 SS
.DA #16 ZP .DA #20 ZP
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
* Relocation Table * Relocation Table
@ -60,11 +63,13 @@ J.ESC .DA CL.BS left arrow
.DA HIS.GetNext .DA HIS.GetNext
.DA HIS.GetPrev .DA HIS.GetPrev
.DA CL.NAK right arow .DA CL.NAK right arow
L.INTCMDS .DA INTCMDS L.CMD.INT .DA CMD.INT
J.INTCMDS .DA Cmd.Exec.CD L.CMD.IOR .DA CMD.IOR
J.CMD.INT .DA Cmd.Exec.CD
.DA Cmd.Exec.DATE .DA Cmd.Exec.DATE
.DA Cmd.Exec.ECHO .DA Cmd.Exec.ECHO
.DA Cmd.Exec.EXIT .DA Cmd.Exec.EXIT
.DA Cmd.Exec.IF
.DA Cmd.Exec.PAUSE .DA Cmd.Exec.PAUSE
.DA Cmd.Exec.PWD .DA Cmd.Exec.PWD
.DA Cmd.Exec.READ .DA Cmd.Exec.READ
@ -172,7 +177,8 @@ CS.RUN >LDA.G bReadMode READ Command ?
jmp CS.RUN.BATCH jmp CS.RUN.BATCH
*-------------------------------------- *--------------------------------------
.10 jsr CL.RESET reset CmdBuf .10 jsr CL.RESET reset CmdBuf
>STA.G bSecureRead Clear password mode
.12 jsr CL.PrintPrompt .12 jsr CL.PrintPrompt
bcs .9 bcs .9
@ -213,9 +219,8 @@ CS.RUN >LDA.G bReadMode READ Command ?
sec sec
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN.READ lda #0 reset Buffer CS.RUN.READ jsr CL.RESET reset CmdBuf
sta (ZPCMDBuf)
.1 >SLEEP .1 >SLEEP
>SYSCALL GetChar >SYSCALL GetChar
bcs .1 no char bcs .1 no char
@ -225,11 +230,19 @@ CS.RUN.READ lda #0 reset Buffer
>LDA.G bCmdBufExec >LDA.G bCmdBufExec
bpl .1 bpl .1
>STZ.G bReadMode
lda (ZPCMDBuf)
beq .8
>PUSHW ZPCMDBuf >PUSHW ZPCMDBuf
>LEA.G CMD.VarName >LEA.G CMD.VarName
>SYSCALL SetEnv >SYSCALL SetEnv
rts rts
.8 clc
rts
*-------------------------------------- *--------------------------------------
CS.RUN.BATCH >SYSCALL GetChar CS.RUN.BATCH >SYSCALL GetChar
bcs .2 bcs .2
@ -268,12 +281,12 @@ CS.RUN.BATCH >SYSCALL GetChar
.7 >LDA.G bCmdBufExec .7 >LDA.G bCmdBufExec
bpl .8 Empty line....nothing to do.... bpl .8 Empty line....nothing to do....
jsr Cmd.Parse jsr CMD.Parse
lda (ZPCMDBuf) lda (ZPCMDBuf)
beq .8 beq .8
jsr Cmd.Exec jsr CMD.Exec
bcs .8 bcs .8
lda #0 lda #0
@ -339,36 +352,6 @@ SetPWD ldy #S.PS.hPREFIX
*-------------------------------------- *--------------------------------------
CS.END CS.END
*-------------------------------------- *--------------------------------------
ENV.PATH .AZ "PATH"
ENV.PWD .AZ "PWD"
ENV.PS1 .AZ "PS1"
ENV.HOME .AZ "HOME"
*--------------------------------------
* https://www.tldp.org/LDP/abs/html/io-redirection.html
*--------------------------------------
CMD. .AZ "&"
.AZ "|"
.AZ "<"
.AZ ">"
.AZ ">>"
.AZ "1>"
.AZ "1>>"
.AZ "2>"
.AZ "2>>"
*--------------------------------------
INTCMDS .AZ "CD"
.AZ "DATE"
.AZ "ECHO"
.AZ "EXIT"
.AZ "PAUSE"
.AZ "PWD"
.AZ "READ"
.AZ "SET"
.AZ "SLEEP"
.AZ "STARTPROC"
.AZ "TIME"
.HS 00
*--------------------------------------
MSG.GREETINGS .AZ "\r\nA2osX-Shell %d.%d\r\n\r\n" MSG.GREETINGS .AZ "\r\nA2osX-Shell %d.%d\r\n\r\n"
MSG.PROMPT .AZ "\e[7h$ " MSG.PROMPT .AZ "\e[7h$ "
MSG.ECHO .AS ">%s" MSG.ECHO .AS ">%s"
@ -378,6 +361,41 @@ MSG.PRINTENV .AZ "%s=%s\r\n"
MSG.CSHERR .AZ "^\r\nLine #%D:" MSG.CSHERR .AZ "^\r\nLine #%D:"
FMT.DATE .AZ "%A (%w), %B %d %Y" FMT.DATE .AZ "%A (%w), %B %d %Y"
FMT.TIME .AZ "%H:%M:%S (%I:%M:%S%p)" FMT.TIME .AZ "%H:%M:%S (%I:%M:%S%p)"
*--------------------------------------
ENV.PATH .AZ "PATH"
ENV.PWD .AZ "PWD"
ENV.PS1 .AZ "PS1"
ENV.HOME .AZ "HOME"
*--------------------------------------
* https://www.tldp.org/LDP/abs/html/io-redirection.html
*--------------------------------------
CMD.IOR .AZ "&"
.AZ "|"
.AZ "<"
.AZ ">>"
.AZ ">"
.AZ "1>>"
.AZ "1>"
.AZ "2>>"
.AZ "2>"
.HS 00
*--------------------------------------
CMD.INT .AZ "CD"
.AZ "DATE"
.AZ "ECHO"
.AZ "EXIT"
.AZ "IF"
.AZ "PAUSE"
.AZ "PWD"
.AZ "READ"
.AZ "SET"
.AZ "SLEEP"
.AZ "STARTPROC"
.AZ "TIME"
.HS 00
*--------------------------------------
CMD.IF.Chars .AS "def"
CMD.IF.Chars.Cnt .EQ *-CMD.IF.Chars
*-------------------------------------- *--------------------------------------
.INB /A2OSX.SRC/SBIN/SHELL.C.CSH .INB /A2OSX.SRC/SBIN/SHELL.C.CSH
.INB /A2OSX.SRC/X.ERRORS.S .INB /A2OSX.SRC/X.ERRORS.S
@ -406,9 +424,11 @@ Sleep .BS 4
CMD.hCmdLine .BS 1 CMD.hCmdLine .BS 1
CMD.hFullpath .BS 1 CMD.hFullpath .BS 1
CMD.bStartProc .BS 1 CMD.bStartProc .BS 1
CMD.VarName.LEN .BS 1
CMD.VarName .BS VarLen.MAX+1 CMD.VarName .BS VarLen.MAX+1
CMD.Stat .BS S.STAT CMD.Stat .BS S.STAT
CMD.Time .BS S.TIME CMD.Time .BS S.TIME
CMD.IFNOT .BS 1
HIS.hBuf .BS 1 HIS.hBuf .BS 1
HIS.Count .BS 1 HIS.Count .BS 1