From 15867ab423a24a82d6fd44f98340d8af46e1f7d3 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 29 May 2024 23:19:53 +0200 Subject: [PATCH] update cx16.mouse_get() and mouse_pos() to also return scroll wheel in X --- compiler/res/prog8lib/cx16/syslib.p8 | 6 +++--- examples/cx16/spotlight.p8 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 3c21bb151..89c17a2db 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -466,7 +466,7 @@ romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) -romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A ; use mouse_pos() instead +romsub $ff6b = mouse_get(ubyte zdataptr @X) -> ubyte @A, byte @X ; use mouse_pos() instead romsub $ff71 = mouse_scan() clobbers(A, X, Y) romsub $ff53 = joystick_scan() clobbers(A, X, Y) romsub $ff56 = joystick_get(ubyte joynr @A) -> uword @AX, bool @Y ; note: everything is inverted @@ -587,9 +587,9 @@ asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { }} } -asmsub mouse_pos() clobbers(X) -> ubyte @A, uword @R0, uword @R1 { +asmsub mouse_pos() -> ubyte @A, uword @R0, uword @R1, byte @X { ; -- short wrapper around mouse_get() kernal routine: - ; -- gets the position of the mouse cursor in cx16.r0 and cx16.r1 (x/y coordinate), returns mouse button status in A. + ; -- gets the position of the mouse cursor in cx16.r0 and cx16.r1 (x/y coordinate), returns mouse button status in A, scroll wheel in X. ; Note: mouse pointer needs to be enabled for this to do anything. %asm {{ ldx #cx16.r0 diff --git a/examples/cx16/spotlight.p8 b/examples/cx16/spotlight.p8 index 3dfc3ba02..dfa8d8adf 100644 --- a/examples/cx16/spotlight.p8 +++ b/examples/cx16/spotlight.p8 @@ -37,7 +37,7 @@ main { ; spotlight repeat { - void, cx16.r0, cx16.r1 = cx16.mouse_pos() + void, cx16.r0, cx16.r1, void = cx16.mouse_pos() new_direction = math.direction(128, HEIGHT/2, clampx(cx16.r0), cx16.r1L) if new_direction != previous_direction { sys.waitvsync()