A2osX/SYS/KERNEL.S.EVT.txt

141 lines
2.7 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
2015-03-14 21:48:35 +00:00
INC 1
AUTO 6
*--------------------------------------
2016-09-29 15:30:15 +00:00
* EVT.GetEvents :
2015-03-14 21:48:35 +00:00
* IN :
* OUT :
* CS = no event, A = ERROR
* CC * event in YA
2015-06-03 18:30:57 +00:00
* (pEvent)
2015-03-14 21:48:35 +00:00
*--------------------------------------
EVT.GetEvents lda #EvtMgr.Table
sta pEvent point to start of event list
2017-01-12 17:43:45 +00:00
stz EvtMgr.Count reset Size
2015-06-03 18:30:57 +00:00
lda K.IrkMgr.VBL do we have IRQ enabled for VBL ?
bpl .10 no, regular poll
lda K.IrkMgr.VBLINT
beq EVT.GetEvents.DEV no
dec K.IrkMgr.VBLINT
bra .11
.10 lda VBL get VLINE status
2016-03-13 21:47:19 +00:00
tax
2017-01-12 17:43:45 +00:00
eor EvtMgr.VBLState
bpl EVT.GetEvents.DEV no change,no tick
2016-03-13 21:47:19 +00:00
txa
2017-01-12 17:43:45 +00:00
sta EvtMgr.VBLState save new
bpl EVT.GetEvents.DEV Up2down transition,no tick
2016-03-13 21:47:19 +00:00
.11 inc A2osX.TIMER16
2015-03-14 21:48:35 +00:00
bne .1
inc A2osX.TIMER16+1
2017-01-12 17:43:45 +00:00
.1 dec EvtMgr.HZ.CNT
2016-09-29 15:30:15 +00:00
bne EVT.GetEvents.DEV not yet 100ms
2016-03-13 21:47:19 +00:00
ldx A2osX.HZ
2017-01-12 17:43:45 +00:00
stx EvtMgr.HZ.CNT
2016-03-13 21:47:19 +00:00
lda #S.EVT.F.T10TH
2017-01-12 17:43:45 +00:00
dec EvtMgr.10TH.CNT
2016-03-13 21:47:19 +00:00
bne .2
2015-03-14 21:48:35 +00:00
2016-03-13 21:47:19 +00:00
ldx #10
2017-01-12 17:43:45 +00:00
stx EvtMgr.10TH.CNT
2015-03-14 21:48:35 +00:00
2016-03-13 21:47:19 +00:00
ora #S.EVT.F.T1SEC
.2 sta (pEvent)
jsr EVT.GetEvents.Add
2016-09-29 15:30:15 +00:00
*--------------------------------------
EVT.GetEvents.DEV
* >LDYAI DevMgr.Table
* >STYA pDev
2016-03-13 21:47:19 +00:00
* stz EvtMgr.Idx
2016-03-13 21:47:19 +00:00
*.1 ldy #S.DEV.F
2017-01-12 17:43:45 +00:00
* lda (pDev),y get S.DEV.F
* bit #S.DEV.F.EVENT
* beq .2 EVENT enabled ?
2017-01-12 17:43:45 +00:00
* ldx #DEVMGR.GETEVENT
2017-01-12 17:43:45 +00:00
* jsr pDevJmp Call DRV GetEvent function
* bcs .2 no event
2016-03-13 21:47:19 +00:00
2017-01-12 17:43:45 +00:00
* ldy #S.EVT.hDEV
* lda EvtMgr.Idx
* sta (pEvent),y
2016-03-13 21:47:19 +00:00
2017-01-12 17:43:45 +00:00
* jsr EVT.GetEvents.Add
2016-03-13 21:47:19 +00:00
2017-01-12 17:43:45 +00:00
* bcs .8 Event Q is full, exit now with CC
2016-03-13 21:47:19 +00:00
*.2 lda pDev
* clc
* adc #S.DEV
* sta pDev
* bcc .3
* inc pDev+1
*
*.3 lda EvtMgr.Idx
* inc EvtMgr.Idx
* cmp DevMgr.Count
* bne .1
sec
2017-01-12 17:43:45 +00:00
lda EvtMgr.Count if 0, exit with CS (from cmp), and A=0 "no event"
2016-03-13 21:47:19 +00:00
beq .9
.8 clc
.9 rts
*--------------------------------------
EVT.GetEvents.Add
2017-01-12 17:43:45 +00:00
inc EvtMgr.Count Add one event to Queue
lda pEvent
clc
adc #S.EVT
sta pEvent
rts if CS, EVT queue full!!! ($100)
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-09-29 15:30:15 +00:00
EVT.DestroyEvent
lda (pEvent)
2015-06-03 18:30:57 +00:00
beq .9
2016-03-13 21:47:19 +00:00
bit #S.EVT.F.hMEM1
2015-03-14 21:48:35 +00:00
beq .1
2015-06-03 18:30:57 +00:00
2016-03-13 21:47:19 +00:00
pha
2015-03-14 21:48:35 +00:00
ldy #S.EVT.DATALO
2015-06-03 18:30:57 +00:00
lda (pEvent),y
2016-09-21 15:20:37 +00:00
jsr K.FreeMemA
2016-03-13 21:47:19 +00:00
pla
2015-06-03 18:30:57 +00:00
2016-03-13 21:47:19 +00:00
.1 bit #S.EVT.F.hMEM2
2015-03-14 21:48:35 +00:00
beq .2
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
ldy #S.EVT.DATAHI
2015-06-03 18:30:57 +00:00
lda (pEvent),y
2016-09-21 15:20:37 +00:00
jsr K.FreeMemA
2015-06-03 18:30:57 +00:00
2016-03-13 21:47:19 +00:00
.2 lda #0
sta (pEvent)
2017-01-12 17:43:45 +00:00
dec EvtMgr.Count
2015-06-03 18:30:57 +00:00
.9 rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
2017-01-12 17:43:45 +00:00
EvtMgr.Idx .BS 1
2015-03-14 21:48:35 +00:00
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.EVT
LOAD /A2OSX.SRC/SYS/KERNEL.S
2015-03-14 21:48:35 +00:00
ASM