Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-05-31 09:31:41 +02:00
parent 267d70f474
commit 2171bad1c9
5 changed files with 108 additions and 136 deletions

Binary file not shown.

View File

@ -136,7 +136,6 @@ CMD.CD.YA >SYSCALL realpath
ldy #$ff
.2 iny
lda (ZPPtr1),y
lda (ZPPtr2),y
bne .2
@ -551,6 +550,7 @@ CMD.FUNC lda (ZPArgVBufPtr)
>SYSCALL SListNewKey
bcs .99
jsr CORE.StkPushYA
bcs .99
lda #$C0+C.FUNC
jsr CORE.StkPush
@ -608,17 +608,13 @@ CMD.CALL.YAX stx M32.ACC X=Code to Execute
jsr CORE.StkCheck
bcs CMD.CALL.RTS
lda ZPInputBuf
jsr CORE.StkPush
>LDYA ZPInputBuf
jsr CORE.StkPushYA
bcs CMD.CALL.9
lda ZPInputBuf+1
jsr CORE.StkPush
lda ZPInputBufPtr
jsr CORE.StkPush
lda ZPInputBufPtr+1
jsr CORE.StkPush
>LDYA ZPInputBufPtr
jsr CORE.StkPushYA
bcs CMD.CALL.9
ldy #S.PS.ARGC
lda (pPS),y
@ -645,9 +641,8 @@ CMD.CALL.YAX stx M32.ACC X=Code to Execute
>STYA ZPInputBufPtr
lda #$C0
jsr CORE.StkPush
clc
jmp CORE.StkPush
CMD.CALL.9 rts
*--------------------------------------
CMD.EXIT lda (ZPArgVBufPtr)
@ -704,11 +699,7 @@ CMD.EXIT.A sta M32.ACC
ldy #S.PS.ARGC
sta (pPS),y
jsr CORE.StkPull
sta ZPInputBufPtr+1
jsr CORE.StkPull
sta ZPInputBufPtr
jsr CORE.StkPullInputBufPtr
jsr CORE.StkPull
sta ZPInputBuf+1
@ -736,7 +727,6 @@ CMD.EXIT.POP and #$3F
jsr CORE.StkPull
>SYSCALL freemem
clc
rts
.9 lda #E.STACKERROR
@ -904,31 +894,20 @@ CMD.FOR jsr CORE.StkGetCtx
jsr CORE.ArgV.Next
beq CMD.END.CSYN
jsr ToUpperCase
cmp #'I'
bne CMD.END.CSYN
ldy #1
lda (ZPArgVBufPtr),y
beq CMD.END.CSYN
jsr ToUpperCase
cmp #'N'
bne CMD.END.CSYN
iny
lda (ZPArgVBufPtr),y
bne CMD.END.CSYN
>PUSHW ZPArgVBufPtr
>LDYA L.IN
>SYSCALL StrCaseCmp
bcs CMD.END.CSYN
jsr CORE.ArgV.Next
beq CMD.END.CSYN
lda #8
lda #8 Make sure 8 bytes free on stack
jsr CORE.StkCheck
bcs .9
sec
jsr CORE.StkPushPtr Push CmdPtr AFTER FOR
>LDYA ZPInputBufPtr
jsr CORE.StkPushYA Push CmdPtr AFTER FOR
lda (ZPArgVBufPtr)
cmp #'('
@ -944,11 +923,8 @@ FOR.LIST >LDYA ZPArgVBufPtr
>SYSCALL strdup
bcs .9
jsr CORE.StkPushYA Push listPtr
jsr CORE.StkPushYAX Push listPtr,hList
txa
jsr CORE.StkPush Push hLIST
>LDYA ZPVarNamePtr
>SYSCALL strdup
bcs .9
@ -1070,8 +1046,8 @@ FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
.9 rts
*--------------------------------------
CMD.NEXT jsr CORE.StkGet Y = StkPtr
bcs .9
and #$3F
cmp #C.FOR
bne .9
@ -1105,12 +1081,13 @@ CMD.NEXT.LIST lda (pData),y Y = StkPtr
sec
sbc #6
tay
>DEBUG
lda (pData),y
sta ZPInputBufPtr+1
sta ZPInputBufPtr
dey
lda (pData),y
sta ZPInputBufPtr
sta ZPInputBufPtr+1
clc
rts
@ -1244,10 +1221,10 @@ CMD.NEXT.EXEC lda (pData),y Y = StkPtr
tay
lda (pData),y
sta ZPInputBufPtr+1
sta ZPInputBufPtr
dey
lda (pData),y
sta ZPInputBufPtr
sta ZPInputBufPtr+1
clc
rts
@ -1318,8 +1295,8 @@ CMD.IF jsr CORE.StkGetCtx
cmp #C.WHILE
bne .8
clc
jsr CORE.StkPushPtr Push BEFORE WHILE/IF
>LDYA ZPInputBufPtr
jsr CORE.StkPushYA Push BEFORE WHILE/IF
bcs .9
.8 >LDA.G CORE.Test
@ -1347,7 +1324,7 @@ CMD.LOOP jsr CORE.StkPull
clc
rts
.8 jmp CORE.StkPullPtr
.8 jmp CORE.StkPullInputBufPtr
.9 lda #E.NOWHILE
sec

View File

@ -677,28 +677,27 @@ CORE.SkipCharsA clc
CORE.StkCheck sec
adc (pData) StackPtr
cmp #CORE.STACK.MAX
lda #E.STKOVERFLOW
rts
*--------------------------------------
CORE.StkPushPtr bcs .1
lda ZPInputCmdPtr
ldx ZPInputCmdPtr+1
bra .2
CORE.StkPushYAX phx
jsr CORE.StkPushYA
bcs CORE.StkPushYA.9
.1 lda ZPInputBufPtr
ldx ZPInputBufPtr+1
.2 jsr CORE.StkPush
bcs CORE.StkPullPtr.9
txa
bra CORE.StkPush
bra CORE.StkPush.1
*--------------------------------------
CORE.StkPushYA phy
jsr CORE.StkPush
pla
bcc CORE.StkPush.1
CORE.StkPushYA.9
plx
rts
*--------------------------------------
CORE.StkPush pha
lda (pData) StackPtr
CORE.StkPush.1 lda (pData) StackPtr
inc
cmp #CORE.STACK.MAX
beq .9
@ -714,26 +713,6 @@ CORE.StkPush pha
* sec
rts
*--------------------------------------
CORE.StkGetPtr lda (pData) StackPtr
beq CORE.StkErr
dec
beq CORE.StkErr
tay
lda (pData),y
sta ZPInputBufPtr
iny
lda (pData),y
sta ZPInputBufPtr+1
clc
rts
CORE.StkErr lda #E.STACKERROR
sec
rts
*--------------------------------------
CORE.StkGetCtx jsr CORE.StkGet
tax
bcs .1 no context...
@ -751,14 +730,16 @@ CORE.StkGetCtx jsr CORE.StkGet
txa
rts
*--------------------------------------
CORE.StkPullPtr jsr CORE.StkPull
bcs CORE.StkPullPtr.9
sta ZPInputBufPtr+1
CORE.StkPullInputBufPtr
jsr CORE.StkPull
bcs CORE.StkPullPtr.9
bcs .9
sta ZPInputBufPtr
CORE.StkPullPtr.9
rts
jsr CORE.StkPull
bcs .9
sta ZPInputBufPtr+1
.9 rts
*--------------------------------------
CORE.StkPull jsr CORE.StkGet
bcs .9
@ -778,6 +759,10 @@ CORE.StkGet lda (pData) StackPtr
clc
rts
*--------------------------------------
CORE.StkErr lda #E.STACKERROR
sec
rts
*--------------------------------------
MAN
SAVE USR/SRC/BIN/SH.S.CORE
LOAD USR/SRC/BIN/SH.S

View File

@ -123,6 +123,7 @@ J.ESC .DA CL.BS left arrow
.DA HIS.GetNext
.DA HIS.GetPrev
.DA CL.NAK right arow
L.IN .DA IN
L.CMD .DA CMD
J.CMD .DA CMD...
.DA CMD..
@ -599,6 +600,8 @@ HOME.PROFILE .AZ "${HOME}PROFILE"
PS1 .AZ "${PS1}"
.HS 00 To Make It ArgV
*--------------------------------------
IN .AZ "IN"
*--------------------------------------
CMD .AZ ".."
.AZ "."
.AZ "CD"

View File

@ -839,86 +839,93 @@ K.FGetS jsr PFT.CheckNodeA
bcs PrintF.GetByte.9
lda (pStack)
sta ZPPtr2 s
sta ZPPtr2 s LO
ldy #1
lda (pStack),y
sta ZPPtr2+1 s
sta ZPPtr2+1 s HI
iny
lda (pStack),y n LO
sta ZPPtr1
lda (pStack),y n
* clc
sbc #1
eor #$ff
sta ZPPtr1 !(n-2)
iny
lda (pStack),y n
sbc #0
eor #$ff
sta ZPPtr1+1 !(n-2)
>PUSHWI 1
lda (pStack),y n HI
sta ZPPtr1+1
bmi .3 already something in buffer
.1 >PUSHWI 1
>PUSHWI K.IOBuf
jsr IO.READ.I
bcs .7
bcc .2
lda K.IOBuf
cmp #C.LF Discard any leading LF
beq .3
cmp #MLI.E.EOF
beq .9
tay
bpl .9 IO error
inc NO DATA -> BLOCKING
rts
.2 lda K.IOBuf
cmp #C.LF Discard any leading LF
beq .1
cmp #C.CR
beq .8 empty string
jsr MEM.PutCharPtr2
lda ZPPtr1
eor #$ff
sta ZPPtr1
lda ZPPtr1+1
eor #$ff
sta ZPPtr1+1
.3 inc ZPPtr1
bne .4
inc ZPPtr1+1
beq .8 Buffer full
.4 >PUSHWI 1
>PUSHWI K.IOBuf
jsr IO.READ.I
bcs .5
lda K.IOBuf
cmp #C.CR
beq .8
jsr MEM.PutCharPtr2
bra .3
inc ZPPtr1
bne .3
inc ZPPtr1+1
beq .8 Buffer full
.3 >PUSHWI 1
>PUSHWI K.IOBuf
jsr IO.READ.I
bcc .2 another char...
cmp #MLI.E.EOF
beq .8
.5 cmp #MLI.E.EOF
beq .8 String terminated by EOF
tay
bpl .9 I/O error
lda ZPPtr2
lda ZPPtr2 NO DATA, but string not yet terminated
sta (pStack) s
lda ZPPtr2+1
ldy #1
lda ZPPtr2+1
sta (pStack),y s
iny
lda ZPPtr1
eor #$ff
* sec
adc #1
iny
sta (pStack),y !(n+2)
sta (pStack),y !n LO
lda ZPPtr1+1
eor #$ff
adc #0
iny
sta (pStack),y !(n+2)
lda ZPPtr1+1
sta (pStack),y !n HI
lda #0 BLOCKING
sec
rts
.7 tay
bpl .9
inc FF
rts BLOCKING
.8 lda #0
sta (ZPPtr2) terminate string