mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
134 lines
2.5 KiB
Plaintext
134 lines
2.5 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* EVT.GetEvents :
|
||
* IN :
|
||
* OUT :
|
||
* CS = no event, A = ERROR
|
||
* CC * event in YA
|
||
* (pEvent)
|
||
*--------------------------------------
|
||
EVT.GetEvents stz pEvent point to start of event list
|
||
stz EvtMgr.Count reset Size
|
||
|
||
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
|
||
|
||
* sta PDLTRIG clr VBL (IIc)
|
||
* lda RDIOUDIS clr VBL (IIc)
|
||
|
||
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
|
||
|
||
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 SYS/KERNEL.S.EVT
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|