0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-08 15:25:05 +00:00
uxn/projects/examples/dev.screen.usm

70 lines
1.5 KiB
Text
Raw Normal View History

2021-03-14 01:34:08 +00:00
( Screen )
2021-03-14 01:34:08 +00:00
;center { x 2 y 2 }
;timer { byte 1 }
|0100 @RESET
( find screen center )
2021-03-14 01:34:08 +00:00
~Screen.width #0002 DIV2 =center.x
~Screen.height #0002 DIV2 =center.y
( draw hor line )
2021-03-14 01:34:08 +00:00
#0000 =Screen.x ~center.y =Screen.y
2021-03-14 22:17:00 +00:00
#0000 ~Screen.width ( from/to )
$draw-hor NOP
2021-03-14 01:34:08 +00:00
( draw ) #01 =Screen.color
2021-03-14 22:17:00 +00:00
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2
2021-03-16 01:08:41 +00:00
OVR2 OVR2 LTH2 ^$draw-hor SWP JMP?
2021-03-14 22:17:00 +00:00
POP2 POP2
( draw ver line )
2021-03-14 01:34:08 +00:00
~center.x =Screen.x #0000 =Screen.y
2021-03-14 22:17:00 +00:00
#0000 ~Screen.height ( from/to )
$draw-ver NOP
2021-03-14 01:34:08 +00:00
( draw ) #02 =Screen.color
2021-03-14 22:17:00 +00:00
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2
2021-03-16 01:08:41 +00:00
OVR2 OVR2 LTH2 ^$draw-ver SWP JMP?
2021-03-14 22:17:00 +00:00
POP2 POP2
2021-02-27 16:18:57 +00:00
( draw blending modes )
2021-03-14 01:34:08 +00:00
#0020 =Sprite.x #0020 =Sprite.y ,icon =Sprite.addr
2021-03-14 22:17:00 +00:00
#00 #10
$draw-blends NOP
( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x
( draw ) OVR =Sprite.color
( incr ) SWP #01 ADD SWP
2021-03-16 01:08:41 +00:00
DUP2 LTH ^$draw-blends SWP JMP?
2021-03-14 22:17:00 +00:00
POP POP
BRK
2021-03-14 01:34:08 +00:00
@FRAME
( update colors every 40 frames )
2021-03-15 22:27:43 +00:00
~timer #40 NEQ ,skip1 ROT JMP2?
2021-03-14 01:34:08 +00:00
#0fac #fffa STR2 #f0bb #fffc STR2 #f053 #fff8 STR2
@skip1
2021-03-15 22:27:43 +00:00
~timer #80 NEQ ,skip2 ROT JMP2?
2021-03-14 01:34:08 +00:00
#00fc #fffc STR2 #f0bb #fff8 STR2 #f053 #fffa STR2
@skip2
2021-03-15 22:27:43 +00:00
~timer #c0 NEQ ,skip3 ROT JMP2?
2021-03-14 01:34:08 +00:00
#000f #fff8 STR2 #0f0f #fffa STR2 #ff00 #fffc STR2
@skip3
2021-03-15 22:27:43 +00:00
~timer #00 NEQ ,skip4 ROT JMP2?
2021-03-14 01:34:08 +00:00
#f0ac #fff8 STR2 #f0bb #fffa STR2 #f053 #fffc STR2
@skip4
~timer #01 ADD =timer
BRK
2021-03-14 01:34:08 +00:00
@icon [ 3c7e e7c3 c3e7 7e3c ]
|d000 @ERROR BRK
2021-03-14 01:34:08 +00:00
|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
2021-02-28 19:17:32 +00:00
|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ f0ac f0bb f053 ] ( palette )