2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2017-02-07 07:27:27 +00:00
|
|
|
|
LOMEM $900
|
2015-03-14 21:48:35 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
*--------------------------------------
|
2016-10-05 15:57:43 +00:00
|
|
|
|
EVT.GetEvents stz 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
|
|
|
|
|
2017-02-06 17:04:03 +00:00
|
|
|
|
lda K.IrkMgr.VBL do we have IRQ enabled for VBL ?
|
2017-02-07 07:27:27 +00:00
|
|
|
|
bpl .10 no, regular poll
|
2017-02-06 17:04:03 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-02-06 17:04:03 +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)
|
2016-10-05 15:57:43 +00:00
|
|
|
|
jsr EVT.GetEvents.Add
|
2016-09-29 15:30:15 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
EVT.GetEvents.DEV
|
2017-02-06 17:04:03 +00:00
|
|
|
|
* >LDYAI DevMgr.Table
|
|
|
|
|
* >STYA pDev
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
2017-02-06 17:04:03 +00:00
|
|
|
|
* stz EvtMgr.Idx
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
2017-02-06 17:04:03 +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 ?
|
2016-10-05 15:57:43 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ldx #DEVMGR.GETEVENT
|
2016-06-24 15:02:13 +00:00
|
|
|
|
|
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
|
|
|
|
|
2017-02-06 17:04:03 +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
|
|
|
|
|
|
2016-10-06 15:50:20 +00:00
|
|
|
|
.8 clc
|
2016-10-05 15:57:43 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EVT.GetEvents.Add
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc EvtMgr.Count Add one event to Queue
|
2016-10-05 15:57:43 +00:00
|
|
|
|
|
|
|
|
|
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 SYS/KERNEL.S.EVT
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|