2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.TskMgrRun
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE
|
|
|
|
|
>STYA pPs
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
lda TSKMGR.SIZE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta TSKMGR.COUNT
|
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
.1 dec TSKMGR.COUNT skip PS 0
|
|
|
|
|
beq .8
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs) get S.PS.F
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bit #S.PS.F.INUSE In use ?
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.CID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
jsr S.GetPSByIDA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcc .5 yes, running....
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
lda (pPs) get S.PS.F
|
2015-03-14 21:48:35 +00:00
|
|
|
|
and #$FF^S.PS.F.HOLD unmark as HOLD
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.2 jsr S.SelectProcess
|
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
lda (pPS)
|
|
|
|
|
bit #S.PS.F.SLEEP Is this PS sleeping?
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .3 no, call TSKMGR.RUN
|
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
and #$FF^S.PS.F.SLEEP unmark as SLEEP
|
|
|
|
|
sta (pPS)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldy #S.PS.PC
|
2016-06-24 15:02:13 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
sec Advance PC by one as it was saved by a JSR
|
|
|
|
|
adc pCode
|
|
|
|
|
sta .21+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
iny
|
2016-06-24 15:02:13 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
adc pCode+1
|
|
|
|
|
sta .21+2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
.21 jsr $FFFF
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bra .4
|
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
.3 ldx #TSKMGR.RUN
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr pCodeJmp Call RUN function
|
|
|
|
|
.4 bcc .5 RUN said CS=QUIT?
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldx #TSKMGR.QUIT yes, quit this process
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr pCodeJmp Call QUIT function
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.ID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeProcessA
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bcs *
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.5 lda pPs
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.PS.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta pPs
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bcc .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pPs+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .1
|
2016-06-24 15:02:13 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* S.DispatchEvent
|
|
|
|
|
* IN:
|
|
|
|
|
* OUT:
|
|
|
|
|
* CS: Not Dispatched
|
|
|
|
|
* CC: Event Cleared
|
|
|
|
|
*--------------------------------------
|
2016-03-13 21:47:19 +00:00
|
|
|
|
S.DispatchEvents
|
|
|
|
|
>LDYAI TskMgr.Table+S.PS.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>STYA pPs
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
lda TSKMGR.SIZE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta TSKMGR.COUNT
|
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
.1 dec TSKMGR.COUNT skip PS 0
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
lda (pPs) get S.PS.F
|
2016-06-23 15:56:13 +00:00
|
|
|
|
bit #S.PS.F.INUSE In use ?
|
2016-03-13 21:47:19 +00:00
|
|
|
|
beq .4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-06-23 15:56:13 +00:00
|
|
|
|
bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
2016-03-13 21:47:19 +00:00
|
|
|
|
bne .4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-06-23 15:56:13 +00:00
|
|
|
|
bit #S.PS.F.EVENT Accept Events ?
|
2016-03-13 21:47:19 +00:00
|
|
|
|
beq .4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
jsr S.SelectProcess
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
|
|
|
|
stz pEvent
|
|
|
|
|
|
|
|
|
|
lda EVTMGR.SIZE
|
|
|
|
|
sta TSKMGR.EVENTCNT
|
|
|
|
|
|
|
|
|
|
.2 lda (pEvent)
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
lda (pCode)
|
|
|
|
|
cmp #H.BIN.HEADER.BIN65
|
|
|
|
|
bne *
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldx #TSKMGR.DOEVENT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr pCodeJmp Call DOEVENT function
|
2016-03-13 21:47:19 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
jsr S.DestroyEvent
|
|
|
|
|
lda EVTMGR.COUNT
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.3 dec TSKMGR.EVENTCNT
|
|
|
|
|
beq .4
|
|
|
|
|
lda pEvent
|
|
|
|
|
clc
|
|
|
|
|
adc #S.EVT
|
|
|
|
|
sta pEvent
|
|
|
|
|
bra .2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
.4 lda pPs
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.PS.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta pPs
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bcc .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pPs+1
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bne .1 always
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
.8 clc
|
2015-06-03 18:30:57 +00:00
|
|
|
|
rts
|
2016-06-24 15:02:13 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.TskMgrQuit clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* PUBLIC
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
* S.ExecProcessNewEnvYA
|
|
|
|
|
* S.ExecProcessYA (Blocking Parent PID)
|
|
|
|
|
* S.CreateProcessNewEnvYA
|
|
|
|
|
* S.CreateProcessYA (Non Blocking)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* in :
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* A = hMem To Cmd Line
|
2015-11-22 22:30:06 +00:00
|
|
|
|
* Y = hMem To Args
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* out :
|
|
|
|
|
* A = Child PSID
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.ExecProcessNewEnvYA
|
|
|
|
|
ldx #S.PS.F.ENV
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
S.ExecProcessYA ldx #0
|
2015-10-19 20:35:00 +00:00
|
|
|
|
S.ExecProcess jsr S.CreateProcess
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .9 terminated, do not set PID as HOLD
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.PS.CID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pha Save Child PID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ora #S.PS.F.HOLD
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pla Get Back PID
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.CreateProcessNewEnvYA
|
|
|
|
|
ldx #S.PS.F.ENV
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
S.CreateProcessYA
|
|
|
|
|
ldx #0
|
|
|
|
|
S.CreateProcess stx S.CreateChildProcess.Flags
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta S.CreateProcessA.Cmd
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sty S.CreateProcessA.Args
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.CreateChildProcess
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .99
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
sta S.CreateProcessA.CPSID
|
|
|
|
|
jsr S.SelectProcessA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
jsr S.InitProcess
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .98 Init Failed or exit?
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.PID switch back to Parent Process
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
|
|
|
|
|
jsr S.SelectProcessA
|
|
|
|
|
|
|
|
|
|
lda S.CreateProcessA.CPSID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.98 pha save error code
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.PID switch back to Parent Process
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
jsr S.SelectProcessA
|
|
|
|
|
|
|
|
|
|
lda S.CreateProcessA.CPSID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeProcessA
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
pla get back error code
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.99 sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.CreateProcessA.Cmd .BS 1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.CreateProcessA.Args .BS 1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.CreateProcessA.CPSID .BS 1
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* S.GetPSByIDA
|
|
|
|
|
* In :
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* A = PID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* Out :
|
|
|
|
|
* Y,A = PTR to TSKSLOT
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.GetPSByIDA sta S.GetPSByIDA.PS
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>LDYAI TskMgr.Table
|
|
|
|
|
>STYA ZPQuickPtr1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda S.GetPSByIDA.PS
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 inx
|
|
|
|
|
lda ZPQuickPtr1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.PS.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta ZPQuickPtr1
|
|
|
|
|
bcc .2
|
|
|
|
|
inc ZPQuickPtr1+1
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPQuickPtr1)
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.ID
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
cmp S.GetPSByIDA.PS
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.3 cpx TSKMGR.SIZE
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 lda #TSKMGR.ERRNSP
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 >LDYA ZPQuickPtr1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.GetPSByIDA.PS .BS 1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-06-23 15:56:13 +00:00
|
|
|
|
S.Sleep pla get PC LO
|
2016-06-24 15:02:13 +00:00
|
|
|
|
sec
|
2016-06-23 15:56:13 +00:00
|
|
|
|
sbc pCode
|
|
|
|
|
ldy #S.PS.PC
|
2015-11-10 21:47:57 +00:00
|
|
|
|
sta (pPs),y
|
2016-06-24 15:02:13 +00:00
|
|
|
|
|
|
|
|
|
pla get PC HI
|
2016-06-23 15:56:13 +00:00
|
|
|
|
sbc pCode+1
|
|
|
|
|
iny
|
2015-11-10 21:47:57 +00:00
|
|
|
|
sta (pPs),y
|
2016-06-24 15:02:13 +00:00
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.SLEEP
|
|
|
|
|
sta (pPs)
|
2015-11-10 21:47:57 +00:00
|
|
|
|
clc No error,
|
|
|
|
|
rts back to Kernel
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* PRIVATE
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* S.CreateChildProcess
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* in :
|
|
|
|
|
* out :
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* A = PSID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* we cannot use ZPQuickPtrs
|
2016-06-23 20:18:29 +00:00
|
|
|
|
* because of calling S.NewPStrYA & S.DupEnvA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.CreateChildProcess
|
|
|
|
|
>LDYAI TskMgr.Table+S.PS.SIZE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>STYA R.AX
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 inx
|
|
|
|
|
cpx TSKMGR.SIZE
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
lda (R.AX) Found an empty slot
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bpl .3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda R.AL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.PS.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta R.AL
|
|
|
|
|
bcc .1
|
|
|
|
|
inc R.AH
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 cpx #K.PS.MAX
|
|
|
|
|
bne .30
|
|
|
|
|
|
|
|
|
|
lda #TSKMGR.ERROOH
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.30 inc TSKMGR.SIZE
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.3 lda #S.PS.F.INUSE
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ora S.CreateChildProcess.Flags
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (R.AX)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.4 inc TSKMGR.LASTID Get a PSID not alredy running
|
|
|
|
|
beq .4 not = 0
|
|
|
|
|
lda TSKMGR.LASTID
|
|
|
|
|
jsr S.GetPSByIDA
|
|
|
|
|
bcc .4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.ID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda TSKMGR.LASTID
|
|
|
|
|
sta (R.AX),y
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #0
|
|
|
|
|
ldy #S.PS.hCS
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.5 sta (R.AX),y Blank Everything in this S.PS
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #S.PS.SIZE
|
|
|
|
|
bne .5
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
lda S.CreateChildProcess.Flags
|
|
|
|
|
and #S.PS.F.ENV need to create ENV & Prefix ?
|
|
|
|
|
beq .6
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.hPREFIX copy hPREFIX...
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
2016-06-23 20:18:29 +00:00
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
jsr S.NewPStrYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hPREFIX
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (R.AX),y
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.PS.hENV ...and hENV from parent PS
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.DupEnvA
|
|
|
|
|
bcs .99
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.PS.hENV
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (R.AX),y
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bra .8
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.6 ldy #S.PS.hPREFIX reuse same hPREFIX...
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
sta (R.AX),y
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hENV ...and hENV from parent PS
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
sta (R.AX),y
|
|
|
|
|
|
|
|
|
|
.8 ldy #S.PS.hINDEV
|
2016-06-23 15:56:13 +00:00
|
|
|
|
.81 lda (pPs),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (R.AX),y
|
2016-06-23 15:56:13 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #S.PS.hERRDEV+1
|
|
|
|
|
bne .81
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.ID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.PID
|
|
|
|
|
sta (R.AX),y
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda TSKMGR.LASTID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc Exit with A=PSID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
S.CreateChildProcess.Flags
|
|
|
|
|
.BS 1
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
* S.InitProcess
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* In :
|
|
|
|
|
* A = hMem To Full Cmd Line
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.InitProcess lda S.CreateProcessA.Args
|
|
|
|
|
beq .1
|
|
|
|
|
jsr S.ExpandPStrA
|
|
|
|
|
.1 ldy #S.PS.hARGS
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y set ARGS hMem (0 if none)
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
lda S.CreateProcessA.Cmd
|
|
|
|
|
jsr S.ExpandPStrA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ldy #S.PS.hCMD
|
|
|
|
|
sta (pPs),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.LoadBinA A = BinPath hMem
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .99
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
>STYA pCode save PTR to Code Segment
|
2015-03-14 21:48:35 +00:00
|
|
|
|
txa
|
|
|
|
|
ldy #S.PS.hCS
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y save CS hMem in TSKSLOT
|
|
|
|
|
|
|
|
|
|
ldy #H.BIN.BIN.DS.SIZE+1
|
|
|
|
|
lda (pCode),y Load DS.SIZE HI
|
|
|
|
|
tax
|
|
|
|
|
dey
|
|
|
|
|
ora (pCode),y
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .2 DS.SIZE=0...
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
>PUSHAX Push DS.SIZE
|
2015-09-13 20:35:07 +00:00
|
|
|
|
>PUSHBI S.MEM.F.INIT0 Clear DS
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.GetMem
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .99
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
>STYA pData
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.PS.hDS
|
|
|
|
|
sta (pPs),y save DS hMem in TSKSLOT
|
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
.2 lda (pCode)
|
|
|
|
|
cmp #H.BIN.HEADER.BIN65
|
|
|
|
|
bne *
|
|
|
|
|
|
|
|
|
|
ldx #TSKMGR.INIT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr pCodeJmp Call INIT function
|
2016-03-17 14:33:37 +00:00
|
|
|
|
bcc .99
|
|
|
|
|
pha save error code
|
|
|
|
|
ldx #TSKMGR.QUIT
|
|
|
|
|
jsr pCodeJmp Call QUIT function
|
|
|
|
|
pla get back error code
|
|
|
|
|
sec
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.99 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* S.SelectProcessA
|
|
|
|
|
* In : A=PSID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.SelectProcessA
|
2015-11-22 22:30:06 +00:00
|
|
|
|
tay
|
|
|
|
|
bne S.SelectProcessN
|
|
|
|
|
S.SelectProcess0
|
|
|
|
|
>LDYAI TskMgr.Table Make PS #0 as current process
|
|
|
|
|
>STYA pPs
|
|
|
|
|
bra S.SelectProcessDev
|
|
|
|
|
S.SelectProcessN
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.GetPSByIDA
|
|
|
|
|
bcs *
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>STYA pPs
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
S.SelectProcess ldy #S.PS.hCS
|
|
|
|
|
lda (pPs),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.GetMemPtrA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>STYA pCode
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hDS
|
|
|
|
|
lda (pPs),y
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq S.SelectProcessDev
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
>STYA pData
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.SelectProcessDev
|
|
|
|
|
ldy #S.PS.hOUTDEV
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
jsr S.GetDevByIDA
|
|
|
|
|
>STYA pDev
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FreeProcessA
|
|
|
|
|
* In : A = PID to free
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FreeProcessA jsr S.GetPSByIDA
|
2016-04-07 06:14:30 +00:00
|
|
|
|
bcs *
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
ldy #S.PS.hARGS
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.1 ldy #S.PS.hCMD
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPQuickPtr1) get S.PS.F
|
2015-11-10 21:47:57 +00:00
|
|
|
|
and #S.PS.F.ENV do we have to discard duplicated env & prefix ?
|
2015-10-19 20:35:00 +00:00
|
|
|
|
beq .4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.2 ldy #S.PS.hENV
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.3 ldy #S.PS.hPREFIX
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.4 ldy #S.PS.hDS
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .5
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.5 ldy #S.PS.hCS
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.8 lda #0
|
|
|
|
|
sta (ZPQuickPtr1) Mark TSKSLOT as free
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
TSKMGR.SIZE .BS 1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
TSKMGR.COUNT .BS 1
|
2016-03-13 21:47:19 +00:00
|
|
|
|
TSKMGR.EVENTCNT .BS 1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
TSKMGR.LASTID .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.TSK
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|