... | ... |
@@ -6,8 +6,8 @@ |
6 | 6 |
|
7 | 7 |
|0000 |
8 | 8 |
|
9 |
-@count $2 |
|
10 |
-@center &x $2 &y $2 |
|
9 |
+ @count $2 |
|
10 |
+ @center &x $2 &y $2 |
|
11 | 11 |
|
12 | 12 |
|0100 ( -> ) |
13 | 13 |
|
... | ... |
@@ -60,11 +60,11 @@ BRK |
60 | 60 |
#00 .Screen/auto DEO |
61 | 61 |
( table ) |
62 | 62 |
;preview_icn .Screen/addr DEO2 |
63 |
- #00 #00 |
|
63 |
+ #0000 |
|
64 | 64 |
&loop |
65 |
- ( move ) DUP #0f AND #40 SFT #01 SFT #00 SWP |
|
65 |
+ ( move ) #00 OVR #0f AND [ #40 SFT #01 SFT ] |
|
66 | 66 |
.center/x LDZ2 #0060 SUB2 ADD2 .Screen/x DEO2 |
67 |
- ( move ) DUP #f0 AND #01 SFT #00 SWP |
|
67 |
+ ( move ) #00 OVR #f0 AND #01 SFT |
|
68 | 68 |
.center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2 |
69 | 69 |
( draw ) DUP .Screen/sprite DEO |
70 | 70 |
INC NEQk ,&loop JCN |
... | ... |
@@ -74,13 +74,13 @@ JMP2r |
74 | 74 |
|
75 | 75 |
@draw-1bpp ( -- ) |
76 | 76 |
|
77 |
- #10 #00 |
|
77 |
+ #1000 |
|
78 | 78 |
&loop |
79 | 79 |
( color ) STHk |
80 |
- ( y ) DUP #02 SFT [ #00 SWP ] #40 SFT2 |
|
81 |
- [ .center/y LDZ2 #0038 SUB2 ADD2 ] STH2 |
|
82 |
- ( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2 |
|
83 |
- [ .center/x LDZ2 #0010 SUB2 ADD2 ] |
|
80 |
+ ( y ) #00 OVR #42 SFT2 |
|
81 |
+ .center/y LDZ2 #0038 SUB2 ADD2 STH2 |
|
82 |
+ ( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 |
|
83 |
+ .center/x LDZ2 #0010 SUB2 ADD2 |
|
84 | 84 |
STH2r STHr #00 ,draw-circle JSR |
85 | 85 |
INC GTHk ,&loop JCN |
86 | 86 |
POP2 |
... | ... |
@@ -89,13 +89,13 @@ JMP2r |
89 | 89 |
|
90 | 90 |
@draw-2bpp ( -- ) |
91 | 91 |
|
92 |
- #10 #00 |
|
92 |
+ #1000 |
|
93 | 93 |
&loop |
94 | 94 |
( color ) STHk |
95 |
- ( y ) DUP #02 SFT [ #00 SWP ] #40 SFT2 |
|
96 |
- [ .center/y LDZ2 #0008 ADD2 ADD2 ] STH2 |
|
97 |
- ( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2 |
|
98 |
- [ .center/x LDZ2 #0010 SUB2 ADD2 ] |
|
95 |
+ ( y ) #00 OVR #42 SFT2 |
|
96 |
+ .center/y LDZ2 #0008 ADD2 ADD2 STH2 |
|
97 |
+ ( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 |
|
98 |
+ .center/x LDZ2 #0010 SUB2 ADD2 |
|
99 | 99 |
STH2r STHr #80 ,draw-circle JSR |
100 | 100 |
INC GTHk ,&loop JCN |
101 | 101 |
POP2 |
... | ... |
@@ -121,14 +121,9 @@ JMP2r |
121 | 121 |
|
122 | 122 |
@draw-short ( short* -- ) |
123 | 123 |
|
124 |
- SWP ,draw-byte JSR |
|
125 |
- |
|
126 |
-@draw-byte ( byte -- ) |
|
127 |
- |
|
128 |
- DUP #04 SFT ,draw-hex JSR #0f AND |
|
129 |
- |
|
130 |
-@draw-hex ( char -- ) |
|
131 |
- |
|
124 |
+ SWP ,&byte JSR |
|
125 |
+ &byte ( byte -- ) DUP #04 SFT ,&hex JSR #0f AND |
|
126 |
+ &hex ( char -- ) |
|
132 | 127 |
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 |
133 | 128 |
#01 .Screen/sprite DEO |
134 | 129 |
|
16 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,287 +0,0 @@ |
1 |
-( Copy of demos/life.tal, but with in infinite loop in the Screen vector ) |
|
2 |
- |
|
3 |
-( Game Of Life: |
|
4 |
- Any live cell with fewer than two live neighbours dies, as if by underpopulation. |
|
5 |
- Any live cell with two or three live neighbours lives on to the next generation. |
|
6 |
- Any live cell with more than three live neighbours dies, as if by overpopulation. |
|
7 |
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. ) |
|
8 |
- |
|
9 |
-|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 |
|
10 |
-|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
|
11 |
-|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
12 |
-|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
13 |
-|80 @Controller &vector $2 &button $1 &key $1 |
|
14 |
-|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 |
|
15 |
- |
|
16 |
-|0000 |
|
17 |
- |
|
18 |
-@world &frame $1 &count $2 |
|
19 |
-@anchor &x $2 &y $2 &x2 $2 &y2 $2 |
|
20 |
-@pointer &x $2 &y $2 |
|
21 |
- |
|
22 |
-|0100 ( -> ) |
|
23 |
- |
|
24 |
- ( theme ) |
|
25 |
- #02cf .System/r DEO2 |
|
26 |
- #02ff .System/g DEO2 |
|
27 |
- #024f .System/b DEO2 |
|
28 |
- ( resize ) |
|
29 |
- #00c0 .Screen/width DEO2 |
|
30 |
- #00c0 .Screen/height DEO2 |
|
31 |
- ( vectors ) |
|
32 |
- ;on-frame .Screen/vector DEO2 |
|
33 |
- ;on-mouse .Mouse/vector DEO2 |
|
34 |
- ;on-control .Controller/vector DEO2 |
|
35 |
- ( glider ) |
|
36 |
- #07 #03 ;set-cell JSR2 |
|
37 |
- #07 #04 ;set-cell JSR2 |
|
38 |
- #05 #04 ;set-cell JSR2 |
|
39 |
- #07 #05 ;set-cell JSR2 |
|
40 |
- #06 #05 ;set-cell JSR2 |
|
41 |
- ( center ) |
|
42 |
- .Screen/width DEI2 #01 SFT2 #0040 SUB2 |
|
43 |
- DUP2 .anchor/x STZ2 |
|
44 |
- #007e ADD2 .anchor/x2 STZ2 |
|
45 |
- .Screen/height DEI2 #01 SFT2 #0040 SUB2 |
|
46 |
- DUP2 .anchor/y STZ2 |
|
47 |
- #007e ADD2 .anchor/y2 STZ2 |
|
48 |
- |
|
49 |
-BRK |
|
50 |
- |
|
51 |
-@on-frame ( -> ) |
|
52 |
- ( Because an interrupted infinite loop will (almost certainly) leave |
|
53 |
- items on the stacks, clear both stacks here. ) |
|
54 |
- #00 .System/wst DEO |
|
55 |
- #00 .System/rst DEO |
|
56 |
- |
|
57 |
- .Mouse/state DEI #00 EQU #01 JCN [ BRK ] |
|
58 |
- #0000 .world/count STZ2 |
|
59 |
- .world/frame LDZ INC |
|
60 |
- DUP .world/frame STZ |
|
61 |
- #03 AND #00 EQU #01 JCN [ BRK ] |
|
62 |
- &infinite-loop |
|
63 |
- ;run JSR2 |
|
64 |
- ,&infinite-loop JMP |
|
65 |
- &paused |
|
66 |
- |
|
67 |
-BRK |
|
68 |
- |
|
69 |
-@on-mouse ( -> ) |
|
70 |
- |
|
71 |
- ( clear last cursor ) |
|
72 |
- ;cursor .Screen/addr DEO2 |
|
73 |
- .pointer/x LDZ2 .Screen/x DEO2 |
|
74 |
- .pointer/y LDZ2 .Screen/y DEO2 |
|
75 |
- #40 .Screen/sprite DEO |
|
76 |
- ( record pointer positions ) |
|
77 |
- .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
|
78 |
- .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
|
79 |
- ( colorize on state ) |
|
80 |
- #42 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO |
|
81 |
- ( on touch in rect ) |
|
82 |
- .Mouse/state DEI #00 NEQ #01 JCN [ BRK ] |
|
83 |
- .Mouse/x DEI2 .Mouse/y DEI2 .anchor ;within-rect JSR2 JMP [ BRK ] |
|
84 |
- ( paint ) |
|
85 |
- .Mouse/x DEI2 .anchor/x LDZ2 SUB2 #01 SFT NIP |
|
86 |
- .Mouse/y DEI2 .anchor/y LDZ2 SUB2 #01 SFT NIP |
|
87 |
- ;set-cell JSR2 |
|
88 |
- ( draw ) |
|
89 |
- ;draw-grid JSR2 |
|
90 |
- |
|
91 |
-BRK |
|
92 |
- |
|
93 |
-@on-control ( -> ) |
|
94 |
- |
|
95 |
- ( toggle play ) |
|
96 |
- .Controller/key DEI #20 NEQ ,&no-toggle JCN |
|
97 |
- ;on-frame |
|
98 |
- .Screen/vector DEI2 ;on-frame/paused EQU2 ,&swap JCN |
|
99 |
- POP2 ;on-frame/paused |
|
100 |
- &swap |
|
101 |
- .Screen/vector DEO2 |
|
102 |
- &no-toggle |
|
103 |
- ( clear on home ) |
|
104 |
- .Controller/button DEI #08 NEQ ,&no-reset JCN |
|
105 |
- ;bank1 #0400 ;mclr JSR2 |
|
106 |
- &no-reset |
|
107 |
- |
|
108 |
-BRK |
|
109 |
- |
|
110 |
-@run ( -- ) |
|
111 |
- |
|
112 |
- ( clear buffer ) |
|
113 |
- ;bank2 #1000 ;mclr JSR2 |
|
114 |
- ( run grid ) |
|
115 |
- #4000 |
|
116 |
- &ver |
|
117 |
- STHk |
|
118 |
- #4000 |
|
119 |
- &hor |
|
120 |
- DUP STHkr ,run-cell JSR |
|
121 |
- INC GTHk ,&hor JCN |
|
122 |
- POP2 |
|
123 |
- POPr |
|
124 |
- INC GTHk ,&ver JCN |
|
125 |
- POP2 |
|
126 |
- ( move buffer ) |
|
127 |
- ;bank2 ;bank1 #1000 ;mcpy JSR2 |
|
128 |
- ( draw ) |
|
129 |
- ;draw-grid JSR2 |
|
130 |
- |
|
131 |
-JMP2r |
|
132 |
- |
|
133 |
-@run-cell ( x y -- ) |
|
134 |
- |
|
135 |
- ( x y ) DUP2 |
|
136 |
- ( neighbours ) DUP2 ;get-neighbours JSR2 |
|
137 |
- ( state ) ROT ROT ;get-cell JSR2 |
|
138 |
- #00 EQU ,&dead JCN |
|
139 |
- DUP #02 LTH ,&dies JCN |
|
140 |
- DUP #03 GTH ,&dies JCN |
|
141 |
- POP ,&save JSR JMP2r |
|
142 |
- &dies POP POP2 JMP2r |
|
143 |
- &dead |
|
144 |
- DUP #03 EQU ,&birth JCN POP POP2 JMP2r |
|
145 |
- &birth POP ,&save JSR JMP2r |
|
146 |
- |
|
147 |
-JMP2r |
|
148 |
- &save ( x y -- ) |
|
149 |
- STH2 #01 STH2r ,get-index JSR [ #1000 ADD2 ] STA |
|
150 |
- .world/count LDZ2 INC2 .world/count STZ2 |
|
151 |
- JMP2r |
|
152 |
- |
|
153 |
-@get-index ( x y -- index* ) |
|
154 |
- |
|
155 |
- ( y ) #3f AND #00 SWP #60 SFT2 |
|
156 |
- ( x ) ROT #3f AND #00 SWP ADD2 |
|
157 |
- ;bank1 ADD2 |
|
158 |
- |
|
159 |
-JMP2r |
|
160 |
- |
|
161 |
-@set-cell ( x y -- ) |
|
162 |
- |
|
163 |
- STH2 #01 STH2r ,get-index JSR STA |
|
164 |
- |
|
165 |
-JMP2r |
|
166 |
- |
|
167 |
-@get-cell ( x y -- cell ) |
|
168 |
- |
|
169 |
- ,get-index JSR LDA |
|
170 |
- |
|
171 |
-JMP2r |
|
172 |
- |
|
173 |
-@get-neighbours ( x y -- neighbours ) |
|
174 |
- |
|
175 |
- ,&origin STR2 |
|
176 |
- LITr 00 |
|
177 |
- #0800 |
|
178 |
- &loop |
|
179 |
- #00 OVR #10 SFT2 ;&mask ADD2 LDA2 [ LIT2 &origin $2 ] |
|
180 |
- ROT ADD STH ADD STHr ;get-cell JSR2 STH ADDr |
|
181 |
- INC GTHk ,&loop JCN |
|
182 |
- POP2 |
|
183 |
- STHr |
|
184 |
- |
|
185 |
-JMP2r |
|
186 |
- &mask ffff 00ff 01ff ff00 0100 ff01 0001 0101 |
|
187 |
- |
|
188 |
-@draw-grid ( -- ) |
|
189 |
- |
|
190 |
- ( draw cell count ) |
|
191 |
- .anchor/x LDZ2 .Screen/x DEO2 |
|
192 |
- .anchor/y2 LDZ2 #0008 ADD2 .Screen/y DEO2 |
|
193 |
- #01 .Screen/auto DEO |
|
194 |
- .world/count LDZ2 ;draw-short JSR2 |
|
195 |
- #00 .Screen/auto DEO |
|
196 |
- #4000 |
|
197 |
- &ver |
|
198 |
- #00 OVR #10 SFT2 .anchor/y LDZ2 ADD2 .Screen/y DEO2 |
|
199 |
- STHk |
|
200 |
- #4000 |
|
201 |
- &hor |
|
202 |
- #00 OVR #10 SFT2 .anchor/x LDZ2 ADD2 .Screen/x DEO2 |
|
203 |
- DUP STHkr ;get-cell JSR2 INC .Screen/pixel DEO |
|
204 |
- INC GTHk ,&hor JCN |
|
205 |
- POP2 |
|
206 |
- POPr |
|
207 |
- INC GTHk ,&ver JCN |
|
208 |
- POP2 |
|
209 |
- |
|
210 |
-JMP2r |
|
211 |
- |
|
212 |
-@draw-short ( short* -- ) |
|
213 |
- |
|
214 |
- SWP ,draw-byte JSR |
|
215 |
- |
|
216 |
-@draw-byte ( byte color -- ) |
|
217 |
- |
|
218 |
- DUP #04 SFT ,draw-hex JSR #0f AND |
|
219 |
- |
|
220 |
-@draw-hex ( char color -- ) |
|
221 |
- |
|
222 |
- #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 |
|
223 |
- #03 .Screen/sprite DEO |
|
224 |
- |
|
225 |
-JMP2r |
|
226 |
- |
|
227 |
-@within-rect ( x* y* rect -- flag ) |
|
228 |
- |
|
229 |
- STH |
|
230 |
- ( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN |
|
231 |
- ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN |
|
232 |
- SWP2 |
|
233 |
- ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN |
|
234 |
- ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN |
|
235 |
- POP2 POP2 POPr |
|
236 |
- #01 |
|
237 |
-JMP2r |
|
238 |
- &skip |
|
239 |
- POP2 POP2 POPr |
|
240 |
- #00 |
|
241 |
- |
|
242 |
-JMP2r |
|
243 |
- |
|
244 |
-@mclr ( addr* len* -- ) |
|
245 |
- |
|
246 |
- OVR2 ADD2 SWP2 |
|
247 |
- &loop |
|
248 |
- STH2k #00 STH2r STA |
|
249 |
- INC2 GTH2k ,&loop JCN |
|
250 |
- POP2 POP2 |
|
251 |
- |
|
252 |
-JMP2r |
|
253 |
- |
|
254 |
-@mcpy ( src* dst* len* -- ) |
|
255 |
- |
|
256 |
- SWP2 STH2 |
|
257 |
- OVR2 ADD2 SWP2 |
|
258 |
- &loop |
|
259 |
- LDAk STH2kr STA INC2r |
|
260 |
- INC2 GTH2k ,&loop JCN |
|
261 |
- POP2 POP2 |
|
262 |
- POP2r |
|
263 |
- |
|
264 |
-JMP2r |
|
265 |
- |
|
266 |
-@cursor |
|
267 |
- 80c0 e0f0 f8e0 1000 |
|
268 |
- |
|
269 |
-@font-hex |
|
270 |
- 7c82 8282 8282 7c00 |
|
271 |
- 3010 1010 1010 3800 |
|
272 |
- 7c82 027c 8080 fe00 |
|
273 |
- 7c82 021c 0282 7c00 |
|
274 |
- 2242 82fe 0202 0200 |
|
275 |
- fe80 807c 0282 7c00 |
|
276 |
- 7c82 80fc 8282 7c00 |
|
277 |
- fe82 0408 0810 1000 |
|
278 |
- 7c82 827c 8282 7c00 |
|
279 |
- 7c82 827e 0202 0200 |
|
280 |
- 7c82 82fe 8282 8200 |
|
281 |
- fc82 82fc 8282 fc00 |
|
282 |
- 7c82 8080 8082 7c00 |
|
283 |
- fc82 8282 8282 fc00 |
|
284 |
- fe80 80f0 8080 fe00 |
|
285 |
- fe80 80f0 8080 8000 |
|
286 |
- |
|
287 |
-@bank1 $1000 @bank2 |
288 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,155 +0,0 @@ |
1 |
-( thue interpreter |
|
2 |
- usage: thue.rom demo.t ) |
|
3 |
- |
|
4 |
-|10 @Console &vector $2 &read $1 &pad $5 &write $1 |
|
5 |
-|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
6 |
- |
|
7 |
-|0000 |
|
8 |
- |
|
9 |
-@src $40 |
|
10 |
-@ptr $2 |
|
11 |
-@len $2 |
|
12 |
- |
|
13 |
-|0100 ( -> ) |
|
14 |
- |
|
15 |
- ;on-console .Console/vector DEO2 |
|
16 |
- |
|
17 |
-BRK |
|
18 |
- |
|
19 |
-@on-console ( -> ) |
|
20 |
- |
|
21 |
- ;src STH2 |
|
22 |
- |
|
23 |
- ( read ) |
|
24 |
- .Console/read DEI |
|
25 |
- DUP #20 LTH OVR #7f GTH ORA ,&end JCN |
|
26 |
- STH2kr ;slen JSR2 #003f GTH2 ,&end JCN |
|
27 |
- STH2r ;sput JSR2 BRK |
|
28 |
- &end |
|
29 |
- POP |
|
30 |
- |
|
31 |
- ( parse ) |
|
32 |
- STH2r .File/name DEO2 |
|
33 |
- #0001 .File/length DEO2 |
|
34 |
- ;program .ptr STZ2 |
|
35 |
- &s |
|
36 |
- ;&buf .File/read DEO2 |
|
37 |
- .File/success DEI2 #0000 EQU2 ,&eof JCN |
|
38 |
- [ LIT &buf $1 ] ;walk JSR2 |
|
39 |
- ,&s JMP |
|
40 |
- &eof |
|
41 |
- |
|
42 |
- ( assemble ) |
|
43 |
- ;program/assembly .ptr STZ2 |
|
44 |
- ;program |
|
45 |
- &w |
|
46 |
- ( save ) DUP2 .ptr LDZ2 STA2 |
|
47 |
- ( incr ) .ptr LDZ2k INC2 INC2 ROT STZ2 |
|
48 |
- ( next ) &eos INC2 LDAk ,&eos JCN INC2 |
|
49 |
- LDAk ,&w JCN |
|
50 |
- |
|
51 |
- ( save acc ) |
|
52 |
- INC2 ;program/accumulator ;scpy JSR2 |
|
53 |
- |
|
54 |
- ( run ) |
|
55 |
- &eval ,step JSR ,&eval JCN |
|
56 |
- #010f DEO |
|
57 |
- |
|
58 |
-BRK |
|
59 |
- |
|
60 |
-@step ( -- done ) |
|
61 |
- |
|
62 |
- ;program/assembly |
|
63 |
- &while |
|
64 |
- DUP2 ;run-rule JSR2 ,&found JCN |
|
65 |
- #0004 ADD2 LDA2k ORA ,&while JCN |
|
66 |
- POP2 |
|
67 |
- #00 |
|
68 |
- |
|
69 |
-JMP2r |
|
70 |
- &found #01 JMP2r |
|
71 |
- |
|
72 |
-@walk ( char -- ) |
|
73 |
- |
|
74 |
- .ptr LDZ2 STA |
|
75 |
- |
|
76 |
- ( check for left-side ) |
|
77 |
- .ptr LDZ2 #0002 SUB2 ;&marker ;scmp JSR2 #01 NEQ ,&no-marker JCN |
|
78 |
- #00 .ptr LDZ2 #0002 SUB2 STA |
|
79 |
- .ptr LDZ2k #0002 SUB2 ROT STZ2 |
|
80 |
- .len LDZ2k INC2 ROT STZ2 |
|
81 |
- &no-marker |
|
82 |
- ( check for right-side ) |
|
83 |
- .ptr LDZ2 LDA #0a NEQ ,&no-lb JCN |
|
84 |
- #00 .ptr LDZ2 STA |
|
85 |
- &no-lb |
|
86 |
- .ptr LDZ2k INC2 ROT STZ2 |
|
87 |
- |
|
88 |
-JMP2r |
|
89 |
- &marker "::= $1 |
|
90 |
- |
|
91 |
-@run-rule ( rule* -- ) |
|
92 |
- |
|
93 |
- LDA2k ,&a STR2 |
|
94 |
- INC2 INC2 LDA2 ,&b STR2 |
|
95 |
- |
|
96 |
- ;program/accumulator |
|
97 |
- &w |
|
98 |
- [ LIT2 &a $2 ] OVR2 ;sseg JSR2 #01 NEQ ,&no-found JCN |
|
99 |
- ,&b LDR2 LDA LIT "~ EQU ,&output JCN |
|
100 |
- ( shift ) DUP2 [ ,&b LDR2 ;slen JSR2 ,&a LDR2 ;slen JSR2 SUB2 ] ;ssft JSR2 |
|
101 |
- ( write ) [ LIT2 &b $2 ] SWP2 OVR2 ;slen JSR2 ;mcpy JSR2 |
|
102 |
- POP2 #01 JMP2r |
|
103 |
- &no-found |
|
104 |
- INC2 LDAk ,&w JCN |
|
105 |
- POP2 |
|
106 |
- #00 |
|
107 |
- |
|
108 |
-JMP2r |
|
109 |
- &output |
|
110 |
- ,&a LDR2 ;slen JSR2 #0000 SWP2 SUB2 ;ssft JSR2 |
|
111 |
- POP2 ,&b LDR2 INC2 |
|
112 |
- LDAk LIT "` NEQ ,&no-lb JCN |
|
113 |
- #0a18 DEO #01 JMP2r |
|
114 |
- &no-lb |
|
115 |
- ,print-str JSR #01 |
|
116 |
- JMP2r |
|
117 |
- |
|
118 |
-@print-str ( str* -- ) |
|
119 |
- |
|
120 |
- &while |
|
121 |
- LDAk #18 DEO |
|
122 |
- INC2 LDAk ,&while JCN |
|
123 |
- POP2 |
|
124 |
- |
|
125 |
-JMP2r |
|
126 |
- |
|
127 |
-@ssft ( str* len* -- ) |
|
128 |
- |
|
129 |
- STH2 DUP2k ;slen JSR2 ADD2 STH2r |
|
130 |
- DUP2 #8000 GTH2 ,&l JCN |
|
131 |
- ORAk ,&r JCN |
|
132 |
- POP2 POP2 POP2 |
|
133 |
- |
|
134 |
-JMP2r |
|
135 |
- &l #8000 SWP2 SUB2 #8000 ADD2 ,msfl JSR JMP2r |
|
136 |
- &r ,msfr JSR JMP2r |
|
137 |
- |
|
138 |
-( stdlib ) |
|
139 |
- |
|
140 |
-@mcpy ( src* dst* len* -- ) SWP2 STH2 OVR2 ADD2 SWP2 &l LDAk STH2kr STA INC2r INC2 GTH2k ,&l JCN POP2 POP2 POP2r JMP2r |
|
141 |
-@msfl ( b* a* len* -- ) STH2 SWP2 EQU2k ,&e JCN &l DUP2k STH2kr ADD2 LDA ROT ROT STA INC2 GTH2k ,&l JCN POP2 POP2 &e POP2r JMP2r |
|
142 |
-@msfr ( b* a* len* -- ) STH2 EQU2k ,&e JCN &l DUP2 LDAk ROT ROT STH2kr ADD2 STA #0001 SUB2 LTH2k ,&l JCN POP2 POP2 &e POP2r JMP2r |
|
143 |
- |
|
144 |
-@scap ( str* -- end* ) LDAk #00 NEQ JMP JMP2r &w INC2 LDAk ,&w JCN JMP2r |
|
145 |
-@sput ( chr str* -- ) ,scap JSR STA JMP2r |
|
146 |
-@slen ( str* -- len* ) DUP2 ,scap JSR SWP2 SUB2 JMP2r |
|
147 |
-@scpy ( src* dst* -- ) STH2 &w LDAk STH2kr STA INC2r INC2 LDAk ,&w JCN POP2 #00 STH2r STA JMP2r |
|
148 |
-@scmp ( a* b* -- f ) STH2 &l LDAk LDAkr STHr ANDk #00 EQU ,&e JCN NEQk ,&e JCN POP2 INC2 INC2r ,&l JMP &e NIP2 POP2r EQU JMP2r |
|
149 |
-@sseg ( a* b* -- f ) STH2 &l LDAk LDAkr STHr NEQ ,&e JCN INC2k LDA #00 EQU ,&e JCN INC2 INC2r ,&l JMP &e LDA LDAr STHr EQU JMP2r |
|
150 |
- |
|
151 |
-$10 |
|
152 |
- |
|
153 |
-@program $4000 |
|
154 |
- &assembly $4000 |
|
155 |
- &accumulator $4000 |