0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-14 10:15:06 +00:00
uxn/examples/dev.ctrl.usm

68 lines
1.3 KiB
Text
Raw Normal View History

2021-02-27 03:46:56 +00:00
( dev/ctrl )
2021-02-14 19:51:36 +00:00
2021-02-27 00:53:09 +00: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 19:51:36 +00:00
&Point2d { x 2 y 2 }
;pos Point2d
;sprite 2
2021-02-14 19:51:36 +00:00
|0100 @RESET
2021-02-27 00:53:09 +00:00
( set origin )
~dev/screen.width #0002 DIV2 =pos.x
~dev/screen.height #0002 DIV2 =pos.y
2021-02-14 19:51:36 +00:00
2021-02-27 00:53:09 +00:00
#12 ,up_icn ~pos.y ~pos.x ,draw-sprite JSR
2021-02-14 19:51:36 +00:00
BRK
|c000 @FRAME
2021-02-20 18:34:10 +00:00
,default_icn =sprite
2021-02-27 00:53:09 +00:00
~dev/ctrl.buttons #10 NEQ ,next1 ROT JMP? POP2
2021-02-20 18:34:10 +00:00
,up_icn =sprite
~pos.y #0001 SUB2 =pos.y
2021-02-14 19:51:36 +00:00
@next1
2021-02-27 00:53:09 +00:00
~dev/ctrl.buttons #20 NEQ ,next2 ROT JMP? POP2
2021-02-20 18:34:10 +00:00
,down_icn =sprite
~pos.y #0001 ADD2 =pos.y
2021-02-14 19:51:36 +00:00
@next2
2021-02-27 00:53:09 +00:00
~dev/ctrl.buttons #40 NEQ ,next3 ROT JMP? POP2
2021-02-20 18:34:10 +00:00
,left_icn =sprite
~pos.x #0001 SUB2 =pos.x
2021-02-15 04:23:00 +00:00
@next3
2021-02-27 00:53:09 +00:00
~dev/ctrl.buttons #80 NEQ ,end ROT JMP? POP2
2021-02-20 18:34:10 +00:00
,right_icn =sprite
~pos.x #0001 ADD2 =pos.x
2021-02-15 01:00:17 +00:00
@end
2021-02-14 19:51:36 +00:00
( redraw )
2021-02-27 00:53:09 +00:00
#13 ~sprite ~pos.y ~pos.x ,draw-sprite JSR
2021-02-14 19:51:36 +00:00
BRK
2021-02-20 18:34:10 +00: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-27 00:53:09 +00:00
=dev/sprite.x
=dev/sprite.y
=dev/sprite.addr
=dev/sprite.color
2021-02-14 19:51:36 +00:00
RTS
|d000 @ERROR BRK
2021-02-27 00:53:09 +00:00
|FF10 ;dev/screen Screen
|FF20 ;dev/sprite Sprite
|FF30 ;dev/ctrl Controller
2021-02-20 18:34:10 +00:00
|FFF0 [ 02ac 05bb 0b53 ] ( palette )
2021-02-14 19:51:36 +00:00
|FFFA .RESET .FRAME .ERROR