mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-02 13:41:30 +00:00
Kernel 0.94++
This commit is contained in:
parent
4ec4d5432b
commit
932c784f54
Binary file not shown.
|
@ -7,6 +7,7 @@ NEW
|
|||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/kernel.i
|
||||
.INB inc/mli.i
|
||||
.INB inc/mli.e.i
|
||||
*--------------------------------------
|
||||
|
@ -108,6 +109,25 @@ CS.RUN
|
|||
>STYA ZPBufPtr
|
||||
stx hBuf
|
||||
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPS),y
|
||||
|
||||
tax
|
||||
|
||||
lsr
|
||||
bcc CS.RUN.LOOP
|
||||
|
||||
lda Nod.Table.hFD-2,x
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtr1
|
||||
|
||||
lda (ZPPtr1)
|
||||
|
||||
beq CS.RUN.LOOP
|
||||
|
||||
cmp #S.FD.T.PIPE
|
||||
beq CS.RUN.LOOP
|
||||
|
||||
>PUSHW L.MSG.INIT
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
|
20
BIN/PS.S.txt
20
BIN/PS.S.txt
|
@ -56,23 +56,32 @@ CS.INIT clc
|
|||
CS.RUN lda #1
|
||||
>SYSCALL ArgV
|
||||
bcs .10
|
||||
|
||||
>SYSCALL AToI
|
||||
bcs .90
|
||||
|
||||
tax
|
||||
bne .90
|
||||
|
||||
tya
|
||||
|
||||
* ldx #0
|
||||
|
||||
.11 cmp PS.Table.PID,x
|
||||
beq .12
|
||||
|
||||
inx
|
||||
cpx #K.PS.MAX
|
||||
bne .11
|
||||
|
||||
lda #E.NSP
|
||||
* sec
|
||||
rts
|
||||
|
||||
.12 jsr CS.RUN.DUMP
|
||||
.12 lda PS.Table.hPS,x
|
||||
jsr CS.RUN.DUMP
|
||||
bcs .9
|
||||
|
||||
lda #0
|
||||
sec
|
||||
rts
|
||||
|
@ -158,22 +167,27 @@ CS.RUN.DecodeFlags
|
|||
lda (ZPPSPtr) Get flags
|
||||
ldy #PS.FLAGS+7
|
||||
ldx #7
|
||||
|
||||
.2 lsr
|
||||
pha
|
||||
lda #'-'
|
||||
bcc .3
|
||||
|
||||
lda MSG.FLAGS,x
|
||||
|
||||
.3 sta (pData),y
|
||||
pla
|
||||
dey
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.PrintArgs
|
||||
ldy #S.PS.hARGV
|
||||
lda (ZPPSPtr),y
|
||||
beq .8 NO ARGV in PS0
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPArgV
|
||||
|
||||
|
@ -185,13 +199,17 @@ CS.RUN.PrintArgs
|
|||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
.2 inc ZPArgV
|
||||
bne .3
|
||||
|
||||
inc ZPArgV+1
|
||||
.3 lda (ZPArgV)
|
||||
bne .2
|
||||
|
||||
inc ZPArgV
|
||||
bne .1
|
||||
|
||||
inc ZPArgV+1
|
||||
bra .1
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@ NEW
|
|||
CL.Init >LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPCLBuf
|
||||
txa
|
||||
>STA.G CL.hCLBuf
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CL.PrintPrompt >PUSHW L.PS1
|
||||
|
@ -66,7 +68,7 @@ CL.CHARIN tax
|
|||
|
||||
.8 rts invalid \e[ sequence
|
||||
|
||||
.2 >LDA.G READ.N
|
||||
.2 >LDA.G CL.MaxCnt
|
||||
bne .3
|
||||
|
||||
lda EscChars.Remap,x
|
||||
|
@ -85,7 +87,7 @@ CL.CHARIN tax
|
|||
clc
|
||||
rts
|
||||
|
||||
.5 >LDA.G READ.N
|
||||
.5 >LDA.G CL.MaxCnt
|
||||
beq CL.READN0X
|
||||
|
||||
cpx #C.SPACE
|
||||
|
@ -98,10 +100,11 @@ CL.CHARIN tax
|
|||
*--------------------------------------
|
||||
>LDA.G CL.Len
|
||||
beq .8
|
||||
|
||||
>LDA.G CL.Ptr
|
||||
beq .8
|
||||
|
||||
>LDA.G bREAD.S
|
||||
>LDA.G CL.bSilent
|
||||
bmi .6
|
||||
|
||||
lda #C.BS
|
||||
|
@ -111,7 +114,7 @@ CL.CHARIN tax
|
|||
jmp CL.DEL
|
||||
*--------------------------------------
|
||||
CL.Insert >LDA.G CL.Len
|
||||
>CMP.G READ.N
|
||||
>CMP.G CL.MaxCnt
|
||||
beq .8 Buffer full, discard...
|
||||
|
||||
inc
|
||||
|
@ -138,14 +141,14 @@ CL.Insert >LDA.G CL.Len
|
|||
sta (ZPCLBuf),y
|
||||
>INC.G CL.Ptr
|
||||
|
||||
>LDA.G bREAD.S
|
||||
>LDA.G CL.bSilent
|
||||
bmi .7
|
||||
|
||||
txa
|
||||
>SYSCALL PutChar
|
||||
jsr CL.PrintEOL
|
||||
|
||||
.7 >LDA.G READ.N READ N = 1, don't wait for CR
|
||||
.7 >LDA.G CL.MaxCnt READ N = 1, don't wait for CR
|
||||
dec
|
||||
bne .8
|
||||
|
||||
|
@ -159,7 +162,7 @@ CL.CHARIN.CTRL cpx #C.CR
|
|||
beq .18
|
||||
|
||||
cpx #C.EOF
|
||||
beq .18
|
||||
beq .19
|
||||
|
||||
cpx #3 Ctrl-C
|
||||
beq CL.CLR
|
||||
|
@ -176,7 +179,7 @@ CL.CHARIN.CTRL cpx #C.CR
|
|||
.18 jsr CheckLFAfterCR Check for any extra LF
|
||||
bcs .9
|
||||
|
||||
lda #$ff
|
||||
.19 lda #$ff
|
||||
>STA.G CL.bReady
|
||||
|
||||
.8 clc
|
||||
|
@ -185,7 +188,7 @@ CL.CHARIN.CTRL cpx #C.CR
|
|||
CL.CLR lda (ZPCLBuf)
|
||||
beq CL.Reset.1
|
||||
|
||||
>LDA.G bREAD.S
|
||||
>LDA.G CL.bSilent
|
||||
bmi CL.Reset.1
|
||||
|
||||
.1 >LDA.G CL.Ptr
|
||||
|
@ -221,13 +224,22 @@ CL.Reset.1 lda #0
|
|||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CL.ReadResetV sec Verbose mode
|
||||
|
||||
CL.ReadReset lda #$ff
|
||||
>STA.G CL.MaxCnt
|
||||
adc #0 CC = silent
|
||||
iny CL.bSilent
|
||||
sta (pData),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
CL.BS >LDA.G CL.Ptr
|
||||
beq .9
|
||||
|
||||
dec
|
||||
sta (pData),y
|
||||
|
||||
>LDA.G bREAD.S
|
||||
>LDA.G CL.bSilent
|
||||
bmi .9
|
||||
|
||||
lda #C.BS
|
||||
|
@ -237,12 +249,16 @@ CL.BS >LDA.G CL.Ptr
|
|||
CL.NAK >LDA.G CL.Ptr
|
||||
>CMP.G CL.Len
|
||||
beq .9
|
||||
|
||||
inc
|
||||
>STA.G CL.Ptr
|
||||
>LDA.G bREAD.S
|
||||
|
||||
>LDA.G CL.bSilent
|
||||
bmi .9
|
||||
|
||||
lda #C.FS
|
||||
>SYSCALL PutChar
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* Erase char UNDER cursor
|
||||
|
@ -265,12 +281,13 @@ CL.DEL pha
|
|||
|
||||
>CMP.G CL.Len
|
||||
bne .1
|
||||
|
||||
pla
|
||||
|
||||
>DEC.G CL.Len
|
||||
>LDA.G bREAD.S
|
||||
bpl CL.PrintEOL
|
||||
clc
|
||||
rts
|
||||
|
||||
>LDA.G CL.bSilent
|
||||
bmi CL.PrintEOL.8
|
||||
*--------------------------------------
|
||||
CL.PrintEOL >LDA.G CL.Ptr
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ CMD.SET.1
|
|||
|
||||
.2 dex
|
||||
bmi .4
|
||||
|
||||
cmp SET.FLAGS,x
|
||||
bne .2
|
||||
|
||||
|
@ -256,9 +257,9 @@ CMD.SET.EXEC jsr CORE.ArgV.NextChar skip "`"
|
|||
|
||||
jsr IO.Pipe.In
|
||||
bcs .9
|
||||
lda #255
|
||||
>STA.G READ.N
|
||||
>STA.G bREAD.S
|
||||
|
||||
* clc Silent Mode
|
||||
jsr CL.ReadReset
|
||||
|
||||
jmp CMD.READ.VAR
|
||||
.9 rts
|
||||
|
@ -275,6 +276,7 @@ CMD.DATE >PUSHEA.G TimeBuf
|
|||
|
||||
>LDYA ZPArgVBufPtr
|
||||
bra .2
|
||||
|
||||
.1 >LDYA L.FMT.DATE
|
||||
|
||||
.2 >PUSHYA
|
||||
|
@ -294,6 +296,7 @@ CMD.ECHO stz ZPPtr1 echo -N
|
|||
|
||||
.1 jsr CMD.IsSwitch
|
||||
bcs .2
|
||||
|
||||
cmp #'N'
|
||||
bne CMD.ECHO.CSYN
|
||||
|
||||
|
@ -301,8 +304,10 @@ CMD.ECHO stz ZPPtr1 echo -N
|
|||
eor ZPPtr1
|
||||
sta ZPPtr1
|
||||
bra .4
|
||||
|
||||
.2 lda ZPPtr1+1
|
||||
beq .3
|
||||
|
||||
lda #C.SPACE
|
||||
>SYSCALL PutChar
|
||||
|
||||
|
@ -334,9 +339,8 @@ CMD.READ lda (ZPArgVBufPtr)
|
|||
beq CMD.ECHO.CSYN
|
||||
|
||||
stz ZPVarNamePtr+1
|
||||
>STZ.G bREAD.S
|
||||
dec
|
||||
>STA.G READ.N
|
||||
|
||||
jsr CL.ReadResetV
|
||||
|
||||
.1 jsr CMD.IsSwitch
|
||||
bcs .4
|
||||
|
@ -345,7 +349,7 @@ CMD.READ lda (ZPArgVBufPtr)
|
|||
bne .2
|
||||
|
||||
lda #$ff
|
||||
>STA.G bREAD.S
|
||||
>STA.G CL.bSilent
|
||||
bra .5
|
||||
|
||||
.2 cmp #'P'
|
||||
|
@ -367,7 +371,7 @@ CMD.READ lda (ZPArgVBufPtr)
|
|||
jsr EXP.GetInt8Arg
|
||||
bcs CMD.ECHO.RTS
|
||||
|
||||
>STA.G READ.N
|
||||
>STA.G CL.MaxCnt
|
||||
bra .5
|
||||
|
||||
.4 >LDYA ZPArgVBufPtr
|
||||
|
@ -378,7 +382,7 @@ CMD.READ lda (ZPArgVBufPtr)
|
|||
|
||||
lda ZPVarNamePtr+1
|
||||
beq CMD.ECHO.CSYN
|
||||
|
||||
*--------------------------------------
|
||||
CMD.READ.VAR jsr CL.Reset
|
||||
|
||||
.1 >SYSCALL GetChar
|
||||
|
@ -552,6 +556,7 @@ CMD.FUNCTION lda (ZPArgVBufPtr)
|
|||
ldy #1
|
||||
lda (ZPArgVBufPtr),y
|
||||
beq .11
|
||||
|
||||
.9 jmp CMD.E.CSYN
|
||||
|
||||
.99 rts
|
||||
|
@ -565,48 +570,46 @@ CMD.FUNCTION lda (ZPArgVBufPtr)
|
|||
jsr CORE.GetNextCharNB
|
||||
bcs .9
|
||||
|
||||
.11 stz M32.ACC '{' counter
|
||||
|
||||
>LDYA ZPInputBufPtr
|
||||
.11 >LDYA ZPInputBufPtr
|
||||
>STYA ZPPtr1
|
||||
|
||||
ldy #0
|
||||
ldx #0
|
||||
stz ZPPtr2
|
||||
stz ZPPtr2+1 DataLen
|
||||
|
||||
ldx #0 '{' counter
|
||||
|
||||
lda (ZPInputBufPtr)
|
||||
beq .6
|
||||
|
||||
.12 cmp #'{'
|
||||
bne .13
|
||||
|
||||
inc M32.ACC
|
||||
inx
|
||||
bra .14
|
||||
|
||||
.13 cmp #'}'
|
||||
bne .14
|
||||
|
||||
dec M32.ACC
|
||||
dex
|
||||
bmi .7
|
||||
|
||||
.14 iny
|
||||
.14 inc ZPPtr2
|
||||
bne .15
|
||||
inx
|
||||
|
||||
inc ZPPtr2+1
|
||||
|
||||
.15 jsr CORE.GetNextChar
|
||||
bne .12
|
||||
|
||||
.6 lda M32.ACC
|
||||
.6 txa
|
||||
bpl .9
|
||||
|
||||
.7 jsr CORE.GetNextChar skip ending '}'
|
||||
|
||||
phx
|
||||
phy
|
||||
>PUSHB.G hFuncList
|
||||
>PUSHW ZPTmpW KeyID
|
||||
>PUSHW ZPPtr1 DataPtr
|
||||
ply
|
||||
pla
|
||||
>PUSHYA DataLen
|
||||
>PUSHW ZPPtr2 DataLen
|
||||
>SYSCALL SListAddData
|
||||
bcs .99
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ CORE.Run jsr IO.Reset
|
|||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs CORE.Run.RTS
|
||||
|
||||
>STYA ZPArgVBuf
|
||||
txa
|
||||
>STA.G CORE.hArgVBuf
|
||||
|
@ -148,6 +149,7 @@ CORE.Run.1 sec coming from PIPE OUT
|
|||
|
||||
cmp #C.CR empty line ?
|
||||
bne .33
|
||||
|
||||
jsr CORE.GetNextChar skip CR...
|
||||
bra .8
|
||||
|
||||
|
@ -184,13 +186,16 @@ CORE.Run.1 sec coming from PIPE OUT
|
|||
|
||||
.45 txa
|
||||
bpl .43 context is FALSE, skip line
|
||||
|
||||
asl
|
||||
bmi CORE.Run.7 parent context is true, exec
|
||||
|
||||
.43 jsr CORE.GetCharNB
|
||||
bcs .44 EOF
|
||||
|
||||
cmp #C.CR
|
||||
beq .44
|
||||
|
||||
cmp #';' TODO ";"
|
||||
beq .44
|
||||
|
||||
|
@ -426,11 +431,11 @@ CORE.ArgV.Add lda #C.SPACE
|
|||
|
||||
ldx #')'
|
||||
stx ZPTmpW
|
||||
|
||||
bra .12
|
||||
|
||||
.11 cmp #'`'
|
||||
bne .12
|
||||
|
||||
sta ZPTmpW
|
||||
|
||||
.12 sta (ZPArgVBufPtr),y
|
||||
|
@ -566,25 +571,32 @@ CORE.IO.Open pha Open Mode
|
|||
CORE.IsSpaceOrEndCmd
|
||||
cmp #C.SPACE
|
||||
beq CORE.IsEndCmd.8
|
||||
|
||||
CORE.IsEndCmd cmp #';'
|
||||
beq CORE.IsEndCmd.8
|
||||
|
||||
cmp #C.CR
|
||||
beq CORE.IsEndCmd.8
|
||||
|
||||
cmp #'|'
|
||||
beq CORE.IsEndCmd.8
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
CORE.IsEndCmd.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.GetCharNB jsr CORE.GetChar
|
||||
bcs CORE.GetNextCharNB.RTS
|
||||
|
||||
jsr CORE.CheckCharNB
|
||||
bcc CORE.GetNextCharNB.RTS
|
||||
*--------------------------------------
|
||||
CORE.GetNextCharNB
|
||||
jsr CORE.GetNextChar
|
||||
bcs CORE.GetNextCharNB.RTS
|
||||
|
||||
jsr CORE.CheckCharNB
|
||||
bcs CORE.GetNextCharNB
|
||||
CORE.GetNextCharNB.RTS
|
||||
|
@ -593,22 +605,28 @@ CORE.GetNextCharNB.RTS
|
|||
CORE.CheckCharNB
|
||||
cmp #C.SPACE
|
||||
beq .9
|
||||
|
||||
cmp #C.LF
|
||||
beq .9
|
||||
|
||||
cmp #C.TAB
|
||||
beq .9
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CORE.GetNextChar
|
||||
inc ZPInputBufPtr
|
||||
bne CORE.GetChar
|
||||
|
||||
inc ZPInputBufPtr+1
|
||||
*--------------------------------------
|
||||
CORE.GetChar lda (ZPInputBufPtr)
|
||||
beq .9
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -686,6 +704,7 @@ CORE.StkCheck sec
|
|||
adc (pData) StackPtr
|
||||
cmp #CORE.STACK.MAX
|
||||
bcc .8
|
||||
|
||||
lda #E.STKOVERFLOW
|
||||
* sec
|
||||
.8 rts
|
||||
|
@ -740,11 +759,14 @@ CORE.StkGetCtx jsr CORE.StkGet
|
|||
|
||||
cmp #$C0+C.CALL
|
||||
beq .1 CS
|
||||
|
||||
cmp #$C0+C.CLEXEC
|
||||
beq .1 CS
|
||||
|
||||
and #$80 get current..
|
||||
lsr becomes parent
|
||||
bra .8
|
||||
|
||||
.1 lda #$40 ...set Parent = true
|
||||
|
||||
.8 sta CORE.TestResult
|
||||
|
@ -755,9 +777,11 @@ CORE.StkGetCtx jsr CORE.StkGet
|
|||
CORE.StkPullInputBufPtr
|
||||
jsr CORE.StkPull
|
||||
bcs .9
|
||||
|
||||
sta ZPInputBufPtr
|
||||
jsr CORE.StkPull
|
||||
bcs .9
|
||||
|
||||
sta ZPInputBufPtr+1
|
||||
|
||||
.9 rts
|
||||
|
@ -774,11 +798,13 @@ CORE.StkPullFree
|
|||
*--------------------------------------
|
||||
CORE.StkPull jsr CORE.StkGet
|
||||
bcs .9
|
||||
|
||||
dey
|
||||
pha
|
||||
tya
|
||||
sta (pData) StackPtr
|
||||
pla
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CORE.StkGet lda (pData) StackPtr
|
||||
|
|
|
@ -232,20 +232,22 @@ EXP.TEST.BINARY lda CORE.Operator
|
|||
>PUSHW ZPPtr1
|
||||
>PUSHW ZPArgVBufPtr
|
||||
>SYSCALL StrCmp
|
||||
|
||||
bcs .1 CS if !=
|
||||
|
||||
lda #%010 010 str1 = str2
|
||||
bra .3
|
||||
|
||||
.1 asl CS if <
|
||||
bcs .2
|
||||
bcc .2
|
||||
|
||||
lda #%100 010 str1 < str2
|
||||
lda #%100 100 str1 < str2
|
||||
bra .3
|
||||
|
||||
.2 lda #%001 010 str1 > str2
|
||||
.2 lda #%001 001 str1 > str2
|
||||
|
||||
.3 ldx CORE.Operator
|
||||
|
||||
and EXP.OP.BINARY.BITS-6,x
|
||||
beq .8 false
|
||||
|
||||
|
|
|
@ -187,6 +187,7 @@ IO.PrintBatchErrMsg
|
|||
|
||||
.1 inc ZPTmpW
|
||||
bne .2
|
||||
|
||||
inc ZPTmpW+1
|
||||
|
||||
.2 ldy #$ff
|
||||
|
|
12
BIN/SH.S.txt
12
BIN/SH.S.txt
|
@ -325,13 +325,11 @@ CS.RUN.INTERACTIVE
|
|||
jsr IO.Reset
|
||||
jsr CL.Reset
|
||||
|
||||
jsr CL.ReadResetV
|
||||
|
||||
jsr CL.PrintPrompt
|
||||
bcs CS.RUN.CMDLINE.9
|
||||
|
||||
>STZ.G bREAD.S
|
||||
dec
|
||||
>STA.G READ.N
|
||||
|
||||
.1 >SYSCALL GetChar
|
||||
bcs CS.RUN.CMDLINE.9 I/O error
|
||||
|
||||
|
@ -697,16 +695,16 @@ bSET.C .BS 1
|
|||
bSET.E .BS 1
|
||||
bSET.X .BS 1
|
||||
|
||||
bREAD.S .BS 1
|
||||
READ.N .BS 1
|
||||
|
||||
Sleep .BS 4
|
||||
|
||||
CL.hCLBuf .BS 1
|
||||
|
||||
CL.Ptr .BS 1
|
||||
CL.Len .BS 1
|
||||
CL.bReady .BS 1
|
||||
CL.bEscMode .BS 1
|
||||
CL.MaxCnt .BS 1
|
||||
CL.bSilent .BS 1
|
||||
|
||||
CORE.hArgVBuf .BS 1
|
||||
CORE.bPipeIn .BS 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user