Kernel 0.9.1 : Code reorganization & move to CSTR (ENV)

This commit is contained in:
Rémy GIBERT 2017-08-30 17:26:34 +02:00
parent b52ac88d2b
commit 830c85a6ac
15 changed files with 271 additions and 292 deletions

View File

@ -80,13 +80,13 @@ Returns argument count in the process command line.
## Out:
+ none, always succeed.
# ExpandPStr.YA
# ExpandStr.YA
## In:
+ Y,A = PTR to String to Expand (PSTR)
+ Y,A = PTR to String to Expand (C-String)
## Out:
+ X = hMem to Expanded String (PSTR)
+ X = hMem to Expanded String (C-String)
+ Y,A = PTR to Expanded String
# PutEnv.YA
@ -139,11 +139,11 @@ And return, if found, the full path to it.
# GetFullPath.YA
## In :
+ Y,A = Filename (PSTR)
+ Y,A = Filename (C-String)
## Out :
+ CC : success
+ Y,A = FullPath (PSTR)
+ Y,A = FullPath (C-String)
+ X = hMem of FullPath
+ CS : A = Error Code
@ -280,20 +280,6 @@ Create a new copy of PSTR
## Out:
+ Buffer filled with memory stats
# ExecProcessNewEnv.YA
# ExecProcess.YA (Blocking Parent PID)
# CreateProcessNewEnv.YA
# CreateProcess.YA (Non Blocking)
## In:
+ Y,A = PTR To Cmd Line
## Out:
+ A = Child PSID
# GetPSByID.A
## In :
@ -311,18 +297,19 @@ Make current process suspend until next RUN
## Out :
+ (none)
# Str2StrArray.YA
Convert a CSTR (e.g. : command Line) to a Array of CSTRs (Args[])
# ExecProcessNewEnv.YA
## In:
+ Y,A = PTR to String
# ExecProcess.YA (Blocking Parent PID)
# CreateProcessNewEnv.YA
# CreateProcess.YA (Non Blocking)
## In:
+ Y,A = PTR To Cmd Line
## Out:
+ CC : success
+ Y,A = PTR to StrArray
+ X = hMem
+ CS : error
+ A = SYS error code
+ A = Child PSID
# Stat
Return information about a file

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,7 @@ INC 1
AUTO 6
.LIST OFF
*---------------------------------------
FIO.Init ldy #S.PS.hCMDLINE
FIO.Init ldy #S.PS.hARGS
lda (pPS),y
>SYSCALL GetMemPtr.A
bcs .99

View File

@ -50,7 +50,7 @@ CS.RUN >LDYAI TSKMGR.TABLE+S.PS
.1 lda (ZPPTR1)
bpl .4
ldy #S.PS.hCMDLINE
ldy #S.PS.hARGS
lda (ZPPTR1),y
>SYSCALL GetMemPtr.A
>PUSHYA

View File

@ -11,7 +11,7 @@ K.ENV.SIZE .EQ 256
K.FLT.MAX .EQ 4
K.EVT.MAX .EQ 8
K.DEV.MAX .EQ 32
K.PS.MAX .EQ 64
K.PS.MAX .EQ 32
*--------------------------------------
* Kernel ZP Aux
*--------------------------------------
@ -78,7 +78,7 @@ EvtMgr.Table .EQ $1180 K.EVT.MAX*S.EVT.SIZE=16*8=128b
*--------------------------------------
DevMgr.Table .EQ $1200 K.DEV.MAX*S.DEV.SIZE=32*16=512b
*--------------------------------------
TskMgr.Table .EQ $1400 K.PS.MAX*S.PS.SIZE=64*16=1k
TskMgr.Table .EQ $1400 K.PS.MAX*S.PS.SIZE=32*32=1k
*--------------------------------------
* MemMgr : $1800->$1FFF MAIN/AUX (2 kBytes)
*--------------------------------------
@ -229,12 +229,12 @@ SYS.ChMod .EQ $6A
SYS.ChOwn .EQ $6C
SYS.ChGrp .EQ $6E
*--------------------------------------
* .EQ $70
SYS.StrLen.YA .EQ $70
SYS.StrCpy .EQ $72
SYS.StrCat .EQ $74
SYS.StrMatch .EQ $76
SYS.StrUprYA .EQ $78
SYS.StrLwrYA .EQ $7A
SYS.StrUpr.YA .EQ $78
SYS.StrLwr.YA .EQ $7A
SYS.StrFTime .EQ $7C
* .EQ $7E
@ -453,15 +453,18 @@ S.PS.hCS .EQ 4
S.PS.hDS .EQ 5
S.PS.hSS .EQ 6
S.PS.hENV .EQ 7
S.PS.hCMDLINE .EQ 8
*
S.PS.hPREFIX .EQ 9
S.PS.hStdIn .EQ 10
S.PS.hStdOut .EQ 11
S.PS.hStdErr .EQ 12
S.PS.RC .EQ 13
S.PS.PC .EQ 14
S.PS.ARGC .EQ 16
S.PS.hARGS .EQ 17
*
S.PS .EQ 16
S.PS .EQ 32
*--------------------------------------
* LIB Function Indexes
*--------------------------------------

View File

@ -58,7 +58,7 @@ K.GetArg.A sta .2+1
.9 sec
rts
*--------------------------------------
ARG.InitArgPtr1 ldy #S.PS.hCMDLINE
ARG.InitArgPtr1 ldy #S.PS.hARGS
lda (pPs),y
jsr K.GetMemPtr.A
>STYA ZPPtr1

View File

@ -162,7 +162,7 @@ BIN.Load.YA >STYA BIN.CmdLine
*--------------------------------------
BIN.Load.YA.1 >PUSHWI K.S.STAT
>PUSHW BIN.CmdLine
jsr K.STAT Look for AUXTYPE
>SYSCALL STAT BANK1!!! Look for AUXTYPE
bcs .9
>LDYA K.S.STAT+S.STAT.P.AUXTYPE
@ -173,7 +173,7 @@ BIN.Load.YA.1 >PUSHWI K.S.STAT
>PUSHBI SYS.FOpen.R
>PUSHW BIN.CmdLine
jsr K.LoadFile
>SYSCALL LoadFile BANK1!!!
.9 bcs .99 Error Loading file
stx BIN.hMem save hMem
@ -214,7 +214,7 @@ BIN.Load.YA.1 >PUSHWI K.S.STAT
jsr BIN.RelocateEXE
>LDYA BIN.CmdLine get back bin path
jsr K.NewPStr.YA make a copy of this string
jsr K.NewCStr.YA make a copy of this string
bcs .98
lda BIN.hMem Keep X=hMem

View File

@ -28,7 +28,7 @@ CORE.Run jsr CORE.TskMgrRun
bmi .2 Ignore & Discard any timer event
jsr RUN.DumpEvent
jsr CORE.DumpEvent
.2 jsr CORE.DestroyEvent
@ -85,7 +85,7 @@ CORE.Run jsr CORE.TskMgrRun
jsr pDevJmp
jmp CORE.Run
*--------------------------------------
RUN.DumpEvent ldy #S.EVT-1
CORE.DumpEvent ldy #S.EVT-1
.1 >PUSHB (pEvent),y
dey

View File

@ -14,7 +14,7 @@ AUTO 6
K.ExpandStr.YA stz K.ExpandStr.hPStr Reset Intermediate string...
.1 >STYA ZPPtr2
>SYSCALL PrintF.YA
stz K.ExpandStr.Len init Expanded String len=0
stz K.ExpandStr.bFound No var found yet
@ -22,7 +22,7 @@ K.ExpandStr.YA stz K.ExpandStr.hPStr Reset Intermediate string...
ldy #0
.10 stz K.ExpandStr.Name
.10 stz K.ExpandStr.VarLen
stz K.ExpandStr.bInVar
.11 lda (ZPPtr2),y End of CSTR?
@ -60,7 +60,7 @@ K.ExpandStr.YA stz K.ExpandStr.hPStr Reset Intermediate string...
.3 cmp #'{' we are in var, "{" after "$"?
bne .31
ldx K.ExpandStr.Name No char in var yet ?
ldx K.ExpandStr.VarLen No char in var yet ?
beq .11 normal, "${" syntax is ok,skip
bne .5 not allowed char in varname, end of var
@ -71,35 +71,37 @@ K.ExpandStr.YA stz K.ExpandStr.hPStr Reset Intermediate string...
jsr K.ExpandStrValidChar
bcc .32 yes, add to varname
ldx K.ExpandStr.Name
ldx K.ExpandStr.VarLen
bne .5 varname has already chars...end of var
inx must be a $? or ?x.....go expand
stx K.ExpandStr.Name
sta K.ExpandStr.Name+1
stx K.ExpandStr.VarLen
sta K.ExpandStr.VarName
bra .51 go Expand....
.32 ldx K.ExpandStr.Name
inx
.32 ldx K.ExpandStr.VarLen
cpx #16
beq .11 varname longer than 15....ignore
sta K.ExpandStr.Name,x
stx K.ExpandStr.Name
sta K.ExpandStr.VarName,x
inx
stx K.ExpandStr.VarLen
bra .11
.5 dey last char was invalid...move back
.50 ldx K.ExpandStr.Name
.50 ldx K.ExpandStr.VarLen
beq .52 var name is empty...start over
.51 phy save current index
.51 stz K.ExpandStr.VarName,x
phy save current index
jsr K.ExpandStrGetValue
ply restore index in string...
.52 jmp .10 reset start flag and continue
.8 ldx K.ExpandStr.Name end of PSTR,are we in a var?
.8 ldx K.ExpandStr.VarLen end of STR,are we in a var?
beq .80 no...exit...
stz K.ExpandStr.VarName,x
jsr K.ExpandStrGetValue yes, expand and add to STR
.80 lda K.ExpandStr.hPStr working from our temp string ?
@ -115,7 +117,12 @@ K.ExpandStr.YA stz K.ExpandStr.hPStr Reset Intermediate string...
beq .82
jmp .1 Yes, start over with hPStr
.82 ldx K.ExpandStr.hPStr
.82 phy
pha
>SYSCALL PrintF.YA
pla
ply
ldx K.ExpandStr.hPStr
* or exit with Y,A from K.NewPStrYA
.9 rts
@ -143,7 +150,7 @@ K.ExpandStrGetValue
jsr ENV.ExpandSysVar
bcc .9
>LDYAI K.ExpandStr.Name
>LDYAI K.ExpandStr.VarName
jsr K.GetEnv.YA
bcs .9
@ -158,57 +165,39 @@ K.ExpandStr.bNoExp .BS 1
K.ExpandStr.bInVar .BS 1
K.ExpandStr.bFound .BS 1
K.ExpandStr.hPStr .BS 1
K.ExpandStr.Name .BS 16
K.ExpandStr.VarLen .BS 1
K.ExpandStr.VarName .BS 16
*/--------------------------------------
* # PutEnv.YA
* ## In:
* Y,A = PTR to String NAME=VALUE (PSTR)
* Y,A = PTR to String NAME=VALUE (C-String)
* ## Out:
*\--------------------------------------
K.PutEnv.YA >STYA ZPPtr1 NAME=VALUE
lda (ZPPtr1)
beq .9
sta K.Buf256
tay
.1 lda (ZPPtr1),y copy PSTR to K.Buf256
sta K.Buf256,y
dey
bne .1
ldy #0
.2 iny
cpy K.Buf256 last char ?
beq .9 no "=" found
lda K.Buf256,y
cmp #'='
bne .2
cpy #1 String like "=value" ?
.1 lda (ZPPtr1),y copy STR to K.Buf256
beq .9
cmp #'='
beq .2
sta K.Buf256,y
iny
bne .1
cpy K.Buf256 last char ?
beq .9 we have "VAR="
.2 lda #0
sta K.Buf256,y
lda K.Buf256 get actual string len
sty K.Buf256 set length of VAR string
dec K.Buf256 ...without "="
clc Substract VAR len+1 from whole len to get
sbc K.Buf256 VALUE len
sta K.Buf256,y save it at "=" POS
stz ZPPtr1 #K.Buf256
sty ZPPtr2
lda /K.Buf256
sta ZPPtr1+1
tya
clc
adc ZPPtr1
sta ZPPtr2
lda ZPPtr2+1
adc #0
sta ZPPtr2+1
>LDYAI K.Buf256
>STYA ZPPtr1
bra K.SetEnvPtr1Ptr2
.9 sec
@ -330,19 +319,18 @@ S.UnsetEnvPtr1 jsr ENV.FindVarPtr1
*--------------------------------------
* ENV.ExpandSysVar
* In:
* K.ExpandStr.Name
* K.ExpandStr.VarName
* Out:
* CC: Found
* Append VALUE to K.Buf256
* CS: Not Found
*--------------------------------------
ENV.ExpandSysVar
ldx K.ExpandStr.Name
ldx K.ExpandStr.VarLen
cpx #1 is name 1 char?
bne .9
ldy #1
lda K.ExpandStr.Name+1
lda K.ExpandStr.VarName
cmp #'0'-1 $0...$9 ??
bcc .1
cmp #'9'+1
@ -464,26 +452,27 @@ ENV.SysVarsExit2
ENV.FindVarPtr1 jsr ENV.InitEnvPtr3 Store ENV
bcs .99
lda (ZPPtr3)
.1 lda (ZPPtr3)
beq .9 end of ENV
.1 cmp (ZPPtr1) Same len as NAME?
bne .3
tay
ldy #0
.2 lda (ZPPtr1),y
cmp (ZPPtr3),y
bne .3
dey
ora #0
beq .8
iny
bne .2
clc
.8 clc
rts
.3 jsr ENV.NextEnvPtr3 Skip NAME
jsr ENV.NextEnvPtr3 Skip VALUE
lda (ZPPtr3)
bne .1
bra .1
.9 sec
.99 rts
@ -493,31 +482,25 @@ ENV.FindVarPtr1 jsr ENV.InitEnvPtr3 Store ENV
* ZPPtr3 -> ENV.NAME to Discard
*--------------------------------------
ENV.DiscardVarPtr3
lda ZPPtr3 Discard current NAME & VALUE definition
sec ZPPtr3 -> NAME
adc (ZPPtr3) add NAME+1 to ZPPtr3
sta ZPPtr4 store it in ZPPtr4
lda #0
adc ZPPtr3+1
sta ZPPtr4+1
lda ZPPtr4 add VALUE+1 to ZPPtr4
sec
adc (ZPPtr4)
sta ZPPtr4
bcc .1
inc ZPPtr4+1
.1 ldy #0
>LDYA ZPPtr3 save actual Ptr
>STYA ZPPtr4
jsr ENV.NextEnvPtr3 Skip current NAME....
jsr ENV.NextEnvPtr3 Skip current VALUE....
ldy #0
.2 lda (ZPPtr4),y Move back tail...
sta (ZPPtr3),y
beq .8 ...until we move ending 0
.1 lda (ZPPtr3),y Move back CSTRs...
.2 sta (ZPPtr4),y
beq .2 0 ended....
iny
bne .2
inc ZPPtr3+1
inc ZPPtr4+1
bra .2
bne .1
inc ZPPtr3
inc ZPPtr4
bra .1
.3 iny
lda (ZPPtr3),y
bne .3 Until array ending 0
.8 rts
*--------------------------------------
@ -527,30 +510,37 @@ ENV.InitEnvPtr3 ldy #S.PS.hENV
>STYA ZPPtr3 Store ENV
rts
*--------------------------------------
ENV.NextEnvPtr3 lda ZPPtr3
ENV.NextEnvPtr3 ldy #0
.1 lda (ZPPtr3),y
beq .2
iny
bne .1
.2 tya
sec
adc (ZPPtr3)
adc ZPPtr3
sta ZPPtr3
bcc .8
inc ZPPtr3+1
.8 rts
*--------------------------------------
ENV.AppendPtr3ToBuf
ldy #0
ldx K.Buf256
ldx #$ff
.1 iny
lda (ZPPtr3),y
inx
beq .9
sta K.Buf256,x
tya
cmp (ZPPtr3) last char?
.1 inx
lda K.Buf256,x
bne .1
stx K.Buf256
.9 rts
ldy #0
.2 lda (ZPPtr3),y
sta K.Buf256,x
bne .2
inx
stz K.Buf256,x
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.ENV

View File

@ -161,8 +161,6 @@ Kernel.Init3 sta SETALTZP
>DEBUGOA
bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
jmp CORE.Run
.9 >PUSHA
@ -846,10 +844,10 @@ MSG.KCREAD.OK >CSTR "OK\n"
MSG.KCREAD.KO >CSTR "\nError While Reading Kernel Config File, Using Default.\n"
*--------------------------------------
DEV.SYS >PSTR "SYS"
I.ENV.A2osX >PSTR "A2OSX"
I.ENV.PATH >PSTR "PATH=${A2OSX}SBIN/;${A2OSX}BIN/"
I.ENV.LIB >PSTR "LIB=${A2OSX}LIB/"
I.ENV.DRV >PSTR "DRV=${A2OSX}DRV/"
I.ENV.A2osX >CSTR "A2OSX"
I.ENV.PATH >CSTR "PATH=${A2OSX}SBIN/;${A2OSX}BIN/"
I.ENV.LIB >CSTR "LIB=${A2OSX}LIB/"
I.ENV.DRV >CSTR "DRV=${A2OSX}DRV/"
STARTUP.CMDLINE >CSTR "${A2OSX}SBIN/SHELL ${A2OSX}A2osX.STARTUP"
*--------------------------------------
MLIOPEN00 .DA #3

View File

@ -73,7 +73,7 @@ K.SYSCALL.JMP .DA 0 $00
*--------------------------------------
* Bank 2
*--------------------------------------
.DA 0 $70
.DA K.StrLen.YA $70
.DA K.StrCpy
.DA K.StrCat
.DA K.StrMatch

View File

@ -491,7 +491,7 @@ K.GetMemStat.YA >STYA ZPMemMgrDstPtr
rts
*--------------------------------------
* In:
* Y,A = BINPATH (PSTR)
* Y,A = BINPATH (C-String)
* Out:
* Y,A = ZPMemMgrSPtr = PTR to S.MEM
* X = hMem
@ -500,7 +500,7 @@ MEM.GetMemByNameYA
ldx MemMgr.LastSlot
beq .9
>STYA ZPMemMgrSrcPtr SAVE BINPATH
>STYA .2+1
>LDYAI MemMgr.Table
>STYA ZPMemMgrTmp1
@ -514,18 +514,15 @@ MEM.GetMemByNameYA
beq .6
jsr K.GetMemPtr.A get pathname
>STYA ZPMemMgrDstPtr
lda (ZPMemMgrSrcPtr)
cmp (ZPMemMgrDstPtr)
bne .6
>STYA .3+1
tay
ldy #0
.2 lda (ZPMemMgrSrcPtr),y
cmp (ZPMemMgrDstPtr),y
.2 lda $ffff,y
.3 cmp $ffff,y
bne .6
dey
iny
ora #0
bne .2
>LDYA ZPMemMgrTmp1

View File

@ -4,52 +4,6 @@ LOMEM $A00
INC 1
AUTO 6
*/--------------------------------------
* # ExecProcessNewEnv.YA
* # ExecProcess.YA (Blocking Parent PID)
* # CreateProcessNewEnv.YA
* # CreateProcess.YA (Non Blocking)
* ## In:
* Y,A = PTR To Cmd Line
* ## Out:
* A = Child PSID
*\--------------------------------------
K.ExecProcessNewEnv.YA
ldx #S.PS.F.ENV+S.PS.F.HOLD
.HS 2C bit abs
K.ExecProcess.YA
ldx #S.PS.F.HOLD
.HS 2C bit abs
K.CreateProcessNewEnv.YA
ldx #S.PS.F.ENV
.HS 2C bit abs
K.CreateProcess.YA
ldx #0
stx K.CreateProcess.Flags
>STYA K.CreateProcess.CmdLine
jsr PS.CreateChild
bcs .9
sta .8+1
>DEBUG
jsr PS.Init
bcc .8
pha save error code
lda .8+1
jsr PS.Free.A
pla get back error code
sec
rts
.8 lda #$ff self modified
.9 rts
*--------------------------------------
K.CreateProcess.Flags .BS 1
K.CreateProcess.CmdLine .BS 2
*/--------------------------------------
* # GetPSByID.A
* ## In :
* A = PID
@ -114,6 +68,68 @@ K.Sleep pla get PC LO
sta (pPs)
clc No error,
rts back to Kernel
*/--------------------------------------
* # ExecProcessNewEnv.YA
* # ExecProcess.YA (Blocking Parent PID)
* # CreateProcessNewEnv.YA
* # CreateProcess.YA (Non Blocking)
* ## In:
* Y,A = PTR To Cmd Line
* ## Out:
* A = Child PSID
*\--------------------------------------
K.ExecProcessNewEnv.YA
ldx #S.PS.F.ENV+S.PS.F.HOLD
.HS 2C bit abs
K.ExecProcess.YA
ldx #S.PS.F.HOLD
.HS 2C bit abs
K.CreateProcessNewEnv.YA
ldx #S.PS.F.ENV
.HS 2C bit abs
K.CreateProcess.YA
ldx #0
stx K.CreateProcess.Flags
>STYA K.CreateProcess.CmdLine
>DEBUG
>SYSCALL PrintF.YA
>DEBUG
jsr PS.CreateChild
bcs .9
sta .8+1
>LDYA K.CreateProcess.CmdLine
jsr PS.CmdLine2Args
bcs .9
phy save PTR to Args[0]...
pha
txa
ldy #S.PS.hARGS
sta (ZPPtr3),y
pla Restore PTR...
ply
jsr PS.Init
bcc .8
pha save error code
lda .8+1
jsr PS.Free.A
pla get back error code
sec
rts
.8 lda #$ff self modified
.9 rts
*--------------------------------------
K.CreateProcess.Flags .BS 1
K.CreateProcess.CmdLine .BS 2
*--------------------------------------
* PS.CreateChild
* in :
@ -234,20 +250,76 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS
clc Exit with A=PSID
.9 rts
*--------------------------------------
PS.Init >LDYA K.CreateProcess.CmdLine
jsr PS.CmdLine2Args
PS.CmdLine2Args >STYA ZPPtr1
ldy #0
.1 lda (ZPPtr1),y compute strlen in Y,X
beq .2
cmp #'"' skip "" in computation....
beq .1
iny
bne .1 max 255
.2 tya +2 for ending 0 for last string, and endig 0 for array
clc
adc #2
tay
lda #0
bcc .3
inc
.3 jsr K.GetMem.YA
bcs .9
phy save PTR to Args[0]...
pha
txa
ldy #S.PS.hCMDLINE
sta (ZPPtr3),y
phx save hMem
phy save PTR.LO
pha save PTR.HI
>STYA ZPPtr2
pla Restore PTR...
ply
jsr BIN.Load.YA Y,A=filename full path
stz PS.CmdLine2Args.bInQuote
ldy #0
ldx #0 Arg Count
.4 lda (ZPPtr1),y
beq .8
cmp #'"' found a quote ?
bne .5
lda PS.CmdLine2Args.bInQuote
eor #$ff
sta PS.CmdLine2Args.bInQuote
bra .71
.5 cmp #' '
bne .70
bit PS.CmdLine2Args.bInQuote
bmi .70
inx Found one arg !!!
lda #0
.70 sta (ZPPtr2) yes, set this token len
.71 inc ZPPtr2
bne .72
inc ZPPtr2+1
.72 iny
bne .4
.8 lda #0
sta (ZPPtr2) set Array Ending 0
pla get back PTR.HI
ply get back PTR.LO
plx get back hMem
clc
.9 rts
PS.CmdLine2Args.bInQuote
.BS 1
*--------------------------------------
PS.Init jsr BIN.Load.YA Y,A=filename full path
bcs .9
>STYA ZPPtr4 save PTR to Code Segment
@ -279,7 +351,7 @@ PS.Init >LDYA K.CreateProcess.CmdLine
dey
ora (ZPPtr4),y
beq * DS.SIZE=0!!!!
beq * SS.SIZE=0!!!!
lda (ZPPtr4),y
tay
@ -300,7 +372,7 @@ PS.Init >LDYA K.CreateProcess.CmdLine
*--------------------------------------
PS.Free.A jsr K.GetPSByID.A PS in ZPPtr1
ldy #S.PS.hCMDLINE
ldy #S.PS.hARGS
jsr PS.Free.A.PsY
lda (ZPPtr1) get S.PS.F
@ -383,74 +455,6 @@ PS.DupEnv.A jsr K.GetMemPtr.A
clc
.9 rts
*--------------------------------------
PS.CmdLine2Args >STYA ZPPtr1
ldy #0
.1 lda (ZPPtr1),y compute strlen in Y,X
beq .2
cmp #'"' skip "" in computation....
beq .1
iny
bne .1 max 255
.2 tya +2 for ending 0 for last string, and endig 0 for array
clc
adc #2
tay
lda #0
bcc .3
inc
.3 jsr K.GetMem.YA
bcs .9
phx save hMem
phy save PTR.LO
pha save PTR.HI
>STYA ZPPtr2
stz PS.CmdLine2Args.bInQuote
ldy #0
ldx #0 Arg Count
.4 lda (ZPPtr1),y
beq .8
cmp #'"' found a quote ?
bne .5
lda PS.CmdLine2Args.bInQuote
eor #$ff
sta PS.CmdLine2Args.bInQuote
bra .71
.5 cmp #' '
bne .70
bit PS.CmdLine2Args.bInQuote
bmi .70
inx Found one arg !!!
lda #0
.70 sta (ZPPtr2) yes, set this token len
.71 inc ZPPtr2
bne .72
inc ZPPtr2+1
.72 iny
bne .4
.8 lda #0
sta (ZPPtr2) set Array Ending 0
pla get back PTR.HI
ply get back PTR.LO
plx get back hMem
clc
.9 rts
PS.CmdLine2Args.bInQuote
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.PS
LOAD /A2OSX.SRC/SYS/KERNEL.S

View File

@ -43,6 +43,7 @@ A2osX.D2 .PH $D000
.INB /A2OSX.SRC/SYS/KERNEL.S.PS
.INB /A2OSX.SRC/SYS/KERNEL.S.ARG
.INB /A2OSX.SRC/SYS/KERNEL.S.ENV
.INB /A2OSX.SRC/SYS/KERNEL.S.BIN
.EP
A2osX.E0 .PH $E000
.INB /A2OSX.SRC/SYS/KERNEL.S.JMP
@ -50,7 +51,6 @@ A2osX.E0 .PH $E000
.INB /A2OSX.SRC/SYS/KERNEL.S.DAT
.INB /A2OSX.SRC/SYS/KERNEL.S.IRQ
.INB /A2OSX.SRC/SYS/KERNEL.S.MEM
.INB /A2OSX.SRC/SYS/KERNEL.S.BIN
.INB /A2OSX.SRC/SYS/KERNEL.S.D01
.EP
A2osX.E0.E .EQ *