From d911728611ce3b8cfb9a1e34e6254fb8d7ac33c2 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 31 Mar 2022 18:24:23 +0200 Subject: [PATCH] x16 r39: cx16.mouse_config() API changed, added mouse_config2() convenience wrapper --- compiler/res/prog8lib/cx16/syslib.p8 | 12 +++++++++++- docs/source/todo.rst | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 6f5df47f7..39c69024d 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -306,7 +306,7 @@ romsub $ff7d = primm() ; X16 additions romsub $ff44 = macptr() clobbers(A,X,Y) romsub $ff47 = enter_basic(ubyte cold_or_warm @Pc) clobbers(A,X,Y) -romsub $ff68 = mouse_config(ubyte shape @A, ubyte scale @X) clobbers (A, X, Y) +romsub $ff68 = mouse_config(ubyte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) 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) @@ -315,6 +315,16 @@ romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; altern 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() +asmsub mouse_config2(ubyte shape @A) clobbers (A, X, Y) { + ; -- convenience wrapper function that handles the screen resolution for mouse_config() for you + %asm {{ + sec + jsr cx16.screen_mode ; set current screen mode and res in A, X, Y + lda #1 + jmp cx16.mouse_config + }} +} + asmsub mouse_pos() -> ubyte @A { ; -- 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. diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 3f0d60fed..12e4d43f5 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,8 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- x16: change mouse_config API https://github.com/commanderx16/x16-docs/blob/master/Commander%20X16%20Programmer's%20Reference%20Guide.md#function-name-mouse_config - also add mouse_config2() ? that does the screen_mode() trick internally for you? - x16: check new ZP free addresses https://github.com/commanderx16/x16-docs/commit/541f2ce9e61d1d0d0e157d7f52fe16bc0895e6f0 and https://www.commanderx16.com/forum/index.php?/topic/363-keep-zero-page-empty-as-much-as-possible/#comment-18561 - x16: check additional FP lib changes https://github.com/commanderx16/x16-rom/commit/ae608673f0210953172d6837acfbb231d62ddbd1