mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-01 00:29:12 +00:00
Kernel 0.9.2
This commit is contained in:
parent
7bdcbe7731
commit
384aa458b0
Binary file not shown.
Binary file not shown.
@ -77,7 +77,7 @@ CS.RUN ldy #S.PS.ARGC
|
|||||||
cmp #2
|
cmp #2
|
||||||
beq CS.RUN.ADD
|
beq CS.RUN.ADD
|
||||||
|
|
||||||
.9 lda #K.E.SYN
|
.9 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -139,7 +139,7 @@ CS.RUN.ADD >PUSHEA.G DST.MAC+5
|
|||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #K.E.SYN
|
.9 lda #E.SYN
|
||||||
.99 sec
|
.99 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -64,7 +64,7 @@ CS.INIT
|
|||||||
.99 >PUSHBI 0
|
.99 >PUSHBI 0
|
||||||
>LDYA L.MSG.USAGE
|
>LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ CS.INIT
|
|||||||
.99 >PUSHBI 0
|
.99 >PUSHBI 0
|
||||||
>LDYA L.MSG.USAGE
|
>LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ CS.RUN.ADD cmp #2
|
|||||||
sec we do not want to stay in memory
|
sec we do not want to stay in memory
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #K.E.SYN
|
.9 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
.99 rts
|
.99 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -123,7 +123,7 @@ CS.INIT ldy #S.PS.ARGC
|
|||||||
.99 >PUSHBI 0
|
.99 >PUSHBI 0
|
||||||
>LDYA L.MSG.USAGE
|
>LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -68,7 +68,7 @@ CS.INIT
|
|||||||
dex
|
dex
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ CS.RUN lda #1
|
|||||||
sec
|
sec
|
||||||
.9 rts
|
.9 rts
|
||||||
|
|
||||||
.99 lda #K.E.SYN
|
.99 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -68,7 +68,7 @@ CS.INIT ldy #S.PS.ARGC
|
|||||||
.99 >PUSHBI 0
|
.99 >PUSHBI 0
|
||||||
>LDYA L.MSG.USAGE
|
>LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ CS.INIT >SYSCALL ArgVC
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.USAGE
|
.99 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -141,7 +141,7 @@ CS.RUN.SET lda #1
|
|||||||
sec we do not want to stay in memory
|
sec we do not want to stay in memory
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #K.E.SYN
|
.9 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -62,7 +62,7 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
|
|||||||
|
|
||||||
>LDYA L.MSG.IPKO
|
>LDYA L.MSG.IPKO
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ CS.RUN.IPOK
|
|||||||
|
|
||||||
.99 >SYSCALL printf
|
.99 >SYSCALL printf
|
||||||
|
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ CS.RUN.OPENSKT ldx #3
|
|||||||
|
|
||||||
>LDYA L.MSG.SKTKO
|
>LDYA L.MSG.SKTKO
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ CS.INIT ldy #S.PS.ARGC
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.USAGE
|
.99 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -69,7 +69,7 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
|
|||||||
|
|
||||||
>LDYA L.MSG.IPKO
|
>LDYA L.MSG.IPKO
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ CS.RUN.IPOK ldy #S.PS.ARGC
|
|||||||
.9 >LDYA L.MSG.USAGE
|
.9 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
|
|
||||||
.99 lda #K.E.SYN
|
.99 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
|||||||
|
|
||||||
.9 >LDYA L.MSG.SKTKO
|
.9 >LDYA L.MSG.SKTKO
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ CS.INIT
|
|||||||
.99 >PUSHBI 0
|
.99 >PUSHBI 0
|
||||||
>LDYA L.MSG.USAGE
|
>LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ CS.INIT
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.USAGE
|
.99 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ CS.INIT.OPENINPUT
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.HEADER.KO
|
.99 >LDYA L.MSG.HEADER.KO
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.IBIN
|
lda #E.IBIN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -126,7 +126,7 @@ Dev.ParseArgs >LDYA ARGS
|
|||||||
>SYSCALL sscanf
|
>SYSCALL sscanf
|
||||||
bcc .8
|
bcc .8
|
||||||
|
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -145,7 +145,7 @@ Dev.ParseArgs >LDYA ARGS
|
|||||||
>SYSCALL sscanf
|
>SYSCALL sscanf
|
||||||
bcc .8
|
bcc .8
|
||||||
|
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -163,7 +163,7 @@ Dev.ParseArgs >LDYA ARGS
|
|||||||
beq .92
|
beq .92
|
||||||
>SYSCALL freemem
|
>SYSCALL freemem
|
||||||
|
|
||||||
.92 lda #K.E.SYN
|
.92 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -146,7 +146,7 @@ Dev.ParseArgs >LDYA ARGS
|
|||||||
>SYSCALL sscanf
|
>SYSCALL sscanf
|
||||||
bcc .8
|
bcc .8
|
||||||
|
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -72,7 +72,7 @@ CS.INIT
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.USAGE
|
.99 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ CS.INIT.OPENINPUT
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.HEADER.KO
|
.99 >LDYA L.MSG.HEADER.KO
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.IBIN
|
lda #E.IBIN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -75,6 +75,22 @@ A2osX.S.XY .EQ $E1
|
|||||||
A2osX.S.NIC .EQ $E2
|
A2osX.S.NIC .EQ $E2
|
||||||
A2osX.S.DISABLE .EQ $FF
|
A2osX.S.DISABLE .EQ $FF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
* ProDOS ERROR CODES : $00->$5F
|
||||||
|
* Lib ERROR CODES : $80->$BF
|
||||||
|
* Kernel ERROR CODES : $C0->$FF
|
||||||
|
*--------------------------------------
|
||||||
|
E.OOM .EQ $FF Out Of Memory Error
|
||||||
|
E.OOH .EQ $FE Out Of Handle Error
|
||||||
|
E.INVH .EQ $FD Invalid Handle
|
||||||
|
E.BUF .EQ $FC Buffer Overflow
|
||||||
|
*--------------------------------------
|
||||||
|
E.NSP .EQ $DD No Such Process Error
|
||||||
|
*--------------------------------------
|
||||||
|
E.SYN .EQ $CF Syntax Error
|
||||||
|
E.ENVF .EQ $CE Env is Full
|
||||||
|
E.IBIN .EQ $CD Invalid BIN format
|
||||||
|
E.FTB .EQ $CC File Too Big Error
|
||||||
|
*--------------------------------------
|
||||||
* A2osX.SYSCALL Constants
|
* A2osX.SYSCALL Constants
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
C.EOF .EQ 4
|
C.EOF .EQ 4
|
||||||
@ -262,22 +278,6 @@ SYS.FreeStkObj .EQ $FE
|
|||||||
SYS.Kernel.JMP .EQ $E000
|
SYS.Kernel.JMP .EQ $E000
|
||||||
SYS.GuiOSD.JMP .EQ $E200
|
SYS.GuiOSD.JMP .EQ $E200
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* ProDOS ERROR CODES : $00->$5F
|
|
||||||
* Lib ERROR CODES : $80->$BF
|
|
||||||
* Kernel ERROR CODES : $C0->$FF
|
|
||||||
*--------------------------------------
|
|
||||||
K.E.OOM .EQ $FF Out Of Memory Error
|
|
||||||
K.E.OOH .EQ $FE Out Of Handle Error
|
|
||||||
K.E.INVH .EQ $FD Invalid Handle
|
|
||||||
K.E.BUF .EQ $FC Buffer Overflow
|
|
||||||
*--------------------------------------
|
|
||||||
K.E.NSP .EQ $DD No Such Process Error
|
|
||||||
*--------------------------------------
|
|
||||||
K.E.SYN .EQ $CF Syntax Error
|
|
||||||
K.E.ENVF .EQ $CE Env is Full
|
|
||||||
K.E.IBIN .EQ $CD Invalid BIN format
|
|
||||||
K.E.FTB .EQ $CC File Too Big Error
|
|
||||||
*--------------------------------------
|
|
||||||
* MEM STRUCT
|
* MEM STRUCT
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.MEM.F .EQ 0
|
S.MEM.F .EQ 0
|
||||||
|
@ -123,7 +123,7 @@ Pak >PULLW ZPStatPtr
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #K.E.OOM
|
.9 lda #E.OOM
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -92,7 +92,7 @@ SKT.Socket.FindFree
|
|||||||
|
|
||||||
txa
|
txa
|
||||||
>SYSCALL freemem
|
>SYSCALL freemem
|
||||||
lda #K.E.OOH
|
lda #E.OOH
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ CS.RUN ldy #S.PS.ARGC
|
|||||||
|
|
||||||
.90 >LDYA L.MSG.USAGE
|
.90 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
.9 rts
|
.9 rts
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ CS.RUN jsr Init.Timeout
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.TCPIPERR
|
.99 >LDYA L.MSG.TCPIPERR
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
CS.RUN.RTS rts
|
CS.RUN.RTS rts
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ CS.RUN.LOOP >SLEEP
|
|||||||
|
|
||||||
.9 >LDYA L.MSG.SKTERR
|
.9 >LDYA L.MSG.SKTERR
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ CS.RUN ldy #S.PS.ARGC
|
|||||||
|
|
||||||
.9 >LDYA L.MSG.USAGE
|
.9 >LDYA L.MSG.USAGE
|
||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
lda #K.E.SYN tell TSKMGR that all done ok, but
|
lda #E.SYN tell TSKMGR that all done ok, but
|
||||||
sec we do not want to stay in memory
|
sec we do not want to stay in memory
|
||||||
.99 rts
|
.99 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -73,7 +73,7 @@ CS.RUN jsr Init.Timeout
|
|||||||
|
|
||||||
.99 >LDYA L.MSG.TCPIPERR
|
.99 >LDYA L.MSG.TCPIPERR
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ CS.RUN.INIT ldx #3
|
|||||||
|
|
||||||
.9 >LDYA L.MSG.SKTERR
|
.9 >LDYA L.MSG.SKTERR
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #K.E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -19,10 +19,14 @@ CMD.Quit >LDA.G hCmdBuf
|
|||||||
* in:
|
* in:
|
||||||
* ZPCMDBuf : CString command line
|
* ZPCMDBuf : CString command line
|
||||||
* out:
|
* out:
|
||||||
* ZPCMDBuf : Remove extra SPACE & comment
|
* ZPArgVBuf :
|
||||||
* ZPCMDBuf : cmd\0 arg1\0 arg2\0 ... \0
|
* /path/excmd\0 arg1\0 arg2\0 ... \0
|
||||||
|
* - or -
|
||||||
|
* intcmd\0 arg1\0 arg2\0 ... \0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.Parse lda #S.PS.F.HOLD+S.PS.F.DUPENV
|
Cmd.Parse >STZ.G CMD.bCmd
|
||||||
|
|
||||||
|
lda #S.PS.F.HOLD+S.PS.F.DUPENV
|
||||||
>STA.G CMD.PSFlags
|
>STA.G CMD.PSFlags
|
||||||
|
|
||||||
>LDYA ZPCMDBuf
|
>LDYA ZPCMDBuf
|
||||||
@ -42,125 +46,151 @@ Cmd.Parse lda #S.PS.F.HOLD+S.PS.F.DUPENV
|
|||||||
bcs .9
|
bcs .9
|
||||||
>STYA ZPArgVBuf
|
>STYA ZPArgVBuf
|
||||||
txa
|
txa
|
||||||
>STA.G hArgVBuf
|
>STA.G CMD.hArgVBuf
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta (ZPArgVBuf)
|
sta (ZPArgVBuf)
|
||||||
|
|
||||||
.1 lda (ZPCMDBuf)
|
lda (ZPCMDBuf)
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
>LDA.G CMD.hCmdLine
|
.1 >LDYA ZPCMDBuf
|
||||||
bne .6 we already have Cmd
|
>SYSCALL puts
|
||||||
|
|
||||||
jsr CMD.CheckExternal
|
>LDA.G CMD.bCmd
|
||||||
bcs .9
|
bne .6 we already have Cmd, go check args
|
||||||
|
|
||||||
|
ldy #2
|
||||||
|
lda (ZPCMDBuf),y only one char ?
|
||||||
|
bne .2
|
||||||
|
|
||||||
.6 jsr CMD.AddToArgV
|
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.AddTokenToArgV
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
.7 jsr CMD.NextCmdBufToken
|
.7 jsr CMD.NextCmdBufToken
|
||||||
bra .1
|
lda (ZPCMDBuf)
|
||||||
|
bne .1
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
|
||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* ZPCMDBuf-> argv[] (formatted & not empty)
|
* ZPCMDBuf-> argv[] (formatted & not empty)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.Exec.CheckExternal
|
Cmd.CheckCmd ldy #$ff
|
||||||
|
|
||||||
ldy #$ff
|
|
||||||
|
|
||||||
.1 iny
|
.1 iny
|
||||||
lda (ZPCMDBuf),y
|
lda (ZPCMDBuf),y
|
||||||
beq .2 no / found, search...
|
beq .2
|
||||||
cmp #'/'
|
cmp #'/'
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
>LDYA ZPCMDBuf found /, some path specified, no search
|
>LDYA ZPCMDBuf found /, some path specified, External, no search
|
||||||
>SYSCALL realpath
|
>SYSCALL realpath
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
phy
|
|
||||||
pha
|
|
||||||
txa
|
txa
|
||||||
>STA.G CMD.hCmdLine
|
>STA.G CMD.hCmdLine
|
||||||
pla
|
bra .6 go check type...
|
||||||
ply
|
|
||||||
>PUSHEA.G CMD.Stat Command line is already full path, no search
|
|
||||||
>LDYA ZPCMDBuf
|
|
||||||
>SYSCALL STAT
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
.2 >LDYAI 256 Get a buffer for found path
|
.2 >LDYA L.CMD.INT
|
||||||
|
jsr CMD.SearchInt no / found, search internal...
|
||||||
|
bcs .4 not internal, search PATH
|
||||||
|
|
||||||
|
jsr CMD.AddYAToArgV X unmodified
|
||||||
|
bcs .9
|
||||||
|
txa
|
||||||
|
>STA.G CMD.bCmd
|
||||||
|
|
||||||
|
clc
|
||||||
|
.9 rts
|
||||||
|
|
||||||
|
.4 >LDYAI 256 Get a buffer for found path
|
||||||
>SYSCALL GetMem
|
>SYSCALL GetMem
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
txa
|
txa
|
||||||
>STA.G CMD.hCmdLine
|
>STA.G CMD.hCmdLine
|
||||||
|
|
||||||
>LDYA L.ENV.PATH push ENVNAME=PATH for search
|
>LDYA L.ENV.PATH push ENVNAME=PATH for search
|
||||||
>SYSCALL GetEnv get value for ENV=PATH
|
>SYSCALL GetEnv get value for ENV=PATH
|
||||||
bcs .9 No PATH, try in CD
|
bcs Cmd.CheckCmd.90
|
||||||
|
|
||||||
jsr Cmd.Exec.EXT.Search
|
jsr Cmd.SearchExt
|
||||||
bcc Cmd.Exec.EXT.ARGS
|
bcc .6 found in PATH, go check Type
|
||||||
|
|
||||||
ldy #S.PS.hPREFIX not found, try in CD
|
ldy #S.PS.hPREFIX not found, try in CD
|
||||||
lda (pPs),y
|
lda (pPs),y
|
||||||
>SYSCALL GetMemPtr
|
>SYSCALL GetMemPtr
|
||||||
jsr Cmd.Exec.EXT.Search
|
jsr Cmd.SearchExt
|
||||||
bcc Cmd.Exec.EXT.ARGS
|
bcs Cmd.CheckCmd.90
|
||||||
|
|
||||||
|
.6 >PUSHEA.G CMD.Stat
|
||||||
|
>LDA.G CMD.hCmdLine
|
||||||
|
>SYSCALL GetMemPtr
|
||||||
|
>SYSCALL STAT
|
||||||
|
bcs Cmd.CheckCmd.90
|
||||||
|
|
||||||
|
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
|
pha
|
||||||
>LDA.G CMD.hCmdLine
|
>LDA.G CMD.hCmdLine
|
||||||
>SYSCALL FreeMem
|
>SYSCALL FreeMem
|
||||||
pla
|
pla
|
||||||
|
|
||||||
sec
|
plp
|
||||||
.9 rts
|
Cmd.CheckCmd.RTS
|
||||||
*--------------------------------------
|
|
||||||
* CMD.hCmdLine = /path/bin
|
|
||||||
*--------------------------------------
|
|
||||||
Cmd.Exec.EXT.ARGS
|
|
||||||
ldx #0
|
|
||||||
jsr Cmd.RemoveStrAtX
|
|
||||||
|
|
||||||
>LDYA ZPCMDBuf
|
|
||||||
>SYSCALL puts
|
|
||||||
>DEBUG
|
|
||||||
|
|
||||||
>LDA.G CMD.hCmdLine
|
|
||||||
>SYSCALL GetMemPtr
|
|
||||||
ldx #0
|
|
||||||
jsr CMD.InsertStrYAAtX
|
|
||||||
|
|
||||||
>LDYA ZPCMDBuf
|
|
||||||
>SYSCALL puts
|
|
||||||
>DEBUG
|
|
||||||
|
|
||||||
>LDA.G CMD.hCmdLine
|
|
||||||
>SYSCALL FreeMem
|
|
||||||
|
|
||||||
ldy #CMD.Stat+S.STAT.P.TYPE
|
|
||||||
lda (pData),y
|
|
||||||
cmp #S.FI.T.TXT
|
|
||||||
beq Cmd.Exec.EXT.TXT
|
|
||||||
cmp #S.FI.T.BIN
|
|
||||||
beq Cmd.Exec.EXT.BIN
|
|
||||||
cmp #S.FI.T.SYS
|
|
||||||
bne .9
|
|
||||||
|
|
||||||
bra *
|
|
||||||
|
|
||||||
.9 lda #K.E.SYN
|
|
||||||
sec
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.Exec.EXT.Search
|
* TXT : add "/PATH/SHELL" "/PATH/CMD"
|
||||||
pha
|
*--------------------------------------
|
||||||
|
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
|
||||||
|
bcs Cmd.CheckCmd.90
|
||||||
|
lda #$ff
|
||||||
|
>STA.G CMD.bCmd
|
||||||
|
bra Cmd.CheckCmd.90
|
||||||
|
*--------------------------------------
|
||||||
|
Cmd.CheckCmd.SYS
|
||||||
|
*--------------------------------------
|
||||||
|
bra *
|
||||||
|
*--------------------------------------
|
||||||
|
Cmd.SearchExt pha
|
||||||
phy
|
phy
|
||||||
>PUSHEA.G CMD.Stat
|
>PUSHEA.G CMD.Stat
|
||||||
>LDA.G CMD.hCmdLine
|
>LDA.G CMD.hCmdLine
|
||||||
@ -173,58 +203,26 @@ Cmd.Exec.EXT.Search
|
|||||||
>SYSCALL FileSearch
|
>SYSCALL FileSearch
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* TXT : Launch "/PATH/SHELL /PATH/CMD ARGS"
|
Cmd.Exec lda (ZPArgVBuf)
|
||||||
*--------------------------------------
|
cmp #'/'
|
||||||
Cmd.Exec.EXT.TXT
|
bne .8
|
||||||
lda #0
|
|
||||||
>SYSCALL ArgV
|
|
||||||
ldx #0
|
|
||||||
jsr Cmd.InsertStrYAAtX
|
|
||||||
*--------------------------------------
|
|
||||||
* BIN : Launch "/PATH/CMD ARGS"
|
|
||||||
*--------------------------------------
|
|
||||||
Cmd.Exec.EXT.BIN
|
|
||||||
>PUSHB.G CMD.PSFlags
|
>PUSHB.G CMD.PSFlags
|
||||||
>LDYA ZPCMDBuf
|
>LDYA ZPArgVBuf
|
||||||
>SYSCALL Exec
|
>SYSCALL exec
|
||||||
rts
|
|
||||||
|
.8 >LDA.G CMD.bCmd
|
||||||
|
tax
|
||||||
|
jmp (J.CMD.INT,x)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Internal Commands
|
* STARTPROC : intcmd = 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CMD.Exec.INT >LDYA L.CMD.INT
|
Cmd.INT.STARTPROC
|
||||||
>STYA ZPPtr2
|
>LDA.G CMD.PSFlags
|
||||||
|
and #$ff^S.PS.F.HOLD
|
||||||
|
sta (pData),y
|
||||||
|
|
||||||
ldx #0
|
clc
|
||||||
|
|
||||||
.1 phx
|
|
||||||
|
|
||||||
>PUSHW ZPPtr2
|
|
||||||
>LDYA ZPCMDBuf
|
|
||||||
>SYSCALL StrCaseCmp
|
|
||||||
bcs .2
|
|
||||||
|
|
||||||
plx
|
|
||||||
jmp (J.CMD.INT,x) Found an internal Cmd...
|
|
||||||
|
|
||||||
.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
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.INT.PWD ldy #S.PS.hPREFIX
|
Cmd.INT.PWD ldy #S.PS.hPREFIX
|
||||||
@ -233,8 +231,9 @@ Cmd.INT.PWD ldy #S.PS.hPREFIX
|
|||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.INT.CD lda (ZPCMDBuf)
|
Cmd.INT.CD ldx #1
|
||||||
bne .1
|
jsr Cmd.GetArgX
|
||||||
|
bcc .1
|
||||||
|
|
||||||
>LDYA L.ENV.HOME
|
>LDYA L.ENV.HOME
|
||||||
>SYSCALL GetEnv
|
>SYSCALL GetEnv
|
||||||
@ -242,33 +241,17 @@ Cmd.INT.CD lda (ZPCMDBuf)
|
|||||||
|
|
||||||
>SYSCALL ExpandStr
|
>SYSCALL ExpandStr
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
bra .4
|
bra .4
|
||||||
|
|
||||||
.1 ldy #0
|
.1 >SYSCALL RealPath
|
||||||
|
|
||||||
.2 lda (ZPCMDBuf),y
|
|
||||||
tax
|
|
||||||
iny
|
|
||||||
lda (ZPCMDBuf),y
|
|
||||||
bne .2
|
|
||||||
cpx #'/'
|
|
||||||
beq .3
|
|
||||||
|
|
||||||
lda #'/'
|
|
||||||
sta (ZPCMDBuf),y
|
|
||||||
iny
|
|
||||||
lda #0
|
|
||||||
sta (ZPCMDBuf),y
|
|
||||||
|
|
||||||
.3 >LDYA ZPCMDBuf Get ARG0
|
|
||||||
>SYSCALL RealPath
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
.4 >STYA ZPCMDBuf
|
.4 >STYA ZPCMDBuf
|
||||||
txa
|
txa
|
||||||
>STA.G CMD.hCmdLine
|
>STA.G CMD.hCmdLine
|
||||||
|
|
||||||
|
**** MEMORY LEAK : CMD.hCmdLine not released
|
||||||
|
|
||||||
ldy #1
|
ldy #1
|
||||||
lda (ZPCMDBuf),y
|
lda (ZPCMDBuf),y
|
||||||
beq .8 we have '/'
|
beq .8 we have '/'
|
||||||
@ -278,8 +261,7 @@ Cmd.INT.CD lda (ZPCMDBuf)
|
|||||||
>SYSCALL STAT
|
>SYSCALL STAT
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
ldy #CMD.Stat+S.STAT.P.TYPE
|
>LDA.G CMD.Stat+S.STAT.P.TYPE
|
||||||
lda (pData),y
|
|
||||||
cmp #$0F Directory ?
|
cmp #$0F Directory ?
|
||||||
bne Cmd.Exec.ERRSYN
|
bne Cmd.Exec.ERRSYN
|
||||||
|
|
||||||
@ -296,26 +278,19 @@ Cmd.INT.CD lda (ZPCMDBuf)
|
|||||||
|
|
||||||
ldy #S.PS.hPREFIX
|
ldy #S.PS.hPREFIX
|
||||||
sta (pPs),y
|
sta (pPs),y
|
||||||
jsr SetPWD
|
jmp SetPWD
|
||||||
clc
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.Exec.ERRSYN lda #K.E.SYN
|
Cmd.Exec.ERRSYN lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.INT.STARTPROC
|
Cmd.INT.SET >DEBUG
|
||||||
lda (ZPCMDBuf)
|
|
||||||
beq Cmd.Exec.ERRSYN
|
|
||||||
|
|
||||||
>LDA.G CMD.PSFlags
|
ldx #1
|
||||||
and #$ff^S.PS.F.HOLD
|
jsr Cmd.GetArgX
|
||||||
sta (pData),y
|
bcc Cmd.INT.SETVAR
|
||||||
|
|
||||||
jmp Cmd.Exec.EXT
|
|
||||||
*--------------------------------------
|
|
||||||
Cmd.INT.SET lda (ZPCMDBuf)
|
|
||||||
bne Cmd.INT.SETVAR
|
|
||||||
|
|
||||||
* No arg, print all ENV
|
* No arg, print all ENV
|
||||||
|
|
||||||
@ -365,42 +340,45 @@ Cmd.INT.SET lda (ZPCMDBuf)
|
|||||||
.8 clc
|
.8 clc
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.INT.SETVAR cmp #'=' string is '=value' ?
|
Cmd.INT.SETVAR >STYA ZPPTR1
|
||||||
|
|
||||||
|
lda (ZPPTR1)
|
||||||
|
cmp #'=' string is '=value' ?
|
||||||
beq .99 syntax error
|
beq .99 syntax error
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
|
|
||||||
.1 iny
|
.1 iny
|
||||||
lda (ZPCMDBuf),y
|
lda (ZPPTR1),y
|
||||||
beq .3 no =, GetEnv
|
beq .3 no =, GetEnv
|
||||||
|
|
||||||
cmp #'=' ARGS contains =, PutEnv
|
cmp #'=' ARGS contains =, PutEnv
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (ZPCMDBuf),y
|
lda (ZPPTR1),y
|
||||||
beq .2 "VAR=" go UnsetEnv
|
beq .2 "VAR=" go UnsetEnv
|
||||||
|
|
||||||
>LDYA ZPCMDBuf String is VAR=VALUE...
|
>LDYA ZPPTR1 String is VAR=VALUE...
|
||||||
>SYSCALL PutEnv
|
>SYSCALL PutEnv
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.2 dey String is "VAR=", Remove ending '='
|
.2 dey String is "VAR=", Remove ending '='
|
||||||
lda #0
|
lda #0
|
||||||
sta (ZPCMDBuf),y
|
sta (ZPPTR1),y
|
||||||
|
|
||||||
>LDYA ZPCMDBuf String is "VAR"...
|
>LDYA ZPPTR1 String is "VAR"...
|
||||||
>SYSCALL UnsetEnv
|
>SYSCALL UnsetEnv
|
||||||
rts
|
rts
|
||||||
|
|
||||||
* Print requested VAR
|
* Print requested VAR
|
||||||
|
|
||||||
.3 >LDYA ZPCMDBuf
|
.3 >LDYA ZPPTR1
|
||||||
>SYSCALL GetEnv
|
>SYSCALL GetEnv
|
||||||
bcs .8
|
bcs .8
|
||||||
|
|
||||||
>PUSHYA push value
|
>PUSHYA push value
|
||||||
>PUSHW ZPCMDBuf push name
|
>PUSHW ZPPTR1 push name
|
||||||
jsr Cmd.INT.SET.PRINT
|
jsr Cmd.INT.SET.PRINT
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
@ -436,16 +414,21 @@ Cmd.INT.TIME clc
|
|||||||
>SYSCALL puts
|
>SYSCALL puts
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.INT.ECHO >PUSHW ZPCMDBuf
|
Cmd.INT.ECHO ldx #1
|
||||||
|
jsr Cmd.GetArgX
|
||||||
|
bcs .71
|
||||||
|
|
||||||
|
>PUSHYA
|
||||||
ldy #S.PS.hStdOut
|
ldy #S.PS.hStdOut
|
||||||
lda (pPs),y
|
lda (pPs),y
|
||||||
>SYSCALL fputs
|
>SYSCALL fputs
|
||||||
|
>DEBUG
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
ldx #1
|
ldx #2
|
||||||
|
|
||||||
.1 phx
|
.1 phx
|
||||||
jsr Cmd.GetStrAtX
|
jsr Cmd.GetArgX
|
||||||
bcs .7
|
bcs .7
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
|
|
||||||
@ -458,11 +441,11 @@ Cmd.INT.ECHO >PUSHW ZPCMDBuf
|
|||||||
plx
|
plx
|
||||||
inx
|
inx
|
||||||
bcc .1
|
bcc .1
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.7 plx
|
.7 plx
|
||||||
>LDA.G bECHO.N
|
.71 >LDA.G bECHO.N
|
||||||
bmi .8
|
bmi .8
|
||||||
|
|
||||||
>PUSHBI 0
|
>PUSHBI 0
|
||||||
@ -643,150 +626,104 @@ CMD.NextCmdBufToken
|
|||||||
bne .1
|
bne .1
|
||||||
inc ZPCMDBuf+1
|
inc ZPCMDBuf+1
|
||||||
.1 tax
|
.1 tax
|
||||||
bne CMD.NextCmdBuf
|
bne CMD.NextCmdBufToken
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CMD.AddToArgV >LDYA ZPArgVBuf
|
CMD.AddTokenToArgV
|
||||||
>STYA ZPPtr1
|
>LDYA ZPCmdBuf
|
||||||
|
CMD.AddYAToArgV >STYA ZPPtr1
|
||||||
|
>LDYA ZPArgVBuf
|
||||||
|
>STYA ZPPtr2
|
||||||
|
|
||||||
.1 lda (ZPPtr1) scan to end of argV
|
.1 lda (ZPPtr2) scan to end of argV
|
||||||
beq .6
|
beq .6
|
||||||
|
|
||||||
.2 inc ZPPtr1
|
.2 inc ZPPtr2
|
||||||
bne .3
|
bne .3
|
||||||
inc ZPPtr1+1
|
inc ZPPtr2+1
|
||||||
.3 lda (ZPPtr1)
|
.3 lda (ZPPtr2)
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
inc ZPPtr1
|
inc ZPPtr2
|
||||||
bne .4
|
bne .4
|
||||||
inc ZPPtr1+1
|
inc ZPPtr2+1
|
||||||
.4 lda (ZPPtr1)
|
.4 lda (ZPPtr2)
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
.6 ldy #$ff
|
.6 ldy #$ff
|
||||||
|
|
||||||
.7 iny
|
.7 iny
|
||||||
beq .9
|
* beq .9
|
||||||
lda (ZPCMDBuf),y
|
lda (ZPPtr1),y
|
||||||
sta (ZPPtr1),y
|
sta (ZPPtr2),y
|
||||||
bne .7 including str ending \0
|
bne .7 including str ending \0
|
||||||
|
|
||||||
iny
|
iny
|
||||||
beq .9
|
* beq .9
|
||||||
sta (ZPPtr1),y arg[] ending \0
|
sta (ZPPtr2),y arg[] ending \0
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #K.E.BUF
|
.9 lda #E.BUF
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.InsertStrYAAtX
|
CMD.SearchInt >STYA ZPPtr2
|
||||||
>STYA ZPPtr3 new str to insert
|
|
||||||
|
|
||||||
jsr Cmd.GetStrAtX get ptr1=arg[x]
|
ldx #0
|
||||||
bcs .9
|
|
||||||
|
|
||||||
>STYA ZPPtr4 Save ptr where to insert
|
.1 phx
|
||||||
|
|
||||||
ldy $ff
|
>PUSHW ZPPtr2
|
||||||
|
>LDYA ZPCMDBuf
|
||||||
|
>SYSCALL StrCaseCmp
|
||||||
|
bcs .2
|
||||||
|
|
||||||
.1 iny get new str len
|
plx
|
||||||
lda (ZPPtr3),y
|
>LDYA ZPPtr2
|
||||||
|
clc Found an internal Cmd...
|
||||||
|
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
|
bne .1
|
||||||
|
|
||||||
tya
|
|
||||||
sec +1
|
|
||||||
adc ZPPtr1
|
|
||||||
sta ZPPtr2
|
|
||||||
|
|
||||||
lda #0
|
|
||||||
adc ZPPtr1+1
|
|
||||||
lda ZPPtr2+1
|
|
||||||
|
|
||||||
ldy #0
|
|
||||||
|
|
||||||
.3 lda (ZPPtr1),y
|
|
||||||
sta (ZPPtr2),y
|
|
||||||
beq .4
|
|
||||||
iny
|
|
||||||
bne .3
|
|
||||||
|
|
||||||
.4 tay
|
|
||||||
beq .5
|
|
||||||
|
|
||||||
jsr Cmd.NextStrPtr1
|
|
||||||
>STYA ZPPtr1
|
|
||||||
jsr Cmd.NextStrPtr2
|
|
||||||
>STYA ZPPtr2
|
|
||||||
bra .3
|
|
||||||
|
|
||||||
.5 ldy #ff copy new str in hole created
|
|
||||||
|
|
||||||
.6 iny
|
|
||||||
lda (ZPPtr3),y
|
|
||||||
sta (ZPPtr4),y
|
|
||||||
bne .6
|
|
||||||
|
|
||||||
.8 clc
|
|
||||||
.9 rts
|
|
||||||
*--------------------------------------
|
|
||||||
Cmd.RemoveStrAtX
|
|
||||||
jsr Cmd.GetStrAtX
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
jsr Cmd.NextStrPtr1
|
|
||||||
>STYA ZPPtr2
|
|
||||||
|
|
||||||
.3 ldy #0
|
|
||||||
|
|
||||||
.4 lda (ZPPtr2),y
|
|
||||||
sta (ZPPtr1),y
|
|
||||||
beq .5
|
|
||||||
iny
|
|
||||||
bra .4
|
|
||||||
|
|
||||||
.5 tya we moved the ending \0
|
|
||||||
beq .8
|
|
||||||
|
|
||||||
sec
|
sec
|
||||||
adc ZPPtr2
|
rts
|
||||||
sta ZPPtr2
|
|
||||||
bcc .6
|
|
||||||
|
|
||||||
inc ZPPtr2+1
|
|
||||||
|
|
||||||
.6 tya
|
|
||||||
|
|
||||||
sec
|
|
||||||
adc ZPPtr1
|
|
||||||
sta ZPPtr1
|
|
||||||
bcc .3
|
|
||||||
|
|
||||||
inc ZPPtr2+1
|
|
||||||
bra .3
|
|
||||||
|
|
||||||
.8 rts
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.GetStrAtX >LDYA ZPCMDBuf
|
Cmd.GetArgX >LDYA ZPArgVBuf
|
||||||
|
|
||||||
.1 dex
|
dex
|
||||||
bmi .8
|
bmi .8
|
||||||
|
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
|
|
||||||
jsr Cmd.NextStrPtr1
|
.1 jsr Cmd.NextArgPtr1
|
||||||
bcc .1
|
bcs .9
|
||||||
rts
|
dex
|
||||||
|
bpl .1
|
||||||
|
|
||||||
.8 >LDYA ZPPtr1
|
>LDYA ZPPtr1
|
||||||
|
|
||||||
clc
|
.8 clc
|
||||||
rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Cmd.NextStrPtr1 lda (ZPPtr1)
|
Cmd.NextArgPtr1 lda (ZPPtr1)
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
.1 inc ZPPtr1
|
.1 inc ZPPtr1
|
||||||
@ -796,29 +733,13 @@ Cmd.NextStrPtr1 lda (ZPPtr1)
|
|||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
inc ZPPtr1
|
inc ZPPtr1
|
||||||
bne .8
|
bne .3
|
||||||
inc ZPPtr1+1
|
inc ZPPtr1+1
|
||||||
|
|
||||||
.8 clc
|
.3 lda (ZPPtr1)
|
||||||
rts
|
|
||||||
|
|
||||||
.9 sec
|
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
Cmd.NextStrPtr2 lda (ZPPtr2)
|
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
>LDYA ZPPtr2
|
.8 clc
|
||||||
>SYSCALL strlen
|
|
||||||
pha
|
|
||||||
tya
|
|
||||||
sec +1
|
|
||||||
adc ZPPtr2
|
|
||||||
tay
|
|
||||||
|
|
||||||
pla
|
|
||||||
adc ZPPtr2+1
|
|
||||||
* clc
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 sec
|
.9 sec
|
||||||
|
@ -65,7 +65,8 @@ J.ESC .DA CL.BS left arrow
|
|||||||
.DA HIS.GetPrev
|
.DA HIS.GetPrev
|
||||||
.DA CL.NAK right arow
|
.DA CL.NAK right arow
|
||||||
L.CMD.INT .DA CMD.INT
|
L.CMD.INT .DA CMD.INT
|
||||||
J.CMD.INT .DA Cmd.INT.CD
|
J.CMD.INT .DA Cmd.INT.STARTPROC
|
||||||
|
.DA Cmd.INT.CD
|
||||||
.DA Cmd.INT.DATE
|
.DA Cmd.INT.DATE
|
||||||
.DA Cmd.INT.ECHO
|
.DA Cmd.INT.ECHO
|
||||||
.DA Cmd.INT.EXIT
|
.DA Cmd.INT.EXIT
|
||||||
@ -75,9 +76,8 @@ J.CMD.INT .DA Cmd.INT.CD
|
|||||||
.DA Cmd.INT.READ
|
.DA Cmd.INT.READ
|
||||||
.DA Cmd.INT.SET
|
.DA Cmd.INT.SET
|
||||||
.DA Cmd.INT.SLEEP
|
.DA Cmd.INT.SLEEP
|
||||||
.DA Cmd.INT.STARTPROC
|
|
||||||
.DA Cmd.INT.TIME
|
.DA Cmd.INT.TIME
|
||||||
L.CMD.IOR .DA CMD.IOR
|
L.CMD.IO .DA CMD.IO
|
||||||
L.CSH.BOPS .DA CSH.BOPS
|
L.CSH.BOPS .DA CSH.BOPS
|
||||||
J.CSH.BOPS .DA CSH.BOPS.ADD
|
J.CSH.BOPS .DA CSH.BOPS.ADD
|
||||||
.DA CSH.BOPS.SUB
|
.DA CSH.BOPS.SUB
|
||||||
@ -198,7 +198,7 @@ CS.RUN >LDA.G bReadMode READ Command ?
|
|||||||
|
|
||||||
jsr CMD.Parse
|
jsr CMD.Parse
|
||||||
|
|
||||||
lda (ZPCMDBuf)
|
lda (ZPArgVBuf)
|
||||||
beq .10 Empty line
|
beq .10 Empty line
|
||||||
|
|
||||||
jsr HIS.Add
|
jsr HIS.Add
|
||||||
@ -285,7 +285,7 @@ CS.RUN.BATCH >SYSCALL GetChar
|
|||||||
|
|
||||||
jsr CMD.Parse
|
jsr CMD.Parse
|
||||||
|
|
||||||
lda (ZPCMDBuf)
|
lda (ZPArgVBuf)
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
jsr CMD.Exec
|
jsr CMD.Exec
|
||||||
@ -371,7 +371,7 @@ ENV.HOME .AZ "HOME"
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* https://www.tldp.org/LDP/abs/html/io-redirection.html
|
* https://www.tldp.org/LDP/abs/html/io-redirection.html
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CMD.IOR .AZ "&"
|
CMD.IO .AZ "&"
|
||||||
.AZ "|"
|
.AZ "|"
|
||||||
.AZ "<"
|
.AZ "<"
|
||||||
.AZ ">>"
|
.AZ ">>"
|
||||||
@ -382,7 +382,8 @@ CMD.IOR .AZ "&"
|
|||||||
.AZ "2>"
|
.AZ "2>"
|
||||||
.HS 00
|
.HS 00
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CMD.INT .AZ "CD"
|
CMD.INT .AZ "STARTPROC"
|
||||||
|
.AZ "CD"
|
||||||
.AZ "DATE"
|
.AZ "DATE"
|
||||||
.AZ "ECHO"
|
.AZ "ECHO"
|
||||||
.AZ "EXIT"
|
.AZ "EXIT"
|
||||||
@ -392,7 +393,6 @@ CMD.INT .AZ "CD"
|
|||||||
.AZ "READ"
|
.AZ "READ"
|
||||||
.AZ "SET"
|
.AZ "SET"
|
||||||
.AZ "SLEEP"
|
.AZ "SLEEP"
|
||||||
.AZ "STARTPROC"
|
|
||||||
.AZ "TIME"
|
.AZ "TIME"
|
||||||
.HS 00
|
.HS 00
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -424,6 +424,7 @@ bSecureRead .BS 1
|
|||||||
Sleep .BS 4
|
Sleep .BS 4
|
||||||
|
|
||||||
CMD.hCmdLine .BS 1
|
CMD.hCmdLine .BS 1
|
||||||
|
CMD.bCmd .BS 1
|
||||||
CMD.hArgVBuf .BS 1
|
CMD.hArgVBuf .BS 1
|
||||||
|
|
||||||
CMD.PSFlags .BS 1
|
CMD.PSFlags .BS 1
|
||||||
|
@ -356,7 +356,7 @@ K.InsDrv >STYA ZPPtr1
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #K.E.OOM
|
.9 lda #E.OOM
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -405,7 +405,7 @@ BIN.RelExe ldy #H.BIN.T+1
|
|||||||
cmp /H.BIN.T.DRV65
|
cmp /H.BIN.T.DRV65
|
||||||
beq .1
|
beq .1
|
||||||
|
|
||||||
lda #K.E.IBIN
|
lda #E.IBIN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ CORE.GetPS ldy #0
|
|||||||
cpy #K.PS.MAX
|
cpy #K.PS.MAX
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.9 lda #K.E.NSP
|
.9 lda #E.NSP
|
||||||
* sec
|
* sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -148,7 +148,7 @@ K.MKDev >STYA .1+1
|
|||||||
cpx #K.IRQDEV.MAX*2
|
cpx #K.IRQDEV.MAX*2
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
.9 lda #K.E.OOH
|
.9 lda #E.OOH
|
||||||
* sec
|
* sec
|
||||||
.99 rts
|
.99 rts
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ K.SetEnv.I jsr K.UnsetEnv.I
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.99 lda #K.E.ENVF
|
.99 lda #E.ENVF
|
||||||
* sec
|
* sec
|
||||||
rts
|
rts
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
|
@ -58,7 +58,7 @@ K.LoadFile clc
|
|||||||
inc
|
inc
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.10 lda #K.E.FTB
|
.10 lda #E.FTB
|
||||||
.11 bra .99
|
.11 bra .99
|
||||||
|
|
||||||
.1 jsr K.GetMem
|
.1 jsr K.GetMem
|
||||||
|
@ -218,7 +218,7 @@ Mem.AddSlot >STYA ZPMemMgrTmp1 save req size
|
|||||||
|
|
||||||
.98 pla discard new Mem.Free HI
|
.98 pla discard new Mem.Free HI
|
||||||
|
|
||||||
.99 lda #K.E.OOM
|
.99 lda #E.OOM
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -64,7 +64,7 @@ PS.CreateChild ldx #0
|
|||||||
cpx #K.PS.MAX
|
cpx #K.PS.MAX
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
lda #K.E.OOH
|
lda #E.OOH
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ K.FClose jsr PFT.CheckNodeA
|
|||||||
stz Nod.Table.hFD,x
|
stz Nod.Table.hFD,x
|
||||||
jmp K.Close
|
jmp K.Close
|
||||||
|
|
||||||
.9 lda #K.E.INVH
|
.9 lda #E.INVH
|
||||||
sec
|
sec
|
||||||
K.FClose.RTS rts
|
K.FClose.RTS rts
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
@ -1144,9 +1144,9 @@ K.FSeek jsr PFT.CheckNodeA
|
|||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
|
|
||||||
.98 lda #K.E.SYN
|
.98 lda #E.SYN
|
||||||
.HS 2C bit abs
|
.HS 2C bit abs
|
||||||
.99 lda #K.E.FTB
|
.99 lda #E.FTB
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
@ -1285,7 +1285,7 @@ STDIO.NewHFileYAX
|
|||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
pla
|
pla
|
||||||
lda #K.E.OOH
|
lda #E.OOH
|
||||||
* sec
|
* sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -1326,7 +1326,7 @@ STDIO.GetHFile tay
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
STDIO.GetHFile.9
|
STDIO.GetHFile.9
|
||||||
lda #K.E.INVH
|
lda #E.INVH
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -386,7 +386,7 @@ K.realpath >STYA ZPPtr1
|
|||||||
.89 >LDYAI K.Buf256
|
.89 >LDYAI K.Buf256
|
||||||
jmp K.NewStr
|
jmp K.NewStr
|
||||||
|
|
||||||
.90 lda #K.E.SYN
|
.90 lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -20,9 +20,14 @@ ERR.Codes .DA #MLI.E.IO
|
|||||||
.DA #MLI.E.LOCKED
|
.DA #MLI.E.LOCKED
|
||||||
.DA #MLI.E.OPEN
|
.DA #MLI.E.OPEN
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DA #K.E.OOM
|
.DA #E.OOM
|
||||||
.DA #K.E.OOH
|
.DA #E.OOH
|
||||||
.DA #K.E.SYN
|
.DA #E.INVH
|
||||||
|
.DA #E.BUF
|
||||||
|
.DA #E.SYN
|
||||||
|
.DA #E.ENVF
|
||||||
|
.DA #E.IBIN
|
||||||
|
.DA #E.FTB
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ERR.Count .EQ *-ERR.Codes
|
ERR.Count .EQ *-ERR.Codes
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -45,7 +50,12 @@ ERR.Messages >PSTR "I/O Error"
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
>PSTR "Out Of Memory"
|
>PSTR "Out Of Memory"
|
||||||
>PSTR "Out Of Memory Handle"
|
>PSTR "Out Of Memory Handle"
|
||||||
|
>PSTR "Invalid Handle"
|
||||||
|
>PSTR "Buffer Overflow"
|
||||||
>PSTR "Syntax Error"
|
>PSTR "Syntax Error"
|
||||||
|
>PSTR "Env Is Full"
|
||||||
|
>PSTR "Invalid BIN format"
|
||||||
|
>PSTR "File Too Big"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
>PSTR "Unknown Error"
|
>PSTR "Unknown Error"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user