mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-21 00:31:59 +00:00
Kernel 0.93
This commit is contained in:
parent
fcc36ca1ed
commit
058026fea0
@ -64,12 +64,13 @@ where [ exp ] and [ condition ] allow to detail operators....
|
||||
| CALL | Working | CALL function <arg> ... |
|
||||
| CASE | Working | CASE <expression> |
|
||||
| CD | Working | CD path or relative path |
|
||||
| .. | Working | CD .. |
|
||||
| DATE | Working | |
|
||||
| DEFAULT | Working | Default CASE for SWITCH |
|
||||
| ECHO | Working | \b,\e,\f,\n,\\\ and \\% supported <br> -N : Suppress \r\n |
|
||||
| ELSE | Working | Optional branch for IF block |
|
||||
| END | Working | End of SWITCH Statement |
|
||||
| EXIT | Working | exit script or shell |
|
||||
| EXIT | Working | exit function, script or shell |
|
||||
| FI | Working | Terminator for IF block |
|
||||
| FUNC | In Progress | FUNC fonction_name <br> \<body\> <br> END |
|
||||
| IF | Working | [ \<condition\> ] |
|
||||
@ -81,10 +82,9 @@ where [ exp ] and [ condition ] allow to detail operators....
|
||||
| PUSHD | Working | Save actual working directory <br> PUSHD \<dir\> do also a CD to \<dir\> |
|
||||
| PWD | Working | Print Working Directory |
|
||||
| RD | Working | Delete an empty directory |
|
||||
| READ | Working | -F : Undefine all functions <br> -S : no echo (password) <br> -P : "prompt message" |
|
||||
| READ | Working | -S : no echo (password) <br> -P : "prompt message" |
|
||||
| REN | Working | Rename a file, directory or volume |
|
||||
| RETURN | In Progress | Exit function with return code |
|
||||
| SET | Working | -X : toggle debug mode <br> -C : toggle Control-C break mode |
|
||||
| SET | Working | -X : toggle debug mode <br> -C : toggle Control-C break mode <br> -E : toggle error printing mode <br> -F : delete all declared functions |
|
||||
| SHIFT | Working | Remove $1 from cmd line |
|
||||
| SLEEP | Working | Wait \<count\> 10th sec |
|
||||
| SWITCH | Working | SWITCH <expression> |
|
||||
|
186
BIN/SH.S.CMD.txt
186
BIN/SH.S.CMD.txt
@ -572,17 +572,24 @@ CMD.. lda (ZPArgVBufPtr)
|
||||
beq .9
|
||||
|
||||
>LDYA ZPArgVBufPtr
|
||||
jmp CORE.FCALL exec cmd file and continue
|
||||
jsr IO.Load
|
||||
bcs CMD.CALL.RTS
|
||||
>LDYA ZPArgVBufPtr
|
||||
jmp CMD.CALL exec cmd file and continue
|
||||
|
||||
.9 jmp CMD.Exec.CSYN
|
||||
*--------------------------------------
|
||||
CMD.CALL.UNDEF lda #E.FUNDEF
|
||||
sec
|
||||
CMD.CALL.RTS rts
|
||||
*--------------------------------------
|
||||
CMD.CALL >LDA.G hFuncList
|
||||
beq .9
|
||||
beq CMD.CALL.UNDEF
|
||||
|
||||
>PUSHW ZPArgVBufPtr
|
||||
>LDA.G hFuncList
|
||||
>SYSCALL SListLookup
|
||||
bcs .9
|
||||
bcs CMD.CALL.UNDEF
|
||||
|
||||
>STYA M32.TMP KeyID
|
||||
|
||||
@ -592,47 +599,131 @@ CMD.CALL >LDA.G hFuncList
|
||||
>PUSHW M32.TMP KeyID
|
||||
>LDA.G hFuncList
|
||||
>SYSCALL SListGetData
|
||||
bcs .99
|
||||
bcs CMD.CALL.RTS
|
||||
|
||||
>LDYA ZPArgVBufPtr FUNC PARAM1 PARAM2...
|
||||
jmp CORE.CALL X = Func Code
|
||||
|
||||
.9 lda #E.FUNDEF
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
CMD.RETURN jsr CORE.RETURN
|
||||
|
||||
CMD.CALL.YAX stx M32.ACC X=Code to Execute
|
||||
|
||||
jsr CORE.ArgV.Dup Y,A = ArgV
|
||||
bcs .9
|
||||
|
||||
lda (ZPArgVBufPtr)
|
||||
beq .8 no arg, exit 0
|
||||
|
||||
>LDYA ZPArgVBufPtr
|
||||
>SYSCALL AToL
|
||||
stx M32.ACC+1 X=ARGV
|
||||
|
||||
lda #7
|
||||
jsr CORE.StkCheck
|
||||
bcs .9
|
||||
|
||||
>PULLL M32.ACC
|
||||
|
||||
lda ZPInputBuf
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda ZPInputBuf+1
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda ZPInputBufPtr
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda ZPInputBufPtr+1
|
||||
jsr CORE.StkPush
|
||||
|
||||
ldy #S.PS.hARGV
|
||||
lda (pPS),y
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda M32.ACC+1 new ARGV
|
||||
ldy #S.PS.hARGV
|
||||
sta (pPS),y
|
||||
|
||||
lda M32.ACC
|
||||
jsr CORE.StkPush
|
||||
|
||||
.8 clc
|
||||
lda M32.ACC
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPInputBuf
|
||||
>STYA ZPInputBufPtr
|
||||
|
||||
lda #$C0
|
||||
jsr CORE.StkPush
|
||||
|
||||
>INC.G bBatchMode
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CMD.EXIT lda (ZPArgVBufPtr)
|
||||
beq .8 no arg, exit 0
|
||||
beq CMD.EXIT.A no arg, exit 0
|
||||
|
||||
>LDYA ZPArgVBufPtr
|
||||
jsr EXP.GET
|
||||
bcs CMD.EXIT.RTS
|
||||
>SYSCALL AToL
|
||||
bcs .9
|
||||
bcs CMD.EXIT.RTS
|
||||
|
||||
>PULLL M32.ACC
|
||||
lda M32.ACC
|
||||
>PULLA
|
||||
inc pStack
|
||||
inc pStack
|
||||
inc pStack
|
||||
|
||||
.8 pha
|
||||
CMD.EXIT.A sta M32.ACC
|
||||
>DEBUG
|
||||
.1 jsr CORE.StkPull
|
||||
bcs CMD.EXIT.RTS
|
||||
|
||||
cmp #$C0 in CALL / . context ?
|
||||
beq .8
|
||||
|
||||
and #$3F
|
||||
ldx #1
|
||||
cmp #C.IF
|
||||
beq .3
|
||||
|
||||
.2 ldx #3
|
||||
cmp #C.WHILE
|
||||
bne CMD.EXIT.99
|
||||
|
||||
.3 lda (pData)
|
||||
|
||||
.4 dec
|
||||
dex
|
||||
bne .4
|
||||
|
||||
sta (pData)
|
||||
bra .1
|
||||
|
||||
.8 jsr CORE.StkPull
|
||||
>SYSCALL freemem Code buffer
|
||||
|
||||
ldy #S.PS.hARGV
|
||||
lda (pPS),y
|
||||
>SYSCALL freemem ArgV buffer
|
||||
|
||||
jsr CORE.StkPull
|
||||
ldy #S.PS.hARGV
|
||||
sta (pPS),y
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBufPtr+1
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBufPtr
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBuf+1
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBuf
|
||||
|
||||
>DEC.G bBatchMode
|
||||
|
||||
pha
|
||||
lda #$FF
|
||||
>STA.G bExit
|
||||
pla
|
||||
clc
|
||||
.9 rts
|
||||
CMD.EXIT.RTS rts
|
||||
|
||||
CMD.EXIT.99 lda #E.STACKERROR
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CMD.BREAK jsr CORE.StkGetCtx Get context in CORE.Test
|
||||
bcs .9
|
||||
@ -659,6 +750,10 @@ CMD.BREAK jsr CORE.StkGetCtx Get context in CORE.Test
|
||||
*--------------------------------------
|
||||
CMD.SWITCH jsr CORE.StkGetCtx
|
||||
|
||||
lda #2
|
||||
jsr CORE.StkCheck
|
||||
bcs .9
|
||||
|
||||
jsr EXP.GET
|
||||
bcs .9
|
||||
>SYSCALL strdup
|
||||
@ -799,6 +894,14 @@ CMD.FOR jsr CORE.StkGetCtx
|
||||
jsr CORE.ArgV.Next
|
||||
beq CMD.END.CSYN
|
||||
|
||||
lda #8
|
||||
jsr CORE.StkCheck
|
||||
bcs .9
|
||||
|
||||
sec
|
||||
jsr CORE.StkPushPtr Push CmdPtr AFTER FOR
|
||||
|
||||
lda (ZPArgVBufPtr)
|
||||
cmp #'('
|
||||
beq FOR.FILE
|
||||
|
||||
@ -806,15 +909,9 @@ CMD.FOR jsr CORE.StkGetCtx
|
||||
bne FOR.LIST
|
||||
|
||||
jmp FOR.EXEC
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
FOR.LIST lda #8
|
||||
jsr CORE.StkCheck
|
||||
bcs .9
|
||||
|
||||
sec
|
||||
jsr CORE.StkPushPtr Push CmdPtr AFTER FOR
|
||||
|
||||
>LDYA ZPArgVBufPtr
|
||||
FOR.LIST >LDYA ZPArgVBufPtr
|
||||
>SYSCALL strdup
|
||||
bcs .9
|
||||
|
||||
@ -851,14 +948,7 @@ FOR.LIST lda #8
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
FOR.FILE lda #8
|
||||
jsr CORE.StkCheck
|
||||
bcs FOR.FILE.9
|
||||
|
||||
sec
|
||||
jsr CORE.StkPushPtr Push CmdPtr AFTER FOR
|
||||
|
||||
jsr CORE.ArgV.NextChar skip "("
|
||||
FOR.FILE jsr CORE.ArgV.NextChar skip "("
|
||||
|
||||
>PUSHWI 0 Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
@ -897,14 +987,7 @@ FOR.FILE lda #8
|
||||
|
||||
FOR.FILE.9 rts
|
||||
*--------------------------------------
|
||||
FOR.EXEC lda #8
|
||||
jsr CORE.StkCheck
|
||||
bcs FOR.FILE.9
|
||||
|
||||
sec
|
||||
jsr CORE.StkPushPtr Push CmdPtr AFTER FOR
|
||||
|
||||
jsr CORE.ArgV.NextChar skip "`"
|
||||
FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
|
||||
|
||||
jsr IO.Pipe.Out
|
||||
bcs .9
|
||||
@ -1222,6 +1305,7 @@ CMD.IF jsr CORE.StkGetCtx
|
||||
*--------------------------------------
|
||||
CMD.LOOP jsr CORE.StkPull
|
||||
bcs .9
|
||||
|
||||
tax
|
||||
and #$3F
|
||||
cmp #C.WHILE
|
||||
@ -1231,8 +1315,8 @@ CMD.LOOP jsr CORE.StkPull
|
||||
bmi .8
|
||||
|
||||
lda (pData)
|
||||
sec
|
||||
sbc #2 Discard loop Ptr
|
||||
dec
|
||||
dec Discard loop Ptr
|
||||
sta (pData)
|
||||
|
||||
clc
|
||||
|
@ -71,7 +71,8 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
|
||||
jsr CORE.GetCharNB
|
||||
bcc .11
|
||||
|
||||
jsr CORE.RETURN
|
||||
lda #0 EOF
|
||||
jsr CMD.EXIT.A
|
||||
bcs .9
|
||||
|
||||
jsr IO.Reset
|
||||
@ -321,100 +322,6 @@ CORE.SkipLine jsr CORE.GetNextCharNB
|
||||
jsr CORE.GetNextChar skip CR...
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CORE.FCALL >STYA ZPPtr1 ArgV
|
||||
>PUSHWI 0 Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHBI O.RDONLY
|
||||
|
||||
>LDYA ZPPtr1
|
||||
>SYSCALL LoadTxtFile
|
||||
bcs CORE.CALL.9
|
||||
|
||||
>LDYA ZPPtr1
|
||||
|
||||
CORE.CALL stx M32.ACC X=Code to Execute
|
||||
|
||||
jsr CORE.ArgV.Dup Y,A = ArgV
|
||||
bcs CORE.CALL.9
|
||||
|
||||
stx M32.ACC+1 X=ARGV
|
||||
|
||||
lda #7
|
||||
jsr CORE.StkCheck
|
||||
bcs CORE.CALL.9
|
||||
|
||||
lda ZPInputBuf
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda ZPInputBuf+1
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda ZPInputBufPtr
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda ZPInputBufPtr+1
|
||||
jsr CORE.StkPush
|
||||
|
||||
ldy #S.PS.hARGV
|
||||
lda (pPS),y
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda M32.ACC+1 new ARGV
|
||||
ldy #S.PS.hARGV
|
||||
sta (pPS),y
|
||||
|
||||
lda M32.ACC
|
||||
jsr CORE.StkPush
|
||||
|
||||
lda M32.ACC
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPInputBuf
|
||||
>STYA ZPInputBufPtr
|
||||
|
||||
lda #$C0
|
||||
jsr CORE.StkPush
|
||||
|
||||
>INC.G bBatchMode
|
||||
* clc
|
||||
CORE.CALL.9 rts
|
||||
*--------------------------------------
|
||||
CORE.RETURN jsr CORE.StkPull
|
||||
bcs .90
|
||||
|
||||
cmp #$C0
|
||||
bne .90
|
||||
|
||||
jsr CORE.StkPull
|
||||
>SYSCALL freemem Code buffer
|
||||
|
||||
ldy #S.PS.hARGV
|
||||
lda (pPS),y
|
||||
>SYSCALL freemem ArgV buffer
|
||||
|
||||
jsr CORE.StkPull
|
||||
ldy #S.PS.hARGV
|
||||
sta (pPS),y
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBufPtr+1
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBufPtr
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBuf+1
|
||||
|
||||
jsr CORE.StkPull
|
||||
sta ZPInputBuf
|
||||
|
||||
>DEC.G bBatchMode
|
||||
* clc
|
||||
rts
|
||||
|
||||
.90 lda #E.STACKERROR
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* search ZPInputBufPtr/ZPArgVBufPtr in Y,A table
|
||||
*--------------------------------------
|
||||
@ -779,15 +686,6 @@ CORE.StkPushPtr bcs .1
|
||||
txa
|
||||
bra CORE.StkPush
|
||||
*--------------------------------------
|
||||
CORE.StkPullPtr jsr CORE.StkPull
|
||||
bcs CORE.StkPullPtr.9
|
||||
sta ZPInputBufPtr+1
|
||||
jsr CORE.StkPull
|
||||
bcs CORE.StkPullPtr.9
|
||||
sta ZPInputBufPtr
|
||||
CORE.StkPullPtr.9
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.StkPushYA phy
|
||||
jsr CORE.StkPush
|
||||
pla
|
||||
@ -846,6 +744,15 @@ CORE.StkGetCtx jsr CORE.StkGet
|
||||
txa
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.StkPullPtr jsr CORE.StkPull
|
||||
bcs CORE.StkPullPtr.9
|
||||
sta ZPInputBufPtr+1
|
||||
jsr CORE.StkPull
|
||||
bcs CORE.StkPullPtr.9
|
||||
sta ZPInputBufPtr
|
||||
CORE.StkPullPtr.9
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.StkPull jsr CORE.StkGet
|
||||
bcs .9
|
||||
|
||||
|
@ -7,7 +7,16 @@ IO.Reset jsr IO.Reset.In
|
||||
jsr IO.Reset.Out
|
||||
jsr IO.Reset.Err
|
||||
IO.Reset.9 rts
|
||||
*--------------------------------------
|
||||
*--------------------------------------
|
||||
IO.Load pha
|
||||
>PUSHWI 0 Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHBI O.RDONLY
|
||||
|
||||
pla
|
||||
>SYSCALL LoadTxtFile
|
||||
rts
|
||||
*--------------------------------------
|
||||
IO.Pipe.In >LDA.G IO.hOut
|
||||
ldy #S.PS.hStdOut
|
||||
sta (pPS),y
|
||||
@ -21,7 +30,7 @@ IO.Pipe.In >LDA.G IO.hOut
|
||||
|
||||
>SYSCALL fopen
|
||||
bcs IO.Set.RTS
|
||||
*--------------------------------------
|
||||
*--------------------------------------
|
||||
IO.Set.In pha
|
||||
jsr IO.Reset.In
|
||||
ldy #S.PS.hStdIn
|
||||
@ -31,7 +40,7 @@ IO.Set.In pha
|
||||
ldy #S.PS.hStdIn
|
||||
sta (pPS),y
|
||||
IO.Set.RTS rts
|
||||
*--------------------------------------
|
||||
*--------------------------------------
|
||||
IO.Reset.In >LDA.G IO.hIn
|
||||
beq .8
|
||||
|
||||
@ -49,7 +58,7 @@ IO.Reset.In >LDA.G IO.hIn
|
||||
>STZ.G IO.hIn
|
||||
.8 clc
|
||||
IO.Reset.In.RTS rts
|
||||
*--------------------------------------
|
||||
*--------------------------------------
|
||||
IO.Pipe.Out >SYSCALL pipe
|
||||
bcs IO.Reset.In.RTS
|
||||
>STA.G IO.hPipe
|
||||
|
47
BIN/SH.S.txt
47
BIN/SH.S.txt
@ -31,24 +31,23 @@ C.TIME .EQ 17
|
||||
C.PUSHD .EQ 18
|
||||
C.POPD .EQ 19
|
||||
C.FUNC .EQ 20
|
||||
C.RETURN .EQ 21
|
||||
C.CALL .EQ 22
|
||||
C.BREAK .EQ 23
|
||||
C.SWITCH .EQ 24
|
||||
C.CASE .EQ 25
|
||||
C.DEFAULT .EQ 26
|
||||
C.END .EQ 27
|
||||
C.CALL .EQ 21
|
||||
C.BREAK .EQ 22
|
||||
C.SWITCH .EQ 23
|
||||
C.CASE .EQ 24
|
||||
C.DEFAULT .EQ 25
|
||||
C.END .EQ 26
|
||||
*--------------------------------------
|
||||
C.FOR .EQ 28
|
||||
C.FOR .EQ 27
|
||||
C.FOR.LIST .EQ 0
|
||||
C.FOR.FILE .EQ 2
|
||||
C.FOR.EXEC .EQ 4
|
||||
C.WHILE .EQ 29
|
||||
C.IF .EQ 30
|
||||
C.NEXT .EQ 31
|
||||
C.LOOP .EQ 32
|
||||
C.ELSE .EQ 33
|
||||
C.FI .EQ 34
|
||||
C.WHILE .EQ 28
|
||||
C.IF .EQ 29
|
||||
C.NEXT .EQ 30
|
||||
C.LOOP .EQ 31
|
||||
C.ELSE .EQ 32
|
||||
C.FI .EQ 33
|
||||
*--------------------------------------
|
||||
E.CSYN .EQ $C0
|
||||
E.ESYN .EQ $C1
|
||||
@ -150,7 +149,6 @@ J.CMD .DA CMD...
|
||||
.DA CMD.PUSHD
|
||||
.DA CMD.POPD
|
||||
.DA CMD.FUNC
|
||||
.DA CMD.RETURN
|
||||
.DA CMD.CALL
|
||||
.DA CMD.BREAK
|
||||
.DA CMD.SWITCH
|
||||
@ -218,9 +216,14 @@ CS.RUN jsr CL.Init
|
||||
lda (pPS),y
|
||||
>SYSCALL GetMemPtr
|
||||
|
||||
jsr CORE.FCALL Exec file an exit
|
||||
jsr IO.Load
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
phx
|
||||
ldy #S.PS.hARGV
|
||||
lda (pPS),y
|
||||
>SYSCALL GetMemPtr
|
||||
plx
|
||||
jsr CMD.CALL.YAX
|
||||
bra CS.RUN.LOOP
|
||||
*--------------------------------------
|
||||
.1 jsr CMD.CD.HOME
|
||||
@ -239,7 +242,10 @@ CS.RUN jsr CL.Init
|
||||
bcs CS.RUN.LOOP no profile...
|
||||
|
||||
>LDYA L.HOME.PROFILE
|
||||
jsr CORE.FCALL exec profile and continue
|
||||
jsr IO.Load
|
||||
bcs CS.RUN.LOOP
|
||||
>LDYA L.HOME.PROFILE
|
||||
jsr CMD.CALL.YAX exec profile and continue
|
||||
|
||||
* bcs CS.RUN.LOOP
|
||||
*--------------------------------------
|
||||
@ -347,7 +353,7 @@ CS.RUN.INTERACTIVE
|
||||
>SYSCALL GetMemPtr Y,A =ARGV
|
||||
|
||||
plx
|
||||
jsr CORE.CALL X = Copy of CL
|
||||
jsr CMD.CALL.YAX X = Copy of CL
|
||||
|
||||
.6 jsr CORE.Run
|
||||
|
||||
@ -442,7 +448,7 @@ CS.RUN.BATCH >LDA.G bSET.C
|
||||
bne CS.RUN.LOOP.END
|
||||
|
||||
pha
|
||||
jsr CORE.RETURN
|
||||
jsr CMD.EXIT.A
|
||||
|
||||
lda (pData)
|
||||
bne .6
|
||||
@ -614,7 +620,6 @@ CMD .AZ ".."
|
||||
.AZ "PUSHD"
|
||||
.AZ "POPD"
|
||||
.AZ "FUNC"
|
||||
.AZ "RETURN"
|
||||
.AZ "CALL"
|
||||
.AZ "BREAK"
|
||||
.AZ "SWITCH"
|
||||
|
Loading…
x
Reference in New Issue
Block a user