uxn/examples/dev.ctrl.usm

68 lines
1.3 KiB
Plaintext
Raw Normal View History

2021-02-16 15:19:48 -05:00
( controller )
2021-02-14 14:51:36 -05:00
2021-02-26 19:53:09 -05:00
&Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
&Sprite { pad 8 x 2 y 2 addr 2 color 1 }
&Controller { buttons 1 }
2021-02-14 14:51:36 -05:00
&Point2d { x 2 y 2 }
;pos Point2d
;sprite 2
2021-02-14 14:51:36 -05:00
|0100 @RESET
2021-02-26 19:53:09 -05:00
( set origin )
~dev/screen.width #0002 DIV2 =pos.x
~dev/screen.height #0002 DIV2 =pos.y
2021-02-14 14:51:36 -05:00
2021-02-26 19:53:09 -05:00
#12 ,up_icn ~pos.y ~pos.x ,draw-sprite JSR
2021-02-14 14:51:36 -05:00
BRK
|c000 @FRAME
2021-02-20 13:34:10 -05:00
,default_icn =sprite
2021-02-26 19:53:09 -05:00
~dev/ctrl.buttons #10 NEQ ,next1 ROT JMP? POP2
2021-02-20 13:34:10 -05:00
,up_icn =sprite
~pos.y #0001 SUB2 =pos.y
2021-02-14 14:51:36 -05:00
@next1
2021-02-26 19:53:09 -05:00
~dev/ctrl.buttons #20 NEQ ,next2 ROT JMP? POP2
2021-02-20 13:34:10 -05:00
,down_icn =sprite
~pos.y #0001 ADD2 =pos.y
2021-02-14 14:51:36 -05:00
@next2
2021-02-26 19:53:09 -05:00
~dev/ctrl.buttons #40 NEQ ,next3 ROT JMP? POP2
2021-02-20 13:34:10 -05:00
,left_icn =sprite
~pos.x #0001 SUB2 =pos.x
2021-02-14 23:23:00 -05:00
@next3
2021-02-26 19:53:09 -05:00
~dev/ctrl.buttons #80 NEQ ,end ROT JMP? POP2
2021-02-20 13:34:10 -05:00
,right_icn =sprite
~pos.x #0001 ADD2 =pos.x
2021-02-14 20:00:17 -05:00
@end
2021-02-14 14:51:36 -05:00
( redraw )
2021-02-26 19:53:09 -05:00
#13 ~sprite ~pos.y ~pos.x ,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
2021-02-26 19:53:09 -05:00
=dev/sprite.x
=dev/sprite.y
=dev/sprite.addr
=dev/sprite.color
2021-02-14 14:51:36 -05:00
RTS
|d000 @ERROR BRK
2021-02-26 19:53:09 -05:00
|FF10 ;dev/screen Screen
|FF20 ;dev/sprite Sprite
|FF30 ;dev/ctrl Controller
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