mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
116 lines
2.3 KiB
Plaintext
116 lines
2.3 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
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
|
||
* (pEvent)
|
||
*--------------------------------------
|
||
S.GetEvent lda EVTMGR.PENDING Get Pending EVENT hMem if any
|
||
beq .1
|
||
jsr S.GetMemPtrA
|
||
>STYA pEvent
|
||
clc
|
||
rts
|
||
|
||
.1 jsr S.CreateEvent
|
||
bcs .9
|
||
|
||
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
|
||
bpl .9 no change
|
||
|
||
sta EVTMGR.VBLSTATE save new
|
||
|
||
dec EVTMGR.FRAMECNT
|
||
bne .9
|
||
lda #K.TIMER16RESOLUTION
|
||
sta EVTMGR.FRAMECNT
|
||
|
||
inc A2osX.TIMER16
|
||
bne .1
|
||
inc A2osX.TIMER16+1
|
||
|
||
.1 lda #S.EVT.F.TIMER
|
||
|
||
.8 sta (pEvent)
|
||
clc
|
||
rts
|
||
|
||
.9 lda #0 error code=0
|
||
sec no event
|
||
rts
|
||
*--------------------------------------
|
||
* S.CreateEvent
|
||
* OUT :
|
||
* X = hMem
|
||
* Y,A = PTR to EVENT
|
||
*--------------------------------------
|
||
S.CreateEvent >PUSHWI S.EVT.SIZE
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr S.GetMem
|
||
bcs .9
|
||
>STYA pEvent
|
||
stx EVTMGR.PENDING
|
||
.9 rts
|
||
*--------------------------------------
|
||
* S.DestroyEvent
|
||
* IN :
|
||
* A = Event hMem
|
||
* OUT :
|
||
*--------------------------------------
|
||
S.DestroyEvent lda EVTMGR.PENDING
|
||
beq .9
|
||
|
||
lda (pEvent)
|
||
and #S.EVT.F.hMEM1
|
||
beq .1
|
||
|
||
ldy #S.EVT.DATALO
|
||
lda (pEvent),y
|
||
jsr S.FreeMemA
|
||
|
||
.1 lda (pEvent)
|
||
and #S.EVT.F.hMEM2
|
||
beq .2
|
||
|
||
ldy #S.EVT.DATAHI
|
||
lda (pEvent),y
|
||
jsr S.FreeMemA
|
||
|
||
.2 lda EVTMGR.PENDING
|
||
jsr S.FreeMemA
|
||
stz EVTMGR.PENDING
|
||
.9 rts
|
||
*--------------------------------------
|
||
EVTMGR.VBLSTATE .BS 1
|
||
EVTMGR.FRAMECNT .BS 1
|
||
EVTMGR.PENDING .BS 1
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.EVT
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|