mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-04 18:32:56 +00:00
Kernel 0.93+
This commit is contained in:
parent
7639e30658
commit
48cfcb9253
@ -97,7 +97,7 @@ CS.RUN
|
||||
.6 >LDA.G index do we have a Source dir ?
|
||||
bne CS.RUN.LOOP
|
||||
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
lda (pPs),y
|
||||
>SYSCALL GetMemPtr
|
||||
jsr InitSrcDirYA
|
||||
|
@ -28,7 +28,7 @@ CMD.PUSHD >LDA.G PUSHD.STACK
|
||||
cmp #PUSHD.STACK+PUSHD.STACK.MAX
|
||||
beq CMD.POPD.CSYN
|
||||
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
lda (pPs),y
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL strdup
|
||||
@ -60,7 +60,7 @@ CMD.POPD.RTS
|
||||
|
||||
CMD.POPD.CSYN jmp CMD.Exec.CSYN
|
||||
*--------------------------------------
|
||||
CMD.PWD ldy #S.PS.hPREFIX
|
||||
CMD.PWD ldy #S.PS.hCWD
|
||||
lda (pPs),y
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL puts
|
||||
@ -150,13 +150,13 @@ CMD.CD.YA >SYSCALL realpath
|
||||
pla
|
||||
*--------------------------------------
|
||||
CMD.SetPrefixA pha
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
lda (pPs),y
|
||||
>SYSCALL FreeMem
|
||||
|
||||
pla
|
||||
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
sta (pPs),y
|
||||
lda #0
|
||||
* clc
|
||||
|
@ -104,7 +104,7 @@ CS.INIT
|
||||
>LDA.G hDstBasePath
|
||||
bne .8 we also have a Dst folder
|
||||
|
||||
ldy #S.PS.hPREFIX no dst folder, use actual prefix
|
||||
ldy #S.PS.hCWD no dst folder, use actual prefix
|
||||
lda (pPs),y
|
||||
>SYSCALL GetMemPtr
|
||||
jsr InitDstDirYA
|
||||
|
@ -493,41 +493,47 @@ S.FD.PIPE.Size .EQ 12
|
||||
*
|
||||
S.FD.PIPE .EQ 14
|
||||
*--------------------------------------
|
||||
* Task Function Indexes
|
||||
*--------------------------------------
|
||||
PS.INIT .EQ 0
|
||||
PS.RUN .EQ 2
|
||||
PS.DOEVENT .EQ 4
|
||||
PS.QUIT .EQ 6
|
||||
*--------------------------------------
|
||||
* PS STRUCT
|
||||
*--------------------------------------
|
||||
S.PS.F .EQ 0
|
||||
S.PS.F.INIT .EQ %10000000
|
||||
S.PS.F.RUN .EQ %01000000
|
||||
S.PS.F.QUIT .EQ %00100000
|
||||
S.PS.F.DOEVENT .EQ %00010000
|
||||
S.PS.F.HOLD .EQ %00001000
|
||||
S.PS.F.SLEEP .EQ %00000100
|
||||
S.PS.F.HOLD .EQ %10000000
|
||||
S.PS.F.SLEEP .EQ %01000000
|
||||
S.PS.F.CLOSEONX .EQ %00000100
|
||||
S.PS.F.EVENT .EQ %00000010
|
||||
S.PS.F.NOHUP .EQ %00000001
|
||||
S.PS.PPID .EQ 1
|
||||
S.PS.PID .EQ 2
|
||||
S.PS.CPID .EQ 3
|
||||
S.PS.hCS .EQ 4
|
||||
S.PS.hDS .EQ 5
|
||||
S.PS.hSS .EQ 6
|
||||
S.PS.ENVPAGECNT .EQ 7
|
||||
S.PS.hENV .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.ARGC .EQ 14
|
||||
S.PS.hARGV .EQ 15
|
||||
|
||||
S.PS.hSID .EQ 16
|
||||
S.PS.S .EQ 1
|
||||
|
||||
S.PS.PPID .EQ 2
|
||||
S.PS.PID .EQ 3
|
||||
S.PS.CPID .EQ 4
|
||||
S.PS.hCS .EQ 5
|
||||
S.PS.hDS .EQ 6
|
||||
S.PS.hSS .EQ 7
|
||||
S.PS.ENVPAGECNT .EQ 8
|
||||
S.PS.hENV .EQ 9
|
||||
S.PS.hCWD .EQ 10
|
||||
S.PS.hStdIn .EQ 11
|
||||
S.PS.hStdOut .EQ 12
|
||||
S.PS.hStdErr .EQ 13
|
||||
S.PS.RC .EQ 14
|
||||
S.PS.ARGC .EQ 15
|
||||
S.PS.hARGV .EQ 16
|
||||
|
||||
S.PS.A .EQ 17
|
||||
S.PS.X .EQ 18
|
||||
S.PS.Y .EQ 19
|
||||
S.PS.P .EQ 20
|
||||
S.PS.PC .EQ 21 WORD
|
||||
*S.PS.ZP.SIZE .EQ 23
|
||||
|
||||
S.PS.hSID .EQ 23
|
||||
|
||||
S.PS.ZP.SESSION .EQ 24
|
||||
S.PS.ZP.CODE .EQ 26
|
||||
@ -542,13 +548,6 @@ S.PS .EQ 66
|
||||
LIBMGR.LOAD .EQ 0
|
||||
LIBMGR.UNLOAD .EQ 2
|
||||
*--------------------------------------
|
||||
* Task Function Indexes
|
||||
*--------------------------------------
|
||||
PS.INIT .EQ 0
|
||||
PS.RUN .EQ 2
|
||||
PS.DOEVENT .EQ 4
|
||||
PS.QUIT .EQ 6
|
||||
*--------------------------------------
|
||||
* EVENT STRUCT
|
||||
*--------------------------------------
|
||||
S.EVT.F .EQ 0
|
||||
|
@ -8,6 +8,7 @@ BIN.R.CS.Start .BS 2
|
||||
BIN.R.CS.End .BS 2
|
||||
BIN.R.End .BS 2
|
||||
BIN.R.Offset .BS 2
|
||||
BIN.R.Stop .BS 2
|
||||
.ED
|
||||
*--------------------------------------
|
||||
* LoadLib
|
||||
@ -307,14 +308,14 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
|
||||
.2 jsr MEM.AddYp1ToPtr1 add current offset in Y to Ptr
|
||||
* + 1 to skip last 00 from beq .2
|
||||
* ZPPtr1=Current Code PTR
|
||||
|
||||
lda BIN.R.End
|
||||
lda BIN.R.CS.End
|
||||
clc
|
||||
adc BIN.R.Offset
|
||||
sta .6+1
|
||||
lda BIN.R.End+1
|
||||
sta BIN.R.Stop
|
||||
|
||||
lda BIN.R.CS.End+1
|
||||
adc BIN.R.Offset+1
|
||||
sta .7+1
|
||||
sta BIN.R.Stop+1
|
||||
|
||||
.3 lda (ZPPtr1) get OPCODE
|
||||
lsr /2
|
||||
@ -341,11 +342,11 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
|
||||
.5 tay A = OPCODE length
|
||||
jsr MEM.AddYToPtr1
|
||||
|
||||
.6 cmp #$ff SELF MODIFIED, A = ZPPtr1
|
||||
.6 cmp BIN.R.Stop A = ZPPtr1
|
||||
bne .3
|
||||
|
||||
lda ZPPtr1+1
|
||||
.7 cmp #$ff SELF MODIFIED
|
||||
.7 cmp BIN.R.Stop+1
|
||||
bne .3 next opcode....
|
||||
|
||||
clc Make sure exit with CC
|
||||
|
@ -12,8 +12,10 @@ CORE.Run stz CORE.PSIndex
|
||||
>STYA pPs
|
||||
|
||||
lda (pPs) get S.PS.F
|
||||
bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
||||
beq .2
|
||||
* bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
||||
* beq .2
|
||||
|
||||
bpl .2
|
||||
|
||||
ldy #S.PS.CPID
|
||||
lda (pPs),y
|
||||
@ -33,24 +35,24 @@ CORE.Run stz CORE.PSIndex
|
||||
|
||||
jsr CORE.UpdateParentPS
|
||||
|
||||
lda (pPs)
|
||||
and #$3F $ff^S.PS.F.INIT+S.PS.F.RUN
|
||||
ora #S.PS.F.QUIT
|
||||
sta (pPs)
|
||||
ldy #S.PS.S
|
||||
lda #PS.QUIT
|
||||
sta (pPs),y
|
||||
bra .3 try executing QUIT now...
|
||||
|
||||
.4 lda (pPs)
|
||||
bit #S.PS.F.SLEEP
|
||||
bne .7
|
||||
|
||||
bit #S.PS.F.INIT
|
||||
beq .5
|
||||
ldy #S.PS.S
|
||||
lda (pPs),y
|
||||
bne .5
|
||||
|
||||
eor #S.PS.F.INIT+S.PS.F.RUN go from INIT to RUN
|
||||
sta (pPs)
|
||||
lda #PS.RUN go from INIT to RUN
|
||||
sta (pPs),y
|
||||
bra .7
|
||||
|
||||
.5 bit #S.PS.F.QUIT
|
||||
.5 cmp #PS.QUIT
|
||||
beq .7
|
||||
|
||||
ldy #S.PS.PID
|
||||
@ -262,13 +264,18 @@ CORE.Dispatch stz CORE.PSIndex
|
||||
jsr K.GetMemPtr
|
||||
>STYA pPS
|
||||
|
||||
lda (pPs) get S.PS.F
|
||||
bit #S.PS.F.INIT+S.PS.F.HOLD+S.PS.F.QUIT Init or Waiting for Another Task to Terminate?
|
||||
bne .5
|
||||
|
||||
lda (pPs)
|
||||
bit #S.PS.F.EVENT Accept Events ?
|
||||
beq .5
|
||||
|
||||
ldy #S.PS.S
|
||||
lda (pPs),y
|
||||
cmp #PS.RUN
|
||||
bne .5
|
||||
|
||||
lda #PS.DOEVENT Flag this PS for IRQ Mgr
|
||||
sta (pPs),y
|
||||
|
||||
jsr CORE.PSSelect
|
||||
|
||||
lda #Evt.Table
|
||||
@ -280,17 +287,9 @@ CORE.Dispatch stz CORE.PSIndex
|
||||
.2 lda (pEvent) Empty event, select next
|
||||
beq .3
|
||||
|
||||
lda (pPs)
|
||||
ora #S.PS.F.DOEVENT
|
||||
sta (pPs)
|
||||
|
||||
jsr CORE.PSDoEvent
|
||||
jsr CORE.PSExec2
|
||||
dec IRQ.InKernel
|
||||
|
||||
lda (pPs)
|
||||
eor #S.PS.F.DOEVENT
|
||||
sta (pPs)
|
||||
|
||||
bcs .3 not for this PS, try next event in list
|
||||
|
||||
jsr CORE.DestroyEvent this PS handled the EVT, destroy it...
|
||||
@ -307,7 +306,11 @@ CORE.Dispatch stz CORE.PSIndex
|
||||
sta pEvent
|
||||
bra .2
|
||||
|
||||
.4 jsr CORE.PSLeave
|
||||
.4 ldy #S.PS.S
|
||||
lda #PS.RUN
|
||||
sta (pPs),y
|
||||
|
||||
jsr CORE.PSLeave
|
||||
|
||||
.5 inc CORE.PSIndex
|
||||
ldx CORE.PSIndex
|
||||
@ -408,27 +411,10 @@ CORE.PSExec lda (pPS)
|
||||
bit #S.PS.F.SLEEP
|
||||
bne CORE.PSResume
|
||||
|
||||
bit #S.PS.F.RUN
|
||||
bne .3
|
||||
CORE.PSExec2 ldy #S.PS.S
|
||||
lda (pPS),y
|
||||
|
||||
bit #S.PS.F.QUIT
|
||||
bne .2
|
||||
|
||||
ldx #ZPBIN.SIZE
|
||||
|
||||
.1 stz ZPBIN-1,x
|
||||
dex
|
||||
bne .1
|
||||
|
||||
* ldx #PS.INIT X=0
|
||||
|
||||
.HS 2C BIT ABS
|
||||
.2 ldx #PS.QUIT
|
||||
.HS 2C BIT ABS
|
||||
.3 ldx #PS.RUN
|
||||
.HS 2C BIT ABS
|
||||
|
||||
CORE.PSDoEvent ldx #PS.DOEVENT
|
||||
tax
|
||||
|
||||
lda pCode+1
|
||||
pha
|
||||
|
@ -566,7 +566,7 @@ ENV.StrVarsJmp .DA ENV.StrVarsSession
|
||||
.DA ENV.StrVarsUID
|
||||
.DA ENV.StrVarsGID
|
||||
*--------------------------------------
|
||||
ENV.StrVarsPWD ldy #S.PS.hPREFIX
|
||||
ENV.StrVarsPWD ldy #S.PS.hCWD
|
||||
lda (pPS),y
|
||||
jsr K.GetMemPtr
|
||||
jmp ENV.AddYAToBuf
|
||||
|
@ -1000,7 +1000,7 @@ TskMgrInit >LDYAI MSG.TSK
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
sta (pPs),y
|
||||
|
||||
>PUSHWI $2C0 Get BOOT from QC
|
||||
|
@ -193,8 +193,9 @@ K.IrqH.Switch inc IRQ.Tick
|
||||
bit A2osX.F A2osX.F.PMODE .EQ %01000000
|
||||
bvc .8
|
||||
|
||||
lda (pPs)
|
||||
and #S.PS.F.DOEVENT
|
||||
ldy #S.PS.S
|
||||
lda (pPs),y
|
||||
eor #PS.DOEVENT Dont switch while DOEVENT
|
||||
bne .9
|
||||
|
||||
.8 clc exit with V flag set
|
||||
|
@ -275,7 +275,7 @@ K.FreeMem.ERR phx
|
||||
jsr K.SYSCALL2.BANK
|
||||
plx
|
||||
lda #E.INVH
|
||||
* >DEBUG
|
||||
>DEBUG
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -152,7 +152,7 @@ PS.CreateChild ldx #0
|
||||
dey #S.PS.PPID
|
||||
sta (PS.NewPSPtr),y
|
||||
|
||||
ldy #S.PS.hPREFIX copy hPREFIX...
|
||||
ldy #S.PS.hCWD copy hPREFIX...
|
||||
lda (ZPPtr1),y
|
||||
jsr K.GetMemPtr
|
||||
|
||||
@ -162,7 +162,7 @@ PS.CreateChild ldx #0
|
||||
jsr Mem.SetOwner Set Ownership
|
||||
|
||||
txa
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
sta (PS.NewPSPtr),y
|
||||
|
||||
jsr ENV.Dup dup hENV from parent PS
|
||||
@ -210,8 +210,10 @@ PS.CreateChild ldx #0
|
||||
ldy #S.PS.CPID
|
||||
sta (ZPPtr1),y
|
||||
|
||||
.8 lda #S.PS.F.INIT
|
||||
sta (PS.NewPSPtr) Make this PS Init....
|
||||
.8
|
||||
* lda #PS.INIT
|
||||
* ldy #S.PS.S
|
||||
* sta (PS.NewPSPtr),y Make this PS Init....
|
||||
|
||||
lda CORE.LastPSID Exit with A=PSID
|
||||
clc
|
||||
@ -244,7 +246,7 @@ PS.Load ldy #$ff
|
||||
jsr ENV.Search.PATH Get fullpath in K.Buf256
|
||||
bcc .6
|
||||
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
lda (PS.NewPSPtr),y
|
||||
jsr K.GetMemPtr
|
||||
>STYA ENV.SearchPath
|
||||
@ -595,11 +597,9 @@ K.Kill cmp #0
|
||||
|
||||
.99 >RET 1
|
||||
*--------------------------------------
|
||||
K.Kill.1 lda (ZPPtr1)
|
||||
|
||||
and #$33
|
||||
ora #S.PS.F.QUIT
|
||||
sta (ZPPtr1)
|
||||
K.Kill.1 ldy #S.PS.S
|
||||
lda #PS.QUIT
|
||||
sta (ZPPtr1),y
|
||||
|
||||
K.Kill.0
|
||||
clc
|
||||
@ -635,7 +635,7 @@ CORE.PSFree sta .10+1 Save PS ID
|
||||
ldy #S.PS.hENV
|
||||
jsr .8
|
||||
|
||||
ldy #S.PS.hPREFIX
|
||||
ldy #S.PS.hCWD
|
||||
jsr .8
|
||||
|
||||
ldy #S.PS.hStdOut
|
||||
|
@ -165,7 +165,7 @@ STDLIB.realpath.I
|
||||
cmp #'/' full path starting with '/'?
|
||||
beq .3 yes, do not append to current prefix
|
||||
|
||||
.1 ldy #S.PS.hPREFIX
|
||||
.1 ldy #S.PS.hCWD
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtr
|
||||
>STYA ZPPtr2
|
||||
|
Loading…
x
Reference in New Issue
Block a user