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.
43 ; --------------------------------------------------------------------------
44 ; Show the mouse pointer. Always called with interrupts disabled.
59 ; --------------------------------------------------------------------------
60 ; Prepare to move the mouse pointer. Always called with interrupts disabled.
65 ; --------------------------------------------------------------------------
66 ; Draw the mouse pointer. Always called with interrupts disabled.
71 ; --------------------------------------------------------------------------
72 ; Move the mouse pointer x position to the value in .XA. Always called with
73 ; interrupts disabled.
79 ; Add the x correction; and, set the low byte. That frees .A.
81 add #<24 ; x correction
90 bnz @L1 ; Branch if high byte not zero
91 lda (vic),y ; Get high x bits of all sprites
92 and #MOUSE_SPR_NMASK ; Clear high bit for sprite
99 @L1: lda (vic),y ; Get high x bits of all sprites
100 ora #MOUSE_SPR_MASK ; Set high bit for sprite
102 bnz @L0 ; Branch always
104 ; --------------------------------------------------------------------------
105 ; Move the mouse pointer y position to the value in .XA. Always called with
106 ; interrupts disabled.
112 add #50 ; y correction (first visible line)
114 sta (vic),y ; Set y position
120 ; --------------------------------------------------------------------------
125 _mouse_def_callbacks: