2 ; Default mouse callbacks for the C64
4 ; Ullrich von Bassewitz, 2004-03-20
6 ; All functions in this module should be interrupt safe, because they may
7 ; be called from an interrupt handler
10 .export _mouse_def_callbacks
12 .include "mouse-kernel.inc"
17 ; Sprite definitions. The first value can be changed to adjust the number
18 ; of the sprite used for the mouse. All others depend on this value.
19 MOUSE_SPR = 0 ; Sprite used for the mouse
20 MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
21 MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
22 VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
23 VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
25 ; --------------------------------------------------------------------------
26 ; Hide the mouse pointer. Always called with interrupts disabled.
34 ; --------------------------------------------------------------------------
35 ; Show the mouse pointer. Always called with interrupts disabled.
43 ; --------------------------------------------------------------------------
44 ; Prepare to move the mouse pointer. Always called with interrupts disabled.
49 ; --------------------------------------------------------------------------
50 ; Draw the mouse pointer. Always called with interrupts disabled.
55 ; --------------------------------------------------------------------------
56 ; Move the mouse pointer X position to the value in a/x. Always called with
57 ; interrupts disabled.
61 ; Add the X correction and set the low byte. This frees A.
63 add #24 ; X correction
70 bne @L1 ; Branch if high byte not zero
71 lda VIC_SPR_HI_X ; Get high X bits of all sprites
72 and #MOUSE_SPR_NMASK ; Clear high bit for sprite
76 @L1: lda VIC_SPR_HI_X ; Get high X bits of all sprites
77 ora #MOUSE_SPR_MASK ; Set high bit for sprite
81 ; --------------------------------------------------------------------------
82 ; Move the mouse pointer Y position to the value in a/x. Always called with
83 ; interrupts disabled.
86 add #50 ; Y correction (first visible line)
87 sta VIC_SPR_Y ; Set Y position
90 ; --------------------------------------------------------------------------