mirror of
https://github.com/irmen/prog8.git
synced 2024-09-08 10:55:08 +00:00
workaround for the joystick_get() irq problem
This commit is contained in:
parent
56fec674c5
commit
e680de05ea
@ -227,7 +227,6 @@ romsub $ff6b = mouse_get(ubyte zpdataptr @X) clobbers(A)
|
|||||||
romsub $ff71 = mouse_scan() clobbers(A, X, Y)
|
romsub $ff71 = mouse_scan() clobbers(A, X, Y)
|
||||||
romsub $ff53 = joystick_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_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y
|
||||||
romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; convenience definition to get the joystick state without requiring inline assembly
|
|
||||||
romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, ubyte jiffies @R3) clobbers(A, X, 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()
|
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()
|
||||||
|
|
||||||
@ -462,6 +461,17 @@ asmsub vload(str name @R0, ubyte device @Y, ubyte bank @A, uword address @R1) ->
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
sub FB_set_pixels_from_buf(uword buffer, uword count) {
|
||||||
%asm {{
|
%asm {{
|
||||||
|
@ -1,33 +1,17 @@
|
|||||||
%import textio
|
%import textio
|
||||||
|
%import gfx2
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
ubyte xx=9
|
repeat {
|
||||||
ubyte yy=9
|
sys.waitvsync()
|
||||||
|
ubyte joy = lsb(cx16.joystick_get2(0))
|
||||||
; ubyte c_xx = xx+1
|
txt.print_ubbin(joy,1)
|
||||||
|
txt.nl()
|
||||||
if xx+1 >= 10 {
|
|
||||||
txt.print("yes")
|
|
||||||
} else {
|
|
||||||
txt.print("error!")
|
|
||||||
}
|
|
||||||
if yy+1 >= 10 {
|
|
||||||
txt.print("yes2")
|
|
||||||
} else {
|
|
||||||
txt.print("error2!")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if xx+1 >= xx-2 {
|
repeat {
|
||||||
txt.print("yes")
|
|
||||||
} else {
|
|
||||||
txt.print("error!")
|
|
||||||
}
|
|
||||||
if yy+1 >= yy-2 {
|
|
||||||
txt.print("yes2")
|
|
||||||
} else {
|
|
||||||
txt.print("error2!")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user