From 7424f1f768b4f15200f328e05d2ad443df0d320e Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 25 Mar 2022 18:03:33 +0100 Subject: [PATCH] remove kernal bug workaround for joystick_get() routine. Fixes #39 --- compiler/res/prog8lib/cx16/syslib.p8 | 12 +----------- docs/source/todo.rst | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 8827febed..c19187d34 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -311,6 +311,7 @@ romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A romsub $ff71 = mouse_scan() clobbers(A, X, Y) romsub $ff53 = joystick_scan() clobbers(A, X, Y) romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y +romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to don't have the hassle to deal with multiple return values romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, ubyte jiffies @R3) clobbers(A, X, Y) romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, ubyte @R3 ; result registers see clock_set_date_time() @@ -533,17 +534,6 @@ asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) }} } -inline asmsub joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX { - ; convenience routine to get the joystick state without requiring inline assembly that deals with the multiple return values. - ; Also disables interrupts to avoid the IRQ race condition mentioned here: https://github.com/commanderx16/x16-rom/issues/203 - ; TODO once that issue is resolved, this routine can be redefined as: romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX - %asm {{ - sei - jsr cx16.joystick_get - cli - }} -} - sub FB_set_pixels_from_buf(uword buffer, uword count) { %asm {{ diff --git a/docs/source/todo.rst b/docs/source/todo.rst index cddfd3156..51dcd12c9 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,8 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- simplify cx16.joystick_get2() once this cx16 rom issue is resolved: https://github.com/commanderx16/x16-rom/issues/203 - Can now be resolved because the fix got merged https://github.com/commanderx16/x16-rom/pull/204 - add unit test for the string encoders special handling of 0x0000 and 0x8000-0x80ff ...