0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-14 18:25:06 +00:00
uxn/examples/controller.usm

65 lines
986 B
Text
Raw Normal View History

2021-02-16 20:19:48 +00:00
( controller )
2021-02-14 19:51:36 +00:00
:dev/r fff8 ( const read port )
:dev/w fff9 ( const write port )
;x 2 ;y 2
|0100 @RESET
2021-02-15 03:43:33 +00:00
#03 =dev/r ( set dev/read to controller )
#02 =dev/w ( set dev/write to sprite )
2021-02-15 01:00:17 +00:00
#0080 =x #0040 =y ( origin )
2021-02-15 22:42:53 +00:00
#0101 ,cursor_icn ~x ~y ,putsprite JSR ( draw sprite )
2021-02-14 19:51:36 +00:00
BRK
|0200 @SPRITESHEET
2021-02-15 22:42:53 +00:00
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]
2021-02-14 19:51:36 +00:00
BRK
|c000 @FRAME
2021-02-15 04:23:00 +00:00
#05 =dev/r ( set dev/read to mouse )
#04 IOR #01 NEQ ,next0 ROT JMP? POP2
#00 IOR2 =x #02 IOR2 =y
2021-02-14 19:51:36 +00:00
@next0
2021-02-15 01:00:17 +00:00
2021-02-15 04:23:00 +00:00
#03 =dev/r ( set dev/read to controller )
2021-02-15 01:00:17 +00:00
2021-02-15 04:23:00 +00:00
#00 IOR #10 NEQ ,next1 ROT JMP? POP2
~y #0001 SUB2 =y
2021-02-14 19:51:36 +00:00
@next1
2021-02-15 04:23:00 +00:00
#00 IOR #20 NEQ ,next2 ROT JMP? POP2
~y #0001 ADD2 =y
2021-02-15 01:00:17 +00:00
2021-02-14 19:51:36 +00:00
@next2
2021-02-15 04:23:00 +00:00
#00 IOR #40 NEQ ,next3 ROT JMP? POP2
~x #0001 SUB2 =x
@next3
2021-02-15 01:00:17 +00:00
#00 IOR #80 NEQ ,end ROT JMP? POP2
~x #0001 ADD2 =x
@end
2021-02-14 19:51:36 +00:00
( redraw )
2021-02-15 22:42:53 +00:00
#0101 ,cursor_icn ~x ~y ,putsprite JSR
2021-02-14 19:51:36 +00:00
BRK
@putsprite
IOW2 ( y short )
IOW2 ( x short )
IOW2 ( sprite address )
2021-02-15 22:42:53 +00:00
IOW2 ( redraw byte )
2021-02-14 19:51:36 +00:00
RTS
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR