mirror of
https://github.com/A2osX/A2osX.git
synced 2025-02-27 00:30:55 +00:00
Kernel 0.92+
This commit is contained in:
parent
f1d2dcf41d
commit
e9bfd87013
Binary file not shown.
@ -122,7 +122,12 @@ CSH.Run jsr CSH.GetCharNB
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
.80 clc
|
.80 jsr CSH.GetNextChar
|
||||||
|
bcs .9
|
||||||
|
cmp #C.CR
|
||||||
|
bne .80
|
||||||
|
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.WHILE
|
CSH.WHILE
|
||||||
|
@ -8,6 +8,7 @@ AUTO 4,1 Enable MASM3 auto line num
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.INB INC/MACROS.I
|
.INB INC/MACROS.I
|
||||||
.INB INC/A2OSX.I
|
.INB INC/A2OSX.I
|
||||||
|
.INB INC/MLI.I
|
||||||
.INB INC/MLI.E.I
|
.INB INC/MLI.E.I
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.INB USR/SRC/BIN/CSH.E
|
.INB USR/SRC/BIN/CSH.E
|
||||||
@ -47,6 +48,7 @@ CS.START cld
|
|||||||
.DA CS.RUN
|
.DA CS.RUN
|
||||||
.DA CS.DOEVENT
|
.DA CS.DOEVENT
|
||||||
.DA CS.QUIT
|
.DA CS.QUIT
|
||||||
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
||||||
.INB USR/SRC/BIN/CSH.R
|
.INB USR/SRC/BIN/CSH.R
|
||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -59,19 +61,41 @@ CS.INIT clc
|
|||||||
* Called until exit with CS
|
* Called until exit with CS
|
||||||
* if RUN exits with CC, RN entered again
|
* if RUN exits with CC, RN entered again
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN
|
CS.RUN >PUSHWI K.VER
|
||||||
|
>PUSHBI 2
|
||||||
|
>LDYA L.MSG.GREETINGS
|
||||||
|
>SYSCALL printf
|
||||||
|
bcs .99
|
||||||
|
|
||||||
* Put your code here
|
jsr CSH.Init
|
||||||
* >LDYA L.MSG.Test Load EFFECTIVE address
|
bcs .99
|
||||||
* >SYSCALL puts Call API to print a string
|
|
||||||
|
ldy #S.PS.ARGC
|
||||||
|
lda (pPS),y
|
||||||
|
beq .90 no arg, usage
|
||||||
|
|
||||||
|
>PUSHWI 0 Aux type
|
||||||
|
>PUSHBI S.FI.T.TXT
|
||||||
|
>PUSHBI O.RDONLY
|
||||||
|
lda #1
|
||||||
|
>SYSCALL ArgV
|
||||||
|
>SYSCALL LoadTxtFile
|
||||||
|
bcs .99
|
||||||
|
|
||||||
|
txa
|
||||||
|
>STA.G hFileBuf
|
||||||
|
>SYSCALL GetMemPtr
|
||||||
|
>STYA ZPFileBufPtr
|
||||||
|
|
||||||
|
.1 >SLEEP
|
||||||
|
jsr CSH.Run
|
||||||
|
bcc .1
|
||||||
|
|
||||||
.8 lda #0 Exit Code = Succes
|
|
||||||
sec QUIT Process
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #E.SYN Exit Code = Succes
|
.90 lda #E.SYN Exit Code = Succes
|
||||||
sec QUIT Process
|
sec QUIT Process
|
||||||
rts
|
.99 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Called if option S.PS.F.EVENT enabled in Header
|
* Called if option S.PS.F.EVENT enabled in Header
|
||||||
* Timer Event : every 10th seconds
|
* Timer Event : every 10th seconds
|
||||||
@ -82,7 +106,8 @@ CS.DOEVENT sec
|
|||||||
* Called once, when RUN exited with CS
|
* Called once, when RUN exited with CS
|
||||||
* Put code for unloading LIB here
|
* Put code for unloading LIB here
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.QUIT clc
|
CS.QUIT jsr CSH.Quit
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.INB USR/SRC/BIN/CSH.S.CORE
|
.INB USR/SRC/BIN/CSH.S.CORE
|
||||||
@ -91,6 +116,7 @@ CS.END
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Initialized DATA
|
* Initialized DATA
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
MSG.Greetings .AZ "\r\nCSH-Shell %d.%d\r\n\r\n"
|
||||||
.INB USR/SRC/BIN/CSH.I
|
.INB USR/SRC/BIN/CSH.I
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DUMMY
|
.DUMMY
|
||||||
|
@ -7,7 +7,6 @@ CL.Init >LDYAI 256
|
|||||||
>SYSCALL GetMem
|
>SYSCALL GetMem
|
||||||
bcs .9
|
bcs .9
|
||||||
>STYA ZPCLBuf
|
>STYA ZPCLBuf
|
||||||
|
|
||||||
txa
|
txa
|
||||||
>STA.G CL.hCLBuf
|
>STA.G CL.hCLBuf
|
||||||
|
|
||||||
@ -85,7 +84,7 @@ CL.CHARIN.CTRL cpx #C.CR
|
|||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
|
|
||||||
lda #$ff
|
lda #$ff
|
||||||
>STA.G CL.bExec
|
>STA.G CL.bReady
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -111,10 +110,8 @@ CL.CHARIN.CTRL cpx #C.CR
|
|||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CL.Insert >LDA.G CL.Len
|
CL.Insert >LDA.G CL.Len
|
||||||
cmp #CL.MAX
|
|
||||||
beq .9 Buffer full, discard...
|
|
||||||
|
|
||||||
inc
|
inc
|
||||||
|
beq .9 Buffer full, discard...
|
||||||
sta (pData),y
|
sta (pData),y
|
||||||
|
|
||||||
pha
|
pha
|
||||||
@ -178,7 +175,7 @@ CL.CLR lda (ZPCLBuf)
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CL.RESET lda #0
|
CL.RESET lda #0
|
||||||
sta (ZPCLBuf)
|
sta (ZPCLBuf)
|
||||||
CL.RESET.1 >STA.G CL.bExec
|
CL.RESET.1 >STA.G CL.bReady
|
||||||
>STA.G CL.Ptr
|
>STA.G CL.Ptr
|
||||||
>STA.G CL.Len
|
>STA.G CL.Len
|
||||||
rts
|
rts
|
||||||
|
@ -464,7 +464,8 @@ CMD.READ lda #1
|
|||||||
bcs .99
|
bcs .99
|
||||||
bra .7
|
bra .7
|
||||||
|
|
||||||
.4 >SYSCALL strdup
|
.4 >STYA ZPVarNamePtr
|
||||||
|
>SYSCALL strdup
|
||||||
txa
|
txa
|
||||||
>STA.G hVarName
|
>STA.G hVarName
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ CORE.Quit >LDA.G CORE.hArgVBuf
|
|||||||
* Input : ZPCLBuf/ZPFileBuf
|
* Input : ZPCLBuf/ZPFileBuf
|
||||||
* Get Line from buf until ;, CR, \0 (EOL / EOF) -> ZPArgVBuf
|
* Get Line from buf until ;, CR, \0 (EOL / EOF) -> ZPArgVBuf
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CORE.GetCmd >LDYA ZPInputBufPtr
|
CORE.GetCmd >LDYA ZPInputBufPtr Save Actual cmd for looping
|
||||||
>STYA ZPInputLinePtr
|
>STYA ZPInputCmdPtr
|
||||||
|
|
||||||
lda (ZPInputBufPtr)
|
lda (ZPInputBufPtr)
|
||||||
beq .9
|
beq .9
|
||||||
@ -308,10 +308,10 @@ CORE.GetArgX >LDYA ZPArgVBuf
|
|||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CORE.StkPushPtr lda ZPInputLinePtr
|
CORE.StkPushPtr lda ZPInputCmdPtr
|
||||||
jsr CORE.StkPush
|
jsr CORE.StkPush
|
||||||
bcs CORE.StkPullPtr.9
|
bcs CORE.StkPullPtr.9
|
||||||
lda ZPInputLinePtr+1
|
lda ZPInputCmdPtr+1
|
||||||
bra CORE.StkPush
|
bra CORE.StkPush
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -97,7 +97,7 @@ IO.Reset.Err >LDA.G IO.hErr
|
|||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
IO.PrintBatchErrMsg
|
IO.PrintBatchErrMsg
|
||||||
>LDA.G hFileBuf
|
>LDA.G hInputBuf
|
||||||
>SYSCALL GetMemPtr
|
>SYSCALL GetMemPtr
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ AUTO 4,1
|
|||||||
.OR $2000
|
.OR $2000
|
||||||
.TF BIN/SHELL
|
.TF BIN/SHELL
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CL.MAX .EQ 159
|
|
||||||
History.MAX .EQ 256
|
History.MAX .EQ 256
|
||||||
CORE.STACK.MAX .EQ 64
|
CORE.STACK.MAX .EQ 64
|
||||||
PUSHD.STACK.MAX .EQ 8
|
PUSHD.STACK.MAX .EQ 8
|
||||||
@ -62,11 +61,12 @@ ZPPtr1 .BS 2
|
|||||||
ZPPtr2 .BS 2
|
ZPPtr2 .BS 2
|
||||||
ZPPtr3 .BS 2
|
ZPPtr3 .BS 2
|
||||||
ZPCLBuf .BS 2
|
ZPCLBuf .BS 2
|
||||||
ZPFileBuf .BS 2
|
ZPInputBuf .BS 2
|
||||||
ZPInputBufPtr .BS 2
|
ZPInputBufPtr .BS 2
|
||||||
ZPInputLinePtr .BS 2
|
ZPInputCmdPtr .BS 2
|
||||||
ZPArgVBuf .BS 2
|
ZPArgVBuf .BS 2
|
||||||
ZPArgVBufPtr .BS 2
|
ZPArgVBufPtr .BS 2
|
||||||
|
ZPVarNamePtr .BS 2
|
||||||
ZS.END .ED
|
ZS.END .ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header (16 Bytes)
|
* File Header (16 Bytes)
|
||||||
@ -184,14 +184,17 @@ CS.RUN jsr CL.Init
|
|||||||
bcs CS.INIT.RTS
|
bcs CS.INIT.RTS
|
||||||
|
|
||||||
txa
|
txa
|
||||||
>STA.G hFileBuf
|
>STA.G hInputBuf
|
||||||
>SYSCALL GetMemPtr
|
>SYSCALL GetMemPtr
|
||||||
>STYA ZPFileBuf
|
>STYA ZPInputBuf
|
||||||
>STYA ZPInputBufPtr
|
>STYA ZPInputBufPtr
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
jsr CMD.SHIFTA Remove $0=/bin/shell
|
jsr CMD.SHIFTA Remove $0=/bin/shell
|
||||||
|
|
||||||
|
lda #$ff
|
||||||
|
>STA.G bBatchMode
|
||||||
|
|
||||||
bra CS.RUN.LOOP
|
bra CS.RUN.LOOP
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.1 jsr CMD.CD.HOME
|
.1 jsr CMD.CD.HOME
|
||||||
@ -226,7 +229,7 @@ CS.RUN.LOOP jsr IO.Reset
|
|||||||
cmp #3 Ctrl-C
|
cmp #3 Ctrl-C
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
>LDA.G hFileBuf batch mode ?
|
>LDA.G bBatchMode batch mode ?
|
||||||
beq .1
|
beq .1
|
||||||
|
|
||||||
>LDA.G bSET.C
|
>LDA.G bSET.C
|
||||||
@ -250,7 +253,7 @@ CS.RUN.LOOP jsr IO.Reset
|
|||||||
.5 cmp #3 Ctrl-C
|
.5 cmp #3 Ctrl-C
|
||||||
bne .60
|
bne .60
|
||||||
|
|
||||||
>LDA.G hFileBuf batch mode ?
|
>LDA.G bBatchMode batch mode ?
|
||||||
beq .61
|
beq .61
|
||||||
|
|
||||||
>LDA.G bSET.C
|
>LDA.G bSET.C
|
||||||
@ -266,7 +269,7 @@ CS.RUN.LOOP jsr IO.Reset
|
|||||||
.6 >LDA.G hVarName read mode ?
|
.6 >LDA.G hVarName read mode ?
|
||||||
bne .7
|
bne .7
|
||||||
|
|
||||||
.62 >LDA.G hFileBuf batch mode ?
|
.62 >LDA.G bBatchMode batch mode ?
|
||||||
beq CS.RUN.INTERACTIVE
|
beq CS.RUN.INTERACTIVE
|
||||||
jmp CS.RUN.BATCH
|
jmp CS.RUN.BATCH
|
||||||
.7 jmp CS.RUN.READ
|
.7 jmp CS.RUN.READ
|
||||||
@ -294,7 +297,7 @@ CS.RUN.INTERACTIVE
|
|||||||
|
|
||||||
jsr CL.CHARIN
|
jsr CL.CHARIN
|
||||||
|
|
||||||
>LDA.G CL.bExec Something to execute ?
|
>LDA.G CL.bReady Something to execute ?
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
lda (ZPCLBuf)
|
lda (ZPCLBuf)
|
||||||
@ -303,7 +306,12 @@ CS.RUN.INTERACTIVE
|
|||||||
jsr HIS.Add
|
jsr HIS.Add
|
||||||
|
|
||||||
>LDYA ZPCLBuf
|
>LDYA ZPCLBuf
|
||||||
|
>SYSCALL strdup
|
||||||
|
bcs .8
|
||||||
|
>STYA ZPInputBuf
|
||||||
>STYA ZPInputBufPtr
|
>STYA ZPInputBufPtr
|
||||||
|
txa
|
||||||
|
>STA.G hInputBuf
|
||||||
|
|
||||||
.7 jsr CORE.GetCmd
|
.7 jsr CORE.GetCmd
|
||||||
bcs .8
|
bcs .8
|
||||||
@ -316,14 +324,15 @@ CS.RUN.INTERACTIVE
|
|||||||
|
|
||||||
.8 jmp CS.RUN.LOOP.END
|
.8 jmp CS.RUN.LOOP.END
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN.READ
|
CS.RUN.READ jsr CL.RESET
|
||||||
|
|
||||||
.1 >SLEEP
|
.1 >SLEEP
|
||||||
>SYSCALL GetChar
|
>SYSCALL GetChar
|
||||||
bcs .1 no char
|
bcs .1 no char
|
||||||
|
|
||||||
jsr CL.CHARIN
|
jsr CL.CHARIN
|
||||||
|
|
||||||
>LDA.G CL.bExec
|
>LDA.G CL.bReady
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
lda (ZPCLBuf)
|
lda (ZPCLBuf)
|
||||||
@ -342,9 +351,10 @@ CS.RUN.READ
|
|||||||
|
|
||||||
.7 php
|
.7 php
|
||||||
pha
|
pha
|
||||||
|
|
||||||
>LDA.G hVarName
|
>LDA.G hVarName
|
||||||
>SYSCALL freemem
|
>SYSCALL freemem
|
||||||
|
|
||||||
>STZ.G hVarName
|
>STZ.G hVarName
|
||||||
>STA.G bREAD.S
|
>STA.G bREAD.S
|
||||||
|
|
||||||
@ -400,7 +410,7 @@ CS.RUN.LOOP.END ldy #S.PS.RC
|
|||||||
bcc CS.RUN.LOOP.8
|
bcc CS.RUN.LOOP.8
|
||||||
tay
|
tay
|
||||||
beq CS.RUN.LOOP.8
|
beq CS.RUN.LOOP.8
|
||||||
>LDA.G hFileBuf batch mode ?
|
>LDA.G bBatchMode batch mode ?
|
||||||
beq .1
|
beq .1
|
||||||
|
|
||||||
jsr IO.PrintBatchErrMsg
|
jsr IO.PrintBatchErrMsg
|
||||||
@ -411,6 +421,10 @@ CS.RUN.LOOP.END ldy #S.PS.RC
|
|||||||
|
|
||||||
jsr IO.PrintErrMsg
|
jsr IO.PrintErrMsg
|
||||||
bcs CS.RUN.LOOP.RTS
|
bcs CS.RUN.LOOP.RTS
|
||||||
|
|
||||||
|
>LDA.G hInputBuf
|
||||||
|
beq CS.RUN.LOOP.8
|
||||||
|
>SYSCALL FreeMem
|
||||||
|
|
||||||
CS.RUN.LOOP.8 >LDA.G bExit
|
CS.RUN.LOOP.8 >LDA.G bExit
|
||||||
beq CS.RUN.LOOP.80
|
beq CS.RUN.LOOP.80
|
||||||
@ -445,11 +459,7 @@ CS.DOEVENT lda (pEvent)
|
|||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.QUIT >LDA.G hFileBuf
|
CS.QUIT jsr HIS.Quit
|
||||||
beq .1
|
|
||||||
>SYSCALL FreeMem
|
|
||||||
|
|
||||||
.1 jsr HIS.Quit
|
|
||||||
jsr CL.Quit
|
jsr CL.Quit
|
||||||
jsr CORE.Quit
|
jsr CORE.Quit
|
||||||
clc
|
clc
|
||||||
@ -652,9 +662,11 @@ DS.START
|
|||||||
CORE.STACK .BS CORE.STACK.MAX+1 pData (0 = Stack Ptr)
|
CORE.STACK .BS CORE.STACK.MAX+1 pData (0 = Stack Ptr)
|
||||||
PUSHD.STACK .BS PUSHD.STACK.MAX+1
|
PUSHD.STACK .BS PUSHD.STACK.MAX+1
|
||||||
|
|
||||||
hFileBuf .BS 1 batch mode
|
hInputBuf .BS 1 batch mode
|
||||||
hVarName .BS 1 read mode
|
hVarName .BS 1 read mode
|
||||||
|
|
||||||
|
bBatchMode .BS 1
|
||||||
|
|
||||||
bEscMode .BS 1
|
bEscMode .BS 1
|
||||||
bPause .BS 1
|
bPause .BS 1
|
||||||
bExit .BS 1
|
bExit .BS 1
|
||||||
@ -670,7 +682,7 @@ TimeBuf .BS S.TIME
|
|||||||
CL.hCLBuf .BS 1
|
CL.hCLBuf .BS 1
|
||||||
CL.Ptr .BS 1
|
CL.Ptr .BS 1
|
||||||
CL.Len .BS 1
|
CL.Len .BS 1
|
||||||
CL.bExec .BS 1
|
CL.bReady .BS 1
|
||||||
CL.CmdSep .BS 1
|
CL.CmdSep .BS 1
|
||||||
|
|
||||||
CORE.IntCmd .BS 1
|
CORE.IntCmd .BS 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user