mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-06 18:37:12 +00:00
Kernel 0.9.2
This commit is contained in:
parent
026a9cc3dc
commit
ba1a76d4df
Binary file not shown.
Binary file not shown.
@ -16,14 +16,26 @@ CMD.Quit >LDA.G hCmdBuf
|
||||
>SYSCALL FreeMem
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* in:
|
||||
* ZPCMDBuf : CString command line
|
||||
* out:
|
||||
* ZPCMDBuf : Remove extra SPACE & comment
|
||||
* ZPCMDBuf : cmd\0 arg1\0 arg2\0 ... \0
|
||||
*--------------------------------------
|
||||
Cmd.Parse >LDYA ZPCMDBuf
|
||||
>STYA ZPPtr1
|
||||
>SYSCALL ExpandStr
|
||||
>STYA ZPPtr1 Ptr to expanded CMD ARGS\0
|
||||
|
||||
txa
|
||||
>STA.G CMD.hCmdLine
|
||||
|
||||
* SET +X
|
||||
>LDYA ZPCMDBuf
|
||||
>SYSCALL puts
|
||||
|
||||
ldy #0
|
||||
|
||||
lda (ZPCMDBuf) empty line...quit
|
||||
lda (ZPPtr1) empty line...quit
|
||||
beq .9
|
||||
|
||||
.1 jsr Cmd.Parse.NextC
|
||||
@ -44,7 +56,8 @@ Cmd.Parse >LDYA ZPCMDBuf
|
||||
cmp #' '
|
||||
bne .3
|
||||
|
||||
sta (ZPCMDBuf),y add One SPACE to buffer
|
||||
lda #0
|
||||
sta (ZPCMDBuf),y add One \0 to buffer
|
||||
iny
|
||||
|
||||
.5 jsr Cmd.Parse.NextC
|
||||
@ -59,6 +72,10 @@ Cmd.Parse >LDYA ZPCMDBuf
|
||||
|
||||
.9 tya
|
||||
>STA.G CmdBuflen
|
||||
|
||||
>LDA.G CMD.hCmdLine
|
||||
>SYSCALL FreeMem
|
||||
|
||||
rts
|
||||
|
||||
Cmd.Parse.NextC lda (ZPPtr1)
|
||||
@ -69,81 +86,43 @@ Cmd.Parse.NextC lda (ZPPtr1)
|
||||
inc ZPPtr1+1 never Z
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
* ZPCMDBuf-> Command line (formatted & not empty)
|
||||
* ZPCMDBuf-> argv[] (formatted & not empty)
|
||||
*--------------------------------------
|
||||
CMD.Exec lda #0
|
||||
>STA.G CMD.bStartProc
|
||||
>STA.G CMD.hFullpath
|
||||
|
||||
* SET +X
|
||||
* >LDYA ZPCMDBuf
|
||||
* >SYSCALL puts
|
||||
|
||||
* sta $C055
|
||||
* >DEBUG
|
||||
|
||||
>LDYA ZPCMDBuf
|
||||
>SYSCALL ExpandStr
|
||||
>STYA ZPPtr1 Ptr to CMD ARGS
|
||||
|
||||
txa
|
||||
>STA.G CMD.hCmdLine
|
||||
>LDYA L.CMD.INT
|
||||
>STYA ZPPtr2
|
||||
|
||||
ldx #0
|
||||
|
||||
.3 lda (ZPPtr2)
|
||||
beq Cmd.Exec.EXT Array Ending 0, must be an external Cmd....
|
||||
.1 phx
|
||||
|
||||
ldy #$ff
|
||||
>PUSHW ZPPtr2
|
||||
>LDYA ZPCMDBuf
|
||||
>SYSCALL StrCaseCmp
|
||||
plx
|
||||
bcc .8
|
||||
|
||||
.4 iny
|
||||
lda (ZPPtr2),y
|
||||
bne .41 End of string in array
|
||||
|
||||
lda (ZPPtr1),y Get CMD char...
|
||||
beq .8 both end with 0, found!
|
||||
cmp #' '
|
||||
beq .8 we reached space between CMD & ARGS....
|
||||
|
||||
.41 lda (ZPPtr1),y Get CMD char...
|
||||
beq .61 end of CMD.....too short...
|
||||
cmp #' '
|
||||
beq .61 we reached space between CMD & ARGS....
|
||||
|
||||
cmp #'a' To Uppercase
|
||||
bcc .5
|
||||
cmp #'z'+1
|
||||
bcs .5
|
||||
eor #$20
|
||||
|
||||
.5 cmp (ZPPtr2),y
|
||||
beq .4
|
||||
|
||||
.61 iny
|
||||
lda (ZPPtr2),y
|
||||
bne .61
|
||||
|
||||
.7 inx
|
||||
inx
|
||||
inx
|
||||
|
||||
tya
|
||||
lda (ZPPtr2)
|
||||
beq Cmd.Exec.EXT Array Ending 0, must be an external Cmd....
|
||||
|
||||
sec
|
||||
adc ZPPtr2
|
||||
sta ZPPtr2
|
||||
bcc .3
|
||||
bcc .1
|
||||
inc ZPPtr2+1
|
||||
bra .3
|
||||
bra .1
|
||||
|
||||
.8 jsr Cmd.Exec.GetArgs X unmodified
|
||||
jmp (J.CMD.INT,x) Found an internal Cmd...
|
||||
*--------------------------------------
|
||||
Cmd.Exec.Done php
|
||||
pha
|
||||
>LDA.G CMD.hCmdLine
|
||||
>SYSCALL FreeMem
|
||||
|
||||
>LDA.G CMD.hFullpath
|
||||
beq .1
|
||||
>SYSCALL FreeMem
|
||||
|
@ -196,7 +196,7 @@ CS.RUN >LDA.G bReadMode READ Command ?
|
||||
|
||||
jsr CMD.Parse
|
||||
|
||||
>LDA.G CmdBuflen
|
||||
lda (ZPCMDBuf)
|
||||
beq .10 Empty line
|
||||
|
||||
jsr HIS.Add
|
||||
|
@ -46,6 +46,7 @@ K.CreatePS ldx #0
|
||||
*--------------------------------------
|
||||
PS.Flags .BS 1
|
||||
PS.CL .BS 2
|
||||
PS.Args .BS 2
|
||||
*/--------------------------------------
|
||||
* # Exec
|
||||
* ## C
|
||||
@ -58,7 +59,13 @@ PS.CL .BS 2
|
||||
* ## RETURN VALUE
|
||||
* A = Child PSID
|
||||
*\--------------------------------------
|
||||
Exec
|
||||
Exec
|
||||
* >STYA PS.CL
|
||||
* >PULLB PS.Flags
|
||||
* >PULLW PS.Args
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* PS.CreateChild
|
||||
* in :
|
||||
@ -356,13 +363,48 @@ PS.Load jsr BIN.Load Y,A=filename full path
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* PS.DupEnv
|
||||
* PS.DupArgs
|
||||
* In:
|
||||
* A = ENV hMem To Duplicate
|
||||
* Y,A = Ptr To Args[]
|
||||
* Out:
|
||||
* A = hMem to new ENV
|
||||
* A = hMem
|
||||
*--------------------------------------
|
||||
PS.DupArgs
|
||||
PS.DupArgs >STYA ZPPtr1
|
||||
|
||||
>STYA ZPPtr3
|
||||
|
||||
lda #1 for array ending 0
|
||||
sta ZPPtr2
|
||||
stz ZPPtr2+1
|
||||
|
||||
.1 lda (ZPPtr3)
|
||||
beq .8
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 iny
|
||||
lda (ZPPtr3),y
|
||||
bne .2
|
||||
|
||||
tya
|
||||
sec
|
||||
adc ZPPtr2
|
||||
sta ZPPtr2
|
||||
bcc .3
|
||||
|
||||
clc
|
||||
inc ZPPtr2+1
|
||||
|
||||
.3 tya
|
||||
sec
|
||||
adc ZPPtr3
|
||||
sta ZPPtr3
|
||||
bcc .1
|
||||
inc ZPPtr3+1
|
||||
bra .1
|
||||
|
||||
.8 >LDYA ZPPtr2
|
||||
bra PS.Dup.I
|
||||
*--------------------------------------
|
||||
* PS.DupEnv
|
||||
* In:
|
||||
@ -374,7 +416,8 @@ PS.DupEnv jsr K.GetMemPtr
|
||||
>STYA ZPPtr1
|
||||
|
||||
>LDYAI K.ENV.SIZE
|
||||
jsr K.GetMem
|
||||
|
||||
PS.Dup.I jsr K.GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr2
|
||||
|
@ -12,21 +12,20 @@ AUTO 4,1
|
||||
* ## RETURN VALUE
|
||||
* Y,A = String length
|
||||
*\--------------------------------------
|
||||
K.StrLen >STYA ZPPtr1
|
||||
K.StrLen >STYA .1+1
|
||||
|
||||
ldy #0
|
||||
ldx #0
|
||||
tya
|
||||
|
||||
.1 lda (ZPPtr1),y
|
||||
.1 ldx $ffff,y SELF MODIFIED
|
||||
beq .8
|
||||
iny
|
||||
bne .1
|
||||
inx
|
||||
inc ZPPtr1+1
|
||||
inc
|
||||
inc .1+2
|
||||
bra .1
|
||||
|
||||
.8 txa
|
||||
rts
|
||||
.8 rts
|
||||
*/--------------------------------------
|
||||
* # StrCat
|
||||
* Concatenate strings
|
||||
|
Loading…
x
Reference in New Issue
Block a user