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
|
|
|
|
|
*--------------------------------------
|
2016-08-18 15:26:11 +00:00
|
|
|
|
S.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
|
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
|
2016-08-18 15:26:11 +00:00
|
|
|
|
dec skip PS 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta TSKMGR.COUNT
|
2016-08-18 15:26:11 +00:00
|
|
|
|
beq .8 no process....
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-08-18 15:26:11 +00:00
|
|
|
|
.1 lda (pPs) get S.PS.F
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bit #S.PS.F.INUSE In use ?
|
2016-08-18 15:26:11 +00:00
|
|
|
|
beq .7
|
2016-06-24 15:02:13 +00:00
|
|
|
|
|
|
|
|
|
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
|
2016-08-18 15:26:11 +00:00
|
|
|
|
bcc .7 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)
|
2016-08-18 15:26:11 +00:00
|
|
|
|
bit #S.PS.F.INIT
|
|
|
|
|
beq .20
|
|
|
|
|
|
|
|
|
|
and #$FF^S.PS.F.INIT unmark as INIT
|
|
|
|
|
sta (pPS)
|
|
|
|
|
|
|
|
|
|
ldx #TSKMGR.INIT
|
|
|
|
|
bra .31
|
|
|
|
|
|
|
|
|
|
.20 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-08-18 15:26:11 +00:00
|
|
|
|
|
2016-06-24 15:02:13 +00:00
|
|
|
|
.3 ldx #TSKMGR.RUN
|
2016-08-18 15:26:11 +00:00
|
|
|
|
.31 jsr pCodeJmp Call INIT/RUN function
|
|
|
|
|
.4 bcc .7 INIT/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
|
|
|
|
|
2016-08-18 15:26:11 +00:00
|
|
|
|
.7 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-08-18 15:26:11 +00:00
|
|
|
|
bcc .71
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pPs+1
|
2016-08-18 15:26:11 +00:00
|
|
|
|
|
|
|
|
|
.71 dec TSKMGR.COUNT
|
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
|
|
|
|
|
*--------------------------------------
|
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
|