1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,257 +0,0 @@ |
1 |
-( |
|
2 |
- wireworld |
|
3 |
- |
|
4 |
- A - conductor |
|
5 |
- B - tail |
|
6 |
- Sel - head |
|
7 |
- Start - clear |
|
8 |
- mouse1 - paint |
|
9 |
- mouse2 - erase |
|
10 |
- |
|
11 |
- RULES: |
|
12 |
- - electron head<3>, becomes electron tail<2> |
|
13 |
- - electron tail<2>, becomes conductor<1> |
|
14 |
- - conductor<1>, becomes electron head<3> |
|
15 |
- if there are exactly 1 or 2 electron heads around it. ) |
|
16 |
- |
|
17 |
-( devices ) |
|
18 |
- |
|
19 |
-|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
20 |
-|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
21 |
-|80 @Controller &vector $2 &button $1 &key $1 &func $1 |
|
22 |
-|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 |
|
23 |
- |
|
24 |
-|0000 |
|
25 |
- |
|
26 |
- @color $1 |
|
27 |
- @pointer &x $2 &y $2 |
|
28 |
- @timer &frame $1 &play $1 |
|
29 |
- |
|
30 |
-( program ) |
|
31 |
- |
|
32 |
-|0100 ( -> ) |
|
33 |
- |
|
34 |
- ( theme ) |
|
35 |
- #0ff2 .System/r DEO2 |
|
36 |
- #0d46 .System/g DEO2 |
|
37 |
- #006f .System/b DEO2 |
|
38 |
- ( size ) |
|
39 |
- #0100 .Screen/width DEO2 |
|
40 |
- #0100 .Screen/height DEO2 |
|
41 |
- ( vectors ) |
|
42 |
- ;on-frame .Screen/vector DEO2 |
|
43 |
- ;on-mouse .Mouse/vector DEO2 |
|
44 |
- ;on-button .Controller/vector DEO2 |
|
45 |
- ( setup ) |
|
46 |
- #01 .timer/play STZ |
|
47 |
- #01 set-color |
|
48 |
- ( start ) |
|
49 |
- ;world ;get-addr/current STA2 |
|
50 |
- #1000 ;run/future STA2 |
|
51 |
- redraw |
|
52 |
- |
|
53 |
-BRK |
|
54 |
- |
|
55 |
-@on-frame ( -> ) |
|
56 |
- |
|
57 |
- .timer/play LDZ [ JMP BRK ] |
|
58 |
- ( every 4th ) |
|
59 |
- .timer/frame LDZk |
|
60 |
- #03 AND ?&no-run |
|
61 |
- run |
|
62 |
- &no-run |
|
63 |
- LDZk INC SWP STZ |
|
64 |
- |
|
65 |
-BRK |
|
66 |
- |
|
67 |
-@on-mouse ( -> ) |
|
68 |
- |
|
69 |
- ;pointer-icn .Screen/addr DEO2 |
|
70 |
- ( clear last cursor ) |
|
71 |
- .pointer/x LDZ2 .Screen/x DEO2 |
|
72 |
- .pointer/y LDZ2 .Screen/y DEO2 |
|
73 |
- #40 .Screen/sprite DEO |
|
74 |
- ( draw new cursor ) |
|
75 |
- .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
|
76 |
- .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
|
77 |
- #40 .color LDZ ADD .Screen/sprite DEO |
|
78 |
- ( paint ) |
|
79 |
- .Mouse/state DEI ?on-mouse-down |
|
80 |
- |
|
81 |
-BRK |
|
82 |
- |
|
83 |
-@on-mouse-down ( -> ) |
|
84 |
- |
|
85 |
- .Mouse/y DEI2 #03 SFT2 NIP #02 NEQ ?&no-menu |
|
86 |
- .Mouse/x DEI2 #03 SFT2 NIP |
|
87 |
- DUP #02 NEQ ?&no-color1 |
|
88 |
- #01 set-color |
|
89 |
- &no-color1 |
|
90 |
- DUP #03 NEQ ?&no-color2 |
|
91 |
- #02 set-color |
|
92 |
- &no-color2 |
|
93 |
- DUP #04 NEQ ?&no-color3 |
|
94 |
- #03 set-color |
|
95 |
- &no-color3 |
|
96 |
- DUP #06 NEQ ?&no-toggle |
|
97 |
- .timer/play LDZk #00 EQU SWP STZ |
|
98 |
- #00 .Mouse/state DEO |
|
99 |
- draw-ui |
|
100 |
- &no-toggle |
|
101 |
- POP |
|
102 |
- &no-menu |
|
103 |
- |
|
104 |
- ( color ) .color LDZ .Mouse/state DEI #01 GTH #00 EQU MUL |
|
105 |
- ( cell* ) .Mouse/x DEI2 #02 SFT2 NIP .Mouse/y DEI2 #02 SFT2 NIP |
|
106 |
- get-addr STA |
|
107 |
- redraw |
|
108 |
- |
|
109 |
-BRK |
|
110 |
- |
|
111 |
-@on-button ( -> ) |
|
112 |
- |
|
113 |
- .Controller/button DEI |
|
114 |
- [ #01 ] NEQk NIP ?&no-a #01 set-color &no-a |
|
115 |
- [ #02 ] NEQk NIP ?&no-b #02 set-color &no-b |
|
116 |
- [ #04 ] NEQk NIP ?&no-select #03 set-color &no-select |
|
117 |
- [ #08 ] NEQk NIP ?&no-start ;world #2000 mclr redraw &no-start |
|
118 |
- POP |
|
119 |
- ( space ) |
|
120 |
- .Controller/key DEI #20 NEQ ?&no-space .timer/play LDZk #00 EQU SWP STZ &no-space |
|
121 |
- |
|
122 |
-BRK |
|
123 |
- |
|
124 |
-( |
|
125 |
-@|core ) |
|
126 |
- |
|
127 |
-@set-color ( color -- ) |
|
128 |
- |
|
129 |
- .color STZ |
|
130 |
- .pointer/x LDZ2 .Screen/x DEO2 |
|
131 |
- .pointer/y LDZ2 .Screen/y DEO2 |
|
132 |
- ;pointer-icn .Screen/addr DEO2 |
|
133 |
- #40 .color LDZ ADD .Screen/sprite DEO |
|
134 |
- #00 .Mouse/state DEO |
|
135 |
- |
|
136 |
-JMP2r |
|
137 |
- |
|
138 |
-@run ( -- ) |
|
139 |
- |
|
140 |
- #40 #00 |
|
141 |
- &ver |
|
142 |
- STHk |
|
143 |
- #40 #00 |
|
144 |
- &hor |
|
145 |
- ( x,y ) DUP STHkr |
|
146 |
- ( cell ) DUP2 get-addr STH2k LDA |
|
147 |
- ( transform ) transform STH2r [ LIT2 &future $2 ] ADD2 STA |
|
148 |
- INC GTHk ?&hor |
|
149 |
- POP2 |
|
150 |
- POPr |
|
151 |
- INC GTHk ?&ver |
|
152 |
- POP2 |
|
153 |
- ( Swap worlds ) |
|
154 |
- ;get-addr/current LDA2k ;run/future LDA2 STH2k ADD2 SWP2 STA2 |
|
155 |
- #0000 STH2r SUB2 ;run/future STA2 |
|
156 |
- |
|
157 |
-!redraw |
|
158 |
- |
|
159 |
-@get-addr ( x y -- addr* ) |
|
160 |
- |
|
161 |
- #00 SWP #60 SFT2 ROT #00 SWP ADD2 [ LIT2 ¤t $2 ] ADD2 |
|
162 |
- |
|
163 |
-JMP2r |
|
164 |
- |
|
165 |
-@transform ( xy cell -- cell ) |
|
166 |
- |
|
167 |
- DUP ?&no-null NIP NIP JMP2r &no-null |
|
168 |
- DUP #03 NEQ ?&no-head POP POP2 #02 JMP2r &no-head |
|
169 |
- DUP #02 NEQ ?&no-tail POP POP2 #01 JMP2r &no-tail |
|
170 |
- DUP #01 NEQ ?&no-cond POP |
|
171 |
- LITr 00 |
|
172 |
- DUP2 #01 SUB get-addr |
|
173 |
- ( tl ) #0001 SUB2 LDAk #03 NEQ JMP INCr |
|
174 |
- ( tc ) INC2 LDAk #03 NEQ JMP INCr |
|
175 |
- ( tr ) INC2 LDA #03 NEQ JMP INCr |
|
176 |
- DUP2 get-addr |
|
177 |
- ( ml ) #0001 SUB2 LDAk #03 NEQ JMP INCr |
|
178 |
- ( mr ) INC2 INC2 LDA #03 NEQ JMP INCr |
|
179 |
- INC get-addr |
|
180 |
- ( bl ) #0001 SUB2 LDAk #03 NEQ JMP INCr |
|
181 |
- ( bc ) INC2 LDAk #03 NEQ JMP INCr |
|
182 |
- ( br ) INC2 LDA #03 NEQ JMP INCr |
|
183 |
- STHkr #02 EQU STHr #01 EQU ORA |
|
184 |
- DUP ADD INC JMP2r |
|
185 |
- &no-cond |
|
186 |
- ( unknown ) |
|
187 |
- NIP NIP |
|
188 |
- |
|
189 |
-JMP2r |
|
190 |
- |
|
191 |
-@mclr ( addr* len* -- ) |
|
192 |
- |
|
193 |
- OVR2 ADD2 SWP2 |
|
194 |
- &loop |
|
195 |
- STH2k #00 STH2r STA |
|
196 |
- INC2 GTH2k ?&loop |
|
197 |
- POP2 POP2 |
|
198 |
- |
|
199 |
-JMP2r |
|
200 |
- |
|
201 |
-( |
|
202 |
-@|drawing ) |
|
203 |
- |
|
204 |
-@redraw ( -- ) |
|
205 |
- |
|
206 |
- ;cell-icn .Screen/addr DEO2 |
|
207 |
- #4000 |
|
208 |
- &ver |
|
209 |
- #00 OVR #20 SFT2 .Screen/y DEO2 |
|
210 |
- STHk |
|
211 |
- #4000 |
|
212 |
- &hor |
|
213 |
- #00 OVR #20 SFT2 .Screen/x DEO2 |
|
214 |
- DUP STHkr get-addr LDA .Screen/sprite DEO |
|
215 |
- INC GTHk ?&hor |
|
216 |
- POP2 |
|
217 |
- POPr |
|
218 |
- INC GTHk ?&ver |
|
219 |
- POP2 |
|
220 |
- |
|
221 |
-@draw-ui ( -- ) |
|
222 |
- |
|
223 |
- ( colors ) |
|
224 |
- #01 .Screen/auto DEO |
|
225 |
- #0010 DUP2 .Screen/x DEO2 .Screen/y DEO2 |
|
226 |
- ;color-icn .Screen/addr DEO2 |
|
227 |
- #01 .Screen/sprite DEO |
|
228 |
- #02 .Screen/sprite DEO |
|
229 |
- #03 .Screen/sprite DEO |
|
230 |
- ( toggle ) |
|
231 |
- #0030 .Screen/x DEO2 |
|
232 |
- ;toggle-icn #00 .timer/play LDZ #30 SFT2 ADD2 .Screen/addr DEO2 |
|
233 |
- #01 .Screen/sprite DEO |
|
234 |
- |
|
235 |
-JMP2r |
|
236 |
- |
|
237 |
-( |
|
238 |
-@|assets ) |
|
239 |
- |
|
240 |
-@pointer-icn [ |
|
241 |
- 80c0 e0f0 f8e0 1000 ] |
|
242 |
-@cell-icn [ |
|
243 |
- e0e0 e000 0000 0000 ] |
|
244 |
-@color-icn [ |
|
245 |
- 7cfe fefe fefe 7c00 ] |
|
246 |
-@toggle-icn [ |
|
247 |
- 6666 6666 6666 6600 |
|
248 |
- 4666 767e 7666 4600 ] |
|
249 |
- |
|
250 |
-( |
|
251 |
- I live in the atom with the happy protons and neutrons. |
|
252 |
- I'm also so negative all the freakin time. |
|
253 |
- What do I do? |
|
254 |
- How do I find peace? ) |
|
255 |
- |
|
256 |
-@world |
|
257 |
- |