A2osX/SYS/KERNEL.S.EVT.txt

192 lines
3.3 KiB
Plaintext
Raw Normal View History

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
*--------------------------------------
* S.EvtMgrInit
*--------------------------------------
2016-03-13 21:47:19 +00:00
S.EvtMgrInit lda #10
sta EVTMGR.10TH.CNT
lda A2osX.HZ
sta EVTMGR.HZ.CNT
lda MACHID
2016-02-24 19:52:24 +00:00
and #MACHID.TYPE
cmp #MACHID.TYPE.IIc
bne .8
* sta CLRIOUDIS
* sta ENBVBLIIC
2016-03-13 21:47:19 +00:00
.8 lda /EvtMgr.Table
sta pEvent+1
2015-03-14 21:48:35 +00:00
clc
rts
*--------------------------------------
* GETEVENT :
* 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-03-13 21:47:19 +00:00
S.GetEvents stz pEvent
stz EVTMGR.COUNT
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-03-13 21:47:19 +00:00
bpl S.GetEvents.DEV no change,no tick
txa
2015-03-14 21:48:35 +00:00
sta EVTMGR.VBLSTATE save new
2016-03-13 21:47:19 +00:00
bpl S.GetEvents.DEV Up2down transition,no tick
* 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
bne S.GetEvents.DEV not yet 100ms
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)
lda pEvent
clc
adc #S.EVT
sta pEvent
inc EVTMGR.COUNT
S.GetEvents.DEV >LDYAI DevMgr.Table
>STYA pDev
stz DevMgr.DevID
.1 ldy #S.DEV.F
lda (pDev),y get S.DEV.F
and #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
inc EVTMGR.COUNT
ldy #S.EVT.hDEV
lda DevMgr.DevID
sta (pEvent),y
lda pEvent
adc #S.EVT cc
sta pEvent
bcs .8 Event Q is full!
.2 lda pDev
clc
adc #S.DEV.SIZE
sta pDev
bcc .3
inc pDev+1
.3 lda DevMgr.DevID
inc DevMgr.DevID
cmp DevMgr.LastDevID
bne .1
.8 lda EVTMGR.COUNT
sta EVTMGR.SIZE
beq .9
clc
rts
.9 sec error code=0,CS=no event
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
2016-03-13 21:47:19 +00:00
S.GetKeyboardEvent
lda KBD
bpl .9
sta KBDSTROBE
sta A2osX.RANDOM16
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
bne .99
inc A2osX.RANDOM16+1
.99 sec no event
rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-03-13 21:47:19 +00:00
S.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
2015-03-14 21:48:35 +00:00
jsr S.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
2015-03-14 21:48:35 +00:00
jsr S.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
EVTMGR.SIZE .BS 1
2015-03-14 21:48:35 +00:00
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.EVT
LOAD SYS/KERNEL.S
ASM