2 ; P/M mouse callbacks for the Ataris
4 ; Christian Groessler, 11.04.2014
6 ; All functions in this module should be interrupt safe, because they may
7 ; be called from an interrupt handler
12 .export _mouse_pm_callbacks
13 .constructor pm_init,27
16 ; get mouse shape data
18 .import mouse_pm_height
19 .import mouse_pm_hotspot_x
20 .import mouse_pm_hotspot_y
23 ; P/M definitions. The first value can be changed to adjust the number
24 ; of the P/M used for the mouse. All others depend on this value.
25 ; Valid P/M numbers are 0 to 4. When 4 is used, the missiles are used
27 MOUSE_PM_NUM = 2 ; P/M used for the mouse
28 MOUSE_PM_BASE = pm_base ; ZP location pointing to the hw area used by the selected P/M
31 MOUSE_PM_RAW = 0 ; MOUSE_PM_RAW is the hardware P/M number for MOUSE_PM_NUM
43 MOUSE_PM_RAW = MOUSE_PM_NUM + 1
45 sta HPOSP0 + MOUSE_PM_NUM
49 ; ------------------------------------------------------------------------
62 ; ------------------------------------------------------------------------
66 omy: .res 1 ; old Mouse Y position
67 colhlp: .res 1 ; helper variable to set P/M color
69 ; ------------------------------------------------------------------------
71 .segment "EXTZP" : zeropage
75 ; ------------------------------------------------------------------------
79 ; Hide the mouse cursor.
84 ; Show the mouse cursor.
98 ; Move the mouse cursor x position to the value in A/X.
103 sbc #<(mouse_pm_hotspot_x - 1)
107 ; Move the mouse cursor y position to the value in A/X.
110 sbc #<(mouse_pm_hotspot_y - 1)
113 jsr clr_pm ; remove player at old position
117 ;jmp set_pm ; put player to new position
120 ; Set P/M data from 'mouse_pm_bits'
123 set_l: lda mouse_pm_bits,x
124 sta (MOUSE_PM_BASE),y
128 cpx #<mouse_pm_height
132 ; Clear (zero) P/M data
133 clr_pm: ldx #<mouse_pm_height
136 clr_l: sta (MOUSE_PM_BASE),y
147 ; this assumes a GRAPHICS 0 screen
149 lda COLOR2 ; get background color
163 sta PCOLR0 + MOUSE_PM_NUM
164 sta SIZEP0 + MOUSE_PM_NUM
168 ; ------------------------------------------------------------------------
177 @iniloo:sta (MOUSE_PM_BASE),y
181 .if 0 ; enable if not using page 6 for P/M data