2 ; Default mouse callbacks for the CBM510 (P128)
4 ; 2004-03-20, Ullrich von Bassewitz2
5 ; 2013-06-25, Greg King
7 ; All functions in this module should be interrupt-safe because they might
8 ; be called from an interrupt handler.
11 .export _mouse_def_callbacks
14 .include "mouse-kernel.inc"
19 ; Sprite definitions. The first value can be changed to adjust the number
20 ; of the sprite used for the mouse. All others depend on that value.
21 MOUSE_SPR = 0 ; Sprite used for the mouse
22 MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
23 MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
24 VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
25 VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
27 ; --------------------------------------------------------------------------
28 ; Hide the mouse pointer. Always called with interrupts disabled.
46 ; --------------------------------------------------------------------------
47 ; Show the mouse pointer. Always called with interrupts disabled.
65 ; --------------------------------------------------------------------------
66 ; Move the mouse pointer x position to the value in .XA. Always called with
67 ; interrupts disabled.
74 ; Add the x correction; and, set the low byte. That frees .A.
76 add #<24 ; x correction
85 bnz @L1 ; Branch if high byte not zero
86 lda (vic),y ; Get high x bits of all sprites
87 and #MOUSE_SPR_NMASK ; Clear high bit for sprite
94 @L1: lda (vic),y ; Get high x bits of all sprites
95 ora #MOUSE_SPR_MASK ; Set high bit for sprite
97 bnz @L0 ; branch always
101 ; --------------------------------------------------------------------------
102 ; Move the mouse pointer y position to the value in .XA. Always called with
103 ; interrupts disabled.
110 add #50 ; y correction (first visible line)
112 sta (vic),y ; Set y position
120 ; --------------------------------------------------------------------------
125 _mouse_def_callbacks: