fixed signature of mouse_get(): it returns the buttonstatus in A. Added convenience cx16.mouse_pos() routine.

This commit is contained in:
Irmen de Jong 2022-01-21 22:06:17 +01:00
parent 53bf8c09fd
commit c8bd57cd4d
4 changed files with 25 additions and 39 deletions

View File

@ -307,13 +307,25 @@ romsub $ff7d = primm()
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 $ff6b = mouse_get(ubyte zpdataptr @X) clobbers(A)
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 $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_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.
%asm {{
phx
ldx #cx16.r0
jsr cx16.mouse_get
plx
rts
}}
}
; It's not documented what registers are clobbered, so we assume the worst for all following kernal routines...:

View File

@ -1 +1 @@
7.7
7.8-dev

View File

@ -3,7 +3,9 @@ TODO
For next release
^^^^^^^^^^^^^^^^
...
- allow goto pointervar (goto $a000 already works...) then use this in cx16assem's run_file()
- allow "xxx" * constexpr (where constexpr is not a number literal, now gives expression error not same type)
- is * lower prio than bitwise & ? fix prios if so!
Need help with

View File

@ -2,45 +2,17 @@
%zeropage basicsafe
main {
str s1 = "Irmen_"
str s2 = @"IRMEN_"
str s3 = sc:"IRMEN_"
str s4 = iso:"Käse, Straße"
sub start() {
txt.iso()
; txt.lowercase()
txt.nl()
txt.nl()
txt.nl()
txt.nl()
txt.nl()
txt.print(s1)
txt.nl()
txt.print(s2)
txt.nl()
txt.print(s3)
txt.nl()
txt.print(s4)
txt.nl()
cx16.mouse_config(1, 0)
sc(1, s1)
sc(2, s2)
sc(3, s3)
sc(4, s4)
}
sub sc(ubyte row, str text) {
uword addr = 1024+row*40
ubyte ix = 0
ubyte ss
repeat {
ss = text[ix]
if not ss
return
@(addr) = ss
addr++
ix++
ubyte mb = cx16.mouse_pos()
txt.print_uw(cx16.r0)
txt.spc()
txt.print_uw(cx16.r1)
txt.spc()
txt.print_ub(mb)
txt.nl()
}
}
}