Optimized shapes

This commit is contained in:
neauoire 2021-08-18 11:40:51 -07:00
parent e3f181579b
commit 3e747e9220
1 changed files with 46 additions and 39 deletions

View File

@ -33,7 +33,10 @@
|0100 |0100
( theme ) #f03f .System/r DEO2 #f03f .System/g DEO2 #003f .System/b DEO2 ( theme )
#f03f .System/r DEO2
#f03c .System/g DEO2
#f03f .System/b DEO2
( background ) ;checker_icn #03 ;cover-pattern JSR2 ( background ) ;checker_icn #03 ;cover-pattern JSR2
@ -41,6 +44,8 @@
#0070 #0040 #0010 #01 ;draw-circle JSR2 #0070 #0040 #0010 #01 ;draw-circle JSR2
#0038 #0030 #0020 #0020 SIZE-TO-RECT #01 ;line-rect JSR2 #0038 #0030 #0020 #0020 SIZE-TO-RECT #01 ;line-rect JSR2
#0038 #0058 #0020 #0020 SIZE-TO-RECT #01 ;fill-rect JSR2 #0038 #0058 #0020 #0020 SIZE-TO-RECT #01 ;fill-rect JSR2
#0010 #0030 #0068 #01 ;line-hor JSR2
#0020 #0058 #0078 #01 ;line-ver JSR2
BRK BRK
@ -70,46 +75,49 @@ BRK
RTN RTN
@line-rect ( x1 y1 x2 y2 color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ DUP2 STH2 -- .rect/y2 STZ2 -- .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2 ( load ) .color STZ
STH2r STH2r STH2k .rect/y2 STZ2 .rect/x2 STZ2
STH2k .rect/y1 STZ2 .rect/x1 STZ2
STH2r STH2r SWP2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) DUP2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2 ( incr ) INC2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 LDZ2 .rect/x2 LDZ2 .rect/x1 LDZ2 .rect/x2 LDZ2 SWP2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) DUP2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2 ( incr ) INC2
OVR2 OVR2 INC2 LTS2 ,&hor JCN OVR2 INC2 OVR2 GTS2 ,&hor JCN
POP2 POP2 POP2 POP2
RTN RTN
@fill-rect ( x1 y1 x2 y2 color -- ) @fill-rect ( x1* y1* x2* y2* color -- )
.color STZ ,&color STR
( x1 x2 y1 y2 ) ROT2 SWP2 ( x1 x2 y1 y2 ) ROT2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) DUP2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 STH2 STH2 OVR2 OVR2 SWP2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) DUP2 .Screen/x DEO2
( draw ) .color LDZ .Screen/pixel DEO ( draw ) ,&color LDR .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2 ( incr ) INC2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 GTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
( incr ) SWP2 INC2 SWP2 ( incr ) INC2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2 POP2 POP2 POP2 POP2
RTN RTN
&color $1
@draw-circle ( xc yc r color -- ) @draw-circle ( xc yc r color -- )
@ -141,33 +149,32 @@ RTN
RTN RTN
@cover-pattern ( addr color -- ) @cover-pattern ( addr* color -- )
( load ) .color STZ .Screen/addr DEO2 ( load ) STH .Screen/addr DEO2
#0000 .Screen/height DEI2 .Screen/height DEI2 #0000
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) DUP2 .Screen/y DEO2
#0000 .Screen/width DEI2 .Screen/width DEI2 #0000
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) DUP2 .Screen/x DEO2
( draw ) .color LDZ .Screen/sprite DEO ( draw ) STHkr .Screen/sprite DEO
( incr ) SWP2 8++ SWP2 #0008 ADD2 GTH2k ,&hor JCN
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2 POP2 POP2
( incr ) SWP2 8++ SWP2 #0008 ADD2 GTH2k ,&ver JCN
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2 POP2 POP2
POPr
RTN RTN
@line-hor ( x0* x1* y* color -- ) @line-hor ( x0* x1* y* color -- )
STH .Screen/y DEO2 STH .Screen/y DEO2
SWP2
&loop &loop
( save ) OVR2 .Screen/x DEO2 ( save ) DUP2 .Screen/x DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
( incr ) SWP2 #0002 INC2 SWP2 INC2 GTH2k ,&loop JCN
LTH2k ,&loop JCN
POP2 POP2 POPr POP2 POP2 POPr
RTN RTN
@ -175,11 +182,11 @@ RTN
@line-ver ( x* y0* y1* color -- ) @line-ver ( x* y0* y1* color -- )
STH ROT2 .Screen/x DEO2 STH ROT2 .Screen/x DEO2
SWP2
&loop &loop
( save ) OVR2 .Screen/y DEO2 ( save ) DUP2 .Screen/y DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
( incr ) SWP2 #0002 INC2 SWP2 INC2 GTH2k ,&loop JCN
LTH2k ,&loop JCN
POP2 POP2 POPr POP2 POP2 POPr
RTN RTN