0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-01 12:02:39 +00:00
uxn/projects/examples/devices/screen.usm

102 lines
2.2 KiB
Text
Raw Normal View History

2021-04-24 17:15:47 +00:00
( dev/screen )
%RTN { JMP2r }
2021-04-29 04:00:39 +00:00
%MOD { DUP2 DIV MUL SUB }
2021-05-24 21:36:15 +00:00
%2// { #01 SFT2 }
2021-04-24 17:15:47 +00: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 17:10:07 +00:00
#025f .System/r DEO2
#0c2f .System/g DEO2
2021-04-29 04:00:39 +00:00
#0da4 .System/b DEO2
2021-04-24 17:15:47 +00:00
( find screen center )
2021-05-24 21:36:15 +00:00
.Screen/width DEI2 2// .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2
2021-04-24 17:15:47 +00:00
( draw )
2021-04-29 17:10:07 +00:00
;draw-table JSR2
2021-04-24 17:15:47 +00:00
;draw-sprites JSR2
2021-04-29 17:10:07 +00:00
;draw-circle JSR2
2021-04-24 17:15:47 +00:00
BRK
@draw-sprites ( -- )
;preview_icn .Screen/addr DEO2
2021-04-29 17:10:07 +00:00
#00 #00
2021-04-29 04:00:39 +00:00
&loop
( move ) OVR #0f AND #40 SFT #02 DIV #00 SWP
2021-05-11 18:14:52 +00:00
.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
2021-04-29 04:00:39 +00:00
( move ) OVR #f0 AND #02 DIV #00 SWP
2021-05-11 18:14:52 +00:00
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
2021-04-24 17:15:47 +00:00
( draw ) OVR .Screen/color DEO
2021-04-29 17:10:07 +00:00
( incr ) SWP #01 ADD SWP
2021-05-12 19:08:51 +00:00
NEQk ,&loop JCN
2021-04-29 17:10:07 +00:00
POP2
RTN
@draw-table ( -- )
#00 #10
&loop
2021-05-13 01:28:45 +00:00
OVR #08 MUL #00 SWP ;font-hex ADD2 .Screen/addr DEO2
2021-04-29 17:10:07 +00:00
( x-axis )
OVR #08 MUL #00 SWP
2021-05-11 18:14:52 +00:00
.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
.center/y LDZ2 #0050 SUB2 .Screen/y DEO2
2021-04-29 17:10:07 +00:00
( draw ) #21 .Screen/color DEO
( y-axis )
OVR #08 MUL #00 SWP
2021-05-11 18:14:52 +00:00
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
.center/x LDZ2 #0050 SUB2 .Screen/x DEO2
2021-04-29 17:10:07 +00:00
( draw ) #21 .Screen/color DEO
2021-04-24 17:15:47 +00:00
( incr ) SWP #01 ADD SWP
2021-05-12 19:08:51 +00:00
LTHk ,&loop JCN
2021-04-29 04:00:39 +00:00
POP2
2021-04-29 17:10:07 +00:00
RTN
@draw-circle ( -- )
2021-04-29 04:00:39 +00:00
2021-04-29 17:10:07 +00:00
;preview_icn .Screen/addr DEO2
2021-05-11 18:14:52 +00:00
.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y LDZ2 #0030 ADD2 .Screen/y DEO2
2021-04-29 17:10:07 +00:00
#21 .Screen/color DEO
2021-05-11 18:14:52 +00:00
.center/x LDZ2 #0050 ADD2 .Screen/x DEO2
2021-04-29 17:10:07 +00:00
#61 .Screen/color DEO
2021-05-11 18:14:52 +00:00
.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y LDZ2 #0038 ADD2 .Screen/y DEO2
2021-04-29 17:10:07 +00:00
#a1 .Screen/color DEO
2021-05-11 18:14:52 +00:00
.center/x LDZ2 #0050 ADD2 .Screen/x DEO2
2021-04-29 17:10:07 +00:00
#f1 .Screen/color DEO
2021-04-24 17:15:47 +00:00
RTN
2021-05-13 01:28:45 +00:00
@preview_icn [
0f38 675f dfbf bfbf 0007 1820 2344 4848
2021-04-29 17:10:07 +00:00
2021-05-13 01:28:45 +00:00
@font-hex
2021-04-29 17:10:07 +00:00
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
2021-05-13 01:28:45 +00:00
007c 8280 f080 827c 007c 8280 f080 8080