A2osX/SYS/KERNEL.S.EVT.txt

116 lines
2.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
.OP 65C02
*--------------------------------------
* S.EvtMgrInit
*--------------------------------------
S.EvtMgrInit stz EVTMGR.PENDING
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
*--------------------------------------
S.GetEvent lda EVTMGR.PENDING Get Pending EVENT hMem if any
beq .1
jsr S.GetMemPtrA
2015-06-03 18:30:57 +00:00
>STYA pEvent
2015-03-14 21:48:35 +00:00
clc
rts
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
.1 jsr S.CreateEvent
bcs .9
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
jsr S.GetSysEvent
bcc .9 got SYS event
jsr S.GetDevEvent
bcc .9 got DEV event
jsr S.DestroyEvent discard empty event
lda #0 error code=0
sec no event
.9 rts
*--------------------------------------
S.GetSysEvent lda VBL get VLINE status
eor EVTMGR.VBLSTATE
2015-06-03 18:30:57 +00:00
bpl .9 no change
2015-03-14 21:48:35 +00:00
sta EVTMGR.VBLSTATE save new
dec EVTMGR.FRAMECNT
2015-06-03 18:30:57 +00:00
bne .9
2015-03-14 21:48:35 +00:00
lda #K.TIMER16RESOLUTION
sta EVTMGR.FRAMECNT
inc A2osX.TIMER16
bne .1
inc A2osX.TIMER16+1
.1 lda #S.EVT.F.TIMER
2015-06-03 18:30:57 +00:00
.8 sta (pEvent)
clc
2015-03-14 21:48:35 +00:00
rts
2015-06-03 18:30:57 +00:00
.9 lda #0 error code=0
2015-03-14 21:48:35 +00:00
sec no event
rts
*--------------------------------------
* S.CreateEvent
* OUT :
* X = hMem
* Y,A = PTR to EVENT
*--------------------------------------
S.CreateEvent >PUSHWI S.EVT.SIZE
2015-06-03 18:30:57 +00:00
>PUSHBI S.MEM.F.INIT0
2015-03-14 21:48:35 +00:00
jsr S.GetMem
bcs .9
2015-06-03 18:30:57 +00:00
>STYA pEvent
stx EVTMGR.PENDING
2015-03-14 21:48:35 +00:00
.9 rts
*--------------------------------------
* S.DestroyEvent
* IN :
* A = Event hMem
* OUT :
*--------------------------------------
2015-06-03 18:30:57 +00:00
S.DestroyEvent lda EVTMGR.PENDING
beq .9
lda (pEvent)
2015-03-14 21:48:35 +00:00
and #S.EVT.F.hMEM1
beq .1
2015-06-03 18:30:57 +00:00
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
2015-06-03 18:30:57 +00:00
.1 lda (pEvent)
2015-03-14 21:48:35 +00:00
and #S.EVT.F.hMEM2
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
.2 lda EVTMGR.PENDING
2015-03-14 21:48:35 +00:00
jsr S.FreeMemA
2015-06-03 18:30:57 +00:00
stz EVTMGR.PENDING
.9 rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
EVTMGR.VBLSTATE .BS 1
EVTMGR.FRAMECNT .BS 1
EVTMGR.PENDING .BS 1
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.EVT
LOAD SYS/KERNEL.S
ASM