mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
142 lines
2.7 KiB
Plaintext
142 lines
2.7 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.DevID
|
||
|
||
.1 ldy #S.DEV.F
|
||
lda (pDev),y get S.DEV.F
|
||
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
|
||
|
||
ldy #S.EVT.hDEV
|
||
lda EvtMgr.DevID
|
||
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.DevID
|
||
inc EvtMgr.DevID
|
||
cmp DevMgr.LastDevID
|
||
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.VBLSTATE .BS 1
|
||
EVTMGR.10TH.CNT .BS 1
|
||
EVTMGR.HZ.CNT .BS 1
|
||
EVTMGR.COUNT .BS 1
|
||
EvtMgr.DevID .BS 1
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.EVT
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|