KERNEL:Cleanup to make room for DHGR Driver

This commit is contained in:
Rémy GIBERT 2016-06-24 17:02:13 +02:00
parent 448a4c2133
commit d2cacb006a
5 changed files with 43 additions and 58 deletions

Binary file not shown.

Binary file not shown.

View File

@ -432,6 +432,7 @@ S.PS.F.INUSE .EQ %10000000
S.PS.F.HOLD .EQ %01000000
S.PS.F.EVENT .EQ %00100000
S.PS.F.ENV .EQ %00010000
S.PS.F.SLEEP .EQ %00001000
S.PS.ID .EQ 1
S.PS.PID .EQ 2
S.PS.hCS .EQ 3

View File

@ -61,12 +61,13 @@ S.GetEvents.DEV >LDYAI DevMgr.Table
.1 ldy #S.DEV.F
lda (pDev),y get S.DEV.F
and #S.DEV.F.EVENT
bit #S.DEV.F.EVENT
beq .2 EVENT enabled ?
lda (pDev)
cmp #H.BIN.HEADER.DRV65
bne *
ldx #DEVMGR.GETEVENT
jsr pDevJmp Call DRV GetEvent function
bcs .2 no event

View File

@ -10,15 +10,17 @@ AUTO 6
S.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE
>STYA pPs
lda #1 Skip PS #0
lda TSKMGR.SIZE
sta TSKMGR.COUNT
.1 lda (pPs) get S.PS.F
and #S.PS.F.INUSE In use ?
beq .5
.1 dec TSKMGR.COUNT skip PS 0
beq .8
lda (pPs) get S.PS.F
and #S.PS.F.HOLD Waiting for Another Task to Terminate?
bit #S.PS.F.INUSE In use ?
beq .5
bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
beq .2
ldy #S.PS.CID
@ -32,35 +34,27 @@ S.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE
.2 jsr S.SelectProcess
ldy #S.PS.PC+1 Is this PS sleeping?
lda (pPs),y
tax
dey
ora (pPs),y
lda (pPS)
bit #S.PS.F.SLEEP Is this PS sleeping?
beq .3 no, call TSKMGR.RUN
lda (pPs),y
clc
adc pCode
sta S.TskMgrRunJmp+1
txa
adc pCode+1
sta S.TskMgrRunJmp+2
and #$FF^S.PS.F.SLEEP unmark as SLEEP
sta (pPS)
lda #0 Don't forget to reset S.PC
ldy #S.PS.PC
sta (pPs),y
lda (pPs),y
sec Advance PC by one as it was saved by a JSR
adc pCode
sta .21+1
iny
sta (pPs),y
lda (pPs),y
adc pCode+1
sta .21+2
jsr S.TskMgrRunJmp
.21 jsr $FFFF
bra .4
.3 lda (pCode)
cmp #H.BIN.HEADER.BIN65
bne *
ldx #TSKMGR.RUN
.3 ldx #TSKMGR.RUN
jsr pCodeJmp Call RUN function
.4 bcc .5 RUN said CS=QUIT?
@ -70,25 +64,18 @@ S.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE
ldy #S.PS.ID
lda (pPs),y
jsr S.FreeProcessA
bcs .99
bcs *
.5 lda pPs
clc
adc #S.PS.SIZE
sta pPs
bcc .6
bcc .1
inc pPs+1
.6 lda TSKMGR.COUNT
inc TSKMGR.COUNT
cmp TSKMGR.SIZE
bne .1
clc
.8 clc
rts
.99 bra *
*--------------------------------------
S.TskMgrRunJmp jmp $FFFF
*--------------------------------------
* S.DispatchEvent
* IN:
@ -100,10 +87,13 @@ S.DispatchEvents
>LDYAI TskMgr.Table+S.PS.SIZE
>STYA pPs
lda #1
lda TSKMGR.SIZE
sta TSKMGR.COUNT
.1 lda (pPs) get S.PS.F
.1 dec TSKMGR.COUNT skip PS 0
beq .9
lda (pPs) get S.PS.F
bit #S.PS.F.INUSE In use ?
beq .4
@ -146,19 +136,15 @@ S.DispatchEvents
clc
adc #S.PS.SIZE
sta pPs
bcc .5
bcc .1
inc pPs+1
.5 lda TSKMGR.COUNT
inc TSKMGR.COUNT
cmp TSKMGR.SIZE
bne .1
sec
rts
bne .1 always
.8 clc
rts
.9 sec
rts
*--------------------------------------
S.TskMgrQuit clc
rts
@ -284,21 +270,18 @@ S.GetPSByIDA sta S.GetPSByIDA.PS
S.GetPSByIDA.PS .BS 1
*--------------------------------------
S.Sleep pla get PC LO
plx get PC HI
inc Advance PC one Byte
bne .1
inx
.1 sec
sec
sbc pCode
ldy #S.PS.PC
sta (pPs),y
txa
pla get PC HI
sbc pCode+1
iny
sta (pPs),y
lda (pPs)
ora #S.PS.F.SLEEP
sta (pPs)
clc No error,
rts back to Kernel
*--------------------------------------