... | ... |
@@ -28,7 +28,7 @@ |
28 | 28 |
|
29 | 29 |
( program ) |
30 | 30 |
|
31 |
-|0200 @RESET |
|
31 |
+|0200 |
|
32 | 32 |
|
33 | 33 |
( theme ) #127f =System.r #34e7 =System.g #56c4 =System.b |
34 | 34 |
( vectors ) ,on-mouse =Mouse.vector |
... | ... |
@@ -274,17 +274,22 @@ RTN |
274 | 274 |
|
275 | 275 |
RTN |
276 | 276 |
|
277 |
-@fill-rect ( x1 y1 x2 y2 color -- ) |
|
278 |
- |
|
279 |
- ( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
|
277 |
+@fill-rect ( x1 y1 x2 y2 color ) |
|
278 |
+ |
|
279 |
+ =color |
|
280 |
+ ( x1 x2 y1 y2 ) ROT2 SWP2 |
|
280 | 281 |
$ver |
281 |
- ~rect.x1 =Screen.x |
|
282 |
+ ( save ) OVR2 =Screen.y |
|
283 |
+ STH2 STH2 OVR2 OVR2 |
|
282 | 284 |
$hor |
285 |
+ ( save ) OVR2 =Screen.x |
|
283 | 286 |
( draw ) ~color =Screen.color |
284 |
- ( incr ) ~Screen.x ++ =Screen.x |
|
285 |
- ~Screen.x ~rect.x2 LTH2 ^$hor JNZ |
|
286 |
- ( incr ) ~Screen.y ++ =Screen.y |
|
287 |
- ~Screen.y ~rect.y2 LTH2 ^$ver JNZ |
|
287 |
+ ( incr ) SWP2 #0001 ADD2 SWP2 |
|
288 |
+ OVR2 OVR2 LTH2 ^$hor JNZ |
|
289 |
+ POP2 POP2 STH2r STH2r |
|
290 |
+ ( incr ) SWP2 #0001 ADD2 SWP2 |
|
291 |
+ OVR2 OVR2 LTH2 ^$ver JNZ |
|
292 |
+ POP2 POP2 POP2 POP2 |
|
288 | 293 |
|
289 | 294 |
RTN |
290 | 295 |
|
... | ... |
@@ -13,6 +13,7 @@ |
13 | 13 |
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 } |
14 | 14 |
|
15 | 15 |
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |
16 |
+|0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 } |
|
16 | 17 |
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 } |
17 | 18 |
|
18 | 19 |
( program ) |
... | ... |
@@ -21,12 +22,12 @@ |
21 | 22 |
|
22 | 23 |
( theme ) #13fd =System.r #1ef3 =System.g #1bf2 =System.b |
23 | 24 |
|
24 |
- #0010 #0020 #0040 #0060 #01 ,fill-rect JSR2 |
|
25 |
- #0020 #0030 #0050 #0070 #02 ,fill-rect JSR2 |
|
26 |
- #0030 #0040 #0060 #0080 #03 ,fill-rect JSR2 |
|
27 |
- #0070 #0020 #00a0 #0060 #01 ,line-rect JSR2 |
|
28 |
- #0080 #0030 #00b0 #0070 #02 ,line-rect JSR2 |
|
29 |
- #0090 #0040 #00c0 #0080 #03 ,line-rect JSR2 |
|
25 |
+ #0010 #0020 #0040 #0060 #01 ,fill-rect-fast JSR2 |
|
26 |
+ #0020 #0030 #0050 #0070 #02 ,fill-rect-fast JSR2 |
|
27 |
+ #0030 #0040 #0060 #0080 #03 ,fill-rect-fast JSR2 |
|
28 |
+ #0070 #0020 #00a0 #0060 #01 ,line-rect-slow JSR2 |
|
29 |
+ #0080 #0030 #00b0 #0070 #02 ,line-rect-slow JSR2 |
|
30 |
+ #0090 #0040 #00c0 #0080 #03 ,line-rect-slow JSR2 |
|
30 | 31 |
|
31 | 32 |
#0000 #0080 #0020 #0020 #21 ,pict_small ,draw-picture JSR2 |
32 | 33 |
#0010 #0088 #0020 #0020 #22 ,pict_small ,draw-picture JSR2 |
... | ... |
@@ -41,6 +42,15 @@ |
41 | 42 |
#0040 #0040 #0030 #01 ,draw-circle JSR2 |
42 | 43 |
#0070 #0030 #0040 #02 ,draw-circle JSR2 |
43 | 44 |
#0050 #0080 #0050 #03 ,draw-circle JSR2 |
45 |
+ |
|
46 |
+ ( benchmark ) |
|
47 |
+ #0000 #0000 #0008 #000f #01 ,fill-rect-fast JSR2 |
|
48 |
+ #0008 #0000 #0010 #000f #02 ,fill-rect-medium JSR2 |
|
49 |
+ #0010 #0000 #0018 #000f #03 ,fill-rect-slow JSR2 |
|
50 |
+ |
|
51 |
+ ( #0000 #0010 #0008 #001f #01 ,line-rect-fast JSR2 ) |
|
52 |
+ #0008 #0010 #000f #001f #02 ,line-rect-medium JSR2 |
|
53 |
+ #0010 #0010 #0017 #001f #03 ,line-rect-slow JSR2 |
|
44 | 54 |
|
45 | 55 |
BRK |
46 | 56 |
|
... | ... |
@@ -70,7 +80,26 @@ BRK |
70 | 80 |
|
71 | 81 |
RTN |
72 | 82 |
|
73 |
-@line-rect ( x1 y1 x2 y2 color ) |
|
83 |
+@line-rect-medium ( x1 y1 x2 y2 color -- ) |
|
84 |
+ |
|
85 |
+ ( load ) =color DUP2 ++ STH2 =rect.y2 =rect.x2 DUP2 STH2 =rect.y1 =rect.x1 |
|
86 |
+ STH2r STH2r |
|
87 |
+ $ver |
|
88 |
+ ( save ) OVR2 =Screen.y |
|
89 |
+ ( draw ) ~rect.x1 =Screen.x ~color DUP =Screen.color ~rect.x2 =Screen.x =Screen.color |
|
90 |
+ ( incr ) SWP2 ++ SWP2 |
|
91 |
+ OVR2 OVR2 LTH2 ^$ver JNZ |
|
92 |
+ POP2 POP2 |
|
93 |
+ ~rect.x1 ++ ~rect.x2 -- |
|
94 |
+ $hor |
|
95 |
+ ( save ) OVR2 =Screen.x |
|
96 |
+ ( draw ) ~rect.y1 =Screen.y ~color DUP =Screen.color ~rect.y2 =Screen.y =Screen.color |
|
97 |
+ ( incr ) SWP2 ++ SWP2 |
|
98 |
+ OVR2 OVR2 ++ LTH2 ^$hor JNZ |
|
99 |
+ POP2 POP2 |
|
100 |
+RTN |
|
101 |
+ |
|
102 |
+@line-rect-slow ( x1 y1 x2 y2 color -- ) |
|
74 | 103 |
|
75 | 104 |
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
76 | 105 |
$hor |
... | ... |
@@ -87,7 +116,44 @@ RTN |
87 | 116 |
|
88 | 117 |
RTN |
89 | 118 |
|
90 |
-@fill-rect ( x1 y1 x2 y2 color ) |
|
119 |
+@fill-rect-fast ( x1 y1 x2 y2 color -- ) |
|
120 |
+ |
|
121 |
+ =color |
|
122 |
+ ( x1 x2 y1 y2 ) ROT2 SWP2 |
|
123 |
+ $ver |
|
124 |
+ ( save ) OVR2 =Screen.y |
|
125 |
+ STH2 STH2 OVR2 OVR2 |
|
126 |
+ $hor |
|
127 |
+ ( save ) OVR2 =Screen.x |
|
128 |
+ ( draw ) ~color =Screen.color |
|
129 |
+ ( incr ) SWP2 ++ SWP2 |
|
130 |
+ OVR2 OVR2 LTH2 ^$hor JNZ |
|
131 |
+ POP2 POP2 STH2r STH2r |
|
132 |
+ ( incr ) SWP2 ++ SWP2 |
|
133 |
+ OVR2 OVR2 LTH2 ^$ver JNZ |
|
134 |
+ POP2 POP2 POP2 POP2 |
|
135 |
+ |
|
136 |
+RTN |
|
137 |
+ |
|
138 |
+@fill-rect-medium ( x1 y1 x2 y2 color -- ) |
|
139 |
+ |
|
140 |
+ ( load ) =color SWP2 =rect.x2 ROT2 =rect.x1 |
|
141 |
+ $ver |
|
142 |
+ ( save ) OVR2 =Screen.y |
|
143 |
+ ~rect.x1 ~rect.x2 |
|
144 |
+ $hor |
|
145 |
+ ( save ) OVR2 =Screen.x |
|
146 |
+ ( draw ) ~color =Screen.color |
|
147 |
+ ( incr ) SWP2 ++ SWP2 |
|
148 |
+ OVR2 OVR2 LTH2 ^$hor JNZ |
|
149 |
+ POP2 POP2 |
|
150 |
+ ( incr ) SWP2 ++ SWP2 |
|
151 |
+ OVR2 OVR2 LTH2 ^$ver JNZ |
|
152 |
+ POP2 POP2 |
|
153 |
+ |
|
154 |
+RTN |
|
155 |
+ |
|
156 |
+@fill-rect-slow ( x1 y1 x2 y2 color -- ) |
|
91 | 157 |
|
92 | 158 |
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
93 | 159 |
$ver |
... | ... |
@@ -124,7 +190,7 @@ RTN |
124 | 190 |
( draw ) ,$seg JSR2 |
125 | 191 |
$loop |
126 | 192 |
( incr ) ~circle.x ++ =circle.x |
127 |
- ~circle.d #0000 #0001 ADD2 LTS2 ^$else JNZ |
|
193 |
+ ~circle.d #0000 ++ LTS2 ^$else JNZ |
|
128 | 194 |
( decr ) ~circle.y -- =circle.y |
129 | 195 |
~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d |
130 | 196 |
,$end JMP2 |
... | ... |
@@ -132,7 +198,7 @@ RTN |
132 | 198 |
~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d |
133 | 199 |
$end |
134 | 200 |
( draw ) ,$seg JSR2 |
135 |
- ~circle.y ~circle.x #0001 SUB2 GTS2 ^$loop JNZ |
|
201 |
+ ~circle.y ~circle.x -- GTS2 ^$loop JNZ |
|
136 | 202 |
RTN |
137 | 203 |
$seg |
138 | 204 |
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color |
... | ... |
@@ -11,7 +11,7 @@ |
11 | 11 |
|0170 ;File { vector 2 pad 6 name 2 length 2 load 2 save 2 } |
12 | 12 |
|01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 refresh 1 } |
13 | 13 |
|
14 |
-|0200 @RESET |
|
14 |
+|0200 |
|
15 | 15 |
#90ff =System.r #9000 =System.g #900f =System.b |
16 | 16 |
#08e0 ~Screen.width #0001 SFT2 SUB2 =scroll.x |
17 | 17 |
#09b0 =scroll.y |
... | ... |
@@ -19,7 +19,7 @@ |
19 | 19 |
#30 =scroll.wait |
20 | 20 |
BRK |
21 | 21 |
|
22 |
-@frame |
|
22 |
+@frame ( -> ) |
|
23 | 23 |
#ffff |
24 | 24 |
$loop |
25 | 25 |
DUP2 ^row JSR |
... | ... |
@@ -534,45 +534,37 @@ RTN |
534 | 534 |
@patternize ( -- ) |
535 | 535 |
|
536 | 536 |
~brush.patt #00 NEQ ^$noplain JNZ |
537 |
- #01 RTN |
|
538 |
- $noplain |
|
537 |
+ #01 RTN $noplain |
|
539 | 538 |
|
540 | 539 |
~brush.patt #01 NEQ ^$notone1 JNZ |
541 | 540 |
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0001 AND2 #0000 EQU2 |
542 | 541 |
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0001 AND2 #0000 EQU2 |
543 | 542 |
#0101 EQU2 |
544 |
- RTN |
|
545 |
- $notone1 |
|
543 |
+ RTN $notone1 |
|
546 | 544 |
|
547 | 545 |
~brush.patt #02 NEQ ^$notone2 JNZ |
548 | 546 |
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 |
549 | 547 |
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 |
550 | 548 |
#0101 EQU2 |
551 |
- RTN |
|
552 |
- $notone2 |
|
549 |
+ RTN $notone2 |
|
553 | 550 |
|
554 | 551 |
~brush.patt #03 NEQ ^$notone3 JNZ |
555 | 552 |
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0005 AND2 #0000 EQU2 |
556 | 553 |
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0005 AND2 #0000 EQU2 |
557 | 554 |
#0101 EQU2 |
558 |
- RTN |
|
559 |
- $notone3 |
|
555 |
+ RTN $notone3 |
|
560 | 556 |
|
561 | 557 |
~brush.patt #04 NEQ ^$notone4 JNZ |
562 |
- ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 RTN |
|
563 |
- $notone4 |
|
558 |
+ ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 RTN $notone4 |
|
564 | 559 |
|
565 | 560 |
~brush.patt #05 NEQ ^$notone5 JNZ |
566 |
- ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 RTN |
|
567 |
- $notone5 |
|
561 |
+ ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 RTN $notone5 |
|
568 | 562 |
|
569 | 563 |
~brush.patt #06 NEQ ^$notone6 JNZ |
570 |
- ~pt0.x #00 ~px.x ADD2 #0001 AND2 SWP POP RTN |
|
571 |
- $notone6 |
|
564 |
+ ~pt0.x #00 ~px.x ADD2 #0001 AND2 SWP POP RTN $notone6 |
|
572 | 565 |
|
573 | 566 |
~brush.patt #07 NEQ ^$notone7 JNZ |
574 |
- ~pt0.y #00 ~px.y ADD2 #0001 AND2 SWP POP RTN |
|
575 |
- $notone7 |
|
567 |
+ ~pt0.y #00 ~px.y ADD2 #0001 AND2 SWP POP RTN $notone7 |
|
576 | 568 |
|
577 | 569 |
#00 |
578 | 570 |
|
... | ... |
@@ -842,17 +834,21 @@ RTN |
842 | 834 |
|
843 | 835 |
RTN |
844 | 836 |
|
845 |
-@fill-rect ( x1 y1 x2 y2 color -- ) |
|
837 |
+@fill-rect ( x1 y1 x2 y2 color ) |
|
846 | 838 |
|
847 |
- ( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
|
839 |
+ ( load ) =color SWP2 =rect.x2 ROT2 =rect.x1 |
|
848 | 840 |
$ver |
849 |
- ~rect.x1 =Screen.x |
|
841 |
+ ( save ) OVR2 =Screen.y |
|
842 |
+ ~rect.x1 ~rect.x2 |
|
850 | 843 |
$hor |
844 |
+ ( save ) OVR2 =Screen.x |
|
851 | 845 |
( draw ) ~color =Screen.color |
852 |
- ( incr ) ~Screen.x ++ =Screen.x |
|
853 |
- ~Screen.x ~rect.x2 NEQ2 ^$hor JNZ |
|
854 |
- ( incr ) ~Screen.y ++ =Screen.y |
|
855 |
- ~Screen.y ~rect.y2 NEQ2 ^$ver JNZ |
|
846 |
+ ( incr ) SWP2 ++ SWP2 |
|
847 |
+ OVR2 OVR2 LTH2 ^$hor JNZ |
|
848 |
+ POP2 POP2 |
|
849 |
+ ( incr ) SWP2 ++ SWP2 |
|
850 |
+ OVR2 OVR2 LTH2 ^$ver JNZ |
|
851 |
+ POP2 POP2 |
|
856 | 852 |
|
857 | 853 |
RTN |
858 | 854 |
|