uxn/examples/devctrl.usm

62 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-02-16 15:19:48 -05:00
( controller )
2021-02-14 14:51:36 -05:00
:dev/r fff8 ( const read port )
:dev/w fff9 ( const write port )
2021-02-20 13:34:10 -05:00
;x 2 ;y 2 ;sprite 2
2021-02-14 14:51:36 -05:00
|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-14 14:51:36 -05:00
2021-02-21 19:52:51 -05:00
#12 ,up_icn ~x ~y ,draw-sprite JSR
2021-02-14 14:51:36 -05:00
BRK
|c000 @FRAME
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-20 13:34:10 -05:00
,default_icn =sprite
2021-02-14 23:23:00 -05:00
#00 IOR #10 NEQ ,next1 ROT JMP? POP2
2021-02-20 13:34:10 -05:00
,up_icn =sprite
2021-02-14 23:23:00 -05:00
~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
2021-02-20 13:34:10 -05:00
,down_icn =sprite
2021-02-14 23:23:00 -05:00
~y #0001 ADD2 =y
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
2021-02-20 13:34:10 -05:00
,left_icn =sprite
2021-02-14 23:23:00 -05:00
~x #0001 SUB2 =x
@next3
2021-02-14 20:00:17 -05:00
#00 IOR #80 NEQ ,end ROT JMP? POP2
2021-02-20 13:34:10 -05:00
,right_icn =sprite
2021-02-14 20:00:17 -05:00
~x #0001 ADD2 =x
@end
2021-02-14 14:51:36 -05:00
( redraw )
2021-02-21 19:52:51 -05:00
#13 ~sprite ~x ~y ,draw-sprite JSR
2021-02-14 14:51:36 -05:00
BRK
2021-02-20 13:34:10 -05:00
@default_icn [ 3c7e ffdb ffe7 7e3c ]
@up_icn [ 2466 e7db ffff 7e3c ]
@down_icn [ 3c7e ffff dbe7 6624 ]
@left_icn [ 3c7e ef1f 1fef 7e3c ]
@right_icn [ 3c7e f7f8 f8f7 7e3c ]
@draw-sprite
IOW2 ( y byte )
IOW2 ( x byte )
2021-02-14 14:51:36 -05:00
IOW2 ( sprite address )
2021-02-20 13:34:10 -05:00
IOW ( layer-color )
2021-02-14 14:51:36 -05:00
RTS
|d000 @ERROR BRK
2021-02-20 13:34:10 -05:00
|FFF0 [ 02ac 05bb 0b53 ] ( palette )
2021-02-14 14:51:36 -05:00
|FFFA .RESET .FRAME .ERROR