From e335d2564d3bb4e39ab22402970af9d23da3a9de Mon Sep 17 00:00:00 2001 From: Greg King Date: Sat, 15 Mar 2014 16:29:13 -0400 Subject: [PATCH] Added code that disables C128 BASIC's sprite-motion interrupt-handler. That lets the mouse drivers control a sprite directly through the VIC's registers. --- libsrc/c128/mou/c128-1351.s | 21 ++++++++++++++++++--- libsrc/c128/mou/c128-joy.s | 19 +++++++++++++++++-- libsrc/c128/mou/c128-pot.s | 23 +++++++++++++++++++---- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/libsrc/c128/mou/c128-1351.s b/libsrc/c128/mou/c128-1351.s index b4d950cda..e1a8a5c8a 100644 --- a/libsrc/c128/mou/c128-1351.s +++ b/libsrc/c128/mou/c128-1351.s @@ -2,7 +2,8 @@ ; Driver for the 1351 proportional mouse. Parts of the code are from ; the Commodore 1351 mouse users guide. ; -; Ullrich von Bassewitz, 2003-12-29, 2009-09-26 +; 2009-09-26, Ullrich von Bassewitz +; 2014-03-15, Greg King ; .include "zeropage.inc" @@ -83,6 +84,8 @@ YMax: .res 2 ; Y2 value of bounding box OldValue: .res 1 ; Temp for MoveCheck routine NewValue: .res 1 ; Temp for MoveCheck routine +INIT_save: .res 1 + .rodata ; Default values for above variables @@ -107,6 +110,14 @@ NewValue: .res 1 ; Temp for MoveCheck routine INSTALL: +; Disable the BASIC interpreter's interrupt-driven sprite-motion code. +; That allows direct access to the VIC-IIe's sprite registers. + + lda INIT_STATUS + sta INIT_save + lda #%11000000 + sta INIT_STATUS + ; Initialize variables. Just copy the default stuff over ldx #.sizeof(DefVars)-1 @@ -133,13 +144,17 @@ INSTALL: ldx #$00 txa - rts ; Run into UNINSTALL instead + rts ;---------------------------------------------------------------------------- ; UNINSTALL routine. Is called before the driver is removed from memory. ; No return code required (the driver is removed from memory on return). -UNINSTALL = HIDE ; Hide cursor on exit +UNINSTALL: + jsr HIDE ; Hide cursor on exit + lda INIT_save + sta INIT_STATUS + rts ;---------------------------------------------------------------------------- ; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages diff --git a/libsrc/c128/mou/c128-joy.s b/libsrc/c128/mou/c128-joy.s index 2bbb4c79b..29689305b 100644 --- a/libsrc/c128/mou/c128-joy.s +++ b/libsrc/c128/mou/c128-joy.s @@ -1,7 +1,8 @@ ; ; Driver for a "joystick mouse". ; -; Ullrich von Bassewitz, 2004-04-05, 2009-09-26 +; 2009-09-26, Ullrich von Bassewitz +; 2014-03-15, Greg King ; .include "zeropage.inc" @@ -85,6 +86,8 @@ XMax: .res 2 ; X2 value of bounding box YMax: .res 2 ; Y2 value of bounding box Buttons: .res 1 ; Button mask +INIT_save: .res 1 + ; Temporary value used in the int handler Temp: .res 1 @@ -113,6 +116,14 @@ Temp: .res 1 INSTALL: +; Disable the BASIC interpreter's interrupt-driven sprite-motion code. +; That allows direct access to the VIC-IIe's sprite registers. + + lda INIT_STATUS + sta INIT_save + lda #%11000000 + sta INIT_STATUS + ; Initialize variables. Just copy the default stuff over ldx #.sizeof(DefVars)-1 @@ -145,7 +156,11 @@ INSTALL: ; UNINSTALL routine. Is called before the driver is removed from memory. ; No return code required (the driver is removed from memory on return). -UNINSTALL = HIDE ; Hide cursor on exit +UNINSTALL: + jsr HIDE ; Hide cursor on exit + lda INIT_save + sta INIT_STATUS + rts ;---------------------------------------------------------------------------- ; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages diff --git a/libsrc/c128/mou/c128-pot.s b/libsrc/c128/mou/c128-pot.s index 2568445f1..07058bf79 100644 --- a/libsrc/c128/mou/c128-pot.s +++ b/libsrc/c128/mou/c128-pot.s @@ -1,8 +1,9 @@ ; -; Driver for a potentiometer "mouse" e.g. Koala Pad +; Driver for a potentiometer "mouse", e.g. Koala Pad ; -; Ullrich von Bassewitz, 2004-03-29, 2009-09-26 -; Stefan Haubenthal, 2006-08-20 +; 2006-08-20, Stefan Haubenthal +; 2009-09-26, Ullrich von Bassewitz +; 2014-03-15, Greg King ; .include "zeropage.inc" @@ -82,6 +83,8 @@ XMax: .res 2 ; X2 value of bounding box YMax: .res 2 ; Y2 value of bounding box Buttons: .res 1 ; Button mask +INIT_save: .res 1 + ; Temporary value used in the int handler Temp: .res 1 @@ -110,6 +113,14 @@ Temp: .res 1 INSTALL: +; Disable the BASIC interpreter's interrupt-driven sprite-motion code. +; That allows direct access to the VIC-IIe's sprite registers. + + lda INIT_STATUS + sta INIT_save + lda #%11000000 + sta INIT_STATUS + ; Initialize variables. Just copy the default stuff over ldx #.sizeof(DefVars)-1 @@ -142,7 +153,11 @@ INSTALL: ; UNINSTALL routine. Is called before the driver is removed from memory. ; No return code required (the driver is removed from memory on return). -UNINSTALL = HIDE ; Hide cursor on exit +UNINSTALL: + jsr HIDE ; Hide cursor on exit + lda INIT_save + sta INIT_STATUS + rts ;---------------------------------------------------------------------------- ; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages -- 2.39.5