mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
added cx16.joystick_get2() for convenience api
This commit is contained in:
parent
b1ef09675b
commit
8d567f6b06
@ -227,6 +227,7 @@ romsub $ff6b = mouse_get(ubyte zpdataptr @X) clobbers(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 ; 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 $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, ubyte @R3 ; result registers see clock_set_date_time()
|
||||
|
||||
|
@ -2,29 +2,32 @@
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
const ubyte world_width=100
|
||||
ubyte j1
|
||||
ubyte j2
|
||||
ubyte j3
|
||||
|
||||
struct Color {
|
||||
ubyte red
|
||||
ubyte green
|
||||
ubyte blue
|
||||
}
|
||||
repeat {
|
||||
%asm {{
|
||||
lda #0
|
||||
jsr cx16.joystick_get
|
||||
sta j1
|
||||
stx j2
|
||||
sty j3
|
||||
}}
|
||||
|
||||
Color rgb = [255,world_width,0] ; note that struct initializer value is same as an array
|
||||
;rgb = [255,world_width,0] ; note that struct initializer value is same as an array
|
||||
;rgb = [255,world_width/2,0] ; note that struct initializer value is same as an array
|
||||
txt.print_ubbin(j1, false)
|
||||
txt.spc()
|
||||
txt.print_ubbin(j2, false)
|
||||
txt.spc()
|
||||
txt.print_ubbin(j3, false)
|
||||
|
||||
|
||||
; struct Entity {
|
||||
; ubyte active
|
||||
; ubyte x
|
||||
; ubyte y
|
||||
; byte direction
|
||||
; }
|
||||
;
|
||||
; Entity pede
|
||||
; pede = [1, 1, 0, -1]
|
||||
txt.spc()
|
||||
uword qq = cx16.joystick_get2(0)
|
||||
txt.print_uwbin(qq, false)
|
||||
txt.nl()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -627,6 +627,7 @@ syn match prog8BuiltInFunc "\<cx16\.mouse_get\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.mouse_scan\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.joystick_scan\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.joystick_get\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.joystick_get2\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.clock_set_date_time\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.clock_get_date_time\>"
|
||||
syn match prog8BuiltInFunc "\<cx16\.GRAPH_init\>"
|
||||
|
Loading…
x
Reference in New Issue
Block a user