Browse code

Optimized shapes

neauoire authored on 18/08/2021 18:40:51
Showing 1 changed files
... ...
@@ -33,7 +33,10 @@
33 33
 
34 34
 |0100
35 35
 	
36
-	( theme ) #f03f .System/r DEO2 #f03f .System/g DEO2 #003f .System/b DEO2
36
+	( theme ) 
37
+	#f03f .System/r DEO2 
38
+	#f03c .System/g DEO2 
39
+	#f03f .System/b DEO2
37 40
 
38 41
 	( background ) ;checker_icn #03 ;cover-pattern JSR2
39 42
 
... ...
@@ -41,6 +44,8 @@
41 44
 	#0070 #0040 #0010 #01 ;draw-circle JSR2
42 45
 	#0038 #0030 #0020 #0020 SIZE-TO-RECT #01 ;line-rect JSR2
43 46
 	#0038 #0058 #0020 #0020 SIZE-TO-RECT #01 ;fill-rect JSR2
47
+	#0010 #0030 #0068 #01 ;line-hor JSR2
48
+	#0020 #0058 #0078 #01 ;line-ver JSR2
44 49
 	
45 50
 BRK
46 51
 
... ...
@@ -70,46 +75,49 @@ BRK
70 75
 
71 76
 RTN
72 77
 
73
-@line-rect ( x1 y1 x2 y2 color -- )
78
+@line-rect ( x1* y1* x2* y2* color -- )
74 79
 
75
-	( load ) .color STZ DUP2 STH2 -- .rect/y2 STZ2 -- .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
76
-	STH2r STH2r
80
+	( load ) .color STZ 
81
+	STH2k .rect/y2 STZ2 .rect/x2 STZ2 
82
+	STH2k .rect/y1 STZ2 .rect/x1 STZ2
83
+	STH2r STH2r SWP2
77 84
 	&ver
78
-		( save ) OVR2 .Screen/y DEO2
85
+		( save ) DUP2 .Screen/y DEO2
79 86
 		( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
80 87
 		( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
81
-		( incr ) SWP2 INC2 SWP2
82
-		OVR2 OVR2 LTS2 ,&ver JCN
88
+		( incr ) INC2
89
+		OVR2 OVR2 GTS2 ,&ver JCN
83 90
 	POP2 POP2
84
-	.rect/x1 LDZ2 .rect/x2 LDZ2
91
+	.rect/x1 LDZ2 .rect/x2 LDZ2 SWP2
85 92
 	&hor
86
-		( save ) OVR2 .Screen/x DEO2
93
+		( save ) DUP2 .Screen/x DEO2
87 94
 		( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
88 95
 		( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
89
-		( incr ) SWP2 INC2 SWP2
90
-		OVR2 OVR2 INC2 LTS2 ,&hor JCN
96
+		( incr ) INC2
97
+		OVR2 INC2 OVR2 GTS2 ,&hor JCN
91 98
 	POP2 POP2
92 99
 
93 100
 RTN
94 101
 
95
-@fill-rect ( x1 y1 x2 y2 color -- )
102
+@fill-rect ( x1* y1* x2* y2* color -- )
96 103
 	
97
-	.color STZ
98
-	( x1 x2 y1 y2 ) ROT2 SWP2
104
+	,&color STR
105
+	( x1 x2 y1 y2 ) ROT2
99 106
 	&ver
100
-		( save ) OVR2 .Screen/y DEO2
101
-		STH2 STH2 OVR2 OVR2
107
+		( save ) DUP2 .Screen/y DEO2
108
+		STH2 STH2 OVR2 OVR2 SWP2
102 109
 		&hor
103
-			( save ) OVR2 .Screen/x DEO2
104
-			( draw ) .color LDZ .Screen/pixel DEO
105
-			( incr ) SWP2 INC2 SWP2
106
-			OVR2 OVR2 LTS2 ,&hor JCN
110
+			( save ) DUP2 .Screen/x DEO2
111
+			( draw ) ,&color LDR .Screen/pixel DEO
112
+			( incr ) INC2
113
+			OVR2 OVR2 GTS2 ,&hor JCN
107 114
 		POP2 POP2 STH2r STH2r
108
-		( incr ) SWP2 INC2 SWP2
109
-		OVR2 OVR2 LTS2 ,&ver JCN
115
+		( incr ) INC2
116
+		OVR2 OVR2 GTS2 ,&ver JCN
110 117
 	POP2 POP2 POP2 POP2
111 118
 
112 119
 RTN
120
+	&color $1
113 121
 
114 122
 @draw-circle ( xc yc r color -- )
115 123
 
... ...
@@ -141,33 +149,32 @@ RTN
141 149
 
142 150
 RTN
143 151
 
144
-@cover-pattern ( addr color -- )
152
+@cover-pattern ( addr* color -- )
145 153
 	
146
-	( load ) .color STZ .Screen/addr DEO2
147
-	#0000 .Screen/height DEI2
154
+	( load ) STH .Screen/addr DEO2
155
+	.Screen/height DEI2 #0000
148 156
 	&ver
149
-		( save ) OVR2 .Screen/y DEO2
150
-		#0000 .Screen/width DEI2
157
+		( save ) DUP2 .Screen/y DEO2
158
+		.Screen/width DEI2 #0000
151 159
 		&hor
152
-			( save ) OVR2 .Screen/x DEO2
153
-			( draw ) .color LDZ .Screen/sprite DEO
154
-			( incr ) SWP2 8++ SWP2
155
-			OVR2 OVR2 LTH2 ,&hor JCN
160
+			( save ) DUP2 .Screen/x DEO2
161
+			( draw ) STHkr .Screen/sprite DEO
162
+			#0008 ADD2 GTH2k ,&hor JCN
156 163
 		POP2 POP2
157
-		( incr ) SWP2 8++ SWP2
158
-		OVR2 OVR2 LTH2 ,&ver JCN
164
+		#0008 ADD2 GTH2k ,&ver JCN
159 165
 	POP2 POP2
166
+	POPr
160 167
 
161 168
 RTN
162 169
 
163 170
 @line-hor ( x0* x1* y* color -- )
164 171
 	
165 172
 	STH .Screen/y DEO2
173
+	SWP2
166 174
 	&loop
167
-		( save ) OVR2 .Screen/x DEO2
175
+		( save ) DUP2 .Screen/x DEO2
168 176
 		( draw ) STHkr .Screen/pixel DEO
169
-		( incr ) SWP2 #0002 INC2 SWP2
170
-		LTH2k ,&loop JCN
177
+		INC2 GTH2k ,&loop JCN
171 178
 	POP2 POP2 POPr
172 179
 
173 180
 RTN
... ...
@@ -175,11 +182,11 @@ RTN
175 182
 @line-ver ( x* y0* y1* color -- )
176 183
 	
177 184
 	STH ROT2 .Screen/x DEO2
185
+	SWP2
178 186
 	&loop
179
-		( save ) OVR2 .Screen/y DEO2
187
+		( save ) DUP2 .Screen/y DEO2
180 188
 		( draw ) STHkr .Screen/pixel DEO
181
-		( incr ) SWP2 #0002 INC2 SWP2
182
-		LTH2k ,&loop JCN
189
+		INC2 GTH2k ,&loop JCN
183 190
 	POP2 POP2 POPr
184 191
 
185 192
 RTN