Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-11-10 15:30:09 +01:00
parent 580e7b625b
commit 51c45b2074
15 changed files with 869 additions and 720 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

67
BIN/MKDIR.S.txt Normal file
View File

@ -0,0 +1,67 @@
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/MKDIR
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #0 ZP
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN lda #1
>SYSCALL ArgV
bcs .99
>SYSCALL MKDir
bcs .9
lda #0
sec
.9 rts
.99 lda #E.SYN
sec
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END
.ED
*--------------------------------------
MAN
SAVE /A2OSX.SRC/BIN/MKDIR.S
ASM

View File

@ -93,10 +93,14 @@ E.FTB .EQ $CC File Too Big Error
*--------------------------------------
* A2osX.SYSCALL Constants
*--------------------------------------
C.ETX .EQ 3 Ctrl-C
C.EOF .EQ 4 Ctrl-D
C.ENQ .EQ 5
C.BEL .EQ 7 Ctrl.G
C.BS .EQ 8
C.TAB .EQ 9
C.LF .EQ 10
C.VT .EQ 11
C.FF .EQ 12
C.CR .EQ 13
C.FS .EQ 21

View File

@ -258,6 +258,8 @@ OApple+1,OApple+2,OApple+3 to switch between screens : Kernel Log, text, DHGR.
| Name | Status | Comment |
| ---- | ------ | ------- |
| CD | Working | Improved syntax : now, 'CD ../BIN' works |
| MD | Working | Create a directory |
| RD | Working | Delete an empty directory |
| PWD | Working | |
| DATE | Working | |
| ECHO | Working | \b,\e,\f,\n,\\\ and \\% supported |
@ -324,7 +326,7 @@ note : '$VAR' does NOT expand Variable
| LSDEV | Working | Dump device Drivers | 0.92 |
| LSOF | Working | List Open Files | 0.92 |
| PS | Working | List Processes| 0.92 |
| MD | Working | Make Directory| 0.92 |
| MKDIR | Working | Make Directory| 0.92 |
| LS | Working | -A : Do Not Print . & .. | 0.92 |
| | | -L : long listing with size/date... | |
| | | -R : Recurse subdirectories | |

View File

@ -3,11 +3,8 @@ PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
CSH.hBuf .BS 1
CSH.BufPtrSave .BS 2
CSH.LineNum .BS 2
CSH.hSymbols .BS 1
CSH.SymbolsPtr .BS 1

54
SBIN/SHELL.R.CSH.txt Normal file
View File

@ -0,0 +1,54 @@
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
L.CSH.BOPS .DA CSH.BOPS
J.CSH.BOPS .DA CSH.BOPS.ADD
.DA CSH.BOPS.SUB
.DA CSH.BOPS.MUL
.DA CSH.BOPS.DIV
.DA CSH.BOPS.MOD
.DA CSH.BOPS.SHL
.DA CSH.BOPS.SHR
.DA CSH.BOPS.L
.DA CSH.BOPS.G
.DA CSH.BOPS.LE
.DA CSH.BOPS.GE
.DA CSH.BOPS.EQ
.DA CSH.BOPS.NE
.DA CSH.BOPS.AND
.DA CSH.BOPS.OR
.DA CSH.BOPS.EOR
.DA CSH.BOPS.LAND
.DA CSH.BOPS.LOR
L.CSH.FN .DA CSH.FN
L.CSH.KW .DA CSH.KW
L.CSH.STYPES .DA CSH.STYPES
J.CSH.KW .DA CSH.IF
.DA CSH.WHILE
.DA CSH.ELSE
.DA CSH.DO
.DA CSH.FOR
.DA CSH.SWITCH
.DA CSH.CASE
.DA CSH.BREAK
.DA CSH.CONTINUE
.DA CSH.FLOAT
.DA CSH.SIGNED
.DA CSH.UNSIGNED
J.CSH.STYPES .DA CSH.CHAR
.DA CSH.INT
.DA CSH.LONG
J.CSH.UTYPES .DA CSH.UCHAR
.DA CSH.UINT
.DA CSH.ULONG
J.CSH.KW.START .DA CSH.IF.START
.DA CSH.WHILE.START
J.CSH.KW.END .DA CSH.IF.END
.DA CSH.WHILE.END
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SBIN/SHELL.R.CSH
LOAD /A2OSX.SRC/SBIN/SHELL.S
ASM

View File

@ -68,15 +68,15 @@ CL.CHARIN.CTRL cpx #C.CR
>LDYA L.MSG.ECHOCRLF
>SYSCALL printf
>LDA.G CmdBufPtr
>LDA.G CL.Ptr
tay
lda #0
sta (ZPCMDBuf),y
tya
>STA.G CmdBuflen
>STA.G CL.Len
lda #$ff
>STA.G bCmdBufexec
>STA.G CL.bExec
clc
rts
@ -101,7 +101,7 @@ CL.CHARIN.CTRL cpx #C.CR
.13 clc
rts
*--------------------------------------
CL.Insert >LDA.G CmdBuflen
CL.Insert >LDA.G CL.Len
cmp #CmdLine.MAX
beq .9 Buffer full, discard...
@ -118,12 +118,12 @@ CL.Insert >LDA.G CmdBuflen
dey
phy
tya
>CMP.G CmdBufPtr
>CMP.G CL.Ptr
bne .1
ply Y=CmdBufPtr
ply Y=CL.Ptr
* >LDA.G CmdBufPtr
* >LDA.G CL.Ptr
txa
sta (ZPCMDBuf),y
@ -135,7 +135,7 @@ CL.Insert >LDA.G CmdBuflen
.2 txa
>SYSCALL PutChar
>INC.G CmdBufPtr
>INC.G CL.Ptr
jmp CL.PrintEOL
@ -154,16 +154,16 @@ CL.CLR ldy #0
lda (ZPCMDBuf),y
bne .2
jsr CL.PRINT
jsr CL.PrintCmdBuf
*--------------------------------------
CL.RESET lda #0
sta (ZPCMDBuf)
>STA.G bCmdBufexec
>STA.G CmdBufPtr
>STA.G CmdBuflen
>STA.G CL.bExec
>STA.G CL.Ptr
>STA.G CL.Len
rts
*--------------------------------------
CL.BS >LDA.G CmdBufPtr
CL.BS >LDA.G CL.Ptr
beq .9
dec
@ -173,12 +173,12 @@ CL.BS >LDA.G CmdBufPtr
>SYSCALL PutChar
.9 rts
*--------------------------------------
CL.NAK >LDA.G CmdBufPtr
>CMP.G CmdBuflen
CL.NAK >LDA.G CL.Ptr
>CMP.G CL.Len
beq .9
inc
>STA.G CmdBufPtr
>STA.G CL.Ptr
lda #C.FS
>SYSCALL PutChar
@ -186,24 +186,24 @@ CL.NAK >LDA.G CmdBufPtr
*--------------------------------------
* Erase char UNDER cursor
*--------------------------------------
CL.SUPPR >LDA.G CmdBuflen
CL.SUPPR >LDA.G CL.Len
beq CL.PrintEOL.8
>LDA.G CmdBufPtr
>LDA.G CL.Ptr
bra CL.DEL.1
*--------------------------------------
* Erase char BEFORE cursor
*--------------------------------------
CL.DEL >LDA.G CmdBuflen
CL.DEL >LDA.G CL.Len
beq CL.PrintEOL.8
>LDA.G CmdBufPtr
>LDA.G CL.Ptr
beq CL.PrintEOL.8
lda #C.BS
>SYSCALL PutChar
>DEC.G CmdBufPtr
>DEC.G CL.Ptr
CL.DEL.1 pha
@ -216,16 +216,16 @@ CL.DEL.1 pha
phy
tya
>CMP.G CmdBufLen
>CMP.G CL.Len
bne .1
pla
>DEC.G CmdBuflen
>DEC.G CL.Len
*--------------------------------------
CL.PrintEOL >LDA.G CmdBufPtr
CL.PrintEOL >LDA.G CL.Ptr
.1 >CMP.G CmdBuflen
.1 >CMP.G CL.Len
beq .2
pha
@ -239,9 +239,9 @@ CL.PrintEOL >LDA.G CmdBufPtr
.2 lda #' '
>SYSCALL PutChar
>LDA.G CmdBufPtr
>LDA.G CL.Ptr
.3 >CMP.G CmdBuflen
.3 >CMP.G CL.Len
beq .4
pha
@ -258,10 +258,380 @@ CL.PrintEOL >LDA.G CmdBufPtr
CL.PrintEOL.8 clc
rts
*--------------------------------------
CL.PRINT >LDYA ZPCMDBuf
CL.PrintCmdBuf >LDYA ZPCMDBuf
>SYSCALL printf
rts
*--------------------------------------
CL.GetLine lda (ZPFileBufPtr)
beq .9
ldy #0
.1 lda (ZPFileBufPtr),y
beq .7
cmp #C.CR
beq .6
sta (ZPCMDBuf),y
iny
cpy #CmdLine.MAX
bne .1
lda #E.SYN Line Too long !!!
* sec
rts
.6 sec skip CR
.HS 90 BCC
.7 clc
tya
adc ZPFileBufPtr
sta ZPFileBufPtr
bcc .8
inc ZPFileBufPtr+1
.8 lda #0
sta (ZPCMDBuf),y
tya
>STA.G CL.Len
lda #$ff
>STA.G CL.bExec
clc
rts
.9 lda #C.EOF
sec
rts
*--------------------------------------
CL.Trace >LDA.G bSET.X
beq .8
>PUSHW ZPCMDBuf
>PUSHBI 2
>LDYA L.MSG.TRACE
>SYSCALL printf
.8 clc
rts
*--------------------------------------
* in:
* ZPCMDBuf : CString command line
* out:
* ZPArgVBuf :
* /path/excmd\0 arg1\0 arg2\0 ... \0
* - or -
* intcmd\0 arg1\0 arg2\0 ... \0
*--------------------------------------
CL.Parse >STZ.G CMD.IntCmd
lda #S.PS.F.HOLD+S.PS.F.DUPENV
>STA.G CMD.PSFlags
>PUSHW ZPCMDBuf
>LDYA ZPCMDBuf
>SYSCALL Args2ArgV
lda #0
sta (ZPArgVBuf)
lda (ZPCMDBuf)
beq .8
.1 cmp #'#' comment ?
beq .8 yes, ignore remaining
>LDA.G CMD.IntCmd
bne .6 we already have Cmd, go check args
ldy #2
lda (ZPCMDBuf),y only one char ?
bne .2
dey
lda (ZPCMDBuf),y
cmp #'.' leading dot ?
bne .2
>LDA.G CMD.PSFlags yes, child process will run in same ENV
and #$ff^S.PS.F.DUPENV
sta (pData),y
bra .7 and skip this token
.2 jsr CL.CheckCmd
bcc .7 success, skip token, already added by CheckCmd
rts
.6 jsr CL.CheckIO
bcc .7
tay
bne .9
jsr CL.AddCmdBufTokenToArgV
bcs .9
.7 jsr CL.NextCmdBufToken
lda (ZPCMDBuf)
bne .1
.8 clc
.9 rts
*--------------------------------------
* ZPCMDBuf-> argv[] (formatted & not empty)
*--------------------------------------
CL.CheckCmd ldy #$ff
.1 iny
lda (ZPCMDBuf),y
beq .2
cmp #'/'
bne .1
>LDYA ZPCMDBuf found /, some path specified, External, no search
>SYSCALL realpath
bcs .9
txa
>STA.G CMD.hCmdLine
bra .6 go check type...
.2 >PUSHW ZPCMDBuf
>LDYA L.CMD.INT
jsr Lookup no / found, search internal...
bcs .4 not internal, search PATH
phx
plx
bne .3
>LDA.G CMD.PSFlags if STARTPROC, skip keyword...
and #$ff^S.PS.F.HOLD
sta (pData),y ...and toggle S.PS.F.HOLD flag
clc
.9 rts
.3 jsr CL.AddYAToArgV X unmodified
bcs .9
txa
>STA.G CMD.IntCmd
clc
rts
.4 >LDYAI 256 Get a buffer for found path
>SYSCALL GetMem
bcs .9
txa
>STA.G CMD.hCmdLine
>LDYA L.ENV.PATH push ENVNAME=PATH for search
>SYSCALL GetEnv get value for ENV=PATH
bcs .5 no PATH, try workdir
jsr CL.SearchExt
bcc .6 found in PATH, go check Type
.5 ldy #S.PS.hPREFIX not found, try in CD
lda (pPs),y
>SYSCALL GetMemPtr
jsr CL.SearchExt
bcs CL.CheckCmd.90
.6 >PUSHEA.G CMD.Stat
>LDA.G CMD.hCmdLine
>SYSCALL GetMemPtr
>SYSCALL STAT
bcs CL.CheckCmd.90
lda #$ff
>STA.G CMD.IntCmd
ldy #CMD.Stat+S.STAT.P.TYPE
lda (pData),y
cmp #S.FI.T.TXT
beq CL.CheckCmd.TXT
cmp #S.FI.T.BIN
beq CL.CheckCmd.BIN
cmp #S.FI.T.SYS
beq CL.CheckCmd.SYS
lda #E.SYN
sec
CL.CheckCmd.90 php
pha
>LDA.G CMD.hCmdLine
>SYSCALL FreeMem
pla
plp
CL.CheckCmd.RTS
rts
*--------------------------------------
* TXT : add "/PATH/SHELL" "/PATH/CMD"
*--------------------------------------
CL.CheckCmd.TXT lda #0
>SYSCALL ArgV
jsr CL.AddYAToArgV
bcs CL.CheckCmd.90
*--------------------------------------
* BIN : add "/PATH/CMD"
*--------------------------------------
CL.CheckCmd.BIN >LDA.G CMD.hCmdLine
>SYSCALL GetMemPtr
jsr CL.AddYAToArgV
bra CL.CheckCmd.90
*--------------------------------------
CL.CheckCmd.SYS bra *
*--------------------------------------
CL.SearchExt pha
phy
>PUSHEA.G CMD.Stat
>LDA.G CMD.hCmdLine
>SYSCALL GetMemPtr
>PUSHYA push dest full path
ply
pla
>PUSHYA push search list
>LDYA ZPCMDBuf push CMD
>SYSCALL FileSearch
rts
*--------------------------------------
CL.CheckIO >PUSHW ZPCMDBuf
>LDYA L.CL.IO
jsr Lookup
bcs .9 not a IO token...should be an arg....
phx
jsr CL.NextCmdBufToken skip this IO token
plx
jmp (J.CL.IO,x)
.9 lda #0
rts
*--------------------------------------
CL.IO.AMP >LDA.G CMD.PSFlags
and #$ff^S.PS.F.HOLD
sta (pData),y
clc
rts
CL.IO.PIPE
clc
rts
CL.IO.IN lda #O.RDONLY+O.TEXT
jsr CL.IO.Open
bcs .9
jsr IO.Set.In
jsr CL.NextCmdBufToken skip arg
clc
.9 rts
CL.IO.OUTA
CL.IO.1OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CL.IO.OUT.1
CL.IO.OUT
CL.IO.1OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CL.IO.OUT.1 jsr CL.IO.Open
bcs .9
jsr IO.Set.Out
jsr CL.NextCmdBufToken skip arg
clc
.9 rts
CL.IO.2OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CL.IO.2OUT.1
CL.IO.2OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CL.IO.2OUT.1 jsr CL.IO.Open
bcs .9
jsr IO.Set.Err
jsr CL.NextCmdBufToken skip arg
clc
.9 rts
*--------------------------------------
CL.IO.Open pha
lda (ZPCMDBuf)
beq .9 no arg left....
>PUSHWI 0 Aux type
>PUSHBI S.FI.T.TXT ftype
pla
>PUSHA flags
>LDYA ZPCMDBuf
>SYSCALL fopen
rts
.9 pla
lda #E.SYN
sec
rts
*--------------------------------------
CL.NextCmdBufToken
lda (ZPCMDBuf)
inc ZPCMDBuf
bne .1
inc ZPCMDBuf+1
.1 tax
bne CL.NextCmdBufToken
rts
*--------------------------------------
CL.AddCmdBufTokenToArgV
>LDYA ZPCmdBuf
CL.AddYAToArgV >STYA ZPPtr1
>LDYA ZPArgVBuf
>STYA ZPPtr2
.1 lda (ZPPtr2) scan to end of argV
beq .6
.2 inc ZPPtr2
bne .3
inc ZPPtr2+1
.3 lda (ZPPtr2)
bne .2
inc ZPPtr2
bne .4
inc ZPPtr2+1
.4 lda (ZPPtr2)
bne .2
.6 ldy #$ff
.7 iny
* beq .9
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .7 including str ending \0
iny
* beq .9
sta (ZPPtr2),y arg[] ending \0
clc
rts
.9 lda #E.BUF
sec
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SBIN/SHELL.S.CL
LOAD /A2OSX.SRC/SBIN/SHELL.S

View File

@ -28,274 +28,6 @@ CMD.Quit >LDA.G CMD.hArgVBuf
>SYSCALL FreeMem
.9 rts
*--------------------------------------
* in:
* ZPCMDBuf : CString command line
* out:
* ZPArgVBuf :
* /path/excmd\0 arg1\0 arg2\0 ... \0
* - or -
* intcmd\0 arg1\0 arg2\0 ... \0
*--------------------------------------
Cmd.Parse >STZ.G CMD.IntCmd
lda #S.PS.F.HOLD+S.PS.F.DUPENV
>STA.G CMD.PSFlags
>PUSHW ZPCMDBuf
>LDYA ZPCMDBuf
>SYSCALL Args2ArgV
lda #0
sta (ZPArgVBuf)
lda (ZPCMDBuf)
beq .8
.1 cmp #'#' comment ?
beq .8 yes, ignore remaining
>LDA.G CMD.IntCmd
bne .6 we already have Cmd, go check args
ldy #2
lda (ZPCMDBuf),y only one char ?
bne .2
dey
lda (ZPCMDBuf),y
cmp #'.' leading dot ?
bne .2
>lda.G CMD.PSFlags yes, child process will run in same ENV
and #S.PS.F.DUPENV
sta (pData),y
bra .7 and skip this token
.2 jsr CMD.CheckCmd
bcc .7 success, skip token, already added by CheckCmd
rts
.6 jsr CMD.CheckIO
bcc .7
tay
bne .9
jsr CMD.AddCmdBufTokenToArgV
bcs .9
.7 jsr CMD.NextCmdBufToken
lda (ZPCMDBuf)
bne .1
.8 clc
.9 rts
*--------------------------------------
* ZPCMDBuf-> argv[] (formatted & not empty)
*--------------------------------------
Cmd.CheckCmd ldy #$ff
.1 iny
lda (ZPCMDBuf),y
beq .2
cmp #'/'
bne .1
>LDYA ZPCMDBuf found /, some path specified, External, no search
>SYSCALL realpath
bcs .9
txa
>STA.G CMD.hCmdLine
bra .6 go check type...
.2 >PUSHW ZPCMDBuf
>LDYA L.CMD.INT
jsr CMD.Search no / found, search internal...
bcs .4 not internal, search PATH
phx
plx
bne .3
>LDA.G CMD.PSFlags if STARTPROC, skip keyword...
and #$ff^S.PS.F.HOLD
sta (pData),y ...and toggle S.PS.F.HOLD flag
clc
.9 rts
.3 jsr CMD.AddYAToArgV X unmodified
bcs .9
txa
>STA.G CMD.IntCmd
clc
rts
.4 >LDYAI 256 Get a buffer for found path
>SYSCALL GetMem
bcs .9
txa
>STA.G CMD.hCmdLine
>LDYA L.ENV.PATH push ENVNAME=PATH for search
>SYSCALL GetEnv get value for ENV=PATH
bcs .5 no PATH, try workdir
jsr Cmd.SearchExt
bcc .6 found in PATH, go check Type
.5 ldy #S.PS.hPREFIX not found, try in CD
lda (pPs),y
>SYSCALL GetMemPtr
jsr Cmd.SearchExt
bcs Cmd.CheckCmd.90
.6 >PUSHEA.G CMD.Stat
>LDA.G CMD.hCmdLine
>SYSCALL GetMemPtr
>SYSCALL STAT
bcs Cmd.CheckCmd.90
lda #$ff
>STA.G CMD.IntCmd
ldy #CMD.Stat+S.STAT.P.TYPE
lda (pData),y
cmp #S.FI.T.TXT
beq Cmd.CheckCmd.TXT
cmp #S.FI.T.BIN
beq Cmd.CheckCmd.BIN
cmp #S.FI.T.SYS
beq Cmd.CheckCmd.SYS
lda #E.SYN
sec
Cmd.CheckCmd.90 php
pha
>LDA.G CMD.hCmdLine
>SYSCALL FreeMem
pla
plp
Cmd.CheckCmd.RTS
rts
*--------------------------------------
* TXT : add "/PATH/SHELL" "/PATH/CMD"
*--------------------------------------
Cmd.CheckCmd.TXT
lda #0
>SYSCALL ArgV
jsr CMD.AddYAToArgV
bcs Cmd.CheckCmd.90
*--------------------------------------
* BIN : add "/PATH/CMD"
*--------------------------------------
Cmd.CheckCmd.BIN
>LDA.G CMD.hCmdLine
>SYSCALL GetMemPtr
jsr CMD.AddYAToArgV
bra Cmd.CheckCmd.90
*--------------------------------------
Cmd.CheckCmd.SYS
*--------------------------------------
bra *
*--------------------------------------
Cmd.SearchExt pha
phy
>PUSHEA.G CMD.Stat
>LDA.G CMD.hCmdLine
>SYSCALL GetMemPtr
>PUSHYA push dest full path
ply
pla
>PUSHYA push search list
>LDYA ZPCMDBuf push CMD
>SYSCALL FileSearch
rts
*--------------------------------------
CMD.CheckIO >PUSHW ZPCMDBuf
>LDYA L.CMD.IO
jsr CMD.Search
bcs .9 not a IO token...should be an arg....
phx
jsr CMD.NextCmdBufToken skip this IO token
plx
jmp (J.CMD.IO,x)
.9 lda #0
rts
*--------------------------------------
CMD.IO.AMP >LDA.G CMD.PSFlags
and #$ff^S.PS.F.HOLD
sta (pData),y
clc
rts
CMD.IO.PIPE
clc
rts
CMD.IO.IN lda #O.RDONLY+O.TEXT
jsr CMD.IO.Open
bcs .9
jsr IO.Set.In
jsr CMD.NextCmdBufToken skip arg
clc
.9 rts
CMD.IO.OUTA
CMD.IO.1OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CMD.IO.OUT.1
CMD.IO.OUT
CMD.IO.1OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CMD.IO.OUT.1 jsr CMD.IO.Open
bcs .9
jsr IO.Set.Out
jsr CMD.NextCmdBufToken skip arg
clc
.9 rts
CMD.IO.2OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CMD.IO.2OUT.1
CMD.IO.2OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CMD.IO.2OUT.1 jsr CMD.IO.Open
bcs .9
jsr IO.Set.Err
jsr CMD.NextCmdBufToken skip arg
clc
.9 rts
*--------------------------------------
CMD.IO.Open pha
lda (ZPCMDBuf)
beq .9 no arg left....
>PUSHWI 0 Aux type
>PUSHBI S.FI.T.TXT ftype
pla
>PUSHA flags
>LDYA ZPCMDBuf
>SYSCALL fopen
rts
.9 pla
lda #E.SYN
sec
rts
*--------------------------------------
* Input : ZPArgVBuf
*--------------------------------------
Cmd.Exec >LDA.G CMD.IntCmd
@ -681,7 +413,7 @@ Cmd.INT.SLEEP ldx #1
clc
rts
.9 jmp Cmd.Exec.ERRSYN
.9 jmp Cmd.Exec.ERRSYN
*--------------------------------------
Cmd.INT.PAUSE lda #$FF
>STA.G bPause
@ -693,13 +425,44 @@ Cmd.INT.EXIT lda #$FF
clc
rts
*--------------------------------------
Cmd.INT.MD ldx #1
jsr Cmd.GetArgX
bcs .9
>SYSCALL MKDir
rts
.9 jmp Cmd.Exec.ERRSYN
*--------------------------------------
Cmd.INT.RD ldx #1
jsr Cmd.GetArgX
bcs .9
phy
pha
>PUSHEA.G CMD.Stat
pla
ply
>SYSCALL STAT
bcs .99
>LDA.G CMD.Stat+S.STAT.P.TYPE
cmp #S.FI.T.DIR
bne .9
ldx #1
jsr Cmd.GetArgX
>SYSCALL Remove
.99 rts
.9 jmp Cmd.Exec.ERRSYN
*--------------------------------------
Cmd.INT.IF ldx #1
jsr Cmd.GetArgX
beq .9
>PUSHYA
>LDYA L.CMD.IF.TOKEN1
jsr CMD.Search
jsr Lookup
bcs .9
@ -716,7 +479,7 @@ Cmd.INT.IF ldx #1
>PUSHYA
>LDYA L.CMD.IF.TOKEN2 -d -e -f ?
jsr CMD.Search
jsr Lookup
bcs .1
jmp (J.CMD.IF.TOKEN2,x)
@ -734,94 +497,6 @@ CMD.IF.F
clc
rts
*--------------------------------------
CMD.NextCmdBufToken
lda (ZPCMDBuf)
inc ZPCMDBuf
bne .1
inc ZPCMDBuf+1
.1 tax
bne CMD.NextCmdBufToken
rts
*--------------------------------------
CMD.AddCmdBufTokenToArgV
>LDYA ZPCmdBuf
CMD.AddYAToArgV >STYA ZPPtr1
>LDYA ZPArgVBuf
>STYA ZPPtr2
.1 lda (ZPPtr2) scan to end of argV
beq .6
.2 inc ZPPtr2
bne .3
inc ZPPtr2+1
.3 lda (ZPPtr2)
bne .2
inc ZPPtr2
bne .4
inc ZPPtr2+1
.4 lda (ZPPtr2)
bne .2
.6 ldy #$ff
.7 iny
* beq .9
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .7 including str ending \0
iny
* beq .9
sta (ZPPtr2),y arg[] ending \0
clc
rts
.9 lda #E.BUF
sec
rts
*--------------------------------------
CMD.Search >STYA ZPPtr2
>PULLW ZPPtr1
ldx #0
.1 phx
>PUSHW ZPPtr2
>LDYA ZPPtr1
>SYSCALL StrCaseCmp
bcs .2
plx
>LDYA ZPPtr2
clc
rts
.2 inc ZPPtr2
bne .3
inc ZPPtr2+1
.3 lda (ZPPtr2)
bne .2
inc ZPPtr2
bne .4
inc ZPPtr2+1
.4 plx
inx
inx
lda (ZPPtr2) Array Ending 0, must be an external Cmd....
bne .1
sec
rts
*--------------------------------------
Cmd.GetArgX >LDYA ZPArgVBuf
dex

View File

@ -30,16 +30,6 @@ CSH.Init lda #$0
>STA.G CSH.DataPtr
>STA.G CSH.StackPtr
lda #1
>SYSCALL ArgV
>SYSCALL LoadTxtFile
bcs .9
txa
>STA.G CSH.hBuf
>SYSCALL GetMemPtr
>STYA ZPCSHBufPtr
>LDYAI 256
>SYSCALL GetMem0
bcs .9
@ -67,7 +57,7 @@ CSH.Init lda #$0
* clc
.9 rts
*--------------------------------------
CSH.Quit >LDA.G CSH.hBuf
CSH.Quit >LDA.G hFileBuf
beq .1
>SYSCALL FreeMem
@ -85,9 +75,7 @@ CSH.Quit >LDA.G CSH.hBuf
.8 rts
*--------------------------------------
CSH.Run jsr CL.RESET
jsr CSH.GetCharNB
CSH.Run jsr CSH.GetCharNB
bcs .9
cmp #'}' End of block ?
@ -158,42 +146,9 @@ CSH.Run jsr CL.RESET
jsr CSH.RestorePtr Restore ptr to get full cmd line to execute
ldy #$0
jsr CL.GetLine
bcs .99
.6 lda (ZPCSHBufPtr),y
beq .7
cmp #C.CR
beq .7
sta (ZPCMDBuf),y
iny
cpy #CmdLine.MAX
bne .6
bra .99 Line Too long !!!
.7 lda #0
sta (ZPCMDBuf),y
tya
clc
adc ZPCSHBufPtr
sta ZPCSHBufPtr
bcc .8
inc ZPCSHBufPtr+1
.8 tya
>STA.G CmdBuflen
lda #$ff
>STA.G bCmdBufexec
>LDA.G bSET.X
beq .80
>PUSHW ZPCMDBuf
>PUSHBI 2
>LDYA L.MSG.ECHO
>SYSCALL printf
.80 clc
rts
*--------------------------------------
@ -279,9 +234,9 @@ CSH.IF.END jsr CSH.GetNextChar just skip ending '}'
rts
*--------------------------------------
CSH.WHILE.END jsr CSH.Pop
sta ZPCSHBufPtr
sta ZPFileBufPtr
jsr CSH.Pop
sta ZPCSHBufPtr+1
sta ZPFileBufPtr+1
clc
rts
*--------------------------------------
@ -556,12 +511,12 @@ CSH.ExpEval jsr CSH.ZeroACC
.80 clc
rts
*--------------------------------------
CSH.SavePtr >LDYA ZPCSHBufPtr
CSH.SavePtr >LDYA ZPFileBufPtr
>STYA.G CSH.BufPtrSave
rts
*--------------------------------------
CSH.RestorePtr >LDYA.G CSH.BufPtrSave
>STYA ZPCSHBufPtr
>STYA ZPFileBufPtr
rts
*--------------------------------------
CSH.LookupFN sec
@ -596,7 +551,7 @@ CSH.Lookup phy Y = len
.2 lda (ZPPtr1),y
.3 dey
cmp (ZPCSHBufPtr),y
cmp (ZPFileBufPtr),y
bne .4
tya
@ -604,10 +559,10 @@ CSH.Lookup phy Y = len
pla Found keyword...
clc
adc ZPCSHBufPtr ..advance Ptr to char after it..
sta ZPCSHBufPtr
adc ZPFileBufPtr ..advance Ptr to char after it..
sta ZPFileBufPtr
bcc .31
inc ZPCSHBufPtr+1
inc ZPFileBufPtr+1
.31 lda ZPPtr1
sec
@ -653,8 +608,8 @@ CSH.GetNumInACC >LDA.G CSH.ACCT
cmp #CSH.T.FLOAT
bcc .1
>PUSHWI ZPCSHBufPtr
>LDYA ZPCSHBufPtr
>PUSHWI ZPFileBufPtr
>LDYA ZPFileBufPtr
>SYSCALL StrToF
bcs .9
@ -664,8 +619,8 @@ CSH.GetNumInACC >LDA.G CSH.ACCT
.1 >PUSHBI 10
>PUSHWI ZPCSHBufPtr
>LDYA ZPCSHBufPtr
>PUSHWI ZPFileBufPtr
>LDYA ZPFileBufPtr
>SYSCALL StrToL
bcs .9
@ -782,7 +737,7 @@ CSH.GetVar >LDYA ZPCSHSymbols
.2 lda (ZPPtr1),y
dey
cmp (ZPCSHBufPtr),y
cmp (ZPFileBufPtr),y
bne .3
tya
@ -802,10 +757,10 @@ CSH.GetVar >LDYA ZPCSHSymbols
txa Get back len
clc
adc ZPCSHBufPtr
sta ZPCSHBufPtr
adc ZPFileBufPtr
sta ZPFileBufPtr
bcc .8
inc ZPCSHBufPtr+1
inc ZPFileBufPtr+1
clc
.8 rts
@ -1037,7 +992,7 @@ CSH.CheckStack tax
CSH.GetOPLen ldy #0
.1 iny
lda (ZPCSHBufPtr),y
lda (ZPFileBufPtr),y
beq .8
jsr CSH.IsOPChar
@ -1049,7 +1004,7 @@ CSH.GetOPLen ldy #0
CSH.GetIDLen ldy #0
.1 iny
lda (ZPCSHBufPtr),y
lda (ZPFileBufPtr),y
beq .8
jsr CSH.IsLetterOrDigit
@ -1071,22 +1026,22 @@ CSH.GetNextCharNB
CSH.GetNextCharNB.RTS
rts
*--------------------------------------
CSH.CheckCharNB cmp #32 SPACE
CSH.CheckCharNB cmp #C.SPACE
beq .9
cmp #13 CR
cmp #C.CR
beq .9
cmp #10 LF
cmp #C.LF
beq .9
cmp #8 TAB
cmp #C.TAB
beq .9
clc
.9 rts
*--------------------------------------
CSH.GetNextChar inc ZPCSHBufPtr
CSH.GetNextChar inc ZPFileBufPtr
bne CSH.GetChar
inc ZPCSHBufPtr+1
inc ZPFileBufPtr+1
*--------------------------------------
CSH.GetChar lda (ZPCSHBufPtr)
CSH.GetChar lda (ZPFileBufPtr)
beq .9
clc
rts
@ -1139,75 +1094,6 @@ CSH.IsDigit10 cmp #'0'
.9 sec
rts
*--------------------------------------
CSH.ErrorMsg >LDA.G CSH.hBuf
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda #0
>STA.G CSH.LineNum
iny
>STA.G CSH.LineNum+1
.1 >LDYA ZPPtr1
>STYA ZPPtr2 Save actual line start
>INCW.G CSH.LineNum
.2 lda (ZPPtr1)
beq .6 EoF
inc ZPPtr1
bne .3
inc ZPPtr1+1
.3 cmp #$0D
bne .2 Scan until EoL
ldx ZPPtr1
cpx ZPCSHBufPtr
lda ZPPtr1+1
sbc ZPCSHBufPtr+1
bcc .1 not this line....
.4 ldy #0
.5 lda (ZPPtr2),y
beq .6
iny
cmp #$0D
beq .6
phy
>SYSCALL PutChar
ply
bra .5
.6 lda #$0D
>SYSCALL PutChar
lda #$0A
>SYSCALL PutChar
lda ZPCSHBufPtr
sec
sbc ZPPtr2
beq .8
tay
.7 phy
lda #'-'
>SYSCALL PutChar
ply
dey
bne .7
.8 >PUSHW.G CSH.LineNum
>PUSHBI 2
>LDYA L.MSG.CSHERR
>SYSCALL printf
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SBIN/SHELL.S.CSH
LOAD /A2OSX.SRC/SBIN/SHELL.S

View File

@ -27,7 +27,7 @@ HIS.Add >LDA.G HIS.hBuf
tya
sec add len+1
>ADC.G CmdBuflen CmdBuffer length
>ADC.G CL.Len CmdBuffer length
pla
bcc .2 enough room
@ -142,10 +142,10 @@ HIS.SetA jsr HIS.GetA
bne .2
tya
>STA.G CmdBufPtr
>STA.G CmdBuflen
>STA.G CL.Ptr
>STA.G CL.Len
jmp CL.PRINT
jmp CL.PrintCmdBuf
*--------------------------------------
HIS.GetA ldy #0

View File

@ -86,6 +86,76 @@ IO.Reset.Err >LDA.G IO.hErr
>STZ.G IO.hErr
.8 rts
*--------------------------------------
IO.PrintBatchErrMsg
>LDA.G hFileBuf
>SYSCALL GetMemPtr
>STYA ZPPtr1
stz ZPPtr3
stz ZPPtr3+1
.1 >LDYA ZPPtr1
>STYA ZPPtr2 Save actual line start
inc ZPPtr3
bne .2
inc ZPPtr3+1
.2 lda (ZPPtr1)
beq .6 EoF
inc ZPPtr1
bne .3
inc ZPPtr1+1
.3 cmp #$0D
bne .2 Scan until EoL
ldx ZPPtr1
cpx ZPFileBufPtr
lda ZPPtr1+1
sbc ZPFileBufPtr+1
bcc .1 not this line....
.4 ldy #0
.5 lda (ZPPtr2),y
beq .6
iny
cmp #$0D
beq .6
phy
>SYSCALL PutChar
ply
bra .5
.6 lda #$0D
>SYSCALL PutChar
lda #$0A
>SYSCALL PutChar
lda ZPFileBufPtr
sec
sbc ZPPtr2
beq .8
tay
.7 phy
lda #'-'
>SYSCALL PutChar
ply
dey
bne .7
.8 >PUSHW ZPPtr3
>PUSHBI 2
>LDYA L.MSG.BATCHERR
>SYSCALL printf
rts
*--------------------------------------
IO.PrintErrMsg pha Save EC for PrintF
ldx L.ERR.Codes

View File

@ -5,6 +5,8 @@ AUTO 4,1
.OP 65C02
.OR $2000
.TF SBIN/SHELL
*--------------------------------------
CSH .EQ 0
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
@ -16,11 +18,13 @@ ZPPtr2 .EQ ZPBIN+2
ZPPtr3 .EQ ZPBIN+4
ZPCMDBuf .EQ ZPBIN+6
ZPArgVBuf .EQ ZPBIN+8
ZPCSHBufPtr .EQ ZPBIN+10
ZPFileBufPtr .EQ ZPBIN+10
.DO CSH=1
ZPCSHSymbols .EQ ZPBIN+12
ZPCSHData .EQ ZPBIN+14
ZPCSHValue .EQ ZPBIN+16
ZPCSHStack .EQ ZPBIN+18
.FIN
*--------------------------------------
CmdLine.MAX .EQ 127
VarLen.MAX .EQ 15
@ -50,11 +54,11 @@ CS.START cld
*--------------------------------------
L.MSG.GREETINGS .DA MSG.GREETINGS
L.MSG.PROMPT .DA MSG.PROMPT
L.MSG.ECHO .DA MSG.ECHO
L.MSG.TRACE .DA MSG.TRACE
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
L.MSG.BATCHERR .DA MSG.BATCHERR
L.MSG.ERROR .DA MSG.ERROR
L.MSG.PRINTENV .DA MSG.PRINTENV
L.MSG.CSHERR .DA MSG.CSHERR
L.ENV.PATH .DA ENV.PATH
L.ENV.PWD .DA ENV.PWD
L.ENV.PS1 .DA ENV.PS1
@ -65,6 +69,16 @@ J.ESC .DA CL.BS left arrow
.DA HIS.GetNext
.DA HIS.GetPrev
.DA CL.NAK right arow
L.CL.IO .DA CL.IO
J.CL.IO .DA CL.IO.AMP
.DA CL.IO.PIPE
.DA CL.IO.IN
.DA CL.IO.OUTA
.DA CL.IO.OUT
.DA CL.IO.1OUTA
.DA CL.IO.1OUT
.DA CL.IO.2OUTA
.DA CL.IO.2OUT
L.CMD.INT .DA CMD.INT
J.CMD.INT .DA Cmd.INT.STARTPROC
.DA Cmd.INT.CD
@ -74,128 +88,94 @@ J.CMD.INT .DA Cmd.INT.STARTPROC
.DA Cmd.INT.EXIT
.DA Cmd.INT.FI
.DA Cmd.INT.IF
.DA Cmd.INT.MD
.DA Cmd.INT.PAUSE
.DA Cmd.INT.PWD
.DA Cmd.INT.RD
.DA Cmd.INT.READ
.DA Cmd.INT.SET
.DA Cmd.INT.SLEEP
.DA Cmd.INT.TIME
L.CMD.IO .DA CMD.IO
J.CMD.IO .DA CMD.IO.AMP
.DA CMD.IO.PIPE
.DA CMD.IO.IN
.DA CMD.IO.OUTA
.DA CMD.IO.OUT
.DA CMD.IO.1OUTA
.DA CMD.IO.1OUT
.DA CMD.IO.2OUTA
.DA CMD.IO.2OUT
L.CMD.IF.TOKEN1 .DA CMD.IF.TOKEN1
L.CMD.IF.TOKEN2 .DA CMD.IF.TOKEN2
J.CMD.IF.TOKEN2 .DA CMD.IF.D
.DA CMD.IF.E
.DA CMD.IF.F
L.CMD.IF.TOKEN3 .DA CMD.IF.TOKEN3
L.CSH.BOPS .DA CSH.BOPS
J.CSH.BOPS .DA CSH.BOPS.ADD
.DA CSH.BOPS.SUB
.DA CSH.BOPS.MUL
.DA CSH.BOPS.DIV
.DA CSH.BOPS.MOD
.DA CSH.BOPS.SHL
.DA CSH.BOPS.SHR
.DA CSH.BOPS.L
.DA CSH.BOPS.G
.DA CSH.BOPS.LE
.DA CSH.BOPS.GE
.DA CSH.BOPS.EQ
.DA CSH.BOPS.NE
.DA CSH.BOPS.AND
.DA CSH.BOPS.OR
.DA CSH.BOPS.EOR
.DA CSH.BOPS.LAND
.DA CSH.BOPS.LOR
L.CSH.FN .DA CSH.FN
L.CSH.KW .DA CSH.KW
L.CSH.STYPES .DA CSH.STYPES
J.CSH.KW .DA CSH.IF
.DA CSH.WHILE
.DA CSH.ELSE
.DA CSH.DO
.DA CSH.FOR
.DA CSH.SWITCH
.DA CSH.CASE
.DA CSH.BREAK
.DA CSH.CONTINUE
.DA CSH.FLOAT
.DA CSH.SIGNED
.DA CSH.UNSIGNED
J.CSH.STYPES .DA CSH.CHAR
.DA CSH.INT
.DA CSH.LONG
J.CSH.UTYPES .DA CSH.UCHAR
.DA CSH.UINT
.DA CSH.ULONG
J.CSH.KW.START .DA CSH.IF.START
.DA CSH.WHILE.START
J.CSH.KW.END .DA CSH.IF.END
.DA CSH.WHILE.END
L.ERR.Codes .DA ERR.Codes
L.ERR.Messages .DA ERR.Messages
.DO CSH=1
.INB /A2OSX.SRC/SBIN/SHELL.R.CSH
.FIN
.DA 0
*--------------------------------------
CS.INIT jsr SetPWD
CS.INIT clc
CS.INIT.RTS rts
*--------------------------------------
CS.RUN jsr SetPWD
jsr CMD.Init
bcs .9
bcs CS.INIT.RTS
ldy #S.PS.ARGC
lda (pPs),y
cmp #1
lda #1
>SYSCALL ArgV
bcs .1 no arg, continue starting interactive
>SYSCALL LoadTxtFile
bcs CS.INIT.RTS
beq .1 no arg, continue starting interactive
jmp CSH.Init
txa
>STA.G hFileBuf
>SYSCALL GetMemPtr
>STYA ZPFileBufPtr
.DO CSH=1
jsr CSH.Init
.FIN
bra CS.RUN.LOOP
.1 jsr HIS.Init
bcs .9
bcs CS.INIT.RTS
>PUSHWI K.VER
>PUSHBI 2
>LDYA L.MSG.GREETINGS
>SYSCALL printf
.9 rts
bcs CS.INIT.RTS
*--------------------------------------
CS.RUN >LDA.G bReadMode READ Command ?
beq .22
jmp CS.RUN.READ
.22 ldy #S.PS.RC
lda (pPs),y
beq .11
CS.RUN.LOOP jsr CL.Reset
jsr IO.Reset
jsr IO.PrintErrMsg
bcs .9
.11 >LDA.G bPause
bpl .13
>LDA.G bReadMode READ Command ?
bne .7
>LDA.G bPause
bpl .4
.2 >SLEEP
>SYSCALL GetChar
bcs .8
bcc .3
tay
beq .2 no char
rts
.3 cmp #3 Ctrl-C
beq .9
bra .6
>STZ.G bPause
.13 jsr CheckSleep
bne .8
.4 jsr CheckSleep
bne .2
>LDA.G CSH.hBuf batch mode ?
beq .10
.6 >LDA.G hFileBuf batch mode ?
beq CS.RUN.INTERCATIVE
jmp CS.RUN.BATCH
*--------------------------------------
.10 jsr CL.RESET reset CmdBuf
jsr IO.Reset
.7 jmp CS.RUN.READ
.9 sec
rts
*--------------------------------------
CS.RUN.INTERCATIVE
>STZ.G bSecureRead Clear password mode
jsr CL.PrintPrompt
@ -203,60 +183,37 @@ CS.RUN >LDA.G bReadMode READ Command ?
.1 >SLEEP
>SYSCALL GetChar
bcc .21 no char
bcc .21
tay
beq .1
beq .1 no char
rts
rts I/O error
.21 cmp #C.EOF
beq .9
jsr CL.CHARIN
>LDA.G bCmdBufExec Something to execute ?
>LDA.G CL.bExec Something to execute ?
bpl .1
lda (ZPCMDBuf)
beq .10 Empty line
beq CS.RUN.LOOP Empty line
jsr HIS.Add
jsr CMD.Parse
bcs .2
lda (ZPArgVBuf)
beq .10 Empty line
jsr CMD.Exec
bcs .2
lda #0
.2 ldy #S.PS.RC
sta (pPs),y
>LDA.G bExit
bne .80
.8 clc
rts
.80 lda #0
sec
.9 rts
jmp CS.RUN.Exec
.9 rts
*--------------------------------------
CS.RUN.READ jsr CL.RESET reset CmdBuf
jsr IO.Reset
CS.RUN.READ
.1 >SLEEP
>SYSCALL GetChar
bcs .1 no char
jsr CL.CHARIN
>LDA.G bCmdBufExec
>LDA.G CL.bExec
bpl .1
>STZ.G bReadMode
@ -268,10 +225,8 @@ CS.RUN.READ jsr CL.RESET reset CmdBuf
>LEA.G CMD.VarName
>SYSCALL SetEnv
rts
.8 clc
rts
.8 jmp CS.RUN.LOOP.END
*--------------------------------------
CS.RUN.BATCH >SYSCALL GetChar
bcs .2
@ -279,7 +234,7 @@ CS.RUN.BATCH >SYSCALL GetChar
cmp #3 test Ctrl-c
bne .1
sec
* sec
rts
.1 cmp #19 test Ctrl-s
@ -290,48 +245,66 @@ CS.RUN.BATCH >SYSCALL GetChar
clc
rts
.2 jsr CSH.Run
.2 .DO CSH=1
jsr CSH.Run
.ELSE
jsr CL.GetLine
.FIN
bcc .7
cmp #MLI.E.EOF
beq .9
cmp #C.EOF
bne .3
pha
jsr CSH.ErrorMsg
lda #$ff
>STA.G bExit
inc
clc
bra CS.RUN.LOOP.END
pla
.3 sec
bra CS.RUN.LOOP.END
ldy #S.PS.RC
sta (pPs),y
sec
rts
.7 >LDA.G bCmdBufExec
bpl .8 Empty line....nothing to do....
.7 >LDA.G CL.bExec
bpl CS.RUN.LOOP.80
lda (ZPCMDBuf)
beq .8
beq CS.RUN.LOOP.80
jsr CMD.Parse
bcs .8
jsr CL.Trace
*--------------------------------------
CS.RUN.Exec jsr CL.Parse
bcs CS.RUN.LOOP.8
lda (ZPArgVBuf)
beq .8
beq CS.RUN.LOOP.8
jsr CMD.Exec
bcs .8
lda #0
.8 ldy #S.PS.RC
>SLEEP if S.PS.HOLD
*--------------------------------------
CS.RUN.LOOP.END ldy #S.PS.RC
sta (pPs),y
clc
rts
.9 lda #0
bcc CS.RUN.LOOP.8
>LDA.G hFileBuf batch mode ?
beq .1
jsr IO.PrintBatchErrMsg
bcs CS.RUN.LOOP.RTS
.1 ldy #S.PS.RC
lda (pPs),y
jsr IO.PrintErrMsg
bcs CS.RUN.LOOP.RTS
CS.RUN.LOOP.8 >LDA.G bExit
beq CS.RUN.LOOP.80
lda #0
sec
rts
CS.RUN.LOOP.RTS rts
CS.RUN.LOOP.80 jmp CS.RUN.LOOP
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9
@ -341,20 +314,21 @@ CS.DOEVENT lda (pEvent)
* ldy #Sleep already set by CheckSleep
clc
ldx #4
.1 lda (pData),y
sbc #0
sta (pData),y
iny
dex
cpy #Sleep+4
bne .1
.9 sec
rts
*--------------------------------------
CS.QUIT jsr HIS.Quit
CS.QUIT .DO CSH=1
jsr CSH.Quit
.FIN
jsr HIS.Quit
jsr CMD.Quit
clc
rts
@ -376,22 +350,62 @@ SetPWD.I >SYSCALL GetMemPtr
>LDYA L.ENV.PWD
>SYSCALL SetEnv
rts
*--------------------------------------
Lookup >STYA ZPPtr2
>PULLW ZPPtr1
ldx #0
.1 phx
>PUSHW ZPPtr2
>LDYA ZPPtr1
>SYSCALL StrCaseCmp
bcs .2
plx
>LDYA ZPPtr2
clc
rts
.2 inc ZPPtr2
bne .3
inc ZPPtr2+1
.3 lda (ZPPtr2)
bne .2
inc ZPPtr2
bne .4
inc ZPPtr2+1
.4 plx
inx
inx
lda (ZPPtr2) Array Ending 0, must be an external Cmd....
bne .1
sec
rts
*--------------------------------------
.INB /A2OSX.SRC/SBIN/SHELL.S.CL
.INB /A2OSX.SRC/SBIN/SHELL.S.CMD
.INB /A2OSX.SRC/SBIN/SHELL.S.CSH
.INB /A2OSX.SRC/SBIN/SHELL.S.IO
.INB /A2OSX.SRC/SBIN/SHELL.S.HIS
.DO CSH=1
.INB /A2OSX.SRC/SBIN/SHELL.S.CSH
.FIN
*--------------------------------------
CS.END
*--------------------------------------
MSG.GREETINGS .AZ "\r\nA2osX-Shell %d.%d\r\n\r\n"
MSG.PROMPT .AZ "\e[7h$ "
MSG.ECHO .AS ">%s"
MSG.TRACE .AS ">%s"
MSG.ECHOCRLF .AZ "\r\n"
MSG.BATCHERR .AZ "^\r\nLine #%D:"
MSG.ERROR .AZ "[$%h]:%S.\r\n"
MSG.PRINTENV .AZ "%s=%s\r\n"
MSG.CSHERR .AZ "^\r\nLine #%D:"
FMT.DATE .AZ "%A (%w), %B %d %Y"
FMT.TIME .AZ "%H:%M:%S (%I:%M:%S%p)"
*--------------------------------------
@ -402,23 +416,7 @@ ENV.HOME .AZ "HOME"
*--------------------------------------
* https://www.tldp.org/LDP/abs/html/io-redirection.html
*--------------------------------------
CMD.INT .AZ "STARTPROC"
.AZ "CD"
.AZ "DATE"
.AZ "ECHO"
.AZ "ELSE"
.AZ "EXIT"
.AZ "FI"
.AZ "IF"
.AZ "PAUSE"
.AZ "PWD"
.AZ "READ"
.AZ "SET"
.AZ "SLEEP"
.AZ "TIME"
.HS 00
*--------------------------------------
CMD.IO .AZ "&"
CL.IO .AZ "&"
.AZ "|"
.AZ "<"
.AZ ">>"
@ -429,6 +427,24 @@ CMD.IO .AZ "&"
.AZ "2>"
.HS 00
*--------------------------------------
CMD.INT .AZ "STARTPROC"
.AZ "CD"
.AZ "DATE"
.AZ "ECHO"
.AZ "ELSE"
.AZ "EXIT"
.AZ "FI"
.AZ "IF"
.AZ "MD"
.AZ "PAUSE"
.AZ "PWD"
.AZ "RD"
.AZ "READ"
.AZ "SET"
.AZ "SLEEP"
.AZ "TIME"
.HS 00
*--------------------------------------
CMD.IF.TOKEN1 .AZ "["
.AZ "!["
.HS 00
@ -440,7 +456,9 @@ CMD.IF.TOKEN3 .AZ "-eq"
.AZ "-ne"
.HS 00
*--------------------------------------
.DO CSH=1
.INB /A2OSX.SRC/SBIN/SHELL.C.CSH
.FIN
.INB /A2OSX.SRC/X.ERRORS.S
*--------------------------------------
EscChars .AS 'DBAC'
@ -449,9 +467,7 @@ EscChars.Cnt .EQ *-EscChars
.DUMMY
.OR 0
DS.START
CmdBufPtr .BS 1
CmdBuflen .BS 1
bCmdBufexec .BS 1
hFileBuf .BS 1
bEscMode .BS 1
bPause .BS 1
@ -463,6 +479,10 @@ bSecureRead .BS 1
Sleep .BS 4
CL.Ptr .BS 1
CL.Len .BS 1
CL.bExec .BS 1
CMD.IntCmd .BS 1
CMD.hCmdLine .BS 1
CMD.hCmdBuf .BS 1
@ -485,9 +505,9 @@ HIS.Index .BS 1
IO.hIn .BS 1
IO.hOut .BS 1
IO.hErr .BS 1
.DO CSH=1
.INB /A2OSX.SRC/SBIN/SHELL.G.CSH
.FIN
DS.END .ED
*--------------------------------------
MAN

View File

@ -140,7 +140,11 @@ K.Stat.DST .DA #S.STAT.P.TYPE
* CS : error
* A = EC
*\-------------------------------------
K.MKDir jsr PFT.CheckPathYA
K.MKDir jsr K.realpath.I
bcs K.MKDir.RTS
>LDYAI K.Buf256
jsr PFT.CheckPathYA
jsr STDIO.SetMLIPathYA
lda #S.FI.A.FULL