A2osX/SYS/KERNEL.S.EVT.txt
2017-03-29 17:48:15 +02:00

141 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
INC 1
AUTO 6
*--------------------------------------
* EVT.GetEvents :
* IN :
* OUT :
* CS = no event, A = ERROR
* CC * event in YA
* (pEvent)
*--------------------------------------
EVT.GetEvents lda #EvtMgr.Table
sta pEvent point to start of event list
stz EvtMgr.Count reset Size
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
tax
eor EvtMgr.VBLState
bpl EVT.GetEvents.DEV no change,no tick
txa
sta EvtMgr.VBLState save new
bpl EVT.GetEvents.DEV Up2down transition,no tick
.11 inc A2osX.TIMER16
bne .1
inc A2osX.TIMER16+1
.1 dec EvtMgr.HZ.CNT
bne EVT.GetEvents.DEV not yet 100ms
ldx A2osX.HZ
stx EvtMgr.HZ.CNT
lda #S.EVT.F.T10TH
dec EvtMgr.10TH.CNT
bne .2
ldx #10
stx EvtMgr.10TH.CNT
ora #S.EVT.F.T1SEC
.2 sta (pEvent)
jsr EVT.GetEvents.Add
*--------------------------------------
EVT.GetEvents.DEV
* >LDYAI DevMgr.Table
* >STYA pDev
* stz EvtMgr.Idx
*.1 ldy #S.DEV.F
* lda (pDev),y get S.DEV.F
* bit #S.DEV.F.EVENT
* beq .2 EVENT enabled ?
* ldx #DEVMGR.GETEVENT
* jsr pDevJmp Call DRV GetEvent function
* bcs .2 no event
* ldy #S.EVT.hDEV
* lda EvtMgr.Idx
* sta (pEvent),y
* jsr EVT.GetEvents.Add
* bcs .8 Event Q is full, exit now with CC
*.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
lda EvtMgr.Count if 0, exit with CS (from cmp), and A=0 "no event"
beq .9
.8 clc
.9 rts
*--------------------------------------
EVT.GetEvents.Add
inc EvtMgr.Count Add one event to Queue
lda pEvent
clc
adc #S.EVT
sta pEvent
rts if CS, EVT queue full!!! ($100)
*--------------------------------------
EVT.DestroyEvent
lda (pEvent)
beq .9
bit #S.EVT.F.hMEM1
beq .1
pha
ldy #S.EVT.DATALO
lda (pEvent),y
jsr K.FreeMemA
pla
.1 bit #S.EVT.F.hMEM2
beq .2
ldy #S.EVT.DATAHI
lda (pEvent),y
jsr K.FreeMemA
.2 lda #0
sta (pEvent)
dec EvtMgr.Count
.9 rts
*--------------------------------------
EvtMgr.Idx .BS 1
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.EVT
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM