uxn/examples/controller.usm

65 lines
983 B
Plaintext
Raw Normal View History

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