2019-11-16 14:51:24 -05:00
|
|
|
;
|
|
|
|
; Default mouse callbacks for the CX16
|
|
|
|
;
|
2019-12-25 10:56:32 -05:00
|
|
|
; 2019-12-25, Greg King
|
2019-11-16 14:51:24 -05:00
|
|
|
;
|
2019-12-25 10:56:32 -05:00
|
|
|
; All functions in this module should be interrupt-safe
|
2019-11-16 14:51:24 -05:00
|
|
|
; because they might be called from an interrupt handler.
|
|
|
|
;
|
|
|
|
|
|
|
|
.export _mouse_def_callbacks
|
|
|
|
|
|
|
|
.include "cx16.inc"
|
|
|
|
|
|
|
|
|
2019-12-25 10:56:32 -05:00
|
|
|
msprite:
|
|
|
|
stz VERA::CTRL ; set address for VERA's data port zero
|
|
|
|
lda #<(VERA::SPRITE::ATTRIB::Z_FLIP + 0 * 8)
|
|
|
|
ldx #>(VERA::SPRITE::ATTRIB::Z_FLIP + 0 * 8)
|
|
|
|
ldy #^(VERA::SPRITE::ATTRIB::Z_FLIP + 0 * 8) | VERA::INC0
|
|
|
|
sta VERA::ADDR
|
|
|
|
stx VERA::ADDR+1
|
|
|
|
sty VERA::ADDR+2
|
|
|
|
rts
|
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
|
|
|
; Hide the mouse pointer.
|
2019-11-16 14:51:24 -05:00
|
|
|
|
2019-12-25 10:56:32 -05:00
|
|
|
hide: jsr msprite
|
|
|
|
lda VERA::DATA0
|
|
|
|
and #<~VERA::SPRITE::DEPTH::LAYER1
|
|
|
|
sta VERA::DATA0
|
|
|
|
rts
|
2019-11-16 14:51:24 -05:00
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
2019-12-25 10:56:32 -05:00
|
|
|
; Show the mouse pointer.
|
2019-11-16 14:51:24 -05:00
|
|
|
|
2019-12-25 10:56:32 -05:00
|
|
|
show: jsr msprite
|
|
|
|
lda VERA::DATA0
|
|
|
|
ora #VERA::SPRITE::DEPTH::LAYER1
|
|
|
|
sta VERA::DATA0
|
|
|
|
rts
|
2019-11-16 14:51:24 -05:00
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
2019-12-25 10:56:32 -05:00
|
|
|
; Prepare to move the mouse pointer.
|
2019-11-16 14:51:24 -05:00
|
|
|
|
|
|
|
prep: ; Fall through
|
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
2019-12-25 10:56:32 -05:00
|
|
|
; Draw the mouse pointer.
|
2019-11-16 14:51:24 -05:00
|
|
|
|
|
|
|
draw: ; Fall through
|
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
2019-12-25 10:56:32 -05:00
|
|
|
; Move the mouse pointer X position to the value in .XA .
|
2019-11-16 14:51:24 -05:00
|
|
|
|
|
|
|
movex: ; Already set by drivers
|
|
|
|
; Fall through
|
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
2019-12-25 10:56:32 -05:00
|
|
|
; Move the mouse pointer Y position to the value in .XA .
|
2019-11-16 14:51:24 -05:00
|
|
|
|
|
|
|
movey: rts ; Already set by drivers
|
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
|
|
|
; Callback structure
|
|
|
|
|
|
|
|
.rodata
|
|
|
|
|
|
|
|
_mouse_def_callbacks:
|
|
|
|
.addr hide
|
|
|
|
.addr show
|
|
|
|
.addr prep
|
|
|
|
.addr draw
|
|
|
|
.addr movex
|
|
|
|
.addr movey
|