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

80 lines
1.9 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
2021-02-28 17:40:19 +00:00
;slime-color 1
2021-02-14 19:51:36 +00:00
|0100 @RESET
2021-02-27 00:53:09 +00:00
( set origin )
2021-02-28 17:40:19 +00:00
~dev/screen.width #0002 DIV2 =dev/sprite.x
~dev/screen.height #0002 DIV2 =dev/sprite.y
,default_icn =dev/sprite.addr
#11 =dev/sprite.color
#0a =slime-color
2021-02-14 19:51:36 +00:00
BRK
|c000 @FRAME
2021-02-28 17:40:19 +00:00
#0a =slime-color
( hold ctrl key to change slime color )
,no-ctrl ~dev/ctrl.buttons #0f AND #01 NEQ JMP? POP2
#05 =slime-color
@no-ctrl
( hold alt key to change slime color )
,no-alt ~dev/ctrl.buttons #0f AND #02 NEQ JMP? POP2
#0f =slime-color
@no-alt
( detect movement )
,no-up ~dev/ctrl.buttons #f0 AND #10 NEQ JMP? POP2
( clear ) #10 =dev/sprite.color
( move ) ~dev/sprite.y #0001 SUB2 =dev/sprite.y ,up_icn =dev/sprite.addr
( draw ) ,redraw JSR BRK
@no-up
,no-down ~dev/ctrl.buttons #f0 AND #20 NEQ JMP? POP2
( clear ) #10 =dev/sprite.color
( move ) ~dev/sprite.y #0001 ADD2 =dev/sprite.y ,down_icn =dev/sprite.addr
( draw ) ,redraw JSR BRK
@no-down
,no-left ~dev/ctrl.buttons #f0 AND #40 NEQ JMP? POP2
( clear ) #10 =dev/sprite.color
( move ) ~dev/sprite.x #0001 SUB2 =dev/sprite.x ,left_icn =dev/sprite.addr
( draw ) ,redraw JSR BRK
@no-left
,no-right ~dev/ctrl.buttons #f0 AND #80 NEQ JMP? POP2
( clear ) #10 =dev/sprite.color
( move ) ~dev/sprite.x #0001 ADD2 =dev/sprite.x ,right_icn =dev/sprite.addr
( draw ) ,redraw JSR BRK
@no-right
2021-02-14 19:51:36 +00:00
2021-02-28 17:40:19 +00:00
BRK
2021-02-20 18:34:10 +00:00
2021-02-28 17:40:19 +00:00
@redraw
( draw face )
#11 =dev/sprite.color
( draw slime )
,slime_icn =dev/sprite.addr
~slime-color =dev/sprite.color
2021-02-14 19:51:36 +00:00
2021-02-28 17:40:19 +00:00
RTS
2021-02-14 19:51:36 +00:00
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 ]
2021-02-28 17:40:19 +00:00
@slime_icn [ 0000 183c 3c18 0000 ]
2021-02-14 19:51:36 +00:00
|d000 @ERROR BRK
2021-02-27 00:53:09 +00:00
|FF10 ;dev/screen Screen
|FF20 ;dev/sprite Sprite
|FF30 ;dev/ctrl Controller
|FFF0 .RESET .FRAME .ERROR ( vectors )
2021-02-28 19:17:32 +00:00
|FFF8 [ 0daf 02ff 035f ] ( palette )