uxn/projects/examples/devices/screen.usm

52 lines
971 B
Plaintext
Raw Normal View History

2021-04-24 13:15:47 -04:00
( dev/screen )
%RTN { JMP2r }
2021-04-29 00:00:39 -04:00
%MOD { DUP2 DIV MUL SUB }
2021-04-24 13:15:47 -04:00
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
( variables )
|0000
@center [ &x $2 &y $2 ]
( init )
|0100 ( -> )
( theme )
2021-04-29 00:00:39 -04:00
#0c5f .System/r DEO2
#022f .System/g DEO2
#0da4 .System/b DEO2
2021-04-24 13:15:47 -04:00
( find screen center )
.Screen/width DEI2 #0002 DIV2 .center/x POK2
.Screen/height DEI2 #0002 DIV2 .center/y POK2
( draw )
;draw-sprites JSR2
BRK
@draw-sprites ( -- )
;preview_icn .Screen/addr DEO2
2021-04-29 00:00:39 -04:00
#00 #ff
&loop
( move ) OVR #0f AND #40 SFT #02 DIV #00 SWP
.center/x PEK2 #0040 SUB2 ADD2 .Screen/x DEO2
( move ) OVR #f0 AND #02 DIV #00 SWP
.center/y PEK2 #0018 SUB2 ADD2 .Screen/y DEO2
2021-04-24 13:15:47 -04:00
( draw ) OVR .Screen/color DEO
( incr ) SWP #01 ADD SWP
2021-04-29 00:00:39 -04:00
DUP2 LTH ,&loop JNZ
POP2
2021-04-24 13:15:47 -04:00
RTN
@preview_icn [ 183c 66db db66 3c18 0000 183c 3c18 0000 ]