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

View File

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

View File

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

View File

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