2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2016-09-29 15:30:15 +00:00
|
|
|
|
K.GetKeyboardEvent
|
|
|
|
|
lda KBD
|
|
|
|
|
bpl .9
|
|
|
|
|
sta KBDSTROBE
|
|
|
|
|
|
|
|
|
|
and #$7F
|
|
|
|
|
ldy #S.EVT.DATA
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
iny
|
|
|
|
|
lda OPENAPPLE
|
|
|
|
|
asl
|
|
|
|
|
lda SOLIDAPPLE
|
|
|
|
|
ror
|
|
|
|
|
and #$C0
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
|
|
|
|
|
lda #S.EVT.F.KEY
|
|
|
|
|
sta (pEvent)
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 inc A2osX.RANDOM16
|
2016-10-05 15:57:43 +00:00
|
|
|
|
sta A2osX.RANDOM16+1
|
|
|
|
|
sec no event
|
2016-09-29 15:30:15 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
|
|
|
|
stz EVTMGR.COUNT reset Size
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
lda VBL get VLINE status
|
|
|
|
|
tax
|
2015-03-14 21:48:35 +00:00
|
|
|
|
eor EVTMGR.VBLSTATE
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bpl EVT.GetEvents.DEV no change,no tick
|
2016-03-13 21:47:19 +00:00
|
|
|
|
txa
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta EVTMGR.VBLSTATE save new
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bpl EVT.GetEvents.DEV Up2down transition,no tick
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
|
|
|
|
* sta PDLTRIG clr VBL (IIc)
|
|
|
|
|
* lda RDIOUDIS clr VBL (IIc)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
inc A2osX.TIMER16
|
|
|
|
|
bne .1
|
|
|
|
|
inc A2osX.TIMER16+1
|
|
|
|
|
|
2016-03-13 21:47:19 +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
|
|
|
|
|
stx EVTMGR.HZ.CNT
|
|
|
|
|
|
|
|
|
|
lda #S.EVT.F.T10TH
|
|
|
|
|
|
|
|
|
|
dec EVTMGR.10TH.CNT
|
|
|
|
|
bne .2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
ldx #10
|
|
|
|
|
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
|
|
|
|
|
>LDYAI DevMgr.Table
|
2016-03-13 21:47:19 +00:00
|
|
|
|
>STYA pDev
|
|
|
|
|
|
|
|
|
|
stz DevMgr.DevID
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.DEV.F
|
|
|
|
|
lda (pDev),y get S.DEV.F
|
2016-06-24 15:02:13 +00:00
|
|
|
|
bit #S.DEV.F.EVENT
|
2016-03-13 21:47:19 +00:00
|
|
|
|
beq .2 EVENT enabled ?
|
2016-10-05 15:57:43 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
lda (pDev)
|
|
|
|
|
cmp #H.BIN.HEADER.DRV65
|
|
|
|
|
bne *
|
2016-06-24 15:02:13 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
ldx #DEVMGR.GETEVENT
|
2016-10-05 15:57:43 +00:00
|
|
|
|
|
2016-03-13 21:47:19 +00:00
|
|
|
|
jsr pDevJmp Call DRV GetEvent function
|
|
|
|
|
bcs .2 no event
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.hDEV
|
|
|
|
|
lda DevMgr.DevID
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
|
2016-10-05 15:57:43 +00:00
|
|
|
|
jsr EVT.GetEvents.Add
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
2016-10-05 15:57:43 +00:00
|
|
|
|
bcc .9 Event Q is full, exit now with CC
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
|
|
|
|
.2 lda pDev
|
|
|
|
|
clc
|
2016-10-03 15:59:36 +00:00
|
|
|
|
adc #S.DEV
|
2016-03-13 21:47:19 +00:00
|
|
|
|
sta pDev
|
|
|
|
|
bcc .3
|
|
|
|
|
inc pDev+1
|
|
|
|
|
|
|
|
|
|
.3 lda DevMgr.DevID
|
|
|
|
|
inc DevMgr.DevID
|
|
|
|
|
cmp DevMgr.LastDevID
|
|
|
|
|
bne .1
|
|
|
|
|
|
2016-10-05 15:57:43 +00:00
|
|
|
|
lda EVTMGR.COUNT if 0, exit with CS=no event (from cmp)
|
2016-03-13 21:47:19 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
2016-10-05 15:57:43 +00:00
|
|
|
|
.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)
|
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)
|
|
|
|
|
dec EVTMGR.COUNT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.9 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
EVTMGR.VBLSTATE .BS 1
|
2016-03-13 21:47:19 +00:00
|
|
|
|
EVTMGR.10TH.CNT .BS 1
|
|
|
|
|
EVTMGR.HZ.CNT .BS 1
|
|
|
|
|
EVTMGR.COUNT .BS 1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.EVT
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|