1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 05:29:30 +00:00
cc65/libsrc/c64/mcbdefault.s
cuz 3bfbaee6a6 Working on loadable mouse drivers
git-svn-id: svn://svn.cc65.org/cc65/trunk@2953 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-21 22:12:06 +00:00

104 lines
2.3 KiB
ArmAsm

;
; Default mouse callbacks for the C64
;
; Ullrich von Bassewitz, 2004-03-20
;
.export _mouse_def_callbacks
.include "mouse-kernel.inc"
.include "c64.inc"
; Sprite definitions. The first value can be changed to adjust the number
; of the sprite used for the mouse.
MOUSE_SPR = 0 ; Sprite used for the mouse
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
.code
; --------------------------------------------------------------------------
; Hide the mouse pointer
.proc hide
lda #MOUSE_SPR_NMASK
sei
and VIC_SPR_ENA
sta VIC_SPR_ENA
cli
rts
.endproc
; --------------------------------------------------------------------------
; Show the mouse pointer
.proc show
lda #MOUSE_SPR_MASK
sei
ora VIC_SPR_ENA
sta VIC_SPR_ENA
cli
rts
.endproc
; --------------------------------------------------------------------------
; Move the mouse pointer X position to the value in a/x
.proc movex
; Set the low byte, this frees A
sta VIC_SPR_X
; Set the high byte
txa ; Test high byte of X coord
bne @L1
sei
lda VIC_SPR_HI_X ; Get high X bits of all sprites
and #MOUSE_SPR_NMASK ; Clear high bit for sprite
sta VIC_SPR_HI_X
cli
rts
@L1: sei
lda VIC_SPR_HI_X ; Get high X bits of all sprites
ora #MOUSE_SPR_NMASK ; Set high bit for sprite
sta VIC_SPR_HI_X
cli
rts
.endproc
; --------------------------------------------------------------------------
; Move the mouse pointer Y position to the value in a/x
.proc movey
sta VIC_SPR_Y ; Set Y position
rts
.endproc
; --------------------------------------------------------------------------
; Callback structure
.rodata
_mouse_def_callbacks:
.addr hide
.addr show
.addr movex
.addr movey