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

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,52 +4,6 @@ LOMEM $A00
INC 1 INC 1
AUTO 6 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 * # GetPSByID.A
* ## In : * ## In :
* A = PID * A = PID
@ -114,6 +68,68 @@ K.Sleep pla get PC LO
sta (pPs) sta (pPs)
clc No error, clc No error,
rts back to Kernel 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 * PS.CreateChild
* in : * in :
@ -234,20 +250,76 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS
clc Exit with A=PSID clc Exit with A=PSID
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
PS.Init >LDYA K.CreateProcess.CmdLine PS.CmdLine2Args >STYA ZPPtr1
jsr PS.CmdLine2Args
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 bcs .9
phx save hMem
phy save PTR to Args[0]... phy save PTR.LO
pha pha save PTR.HI
>STYA ZPPtr2
txa
ldy #S.PS.hCMDLINE
sta (ZPPtr3),y
pla Restore PTR... stz PS.CmdLine2Args.bInQuote
ply
jsr BIN.Load.YA Y,A=filename full path 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 bcs .9
>STYA ZPPtr4 save PTR to Code Segment >STYA ZPPtr4 save PTR to Code Segment
@ -279,7 +351,7 @@ PS.Init >LDYA K.CreateProcess.CmdLine
dey dey
ora (ZPPtr4),y ora (ZPPtr4),y
beq * DS.SIZE=0!!!! beq * SS.SIZE=0!!!!
lda (ZPPtr4),y lda (ZPPtr4),y
tay tay
@ -300,7 +372,7 @@ PS.Init >LDYA K.CreateProcess.CmdLine
*-------------------------------------- *--------------------------------------
PS.Free.A jsr K.GetPSByID.A PS in ZPPtr1 PS.Free.A jsr K.GetPSByID.A PS in ZPPtr1
ldy #S.PS.hCMDLINE ldy #S.PS.hARGS
jsr PS.Free.A.PsY jsr PS.Free.A.PsY
lda (ZPPtr1) get S.PS.F lda (ZPPtr1) get S.PS.F
@ -383,74 +455,6 @@ PS.DupEnv.A jsr K.GetMemPtr.A
clc clc
.9 rts .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 MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.PS SAVE /A2OSX.SRC/SYS/KERNEL.S.PS
LOAD /A2OSX.SRC/SYS/KERNEL.S 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.PS
.INB /A2OSX.SRC/SYS/KERNEL.S.ARG .INB /A2OSX.SRC/SYS/KERNEL.S.ARG
.INB /A2OSX.SRC/SYS/KERNEL.S.ENV .INB /A2OSX.SRC/SYS/KERNEL.S.ENV
.INB /A2OSX.SRC/SYS/KERNEL.S.BIN
.EP .EP
A2osX.E0 .PH $E000 A2osX.E0 .PH $E000
.INB /A2OSX.SRC/SYS/KERNEL.S.JMP .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.DAT
.INB /A2OSX.SRC/SYS/KERNEL.S.IRQ .INB /A2OSX.SRC/SYS/KERNEL.S.IRQ
.INB /A2OSX.SRC/SYS/KERNEL.S.MEM .INB /A2OSX.SRC/SYS/KERNEL.S.MEM
.INB /A2OSX.SRC/SYS/KERNEL.S.BIN
.INB /A2OSX.SRC/SYS/KERNEL.S.D01 .INB /A2OSX.SRC/SYS/KERNEL.S.D01
.EP .EP
A2osX.E0.E .EQ * A2osX.E0.E .EQ *