From 08efc299ffacac0e13296a33e50ef64be99358e3 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Mon, 12 Oct 2015 20:18:13 +0200
Subject: [PATCH] Allow to override mouse sprite location data.
---
libsrc/c64/mcbdefault.s | 21 +++++++++++++++++----
libsrc/c64/mcbspritedata.s | 4 ++++
2 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 libsrc/c64/mcbspritedata.s
diff --git a/libsrc/c64/mcbdefault.s b/libsrc/c64/mcbdefault.s
index c4feddfea..cd36d8515 100644
--- a/libsrc/c64/mcbdefault.s
+++ b/libsrc/c64/mcbdefault.s
@@ -11,6 +11,8 @@
.export _mouse_def_callbacks
.import _mouse_def_pointershape
.import _mouse_def_pointercolor
+ .import mcb_spritememory
+ .import mcb_spritepointer
.include "mouse-kernel.inc"
.include "c64.inc"
@@ -20,7 +22,6 @@
; Sprite definitions. The first value can be changed to adjust the number
; of the sprite used for the mouse. All others depend on this value.
MOUSE_SPR = 0 ; Sprite used for the mouse
-MOUSE_SPR_MEM = $0340 ; Memory location
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
@@ -33,18 +34,30 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
initmcb:
+; Make all RAM accessible
+
+ lda #$30
+ ldy $01
+ sei
+ sta $01
+
; Copy the mouse sprite data
ldx #64 - 1
@L0: lda _mouse_def_pointershape,x
- sta MOUSE_SPR_MEM,x
+ sta mcb_spritememory,x
dex
bpl @L0
; Set the mouse sprite pointer
- lda #<(MOUSE_SPR_MEM / 64)
- sta $07F8 + MOUSE_SPR
+ lda #<(mcb_spritememory / 64)
+ sta mcb_spritepointer + MOUSE_SPR
+
+; Restore memory configuration
+
+ sty $01
+ cli
; Set the mouse sprite color
diff --git a/libsrc/c64/mcbspritedata.s b/libsrc/c64/mcbspritedata.s
new file mode 100644
index 000000000..2c7aa1491
--- /dev/null
+++ b/libsrc/c64/mcbspritedata.s
@@ -0,0 +1,4 @@
+; VIC sprite data for the mouse pointer
+
+ .export mcb_spritememory := $0340
+ .export mcb_spritepointer := $07F8
--
2.39.5