Kernel 0.93++

This commit is contained in:
Rémy GIBERT 2020-02-07 13:53:46 +01:00
parent e881633271
commit 9dbb05cd66
7 changed files with 111 additions and 102 deletions

Binary file not shown.

View File

@ -34,7 +34,8 @@ HIS.Add >LDA.G HIS.hBuf
.1 >STZ.G HIS.Index Reset Index
>INC.G HIS.Count
.9 rts
.9
History.RTS rts
*--------------------------------------
HIS.GetPrev >LDA.G HIS.hBuf
beq HISTORY.RTS
@ -48,8 +49,6 @@ HIS.GetPrev >LDA.G HIS.hBuf
>LDA.G HIS.Count
.1 dec
bra HIS.GetToCl
History.RTS rts
*--------------------------------------
HIS.GetNext >LDA.G HIS.hBuf
beq HISTORY.RTS

View File

@ -259,18 +259,18 @@ SYS.InsDrv .EQ $9E
*--------------------------------------
SYS.ExecL .EQ $A0
SYS.ExecV .EQ $A2
* .EQ $A4
SYS.Fork .EQ $A4
SYS.Kill .EQ $A6
SYS.LoadFile .EQ $A8
SYS.LoadTxtFile .EQ $AA
SYS.GetMemStat .EQ $AC
* .EQ $AE
SYS.FileSearch .EQ $AC
SYS.GetMemStat .EQ $AE
SYS.Shift .EQ $B0
SYS.ArgV .EQ $B2
SYS.Expand .EQ $B4
SYS.FileSearch .EQ $B6
* .EQ $B6
SYS.PutEnv .EQ $B8
SYS.SetEnv .EQ $BA

View File

@ -41,7 +41,6 @@ K.Shift jsr K.ArgV
dec
sta (pPS),y
clc
rts
.9 rts
*/--------------------------------------
@ -77,6 +76,71 @@ K.ArgV tax save requested arg#
.9 lda #E.OOB
sec
rts
*/--------------------------------------
* # Arg2ArgV
* Expand String and convert to StrV List
* ## C
* short int arg2argv(char* args, char* argv[])
* ## ASM
* `>PUSHW argv`
* `>LDYA args`
* `>SYSCALL Arg2ArgV`
* ## RETURN VALUE
* A = Arg count
*\--------------------------------------
K.Arg2ArgV jsr K.Expand
bcs .9
>STYA ZPPtr1
stx .80+1
>PULLW ZPPtr2 Get target buffer
ldx #0 Arg Count
ldy #0 bInQuote
.1 jsr SHARED.GetCharPtr1
beq .8
cmp #C.SPACE
beq .1 skip leading spaces
.2 cmp #'"' found a quote ?
bne .3
tya
eor #$ff
tay
bra .7 skip quote and check next char
.3 cmp #C.SPACE
bne .6 regular char ...store...
tya
bmi .4 between quotes... store space...
inx Found one arg !!!
lda #0 set this token End
jsr SHARED.PutCharPtr2
bra .1
.4 lda #C.SPACE
.6 jsr SHARED.PutCharPtr2
.7 jsr SHARED.GetCharPtr1
bne .2
inx
.8 jsr SHARED.PutCharPtr2 set Argv[x] Ending 0
sta (ZPPtr2) set Array Ending 0
phx
.80 lda #$FF SELF MODIFIED
jsr K.FreeMem Discard expanded string
pla get back Arg Count
* clc
rts
.9 >RET 2 Discard target buffer
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.ARG

View File

@ -99,17 +99,17 @@ K.SYSCALL .DA 0 $00
.DA K.ExecL $A0
.DA K.ExecV
.DA 0
.DA K.Fork
.DA K.Kill
.DA K.LoadFile
.DA K.LoadTxtFile
.DA K.FileSearch
.DA K.GetMemStat
.DA 0
.DA K.Shift $B0
.DA K.ArgV
.DA K.Expand
.DA K.FileSearch
.DA 0
.DA K.PutEnv
.DA K.SetEnv
.DA K.GetEnv

View File

@ -31,7 +31,7 @@ K.ExecL >PULLB PS.Flags
>PUSHYA
.1 ldy #$ff SELF MODIFIED
.2 lda #$ff SELF MODIFIED
jsr K.Str2StrV
jsr K.Arg2ArgV
bcs .9
@ -78,6 +78,17 @@ PS.Exec jsr PS.CreateChild A=PID,Child S.PS at PS.NewPSPtr,PS.Load.hMem
.8 lda #$ff SELF MODIFIED
* clc
.9 rts
*/--------------------------------------
* # Fork
* ## C
* `short nt fork();`
* ## ASM
* `>SYSCALL fork`
* ## RETURN VALUE
* A = Child PSID
*\--------------------------------------
K.Fork clc
rts
*--------------------------------------
* PS.CreateChild
* in :

View File

@ -163,6 +163,31 @@ K.StrVAdd sta CLRREADAUX
clc
rts
*--------------------------------------
STRV.NStrPtr1 ldy #$ff
.1 iny
lda (ZPPtr1)
beq .2
inc ZPPtr1
bne .1
inc ZPPtr1+1
bra .1
.2 tya
beq .9
inc ZPPtr1
bne .8
inc ZPPtr1+1 skip \0
.8 clc
rts
.9 sec Y,A = 0
rts
*/--------------------------------------
* # StrVDup
* ## ASM
@ -210,96 +235,6 @@ K.StrVDup >STYA ZPPtr1
clc
.9 rts
*/--------------------------------------
* # Str2StrV
* Expand String and convert to StrV List
* ## C
* short int str2strv(char* args, char* argv[])
* ## ASM
* `>PUSHW argv`
* `>LDYA args`
* `>SYSCALL Str2StrV`
* ## RETURN VALUE
* A = Arg count
*\--------------------------------------
K.Str2StrV jsr K.Expand
bcs .9
>STYA ZPPtr1
stx .80+1
>PULLW ZPPtr2 Get target buffer
ldx #0 Arg Count
ldy #0 bInQuote
.1 jsr SHARED.GetCharPtr1
beq .8
cmp #C.SPACE
beq .1 skip leading spaces
.2 cmp #'"' found a quote ?
bne .3
tya
eor #$ff
tay
bra .7 skip quote and check next char
.3 cmp #C.SPACE
bne .6 regular char ...store...
tya
bmi .4 between quotes... store space...
inx Found one arg !!!
lda #0 set this token End
jsr SHARED.PutCharPtr2
bra .1
.4 lda #C.SPACE
.6 jsr SHARED.PutCharPtr2
.7 jsr SHARED.GetCharPtr1
bne .2
inx
.8 jsr SHARED.PutCharPtr2 set Argv[x] Ending 0
sta (ZPPtr2) set Array Ending 0
phx
.80 lda #$FF SELF MODIFIED
jsr K.FreeMem Discard expanded string
pla get back Arg Count
* clc
rts
.9 >RET 2 Discard target buffer
*--------------------------------------
STRV.NStrPtr1 ldy #$ff
.1 iny
lda (ZPPtr1)
beq .2
inc ZPPtr1
bne .1
inc ZPPtr1+1
bra .1
.2 tya
beq .9
inc ZPPtr1
bne .8
inc ZPPtr1+1 skip \0
.8 clc
rts
.9 sec Y,A = 0
rts
*--------------------------------------
STRV.Ptr1Ptr2cpy
ldx #0