Deriving a new dialect of Very Tiny Language from VTL-2 6800 version
修订版 | 465daf7e916d442d4f51b9638be410a50fef25a0 (tree) |
---|---|
时间 | 2022-10-02 21:15:47 |
作者 | Joel Matthew Rees <joel.rees@gmai...> |
Commiter | Joel Matthew Rees |
the rest of the wandered files
@@ -0,0 +1,742 @@ | ||
1 | + OPT 6801 | |
2 | +* VTL-2 for 6801 | |
3 | +* V-3.6 | |
4 | +* 9-23-76 | |
5 | +* BY GARY SHANNON | |
6 | +* & FRANK MCCOY | |
7 | +* COPYWRIGHT 1976, THE COMPUTER STORE | |
8 | +* | |
9 | +* Modifications for 6803-based MC-10 | |
10 | +* including moving variables out of direct page, etc. | |
11 | +* by Joel Matthew Rees | |
12 | +* Copyright 2022, Joel Matthew Rees | |
13 | +* | |
14 | +* Modifications explained at | |
15 | +* https://joels-programming-fun.blogspot.com/2022/08/trs-mc-10-assembly-lang-pt1-vtl-2.html | |
16 | +* | |
17 | +* DEFINE LOCATIONS IN MONITOR | |
18 | +* INCH EQU $FF00 ; per VTL.ASM | |
19 | +* EINCH EQU $F012 ; exorsim mdos Input byte with echo unless AECHO is set | |
20 | +* INCH EQU $F015 ; exorsim mdos Input char with echo (F012 -> strip bit 7) | |
21 | +* POLCAT EQU $FF24 ; from VTL.ASM | |
22 | +* OUTCH EQU $FF81 ; from VTL.ASM | |
23 | +* EOUTCH EQU $F018 ; exorsim mdos Output character with NULs | |
24 | +* OUTS EQU $FF82 ; from VTL.ASM | |
25 | +* EPCRLF EQU $F021 ; Primarily for forced initialization in exorsim. | |
26 | +* | |
27 | +* FOR SBC6800: | |
28 | +*BREAK EQU $1B ; BREAK KEY | |
29 | +* For MC-10: | |
30 | +BREAK EQU $03 | |
31 | +* For exorsim | |
32 | +*ACIACS EQU $FCF4 ; exorcisor | |
33 | +*ACIADA EQU $FCF5 ; exorcisor | |
34 | +* | |
35 | +* A few interpreter variables in the direct page won't hurt. | |
36 | +* (Yes, I can hear voices of complaint that it's not as "tight" as it could be.) | |
37 | +* (This allows us to save more ROM space and uses DP that would otherwise go wasted.) | |
38 | +* (Trade-offs.) | |
39 | +* (It also helps us understand the code, so we can do a better 6809 transliteration.) | |
40 | +* (I hope the names are meaningful.) | |
41 | +* | |
42 | +* In .c10 format, the following as ORG and RMBs will cause object code output, | |
43 | +* which will prevent the code from loading. | |
44 | +* Changed to EQU for the MC10. | |
45 | +* ORG $C0 ; Move this according to your environment's needs. | |
46 | +DPBASE EQU $C0 ; Change this to move the registers. | |
47 | +* PARSET RMB 2 ; Instead of SAVE0 in TERM/NXTRM | |
48 | +PARSET EQU DPBASE+2 | |
49 | +* CVTSUM RMB 2 ; Instead of SAVE1 in CBLOOP | |
50 | +CVTSUM EQU PARSET+2 | |
51 | +* MLDVCT EQU CVTSUM ; Instead of SAVE1 in mul/div (1 byte only) | |
52 | +MLDVCT EQU CVTSUM | |
53 | +* DIVQUO RMB 2 ; Instead of SAVE2 in DIV | |
54 | +DIVQUO EQU MLDVCT+2 | |
55 | +* MPLIER EQU DIVQUO ; Instead of SAVE2 in MULTIP | |
56 | +MPLIER EQU DIVQUO | |
57 | +* EVALPT RMB 2 ; Instead of SAVE3 | |
58 | +EVALPT EQU MPLIER+2 | |
59 | +* CNVPTR RMB 2 ; Instead of SAVE4 | |
60 | +CNVPTR EQU EVALPT+2 | |
61 | +* VARADR RMB 2 ; Instead of SAVE6 | |
62 | +VARADR EQU CNVPTR+2 | |
63 | +* OPRLIN RMB 2 ; Instead of SAVE7 | |
64 | +OPRLIN EQU VARADR+2 | |
65 | +* EDTLIN RMB 2 ; Instead of SAVE8 | |
66 | +EDTLIN EQU OPRLIN+2 | |
67 | +* INSPTR RMB 2 ; Instead of SAVE10 (maybe? Will some VTL programs want it back?) | |
68 | +INSPTR EQU EDTLIN+2 | |
69 | +* SAVLIN RMB 2 ; Instead of SAVE11 | |
70 | +SAVLIN EQU INSPTR+2 | |
71 | +* SRC RMB 2 ; For copy routine | |
72 | +SRC EQU SAVLIN+2 | |
73 | +* DST RMB 2 ; ditto | |
74 | +DST EQU SRC+2 | |
75 | +STKMRK EQU DST+2 ; to restore the stack on each pass. | |
76 | +DPALLOC EQU STKMRK+2 ; total storage declared in the direct page | |
77 | +* | |
78 | +* SET ASIDE FOUR BYTES FOR USER | |
79 | +* DEFINED INTERUPT ROUTINE IF NEEDED | |
80 | + ORG $4300 | |
81 | +* ZERO must be set at even $100 boundary for address math to work. | |
82 | +ZERO RMB 4 ; INTERUPT VECTOR | |
83 | +AT RMB 2 ; CANCEL & C-R | |
84 | +* | |
85 | +* GENERAL PURPOSE STORRGE | |
86 | +VARS RMB 52 ; VARIABLES(A-Z) | |
87 | +BRAK RMB 2 ; [ | |
88 | +* SAVE10 has me worried about implicit linkage in VTL programs. Might need to leave it here. | |
89 | +SAVE10 RMB 2 ; BACK SLASH | |
90 | +BRIK RMB 2 ; ] | |
91 | +UP RMB 2 ; ^ | |
92 | +SAVE11 RMB 2 ; Need something in each SAVE to reserve space | |
93 | +* ; to keep the math straight. | |
94 | +* ; Leave the SAVEs declared as they are. | |
95 | +* | |
96 | +SAVE14 RMB 2 ; SPACE (originally unused) | |
97 | +EXCL RMB 2 ; ! | |
98 | +QUOTE RMB 2 ; " | |
99 | +DOLR RMB 2 ; # | |
100 | +DOLLAR RMB 2 ; $ | |
101 | +REMN RMB 2 ; % | |
102 | +AMPR RMB 2 ; & | |
103 | +QUITE RMB 2 ; ' | |
104 | +PAREN RMB 2 ; ( | |
105 | +PARIN RMB 2 ; ) | |
106 | +STAR RMB 2 ; * | |
107 | +PLUS RMB 2 ; + | |
108 | +COMA RMB 2 ; , | |
109 | +MINS RMB 2 ; - | |
110 | +PERD RMB 2 ; . | |
111 | +SLASH RMB 2 ; / | |
112 | +* | |
113 | +SAVE0 RMB 2 ; unused | |
114 | +SAVE1 RMB 2 ; unused | |
115 | +SAVE2 RMB 2 ; unused | |
116 | +SAVE3 RMB 2 ; unused | |
117 | +SAVE4 RMB 2 ; unused | |
118 | +SAVE5 RMB 2 ; unused (PSH/PULX) | |
119 | +SAVE6 RMB 2 ; unused | |
120 | +SAVE7 RMB 2 ; unused | |
121 | +SAVE8 RMB 2 ; unused | |
122 | +SAVE9 RMB 2 ; unused (PSH/PULX) | |
123 | +COLN RMB 2 ; : | |
124 | +SEMI RMB 2 ; ; | |
125 | +LESS RMB 2 ; < | |
126 | +EQAL RMB 2 ; = | |
127 | +GRRT RMB 1 ; > | |
128 | +DECB_1 RMB 1 | |
129 | +* | |
130 | +DECBUF RMB 4 | |
131 | +LASTD RMB 1 | |
132 | +DELIM RMB 1 | |
133 | +LINLEN EQU 72 | |
134 | +LINBUF RMB LINLEN+1 | |
135 | +BUFOFF EQU LINBUF-ZERO ; Unmagic 87. Some assemblers will cough at this. | |
136 | +* | |
137 | + ORG $43F1 | |
138 | +STACK RMB 1 | |
139 | +* | |
140 | + ORG $4400 | |
141 | +MI RMB 4 ; INTERUPT VECTORS | |
142 | +NMI RMB 4 | |
143 | +PRGM EQU * ; PROGRAM STARTS HERE | |
144 | +* Must have some RAM here. | |
145 | +* | |
146 | + ORG $4C00 | |
147 | +* | |
148 | +* The COLD boot can be removed or ignored to restore the original behavior, | |
149 | +* but if you do that don't forget to set & (AMPR) and * (STAR) values | |
150 | +* by hand immediately after STARTing. | |
151 | +* | |
152 | +* Also, instead of PROBEing, if you know the limits for a particular ROM | |
153 | +* application, you can set STAR directly: | |
154 | +* LDX #PRGM | |
155 | +* STX AMPR | |
156 | +* LDX #RAMLIM | |
157 | +* STX STAR | |
158 | +* START ... | |
159 | +* | |
160 | +COLD STS STKMRK ; Mark the stack, | |
161 | +* LDS #STACK ; but use BASIC's stack. (S on 6800 points to next free byte.) | |
162 | +* JSR TRMINI | |
163 | + LDX #PRGM ; initialize program area base | |
164 | + STX AMPR | |
165 | + LDAA #$5A ; Probe RAM limit | |
166 | + LDAB #$A5 | |
167 | + BRA PROBET | |
168 | +PROBE STAA 0,X | |
169 | + CMPA 0,X | |
170 | + BNE NOTRAM | |
171 | + STAB 0,X | |
172 | + CMPB 0,X | |
173 | + BNE NOTRAM | |
174 | + INX ; all bits seem to be R/W. | |
175 | +PROBET CPX #COLD | |
176 | + BLO PROBE ; CPX on 6801 works right. | |
177 | +NOTRAM DEX | |
178 | + STX STAR | |
179 | +START | |
180 | +* LDS #STACK ; re-initialize at beginning of each evaluate | |
181 | + LDS STKMRK ; from mark instead of constant | |
182 | + STS SEMI ; DBG Comment this out when we no longer need to see the stack pointer BASIC gives us. | |
183 | +* NOTE: Instead of clearing A here, call PNTMSG instead of STRING? | |
184 | + CLRA ; NUL delimiter | |
185 | + LDX #OKM | |
186 | + BSR STRGT | |
187 | +* | |
188 | +LOOP CLRA | |
189 | + STAA DOLR | |
190 | + STAA DOLR+1 | |
191 | + JSR CVTLN | |
192 | + BCC STMNT ; NO LINE# THEN EXEC | |
193 | + BSR EXEC | |
194 | + BEQ START | |
195 | +* | |
196 | +LOOP2 BSR FIND ; FIND LINE | |
197 | +EQSTRT BEQ START ; IF END THEN STOP | |
198 | + LDX 0,X ; LOAD REAL LINE # | |
199 | + STX DOLR ; SAVE IT | |
200 | + LDX SAVLIN ; GET LINE | |
201 | + INX ; BUMP PAST LINE # | |
202 | + INX ; BUMP PAST LINE # | |
203 | + INX ; BUMP PAST SPACE | |
204 | + BSR EXEC ; EXECUTE IT | |
205 | + BEQ LOOP3 ; IF ZERO, CONTINUE | |
206 | + LDX SAVLIN ; FIND LINE | |
207 | + LDX 0,X ; GET IT | |
208 | + CPX DOLR ; HAS IT CHANGED? | |
209 | + BEQ LOOP3 ; IF NOT GET NEXT | |
210 | +* | |
211 | + INX ; INCREMENT OLD LINE# | |
212 | + STX EXCL ; SAVE FOR RETURN | |
213 | + BRA LOOP2 ; CONTINUE | |
214 | +* | |
215 | +LOOP3 BSR FND3 ; FIND NEXT LINE | |
216 | + BRA EQSTRT ; CONTINUE | |
217 | +* | |
218 | +EXEC STX OPRLIN ; EXECUTE LINE | |
219 | + JSR VAR2 | |
220 | + INX | |
221 | +* | |
222 | +SKIP LDAA 0,X ; GET FIRST TERM | |
223 | + BSR EVIL ; EVALUATE EXPRESSION | |
224 | +OUTX LDX DOLR ; GET LINE # | |
225 | + RTS | |
226 | +* | |
227 | +EVIL CMPA #$22 ; IF " THEN BRANCH | |
228 | + BNE EVALU | |
229 | + INX | |
230 | +STRGT JMP STRING ; TO PRINT IT | |
231 | +* | |
232 | +STMNT STX EDTLIN ; SAVE LINE # | |
233 | + STD DOLR | |
234 | + LDX DOLR | |
235 | + BNE SKP2 ; IF LINE# <> 0 | |
236 | +* | |
237 | + LDX #PRGM ; LIST PROGRAM | |
238 | +LST2 CPX AMPR ; END OF PROGRAM | |
239 | + BEQ EQSTRT | |
240 | + STX SAVLIN ; LINE # FOR CVDEC | |
241 | + LDD 0,X | |
242 | + JSR PRNT2 | |
243 | + LDX SAVLIN | |
244 | + INX | |
245 | + INX | |
246 | + JSR PNTMSG | |
247 | + JSR CRLF | |
248 | + BRA LST2 | |
249 | +* | |
250 | +NXTXT LDX SAVLIN ; GET POINTER | |
251 | + INX ; BUMP PAST LINE# | |
252 | +LOOKAG INX ; FIND END OF LINE | |
253 | + TST 0,X | |
254 | + BNE LOOKAG | |
255 | + INX | |
256 | + RTS | |
257 | +* | |
258 | +FIND LDX #PRGM ; FIND LINE | |
259 | +FND2 STX SAVLIN | |
260 | + CPX AMPR | |
261 | + BEQ RTS1 | |
262 | +* LDAA 1,X ; almost missed this. | |
263 | +* SUBA DOLR+1 ; This was necessary because no SUBD | |
264 | +* LDAA 0,X ; and CPX does not affect C flag on 6800 | |
265 | +* SBCA DOLR | |
266 | +* PSHB ; B does not seem to be in use. | |
267 | + LDD 0,X ; Use D because we think we want to keep X. | |
268 | + SUBD DOLR | |
269 | +* PULB | |
270 | + BCC SET | |
271 | +FND3 BSR NXTXT | |
272 | + BRA FND2 | |
273 | +* | |
274 | +SET LDAA #$FF ; SET NOT EQUAL | |
275 | +RTS1 RTS | |
276 | +* | |
277 | +EVALU JSR EVAL ; EVALUATE LINE | |
278 | + PSHB | |
279 | + PSHA | |
280 | + LDX OPRLIN | |
281 | + JSR CONVP | |
282 | + PULA | |
283 | + CMPB #'$ ; STRING? | |
284 | + BNE AR1 | |
285 | + PULB | |
286 | + JMP OUTCH ; THEN PRINT IT | |
287 | +AR1 SUBB #'? ; PRINT? | |
288 | + BNE AR11 ; was out of range. | |
289 | + JMP PRNT ; THEN DO IT | |
290 | +* BEQ PRNT ; When we bring it back within range. | |
291 | +AR11 INCB ; MACHINE LANGUAGE? | |
292 | + PULB | |
293 | + BNE AR2 | |
294 | + SWI ; THEN INTERUPT | |
295 | +* | |
296 | +AR2 STD 0,X ; STORE NEW VALUE | |
297 | + BNE AR2RND ; Initialize/don't get stuck on zero. | |
298 | + INCB ; Keep it known cheap. | |
299 | +* ADDD QUITE ; RANDOMIZER ; NO! Don't do this. | |
300 | +AR2RND ADDB QUITE ; RANDOMIZER ; Adding the low byte to the high byte | |
301 | + ADCA QUITE+1 ; ; is cheap but intentional. | |
302 | + STD QUITE | |
303 | + RTS | |
304 | +* | |
305 | +SKP2 BSR FIND ; FIND LINE | |
306 | + BEQ INSRT ; IF NOT THERE | |
307 | + LDX 0,X ; THEN INSERT | |
308 | + CPX DOLR ; NEW LINE | |
309 | + BNE INSRT | |
310 | +* | |
311 | + BSR NXTXT ; SETUP REGISTERS | |
312 | +* LDS SAVLIN ; FOR DELETE | |
313 | + STX SRC | |
314 | + LDX SAVLIN | |
315 | + STX DST | |
316 | +* | |
317 | +DELT LDX SRC | |
318 | + CPX AMPR ; DELETE OLD LINE | |
319 | + BEQ FITIT | |
320 | + LDAA 0,X | |
321 | + INX | |
322 | + STX SRC | |
323 | +* PSHA | |
324 | +* INX | |
325 | +* INS | |
326 | +* INS | |
327 | + LDX DST | |
328 | + STA 0,X | |
329 | + INX | |
330 | + STX DST | |
331 | + BRA DELT | |
332 | +* | |
333 | +* FITIT STS AMPR ; STORE NEW END | |
334 | +FITIT LDX DST | |
335 | + STX AMPR ; STORE NEW END | |
336 | +* | |
337 | +INSRT LDX EDTLIN ; COUNT NEW LINE LENGTH | |
338 | + LDAB #$03 | |
339 | + TST 0,X | |
340 | + BEQ GOTIT ; IF NO LINE THEN STOP | |
341 | +CNTLN INCB ; count bytes | |
342 | + INX | |
343 | + TST 0,X ; Find trailing NUL | |
344 | + BNE CNTLN | |
345 | +* | |
346 | +* Could use ABX in here, if we reorganized the code. | |
347 | +OPEN CLRA ; CALCULATE NEW END | |
348 | + ADDD AMPR | |
349 | + STD INSPTR | |
350 | + SUBD STAR | |
351 | + BCC RSTRT ; IF TOO BIG THEN STOP | |
352 | + LDX AMPR | |
353 | +* LDS INSPTR ; Remember that the 6800/6801 stack is postdecrement push. | |
354 | +* STS AMPR | |
355 | + LDD INSPTR ; (Since we're imitating stack blast.) | |
356 | + STD AMPR | |
357 | +* | |
358 | +* LDS AMPR | |
359 | + STD DST | |
360 | + INX ; SLIDE OPEN GAP | |
361 | +SLIDE DEX ; going down | |
362 | + STX SRC | |
363 | + LDAB 0,X | |
364 | +* PSHB ; stack blast it | |
365 | + LDX DST | |
366 | + STAB 0,X ; mimic 6800 push | |
367 | + DEX | |
368 | + STX DST | |
369 | + LDX SRC | |
370 | + CPX SAVLIN | |
371 | + BHI SLIDE | |
372 | +* | |
373 | +* DON LDS DOLR ; STORE LINE # | |
374 | +* STS 0,X | |
375 | +DON LDD DOLR ; STORE LINE # | |
376 | + STD 0,X ; Note MSB1st byte order implicit dependency here. | |
377 | + STX DST ; will skip by offset on store | |
378 | +* LDS EDTLIN ; GET NEW LINE | |
379 | +* DES ; pre-increment | |
380 | + LDD EDTLIN ; GET NEW LINE | |
381 | + STD SRC | |
382 | +* | |
383 | +*MOVL INX ; INSERT NEW LINE (skip over LINE # hi byte) | |
384 | +* PULB | |
385 | +* STAB 1,X ; (skips over low byte, BTW) | |
386 | +MOVL LDX SRC | |
387 | + LDAB 0,X | |
388 | + INX | |
389 | + STX SRC | |
390 | + LDX DST | |
391 | + INX ; skip over what was already stored (too tricky for words). | |
392 | + STX DST | |
393 | + STAB 1,X ; note offset store | |
394 | + BNE MOVL ; until NUL stored | |
395 | +* | |
396 | +GOTIT | |
397 | +* LDS #STACK ; Ready for a new line of input. | |
398 | + LDS STKMRK ; restore from mark | |
399 | + JMP LOOP | |
400 | +* | |
401 | +RSTRT JMP START ; warm start over | |
402 | +* | |
403 | +PRNT PULB ; PRINT DECIMAL | |
404 | +PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL | |
405 | + STX CNVPTR | |
406 | + LDX #PWRS10 | |
407 | +CVD1 PSHX | |
408 | + LDX 0,X | |
409 | + STX VARADR | |
410 | + LDX #VARADR | |
411 | + JSR DIVIDE | |
412 | + PSHA | |
413 | + LDX CNVPTR | |
414 | + LDAA DIVQUO+1 | |
415 | + ADDA #'0 | |
416 | + STAA 0,X | |
417 | + PULA | |
418 | + INX | |
419 | + STX CNVPTR | |
420 | + PULX | |
421 | + INX | |
422 | + INX | |
423 | + TST 1,X | |
424 | + BNE CVD1 | |
425 | +* | |
426 | + LDX #DECB_1 | |
427 | + COM 5,X ; ZERO SUPPRESS | |
428 | +ZRSUP INX | |
429 | + LDAB 0,X | |
430 | + CMPB #'0 | |
431 | + BEQ ZRSUP | |
432 | + COM LASTD | |
433 | +* | |
434 | +PNTMSG CLRA ; ZERO FOR DELIM | |
435 | +STRTMS STAA DELIM ; STORE DELIMTER | |
436 | +* | |
437 | +OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT | |
438 | + INX | |
439 | + CMPB DELIM | |
440 | + BEQ CTLC | |
441 | + JSR OUTCH | |
442 | + BRA OUTMSG | |
443 | +* | |
444 | +CTLC JSR POLCAT ; POL FOR CHARACTER | |
445 | + BCC RTS2 | |
446 | + BSR INCH2 | |
447 | + CMPB #BREAK ; BREAK KEY? | |
448 | + BEQ RSTRT | |
449 | +* | |
450 | +INCH2 JMP INCH | |
451 | +* | |
452 | +STRING BSR STRTMS ; PRINT STRING LITERAL | |
453 | + LDAA 0,X | |
454 | + CMPA #'; | |
455 | + BEQ OUTD | |
456 | + JMP CRLF | |
457 | +* | |
458 | +EVAL BSR GETVAL ; EVALUATE EXPRESSION | |
459 | +* | |
460 | +NXTRM PSHA | |
461 | + LDAA 0,X ; END OF LINE? | |
462 | + BEQ OUTN | |
463 | + CMPA #') | |
464 | +OUTN PULA | |
465 | + BEQ OUTD | |
466 | + BSR TERM | |
467 | + LDX PARSET | |
468 | + BRA NXTRM | |
469 | +* | |
470 | +TERM PSHA ; GET VALUE | |
471 | + PSHB | |
472 | + LDAA 0,X | |
473 | + PSHA | |
474 | + INX | |
475 | + BSR GETVAL | |
476 | + STD EVALPT | |
477 | + STX PARSET | |
478 | + LDX #EVALPT | |
479 | + PULA | |
480 | + PULB | |
481 | +* | |
482 | + CMPA #'* ; SEE IF * | |
483 | + BNE EVAL2 | |
484 | + PULA ; MULTIPLY | |
485 | +MULTIP STD MPLIER ; 2'S COMPLEMENT | |
486 | + LDAB #$10 | |
487 | + STAB MLDVCT | |
488 | + CLRA | |
489 | + CLRB | |
490 | +* | |
491 | +MULT LSR MPLIER | |
492 | + ROR MPLIER+1 | |
493 | + BCC NOAD | |
494 | +MULTI ADDD 0,X | |
495 | +NOAD ASL 1,X | |
496 | + ROL 0,X | |
497 | + DEC MLDVCT | |
498 | + BNE MULT ; LOOP TIL DONE | |
499 | +RTS2 RTS | |
500 | +* | |
501 | +GETVAL JSR CVBIN ; GET VALUE | |
502 | + BCC OUTV | |
503 | + CMPB #'? ; OF LITERAL | |
504 | + BNE VAR | |
505 | + PSHX ; OR INPUT | |
506 | + JSR INLN | |
507 | + BSR EVAL | |
508 | + PULX | |
509 | +OUTD INX | |
510 | +OUTV RTS | |
511 | +* | |
512 | +VAR CMPB #'$ ; OR STRING | |
513 | + BNE VAR1 | |
514 | + BSR INCH2 | |
515 | + CLRA | |
516 | + INX | |
517 | + RTS | |
518 | +* | |
519 | +VAR1 CMPB #'( | |
520 | + BNE VAR2 | |
521 | + INX | |
522 | + BRA EVAL | |
523 | +* | |
524 | +VAR2 BSR CONVP ; OR VARIABLE | |
525 | + LDD 0,X ; OR ARRAY ELEMENT | |
526 | + LDX VARADR ; LOAD OLD INDEX | |
527 | + RTS | |
528 | +* | |
529 | +ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT | |
530 | + ASLD | |
531 | + ADDD AMPR | |
532 | + BRA PACK | |
533 | +* | |
534 | +CONVP LDAB 0,X ; GET LOCATION | |
535 | + INX | |
536 | + PSHB | |
537 | + CMPB #': | |
538 | + BEQ ARRAY ; OF VARIABLE OR | |
539 | + CLRA ; ARRAY ELEMENT | |
540 | + ANDB #$3F ; mask out-of-variable-range | |
541 | + ADDB #$02 ; bump past "interrupt vectors" | |
542 | + ASLB ; make into offset (would be address in DP in original) | |
543 | + ADDD #ZERO ; The 6801 can do this right. | |
544 | +* | |
545 | +PACK STX VARADR ; STORE OLD INDEX | |
546 | + STD CNVPTR | |
547 | + LDX CNVPTR ; LOAD NEW INDEX | |
548 | + PULB | |
549 | + RTS | |
550 | +* | |
551 | +EVAL2 CMPA #'+ ; ADDITION | |
552 | + BNE EVAL3 | |
553 | + PULA | |
554 | +ADD ADDD 0,X | |
555 | + RTS | |
556 | +* | |
557 | +EVAL3 CMPA #'- ; SUBTRACTION | |
558 | + BNE EVAL4 | |
559 | + PULA | |
560 | +SUBTR SUBD 0,X | |
561 | + RTS | |
562 | +* | |
563 | +EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE | |
564 | + BNE EVAL5 | |
565 | + PULA | |
566 | + BSR DIVIDE | |
567 | + STD REMN | |
568 | + LDD DIVQUO | |
569 | + RTS | |
570 | +* | |
571 | +EVAL5 SUBA #'= ; SEE IF EQUAL TEST | |
572 | + BNE EVAL6 | |
573 | + PULA | |
574 | + SUBD 0,X | |
575 | + BNE NOTEQ | |
576 | + TSTB | |
577 | + BEQ EQL | |
578 | +NOTEQ LDAB #$FF | |
579 | +EQL BRA COMBOUT | |
580 | +* | |
581 | +EVAL6 DECA ; SEE IF LESS THAN TEST | |
582 | + PULA | |
583 | + BEQ EVAL7 | |
584 | +* | |
585 | +SUB2 SUBD 0,X | |
586 | + ROLB | |
587 | +COMOUT CLRA | |
588 | + ANDB #$01 | |
589 | + RTS | |
590 | +* | |
591 | +EVAL7 BSR SUB2 ; GT TEST | |
592 | +COMBOUT COMB | |
593 | + BRA COMOUT | |
594 | +* | |
595 | +PWRS10 FCB $27 ; 10000 | |
596 | + FCB $10 | |
597 | + FCB $03 ; 1000 | |
598 | + FCB $E8 | |
599 | + FCB $00 ; 100 | |
600 | + FCB $64 | |
601 | + FCB $00 ; 10 | |
602 | + FCB $0A | |
603 | + FCB $00 ; 1 | |
604 | + FCB $01 | |
605 | +* | |
606 | +DIVIDE CLR MLDVCT ; DEVIDE 16-BITS | |
607 | +GOT INC MLDVCT | |
608 | + ASL 1,X | |
609 | + ROL 0,X | |
610 | + BCC GOT | |
611 | + ROR 0,X | |
612 | + ROR 1,X | |
613 | + CLR DIVQUO | |
614 | + CLR DIVQUO+1 | |
615 | +DIV2 SUBD 0,X | |
616 | + BCC OK | |
617 | + ADDD 0,X | |
618 | + CLC | |
619 | + BRA DIVNOC ; instead of the trick | |
620 | +* The 6801 CPX affects all relevant flags, can't use this trick. | |
621 | +* FCB $9C ; CPX | |
622 | +OK SEC ; $0D | |
623 | +DIVNOC ROL DIVQUO+1 | |
624 | + ROL DIVQUO | |
625 | + DEC MLDVCT | |
626 | + BEQ DONE | |
627 | + LSR 0,X | |
628 | + ROR 1,X | |
629 | + BRA DIV2 | |
630 | +* | |
631 | +TSTN LDAB 0,X ; TEST FOR NUMERIC | |
632 | + CMPB #$3A | |
633 | + BPL NOTDEC | |
634 | + CMPB #'0 | |
635 | + BGE DONE | |
636 | +NOTDEC SEC | |
637 | + RTS | |
638 | +DONE CLC | |
639 | +DUN RTS | |
640 | +* | |
641 | +CVTLN BSR INLN | |
642 | +* | |
643 | +CVBIN BSR TSTN ; CONVERT TO BINARY | |
644 | + BCS DUN | |
645 | +CONT CLRA | |
646 | + CLRB | |
647 | +CBLOOP ADDB 0,X | |
648 | + ADCA #$00 | |
649 | + SUBB #'0 | |
650 | + SBCA #$00 | |
651 | + STD CVTSUM | |
652 | + INX | |
653 | + PSHB | |
654 | + BSR TSTN | |
655 | + PULB | |
656 | + BCS DONE | |
657 | + ASLD | |
658 | + ASLD | |
659 | + ADDD CVTSUM | |
660 | + ASLD | |
661 | + BRA CBLOOP | |
662 | +* | |
663 | +INLN6 CMPB #'@ ; CANCEL | |
664 | + BEQ NEWLIN | |
665 | + INX ; '.' | |
666 | + CPX #ZERO+LINLEN+2 ; (Here's part of what we had to fix for moving the variables.) | |
667 | + BNE INLN2 | |
668 | +NEWLIN BSR CRLF | |
669 | +* | |
670 | +INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL | |
671 | +INLN5 DEX | |
672 | + CPX #ZERO ; Make this explicit to enable variables moved out of DP. | |
673 | + BEQ NEWLIN ; (Was implicit zero compare X from DEX, now explicit.) | |
674 | +INLN2 JSR INCH ; INPUT CHARACTER | |
675 | + STAB BUFOFF-1,X ; STORE IT | |
676 | + CMPB #$5F ; BACKSPACE? | |
677 | + BEQ INLN5 | |
678 | +* | |
679 | +INLIN3 CMPB #$0D ; CARRIAGE RETURN | |
680 | + BMI INLN2 | |
681 | + BNE INLN6 | |
682 | +* | |
683 | +INLIN4 CLR BUFOFF-1,X ; CLEAR LAST CHAR | |
684 | + LDX #LINBUF | |
685 | + BRA LF | |
686 | +* | |
687 | +* CRLF JSR EPCRLF | |
688 | +CRLF LDAB #$0D ; CARR-RET | |
689 | + BSR OUTCH2 | |
690 | +LF LDAB #$0A ; LINE FEED | |
691 | +OUTCH2 BRA OUTCH | |
692 | +* | |
693 | +OKM FCB $0D | |
694 | + FCB $0A | |
695 | + FCC 'OK' | |
696 | + FCB $00 | |
697 | +* | |
698 | +*TRMINI LDAB #40 | |
699 | +*TRMILP JSR EPCRLF | |
700 | +* DECB | |
701 | +* BNE TRMILP | |
702 | +* RTS | |
703 | +* | |
704 | +* MC-10 BASIC ROM vectors | |
705 | +INCHV EQU $FFDC ; Scan keyboard | |
706 | +OUTCHV EQU $FFDE ; Write char to screen | |
707 | +* | |
708 | +* RECEIVER POLLING | |
709 | +POLCAT PSHA | |
710 | + PSHX | |
711 | + LDX INCHV ; at any rate, don't wait. | |
712 | + JSR 0,X ; | |
713 | + TAB ; MC-10 ROM says NUL is not input. | |
714 | + SEC | |
715 | + BNE POLCATR ; Don't wait. | |
716 | + CLC | |
717 | +POLCATR PULX | |
718 | + PULA | |
719 | + RTS | |
720 | +*POLCAT LDAB ACIACS | |
721 | +* ASRB | |
722 | +* RTS | |
723 | +* | |
724 | +* INPUT ONE CHAR INTO B ACCUMULATOR | |
725 | +INCH BSR POLCAT | |
726 | + BCC INCH ; Wait here. | |
727 | + BSR OUTCH | |
728 | + RTS | |
729 | +* | |
730 | +* OUTPUT ONE CHAR | |
731 | +OUTCH PSHA | |
732 | + PSHX | |
733 | + LDX OUTCHV | |
734 | + TBA | |
735 | + JSR 0,X | |
736 | + PULX | |
737 | + PULA | |
738 | + RTS | |
739 | +* | |
740 | + ORG COLD | |
741 | +* | |
742 | + END |
@@ -0,0 +1,825 @@ | ||
1 | + | |
2 | +***** pass 1 on VTL_6801_mc10.asm ***** | |
3 | + | |
4 | +***** pass 1 on VTL_6801_mc10.asm done ***** | |
5 | + | |
6 | + | |
7 | +***** pass 2 on VTL_6801_mc10.asm ***** | |
8 | + 1 OPT 6801 | |
9 | + 2 * VTL-2 for 6801 | |
10 | + 3 * V-3.6 | |
11 | + 4 * 9-23-76 | |
12 | + 5 * BY GARY SHANNON | |
13 | + 6 * & FRANK MCCOY | |
14 | + 7 * COPYWRIGHT 1976, THE COMPUTER STORE | |
15 | + 8 * | |
16 | + 9 * Modifications for 6803-based MC-10 | |
17 | + 10 * including moving variables out of direct page, etc. | |
18 | + 11 * by Joel Matthew Rees | |
19 | + 12 * Copyright 2022, Joel Matthew Rees | |
20 | + 13 * | |
21 | + 14 * Modifications explained at | |
22 | + 15 * https://joels-programming-fun.blogspot.com/2022/08/trs | |
23 | + 16 * | |
24 | + 17 * DEFINE LOCATIONS IN MONITOR | |
25 | + 18 * INCH EQU $FF00 ; per VTL.ASM | |
26 | + 19 * EINCH EQU $F012 ; exorsim mdos Input byte with echo un | |
27 | + 20 * INCH EQU $F015 ; exorsim mdos Input char with echo (F0 | |
28 | + 21 * POLCAT EQU $FF24 ; from VTL.ASM | |
29 | + 22 * OUTCH EQU $FF81 ; from VTL.ASM | |
30 | + 23 * EOUTCH EQU $F018 ; exorsim mdos Output character with | |
31 | + 24 * OUTS EQU $FF82 ; from VTL.ASM | |
32 | + 25 * EPCRLF EQU $F021 ; Primarily for forced initialization | |
33 | + 26 * | |
34 | + 27 * FOR SBC6800: | |
35 | + 28 *BREAK EQU $1B ; BREAK KEY | |
36 | + 29 * For MC-10: | |
37 | + 30 0003 BREAK EQU $03 | |
38 | + 31 * For exorsim | |
39 | + 32 *ACIACS EQU $FCF4 ; exorcisor | |
40 | + 33 *ACIADA EQU $FCF5 ; exorcisor | |
41 | + 34 * | |
42 | + 35 * A few interpreter variables in the direct page won't h | |
43 | + 36 * (Yes, I can hear voices of complaint that it's not as | |
44 | + 37 * (This allows us to save more ROM space and uses DP tha | |
45 | + 38 * (Trade-offs.) | |
46 | + 39 * (It also helps us understand the code, so we can do a | |
47 | + 40 * (I hope the names are meaningful.) | |
48 | + 41 * | |
49 | + 42 * In .c10 format, the following as ORG and RMBs will cau | |
50 | + 43 * which will prevent the code from loading. | |
51 | + 44 * Changed to EQU for the MC10. | |
52 | + 45 * ORG $C0 ; Move this according to your environment's n | |
53 | + 46 00C0 DPBASE EQU $C0 ; Change this to move the registers. | |
54 | + 47 * PARSET RMB 2 ; Instead of SAVE0 in TERM/NXTRM | |
55 | + 48 00C2 PARSET EQU DPBASE+2 | |
56 | + 49 * CVTSUM RMB 2 ; Instead of SAVE1 in CBLOOP | |
57 | + 50 00C4 CVTSUM EQU PARSET+2 | |
58 | + 51 * MLDVCT EQU CVTSUM ; Instead of SAVE1 in mul/div (1 byt | |
59 | + 52 00C4 MLDVCT EQU CVTSUM | |
60 | + 53 * DIVQUO RMB 2 ; Instead of SAVE2 in DIV | |
61 | + 54 00C6 DIVQUO EQU MLDVCT+2 | |
62 | + 55 * MPLIER EQU DIVQUO ; Instead of SAVE2 in MULTIP | |
63 | + 56 00C6 MPLIER EQU DIVQUO | |
64 | + 57 * EVALPT RMB 2 ; Instead of SAVE3 | |
65 | + 58 00C8 EVALPT EQU MPLIER+2 | |
66 | + 59 * CNVPTR RMB 2 ; Instead of SAVE4 | |
67 | + 60 00CA CNVPTR EQU EVALPT+2 | |
68 | + 61 * VARADR RMB 2 ; Instead of SAVE6 | |
69 | + 62 00CC VARADR EQU CNVPTR+2 | |
70 | + 63 * OPRLIN RMB 2 ; Instead of SAVE7 | |
71 | + 64 00CE OPRLIN EQU VARADR+2 | |
72 | + 65 * EDTLIN RMB 2 ; Instead of SAVE8 | |
73 | + 66 00D0 EDTLIN EQU OPRLIN+2 | |
74 | + 67 * INSPTR RMB 2 ; Instead of SAVE10 (maybe? Will some VTL | |
75 | + 68 00D2 INSPTR EQU EDTLIN+2 | |
76 | + 69 * SAVLIN RMB 2 ; Instead of SAVE11 | |
77 | + 70 00D4 SAVLIN EQU INSPTR+2 | |
78 | + 71 * SRC RMB 2 ; For copy routine | |
79 | + 72 00D6 SRC EQU SAVLIN+2 | |
80 | + 73 * DST RMB 2 ; ditto | |
81 | + 74 00D8 DST EQU SRC+2 | |
82 | + 75 00DA STKMRK EQU DST+2 ; to restore the stack on each pass. | |
83 | + 76 00DC DPALLOC EQU STKMRK+2 ; total storage declared in the dir | |
84 | + 77 * | |
85 | + 78 * SET ASIDE FOUR BYTES FOR USER | |
86 | + 79 * DEFINED INTERUPT ROUTINE IF NEEDED | |
87 | + 80 ORG $4300 | |
88 | + 81 * ZERO must be set at even $100 boundary for address mat | |
89 | + 82 4300 00 00 00 00 | |
90 | + ZERO RMB 4 ; INTERUPT VECTOR | |
91 | + 83 4304 00 00 AT RMB 2 ; CANCEL & C-R | |
92 | + 84 * | |
93 | + 85 * GENERAL PURPOSE STORRGE | |
94 | + 86 4306 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
95 | + 431A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
96 | + 432E 00 00 00 00 00 00 00 00 00 00 00 00 | |
97 | + VARS RMB 52 ; VARIABLES(A-Z) | |
98 | + 87 433A 00 00 BRAK RMB 2 ; [ | |
99 | + 88 * SAVE10 has me worried about implicit linkage in VTL pr | |
100 | + 89 433C 00 00 SAVE10 RMB 2 ; BACK SLASH | |
101 | + 90 433E 00 00 BRIK RMB 2 ; ] | |
102 | + 91 4340 00 00 UP RMB 2 ; ^ | |
103 | + 92 4342 00 00 SAVE11 RMB 2 ; Need something in each SAVE to reserve sp | |
104 | + 93 * ; to keep the math straight. | |
105 | + 94 * ; Leave the SAVEs declared as they are. | |
106 | + 95 * | |
107 | + 96 4344 00 00 SAVE14 RMB 2 ; SPACE (originally unused) | |
108 | + 97 4346 00 00 EXCL RMB 2 ; ! | |
109 | + 98 4348 00 00 QUOTE RMB 2 ; " | |
110 | + 99 434A 00 00 DOLR RMB 2 ; # | |
111 | + 100 434C 00 00 DOLLAR RMB 2 ; $ | |
112 | + 101 434E 00 00 REMN RMB 2 ; % | |
113 | + 102 4350 00 00 AMPR RMB 2 ; & | |
114 | + 103 4352 00 00 QUITE RMB 2 ; ' | |
115 | + 104 4354 00 00 PAREN RMB 2 ; ( | |
116 | + 105 4356 00 00 PARIN RMB 2 ; ) | |
117 | + 106 4358 00 00 STAR RMB 2 ; * | |
118 | + 107 435A 00 00 PLUS RMB 2 ; + | |
119 | + 108 435C 00 00 COMA RMB 2 ; , | |
120 | + 109 435E 00 00 MINS RMB 2 ; - | |
121 | + 110 4360 00 00 PERD RMB 2 ; . | |
122 | + 111 4362 00 00 SLASH RMB 2 ; / | |
123 | + 112 * | |
124 | + 113 4364 00 00 SAVE0 RMB 2 ; unused | |
125 | + 114 4366 00 00 SAVE1 RMB 2 ; unused | |
126 | + 115 4368 00 00 SAVE2 RMB 2 ; unused | |
127 | + 116 436A 00 00 SAVE3 RMB 2 ; unused | |
128 | + 117 436C 00 00 SAVE4 RMB 2 ; unused | |
129 | + 118 436E 00 00 SAVE5 RMB 2 ; unused (PSH/PULX) | |
130 | + 119 4370 00 00 SAVE6 RMB 2 ; unused | |
131 | + 120 4372 00 00 SAVE7 RMB 2 ; unused | |
132 | + 121 4374 00 00 SAVE8 RMB 2 ; unused | |
133 | + 122 4376 00 00 SAVE9 RMB 2 ; unused (PSH/PULX) | |
134 | + 123 4378 00 00 COLN RMB 2 ; : | |
135 | + 124 437A 00 00 SEMI RMB 2 ; ; | |
136 | + 125 437C 00 00 LESS RMB 2 ; < | |
137 | + 126 437E 00 00 EQAL RMB 2 ; = | |
138 | + 127 4380 00 GRRT RMB 1 ; > | |
139 | + 128 4381 00 DECB_1 RMB 1 | |
140 | + 129 * | |
141 | + 130 4382 00 00 00 00 | |
142 | + DECBUF RMB 4 | |
143 | + 131 4386 00 LASTD RMB 1 | |
144 | + 132 4387 00 DELIM RMB 1 | |
145 | + 133 0048 LINLEN EQU 72 | |
146 | + 134 4388 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
147 | + 439C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
148 | + 43B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
149 | + 43C4 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
150 | + LINBUF RMB LINLEN+1 | |
151 | + 135 0088 BUFOFF EQU LINBUF-ZERO ; Unmagic 87. Some assemblers wil | |
152 | + 136 * | |
153 | + 137 ORG $43F1 | |
154 | + 138 43F1 00 STACK RMB 1 | |
155 | + 139 * | |
156 | + 140 ORG $4400 | |
157 | + 141 4400 00 00 00 00 | |
158 | + MI RMB 4 ; INTERUPT VECTORS | |
159 | + 142 4404 00 00 00 00 | |
160 | + NMI RMB 4 | |
161 | + 143 4408 PRGM EQU * ; PROGRAM STARTS HERE | |
162 | + 144 * Must have some RAM here. | |
163 | + 145 * | |
164 | + 146 ORG $4C00 | |
165 | + 147 * | |
166 | + 148 * The COLD boot can be removed or ignored to restore the | |
167 | + 149 * but if you do that don't forget to set & (AMPR) and * | |
168 | + 150 * by hand immediately after STARTing. | |
169 | + 151 * | |
170 | + 152 * Also, instead of PROBEing, if you know the limits for | |
171 | + 153 * application, you can set STAR directly: | |
172 | + 154 * LDX #PRGM | |
173 | + 155 * STX AMPR | |
174 | + 156 * LDX #RAMLIM | |
175 | + 157 * STX STAR | |
176 | + 158 * START ... | |
177 | + 159 * | |
178 | + 160 4C00 9F DA COLD STS STKMRK ; Mark the stack, | |
179 | + 161 * LDS #STACK ; but use BASIC's stack. (S on 6800 points | |
180 | + 162 * JSR TRMINI | |
181 | + 163 4C02 CE 44 08 LDX #PRGM ; initialize program area base | |
182 | + 164 4C05 FF 43 50 STX AMPR | |
183 | + 165 4C08 86 5A LDAA #$5A ; Probe RAM limit | |
184 | + 166 4C0A C6 A5 LDAB #$A5 | |
185 | + 167 4C0C 20 0D BRA PROBET | |
186 | + 168 4C0E A7 00 PROBE STAA 0,X | |
187 | + 169 4C10 A1 00 CMPA 0,X | |
188 | + 170 4C12 26 0C BNE NOTRAM | |
189 | + 171 4C14 E7 00 STAB 0,X | |
190 | + 172 4C16 E1 00 CMPB 0,X | |
191 | + 173 4C18 26 06 BNE NOTRAM | |
192 | + 174 4C1A 08 INX ; all bits seem to be R/W. | |
193 | + 175 4C1B 8C 4C 00 PROBET CPX #COLD | |
194 | + 176 4C1E 25 EE BLO PROBE ; CPX on 6801 works right. | |
195 | + 177 4C20 09 NOTRAM DEX | |
196 | + 178 4C21 FF 43 58 STX STAR | |
197 | + 179 4C24 START | |
198 | + 180 * LDS #STACK ; re-initialize at beginning of each evalua | |
199 | + 181 4C24 9E DA LDS STKMRK ; from mark instead of constant | |
200 | + 182 4C26 BF 43 7A STS SEMI ; DBG Comment this out when we no longer need | |
201 | + 183 * NOTE: Instead of clearing A here, call PNTMSG instead | |
202 | + 184 4C29 4F CLRA ; NUL delimiter | |
203 | + 185 4C2A CE 4F 3E LDX #OKM | |
204 | + 186 4C2D 8D 48 BSR STRGT | |
205 | + 187 * | |
206 | + 188 4C2F 4F LOOP CLRA | |
207 | + 189 4C30 B7 43 4A STAA DOLR | |
208 | + 190 4C33 B7 43 4B STAA DOLR+1 | |
209 | + 191 4C36 BD 4E EB JSR CVTLN | |
210 | + 192 4C39 24 3F BCC STMNT ; NO LINE# THEN EXEC | |
211 | + 193 4C3B 8D 27 BSR EXEC | |
212 | + 194 4C3D 27 E5 BEQ START | |
213 | + 195 * | |
214 | + 196 4C3F 8D 68 LOOP2 BSR FIND ; FIND LINE | |
215 | + 197 4C41 27 E1 EQSTRT BEQ START ; IF END THEN STOP | |
216 | + 198 4C43 EE 00 LDX 0,X ; LOAD REAL LINE # | |
217 | + 199 4C45 FF 43 4A STX DOLR ; SAVE IT | |
218 | + 200 4C48 DE D4 LDX SAVLIN ; GET LINE | |
219 | + 201 4C4A 08 INX ; BUMP PAST LINE # | |
220 | + 202 4C4B 08 INX ; BUMP PAST LINE # | |
221 | + 203 4C4C 08 INX ; BUMP PAST SPACE | |
222 | + 204 4C4D 8D 15 BSR EXEC ; EXECUTE IT | |
223 | + 205 4C4F 27 0F BEQ LOOP3 ; IF ZERO, CONTINUE | |
224 | + 206 4C51 DE D4 LDX SAVLIN ; FIND LINE | |
225 | + 207 4C53 EE 00 LDX 0,X ; GET IT | |
226 | + 208 4C55 BC 43 4A CPX DOLR ; HAS IT CHANGED? | |
227 | + 209 4C58 27 06 BEQ LOOP3 ; IF NOT GET NEXT | |
228 | + 210 * | |
229 | + 211 4C5A 08 INX ; INCREMENT OLD LINE# | |
230 | + 212 4C5B FF 43 46 STX EXCL ; SAVE FOR RETURN | |
231 | + 213 4C5E 20 DF BRA LOOP2 ; CONTINUE | |
232 | + 214 * | |
233 | + 215 4C60 8D 58 LOOP3 BSR FND3 ; FIND NEXT LINE | |
234 | + 216 4C62 20 DD BRA EQSTRT ; CONTINUE | |
235 | + 217 * | |
236 | + 218 4C64 DF CE EXEC STX OPRLIN ; EXECUTE LINE | |
237 | + 219 4C66 BD 4E 3C JSR VAR2 | |
238 | + 220 4C69 08 INX | |
239 | + 221 * | |
240 | + 222 4C6A A6 00 SKIP LDAA 0,X ; GET FIRST TERM | |
241 | + 223 4C6C 8D 04 BSR EVIL ; EVALUATE EXPRESSION | |
242 | + 224 4C6E FE 43 4A OUTX LDX DOLR ; GET LINE # | |
243 | + 225 4C71 39 RTS | |
244 | + 226 * | |
245 | + 227 4C72 81 22 EVIL CMPA #$22 ; IF " THEN BRANCH | |
246 | + 228 4C74 26 4B BNE EVALU | |
247 | + 229 4C76 08 INX | |
248 | + 230 4C77 7E 4D CB STRGT JMP STRING ; TO PRINT IT | |
249 | + 231 * | |
250 | + 232 4C7A DF D0 STMNT STX EDTLIN ; SAVE LINE # | |
251 | + 233 4C7C FD 43 4A STD DOLR | |
252 | + 234 4C7F FE 43 4A LDX DOLR | |
253 | + 235 4C82 26 6B BNE SKP2 ; IF LINE# <> 0 | |
254 | + 236 * | |
255 | + 237 4C84 CE 44 08 LDX #PRGM ; LIST PROGRAM | |
256 | + 238 4C87 BC 43 50 LST2 CPX AMPR ; END OF PROGRAM | |
257 | + 239 4C8A 27 B5 BEQ EQSTRT | |
258 | + 240 4C8C DF D4 STX SAVLIN ; LINE # FOR CVDEC | |
259 | + 241 4C8E EC 00 LDD 0,X | |
260 | + 242 4C90 BD 4D 76 JSR PRNT2 | |
261 | + 243 4C93 DE D4 LDX SAVLIN | |
262 | + 244 4C95 08 INX | |
263 | + 245 4C96 08 INX | |
264 | + 246 4C97 BD 4D AC JSR PNTMSG | |
265 | + 247 4C9A BD 4F 36 JSR CRLF | |
266 | + 248 4C9D 20 E8 BRA LST2 | |
267 | + 249 * | |
268 | + 250 4C9F DE D4 NXTXT LDX SAVLIN ; GET POINTER | |
269 | + 251 4CA1 08 INX ; BUMP PAST LINE# | |
270 | + 252 4CA2 08 LOOKAG INX ; FIND END OF LINE | |
271 | + 253 4CA3 6D 00 TST 0,X | |
272 | + 254 4CA5 26 FB BNE LOOKAG | |
273 | + 255 4CA7 08 INX | |
274 | + 256 4CA8 39 RTS | |
275 | + 257 * | |
276 | + 258 4CA9 CE 44 08 FIND LDX #PRGM ; FIND LINE | |
277 | + 259 4CAC DF D4 FND2 STX SAVLIN | |
278 | + 260 4CAE BC 43 50 CPX AMPR | |
279 | + 261 4CB1 27 0D BEQ RTS1 | |
280 | + 262 * LDAA 1,X ; almost missed this. | |
281 | + 263 * SUBA DOLR+1 ; This was necessary because no SUBD | |
282 | + 264 * LDAA 0,X ; and CPX does not affect C flag on 6800 | |
283 | + 265 * SBCA DOLR | |
284 | + 266 * PSHB ; B does not seem to be in use. | |
285 | + 267 4CB3 EC 00 LDD 0,X ; Use D because we think we want to keep X. | |
286 | + 268 4CB5 B3 43 4A SUBD DOLR | |
287 | + 269 * PULB | |
288 | + 270 4CB8 24 04 BCC SET | |
289 | + 271 4CBA 8D E3 FND3 BSR NXTXT | |
290 | + 272 4CBC 20 EE BRA FND2 | |
291 | + 273 * | |
292 | + 274 4CBE 86 FF SET LDAA #$FF ; SET NOT EQUAL | |
293 | + 275 4CC0 39 RTS1 RTS | |
294 | + 276 * | |
295 | + 277 4CC1 BD 4D D6 EVALU JSR EVAL ; EVALUATE LINE | |
296 | + 278 4CC4 37 PSHB | |
297 | + 279 4CC5 36 PSHA | |
298 | + 280 4CC6 DE CE LDX OPRLIN | |
299 | + 281 4CC8 BD 4E 4C JSR CONVP | |
300 | + 282 4CCB 32 PULA | |
301 | + 283 4CCC C1 24 CMPB #'$ ; STRING? | |
302 | + 284 4CCE 26 04 BNE AR1 | |
303 | + 285 4CD0 33 PULB | |
304 | + 286 4CD1 7E 4F 59 JMP OUTCH ; THEN PRINT IT | |
305 | + 287 4CD4 C0 3F AR1 SUBB #'? ; PRINT? | |
306 | + 288 4CD6 26 03 BNE AR11 ; was out of range. | |
307 | + 289 4CD8 7E 4D 75 JMP PRNT ; THEN DO IT | |
308 | + 290 * BEQ PRNT ; When we bring it back within range. | |
309 | + 291 4CDB 5C AR11 INCB ; MACHINE LANGUAGE? | |
310 | + 292 4CDC 33 PULB | |
311 | + 293 4CDD 26 01 BNE AR2 | |
312 | + 294 4CDF 3F SWI ; THEN INTERUPT | |
313 | + 295 * | |
314 | + 296 4CE0 ED 00 AR2 STD 0,X ; STORE NEW VALUE | |
315 | + 297 4CE2 26 01 BNE AR2RND ; Initialize/don't get stuck on zero. | |
316 | + 298 4CE4 5C INCB ; Keep it known cheap. | |
317 | + 299 * ADDD QUITE ; RANDOMIZER ; NO! Don't do this. | |
318 | + 300 4CE5 FB 43 52 AR2RND ADDB QUITE ; RANDOMIZER ; Adding the low byte to | |
319 | + 301 4CE8 B9 43 53 ADCA QUITE+1 ; ; is cheap but intentional. | |
320 | + 302 4CEB FD 43 52 STD QUITE | |
321 | + 303 4CEE 39 RTS | |
322 | + 304 * | |
323 | + 305 4CEF 8D B8 SKP2 BSR FIND ; FIND LINE | |
324 | + 306 4CF1 27 29 BEQ INSRT ; IF NOT THERE | |
325 | + 307 4CF3 EE 00 LDX 0,X ; THEN INSERT | |
326 | + 308 4CF5 BC 43 4A CPX DOLR ; NEW LINE | |
327 | + 309 4CF8 26 22 BNE INSRT | |
328 | + 310 * | |
329 | + 311 4CFA 8D A3 BSR NXTXT ; SETUP REGISTERS | |
330 | + 312 * LDS SAVLIN ; FOR DELETE | |
331 | + 313 4CFC DF D6 STX SRC | |
332 | + 314 4CFE DE D4 LDX SAVLIN | |
333 | + 315 4D00 DF D8 STX DST | |
334 | + 316 * | |
335 | + 317 4D02 DE D6 DELT LDX SRC | |
336 | + 318 4D04 BC 43 50 CPX AMPR ; DELETE OLD LINE | |
337 | + 319 4D07 27 0E BEQ FITIT | |
338 | + 320 4D09 A6 00 LDAA 0,X | |
339 | + 321 4D0B 08 INX | |
340 | + 322 4D0C DF D6 STX SRC | |
341 | + 323 * PSHA | |
342 | + 324 * INX | |
343 | + 325 * INS | |
344 | + 326 * INS | |
345 | + 327 4D0E DE D8 LDX DST | |
346 | + 328 4D10 A7 00 STA 0,X | |
347 | + 329 4D12 08 INX | |
348 | + 330 4D13 DF D8 STX DST | |
349 | + 331 4D15 20 EB BRA DELT | |
350 | + 332 * | |
351 | + 333 * FITIT STS AMPR ; STORE NEW END | |
352 | + 334 4D17 DE D8 FITIT LDX DST | |
353 | + 335 4D19 FF 43 50 STX AMPR ; STORE NEW END | |
354 | + 336 * | |
355 | + 337 4D1C DE D0 INSRT LDX EDTLIN ; COUNT NEW LINE LENGTH | |
356 | + 338 4D1E C6 03 LDAB #$03 | |
357 | + 339 4D20 6D 00 TST 0,X | |
358 | + 340 4D22 27 49 BEQ GOTIT ; IF NO LINE THEN STOP | |
359 | + 341 4D24 5C CNTLN INCB ; count bytes | |
360 | + 342 4D25 08 INX | |
361 | + 343 4D26 6D 00 TST 0,X ; Find trailing NUL | |
362 | + 344 4D28 26 FA BNE CNTLN | |
363 | + 345 * | |
364 | + 346 * Could use ABX in here, if we reorganized the code. | |
365 | + 347 4D2A 4F OPEN CLRA ; CALCULATE NEW END | |
366 | + 348 4D2B F3 43 50 ADDD AMPR | |
367 | + 349 4D2E DD D2 STD INSPTR | |
368 | + 350 4D30 B3 43 58 SUBD STAR | |
369 | + 351 4D33 24 3D BCC RSTRT ; IF TOO BIG THEN STOP | |
370 | + 352 4D35 FE 43 50 LDX AMPR | |
371 | + 353 * LDS INSPTR ; Remember that the 6800/6801 stack is post | |
372 | + 354 * STS AMPR | |
373 | + 355 4D38 DC D2 LDD INSPTR ; (Since we're imitating stack blast.) | |
374 | + 356 4D3A FD 43 50 STD AMPR | |
375 | + 357 * | |
376 | + 358 * LDS AMPR | |
377 | + 359 4D3D DD D8 STD DST | |
378 | + 360 4D3F 08 INX ; SLIDE OPEN GAP | |
379 | + 361 4D40 09 SLIDE DEX ; going down | |
380 | + 362 4D41 DF D6 STX SRC | |
381 | + 363 4D43 E6 00 LDAB 0,X | |
382 | + 364 * PSHB ; stack blast it | |
383 | + 365 4D45 DE D8 LDX DST | |
384 | + 366 4D47 E7 00 STAB 0,X ; mimic 6800 push | |
385 | + 367 4D49 09 DEX | |
386 | + 368 4D4A DF D8 STX DST | |
387 | + 369 4D4C DE D6 LDX SRC | |
388 | + 370 4D4E 9C D4 CPX SAVLIN | |
389 | + 371 4D50 22 EE BHI SLIDE | |
390 | + 372 * | |
391 | + 373 * DON LDS DOLR ; STORE LINE # | |
392 | + 374 * STS 0,X | |
393 | + 375 4D52 FC 43 4A DON LDD DOLR ; STORE LINE # | |
394 | + 376 4D55 ED 00 STD 0,X ; Note MSB1st byte order implicit dependency he | |
395 | + 377 4D57 DF D8 STX DST ; will skip by offset on store | |
396 | + 378 * LDS EDTLIN ; GET NEW LINE | |
397 | + 379 * DES ; pre-increment | |
398 | + 380 4D59 DC D0 LDD EDTLIN ; GET NEW LINE | |
399 | + 381 4D5B DD D6 STD SRC | |
400 | + 382 * | |
401 | + 383 *MOVL INX ; INSERT NEW LINE (skip over LINE # hi byte) | |
402 | + 384 * PULB | |
403 | + 385 * STAB 1,X ; (skips over low byte, BTW) | |
404 | + 386 4D5D DE D6 MOVL LDX SRC | |
405 | + 387 4D5F E6 00 LDAB 0,X | |
406 | + 388 4D61 08 INX | |
407 | + 389 4D62 DF D6 STX SRC | |
408 | + 390 4D64 DE D8 LDX DST | |
409 | + 391 4D66 08 INX ; skip over what was already stored (too tricky fo | |
410 | + 392 4D67 DF D8 STX DST | |
411 | + 393 4D69 E7 01 STAB 1,X ; note offset store | |
412 | + 394 4D6B 26 F0 BNE MOVL ; until NUL stored | |
413 | + 395 * | |
414 | + 396 4D6D GOTIT | |
415 | + 397 * LDS #STACK ; Ready for a new line of input. | |
416 | + 398 4D6D 9E DA LDS STKMRK ; restore from mark | |
417 | + 399 4D6F 7E 4C 2F JMP LOOP | |
418 | + 400 * | |
419 | + 401 4D72 7E 4C 24 RSTRT JMP START ; warm start over | |
420 | + 402 * | |
421 | + 403 4D75 33 PRNT PULB ; PRINT DECIMAL | |
422 | + 404 4D76 CE 43 82 PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL | |
423 | + 405 4D79 DF CA STX CNVPTR | |
424 | + 406 4D7B CE 4E A2 LDX #PWRS10 | |
425 | + 407 4D7E 3C CVD1 PSHX | |
426 | + 408 4D7F EE 00 LDX 0,X | |
427 | + 409 4D81 DF CC STX VARADR | |
428 | + 410 4D83 CE 00 CC LDX #VARADR | |
429 | + 411 4D86 BD 4E AC JSR DIVIDE | |
430 | + 412 4D89 36 PSHA | |
431 | + 413 4D8A DE CA LDX CNVPTR | |
432 | + 414 4D8C 96 C7 LDAA DIVQUO+1 | |
433 | + 415 4D8E 8B 30 ADDA #'0 | |
434 | + 416 4D90 A7 00 STAA 0,X | |
435 | + 417 4D92 32 PULA | |
436 | + 418 4D93 08 INX | |
437 | + 419 4D94 DF CA STX CNVPTR | |
438 | + 420 4D96 38 PULX | |
439 | + 421 4D97 08 INX | |
440 | + 422 4D98 08 INX | |
441 | + 423 4D99 6D 01 TST 1,X | |
442 | + 424 4D9B 26 E1 BNE CVD1 | |
443 | + 425 * | |
444 | + 426 4D9D CE 43 81 LDX #DECB_1 | |
445 | + 427 4DA0 63 05 COM 5,X ; ZERO SUPPRESS | |
446 | + 428 4DA2 08 ZRSUP INX | |
447 | + 429 4DA3 E6 00 LDAB 0,X | |
448 | + 430 4DA5 C1 30 CMPB #'0 | |
449 | + 431 4DA7 27 F9 BEQ ZRSUP | |
450 | + 432 4DA9 73 43 86 COM LASTD | |
451 | + 433 * | |
452 | + 434 4DAC 4F PNTMSG CLRA ; ZERO FOR DELIM | |
453 | + 435 4DAD B7 43 87 STRTMS STAA DELIM ; STORE DELIMTER | |
454 | + 436 * | |
455 | + 437 4DB0 E6 00 OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT | |
456 | + 438 4DB2 08 INX | |
457 | + 439 4DB3 F1 43 87 CMPB DELIM | |
458 | + 440 4DB6 27 05 BEQ CTLC | |
459 | + 441 4DB8 BD 4F 59 JSR OUTCH | |
460 | + 442 4DBB 20 F3 BRA OUTMSG | |
461 | + 443 * | |
462 | + 444 4DBD BD 4F 43 CTLC JSR POLCAT ; POL FOR CHARACTER | |
463 | + 445 4DC0 24 57 BCC RTS2 | |
464 | + 446 4DC2 8D 04 BSR INCH2 | |
465 | + 447 4DC4 C1 03 CMPB #BREAK ; BREAK KEY? | |
466 | + 448 4DC6 27 AA BEQ RSTRT | |
467 | + 449 * | |
468 | + 450 4DC8 7E 4F 52 INCH2 JMP INCH | |
469 | + 451 * | |
470 | + 452 4DCB 8D E0 STRING BSR STRTMS ; PRINT STRING LITERAL | |
471 | + 453 4DCD A6 00 LDAA 0,X | |
472 | + 454 4DCF 81 3B CMPA #'; | |
473 | + 455 4DD1 27 57 BEQ OUTD | |
474 | + 456 4DD3 7E 4F 36 JMP CRLF | |
475 | + 457 * | |
476 | + 458 4DD6 8D 42 EVAL BSR GETVAL ; EVALUATE EXPRESSION | |
477 | + 459 * | |
478 | + 460 4DD8 36 NXTRM PSHA | |
479 | + 461 4DD9 A6 00 LDAA 0,X ; END OF LINE? | |
480 | + 462 4DDB 27 02 BEQ OUTN | |
481 | + 463 4DDD 81 29 CMPA #') | |
482 | + 464 4DDF 32 OUTN PULA | |
483 | + 465 4DE0 27 48 BEQ OUTD | |
484 | + 466 4DE2 8D 04 BSR TERM | |
485 | + 467 4DE4 DE C2 LDX PARSET | |
486 | + 468 4DE6 20 F0 BRA NXTRM | |
487 | + 469 * | |
488 | + 470 4DE8 36 TERM PSHA ; GET VALUE | |
489 | + 471 4DE9 37 PSHB | |
490 | + 472 4DEA A6 00 LDAA 0,X | |
491 | + 473 4DEC 36 PSHA | |
492 | + 474 4DED 08 INX | |
493 | + 475 4DEE 8D 2A BSR GETVAL | |
494 | + 476 4DF0 DD C8 STD EVALPT | |
495 | + 477 4DF2 DF C2 STX PARSET | |
496 | + 478 4DF4 CE 00 C8 LDX #EVALPT | |
497 | + 479 4DF7 32 PULA | |
498 | + 480 4DF8 33 PULB | |
499 | + 481 * | |
500 | + 482 4DF9 81 2A CMPA #'* ; SEE IF * | |
501 | + 483 4DFB 26 68 BNE EVAL2 | |
502 | + 484 4DFD 32 PULA ; MULTIPLY | |
503 | + 485 4DFE DD C6 MULTIP STD MPLIER ; 2'S COMPLEMENT | |
504 | + 486 4E00 C6 10 LDAB #$10 | |
505 | + 487 4E02 D7 C4 STAB MLDVCT | |
506 | + 488 4E04 4F CLRA | |
507 | + 489 4E05 5F CLRB | |
508 | + 490 * | |
509 | + 491 4E06 74 00 C6 MULT LSR MPLIER | |
510 | + 492 4E09 76 00 C7 ROR MPLIER+1 | |
511 | + 493 4E0C 24 02 BCC NOAD | |
512 | + 494 4E0E E3 00 MULTI ADDD 0,X | |
513 | + 495 4E10 68 01 NOAD ASL 1,X | |
514 | + 496 4E12 69 00 ROL 0,X | |
515 | + 497 4E14 7A 00 C4 DEC MLDVCT | |
516 | + 498 4E17 26 ED BNE MULT ; LOOP TIL DONE | |
517 | + 499 4E19 39 RTS2 RTS | |
518 | + 500 * | |
519 | + 501 4E1A BD 4E ED GETVAL JSR CVBIN ; GET VALUE | |
520 | + 502 4E1D 24 0C BCC OUTV | |
521 | + 503 4E1F C1 3F CMPB #'? ; OF LITERAL | |
522 | + 504 4E21 26 09 BNE VAR | |
523 | + 505 4E23 3C PSHX ; OR INPUT | |
524 | + 506 4E24 BD 4F 17 JSR INLN | |
525 | + 507 4E27 8D AD BSR EVAL | |
526 | + 508 4E29 38 PULX | |
527 | + 509 4E2A 08 OUTD INX | |
528 | + 510 4E2B 39 OUTV RTS | |
529 | + 511 * | |
530 | + 512 4E2C C1 24 VAR CMPB #'$ ; OR STRING | |
531 | + 513 4E2E 26 05 BNE VAR1 | |
532 | + 514 4E30 8D 96 BSR INCH2 | |
533 | + 515 4E32 4F CLRA | |
534 | + 516 4E33 08 INX | |
535 | + 517 4E34 39 RTS | |
536 | + 518 * | |
537 | + 519 4E35 C1 28 VAR1 CMPB #'( | |
538 | + 520 4E37 26 03 BNE VAR2 | |
539 | + 521 4E39 08 INX | |
540 | + 522 4E3A 20 9A BRA EVAL | |
541 | + 523 * | |
542 | + 524 4E3C 8D 0E VAR2 BSR CONVP ; OR VARIABLE | |
543 | + 525 4E3E EC 00 LDD 0,X ; OR ARRAY ELEMENT | |
544 | + 526 4E40 DE CC LDX VARADR ; LOAD OLD INDEX | |
545 | + 527 4E42 39 RTS | |
546 | + 528 * | |
547 | + 529 4E43 BD 4D D6 ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT | |
548 | + 530 4E46 05 ASLD | |
549 | + 531 4E47 F3 43 50 ADDD AMPR | |
550 | + 532 4E4A 20 11 BRA PACK | |
551 | + 533 * | |
552 | + 534 4E4C E6 00 CONVP LDAB 0,X ; GET LOCATION | |
553 | + 535 4E4E 08 INX | |
554 | + 536 4E4F 37 PSHB | |
555 | + 537 4E50 C1 3A CMPB #': | |
556 | + 538 4E52 27 EF BEQ ARRAY ; OF VARIABLE OR | |
557 | + 539 4E54 4F CLRA ; ARRAY ELEMENT | |
558 | + 540 4E55 C4 3F ANDB #$3F ; mask out-of-variable-range | |
559 | + 541 4E57 CB 02 ADDB #$02 ; bump past "interrupt vectors" | |
560 | + 542 4E59 58 ASLB ; make into offset (would be address in DP in ori | |
561 | + 543 4E5A C3 43 00 ADDD #ZERO ; The 6801 can do this right. | |
562 | + 544 * | |
563 | + 545 4E5D DF CC PACK STX VARADR ; STORE OLD INDEX | |
564 | + 546 4E5F DD CA STD CNVPTR | |
565 | + 547 4E61 DE CA LDX CNVPTR ; LOAD NEW INDEX | |
566 | + 548 4E63 33 PULB | |
567 | + 549 4E64 39 RTS | |
568 | + 550 * | |
569 | + 551 4E65 81 2B EVAL2 CMPA #'+ ; ADDITION | |
570 | + 552 4E67 26 04 BNE EVAL3 | |
571 | + 553 4E69 32 PULA | |
572 | + 554 4E6A E3 00 ADD ADDD 0,X | |
573 | + 555 4E6C 39 RTS | |
574 | + 556 * | |
575 | + 557 4E6D 81 2D EVAL3 CMPA #'- ; SUBTRACTION | |
576 | + 558 4E6F 26 04 BNE EVAL4 | |
577 | + 559 4E71 32 PULA | |
578 | + 560 4E72 A3 00 SUBTR SUBD 0,X | |
579 | + 561 4E74 39 RTS | |
580 | + 562 * | |
581 | + 563 4E75 81 2F EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE | |
582 | + 564 4E77 26 09 BNE EVAL5 | |
583 | + 565 4E79 32 PULA | |
584 | + 566 4E7A 8D 30 BSR DIVIDE | |
585 | + 567 4E7C FD 43 4E STD REMN | |
586 | + 568 4E7F DC C6 LDD DIVQUO | |
587 | + 569 4E81 39 RTS | |
588 | + 570 * | |
589 | + 571 4E82 80 3D EVAL5 SUBA #'= ; SEE IF EQUAL TEST | |
590 | + 572 4E84 26 0C BNE EVAL6 | |
591 | + 573 4E86 32 PULA | |
592 | + 574 4E87 A3 00 SUBD 0,X | |
593 | + 575 4E89 26 03 BNE NOTEQ | |
594 | + 576 4E8B 5D TSTB | |
595 | + 577 4E8C 27 02 BEQ EQL | |
596 | + 578 4E8E C6 FF NOTEQ LDAB #$FF | |
597 | + 579 4E90 20 0D EQL BRA COMBOUT | |
598 | + 580 * | |
599 | + 581 4E92 4A EVAL6 DECA ; SEE IF LESS THAN TEST | |
600 | + 582 4E93 32 PULA | |
601 | + 583 4E94 27 07 BEQ EVAL7 | |
602 | + 584 * | |
603 | + 585 4E96 A3 00 SUB2 SUBD 0,X | |
604 | + 586 4E98 59 ROLB | |
605 | + 587 4E99 4F COMOUT CLRA | |
606 | + 588 4E9A C4 01 ANDB #$01 | |
607 | + 589 4E9C 39 RTS | |
608 | + 590 * | |
609 | + 591 4E9D 8D F7 EVAL7 BSR SUB2 ; GT TEST | |
610 | + 592 4E9F 53 COMBOUT COMB | |
611 | + 593 4EA0 20 F7 BRA COMOUT | |
612 | + 594 * | |
613 | + 595 4EA2 27 PWRS10 FCB $27 ; 10000 | |
614 | + 596 4EA3 10 FCB $10 | |
615 | + 597 4EA4 03 FCB $03 ; 1000 | |
616 | + 598 4EA5 E8 FCB $E8 | |
617 | + 599 4EA6 00 FCB $00 ; 100 | |
618 | + 600 4EA7 64 FCB $64 | |
619 | + 601 4EA8 00 FCB $00 ; 10 | |
620 | + 602 4EA9 0A FCB $0A | |
621 | + 603 4EAA 00 FCB $00 ; 1 | |
622 | + 604 4EAB 01 FCB $01 | |
623 | + 605 * | |
624 | + 606 4EAC 7F 00 C4 DIVIDE CLR MLDVCT ; DEVIDE 16-BITS | |
625 | + 607 4EAF 7C 00 C4 GOT INC MLDVCT | |
626 | + 608 4EB2 68 01 ASL 1,X | |
627 | + 609 4EB4 69 00 ROL 0,X | |
628 | + 610 4EB6 24 F7 BCC GOT | |
629 | + 611 4EB8 66 00 ROR 0,X | |
630 | + 612 4EBA 66 01 ROR 1,X | |
631 | + 613 4EBC 7F 00 C6 CLR DIVQUO | |
632 | + 614 4EBF 7F 00 C7 CLR DIVQUO+1 | |
633 | + 615 4EC2 A3 00 DIV2 SUBD 0,X | |
634 | + 616 4EC4 24 05 BCC OK | |
635 | + 617 4EC6 E3 00 ADDD 0,X | |
636 | + 618 4EC8 0C CLC | |
637 | + 619 4EC9 20 01 BRA DIVNOC ; instead of the trick | |
638 | + 620 * The 6801 CPX affects all relevant flags, can't use thi | |
639 | + 621 * FCB $9C ; CPX | |
640 | + 622 4ECB 0D OK SEC ; $0D | |
641 | + 623 4ECC 79 00 C7 DIVNOC ROL DIVQUO+1 | |
642 | + 624 4ECF 79 00 C6 ROL DIVQUO | |
643 | + 625 4ED2 7A 00 C4 DEC MLDVCT | |
644 | + 626 4ED5 27 12 BEQ DONE | |
645 | + 627 4ED7 64 00 LSR 0,X | |
646 | + 628 4ED9 66 01 ROR 1,X | |
647 | + 629 4EDB 20 E5 BRA DIV2 | |
648 | + 630 * | |
649 | + 631 4EDD E6 00 TSTN LDAB 0,X ; TEST FOR NUMERIC | |
650 | + 632 4EDF C1 3A CMPB #$3A | |
651 | + 633 4EE1 2A 04 BPL NOTDEC | |
652 | + 634 4EE3 C1 30 CMPB #'0 | |
653 | + 635 4EE5 2C 02 BGE DONE | |
654 | + 636 4EE7 0D NOTDEC SEC | |
655 | + 637 4EE8 39 RTS | |
656 | + 638 4EE9 0C DONE CLC | |
657 | + 639 4EEA 39 DUN RTS | |
658 | + 640 * | |
659 | + 641 4EEB 8D 2A CVTLN BSR INLN | |
660 | + 642 * | |
661 | + 643 4EED 8D EE CVBIN BSR TSTN ; CONVERT TO BINARY | |
662 | + 644 4EEF 25 F9 BCS DUN | |
663 | + 645 4EF1 4F CONT CLRA | |
664 | + 646 4EF2 5F CLRB | |
665 | + 647 4EF3 EB 00 CBLOOP ADDB 0,X | |
666 | + 648 4EF5 89 00 ADCA #$00 | |
667 | + 649 4EF7 C0 30 SUBB #'0 | |
668 | + 650 4EF9 82 00 SBCA #$00 | |
669 | + 651 4EFB DD C4 STD CVTSUM | |
670 | + 652 4EFD 08 INX | |
671 | + 653 4EFE 37 PSHB | |
672 | + 654 4EFF 8D DC BSR TSTN | |
673 | + 655 4F01 33 PULB | |
674 | + 656 4F02 25 E5 BCS DONE | |
675 | + 657 4F04 05 ASLD | |
676 | + 658 4F05 05 ASLD | |
677 | + 659 4F06 D3 C4 ADDD CVTSUM | |
678 | + 660 4F08 05 ASLD | |
679 | + 661 4F09 20 E8 BRA CBLOOP | |
680 | + 662 * | |
681 | + 663 4F0B C1 40 INLN6 CMPB #'@ ; CANCEL | |
682 | + 664 4F0D 27 06 BEQ NEWLIN | |
683 | + 665 4F0F 08 INX ; '.' | |
684 | + 666 4F10 8C 43 4A CPX #ZERO+LINLEN+2 ; (Here's part of what we had to fix | |
685 | + 667 4F13 26 0B BNE INLN2 | |
686 | + 668 4F15 8D 1F NEWLIN BSR CRLF | |
687 | + 669 * | |
688 | + 670 4F17 CE 43 02 INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL | |
689 | + 671 4F1A 09 INLN5 DEX | |
690 | + 672 4F1B 8C 43 00 CPX #ZERO ; Make this explicit to enable variables move | |
691 | + 673 4F1E 27 F5 BEQ NEWLIN ; (Was implicit zero compare X from DEX, now | |
692 | + 674 4F20 BD 4F 52 INLN2 JSR INCH ; INPUT CHARACTER | |
693 | + 675 4F23 E7 87 STAB BUFOFF-1,X ; STORE IT | |
694 | + 676 4F25 C1 5F CMPB #$5F ; BACKSPACE? | |
695 | + 677 4F27 27 F1 BEQ INLN5 | |
696 | + 678 * | |
697 | + 679 4F29 C1 0D INLIN3 CMPB #$0D ; CARRIAGE RETURN | |
698 | + 680 4F2B 2B F3 BMI INLN2 | |
699 | + 681 4F2D 26 DC BNE INLN6 | |
700 | + 682 * | |
701 | + 683 4F2F 6F 87 INLIN4 CLR BUFOFF-1,X ; CLEAR LAST CHAR | |
702 | + 684 4F31 CE 43 88 LDX #LINBUF | |
703 | + 685 4F34 20 04 BRA LF | |
704 | + 686 * | |
705 | + 687 * CRLF JSR EPCRLF | |
706 | + 688 4F36 C6 0D CRLF LDAB #$0D ; CARR-RET | |
707 | + 689 4F38 8D 02 BSR OUTCH2 | |
708 | + 690 4F3A C6 0A LF LDAB #$0A ; LINE FEED | |
709 | + 691 4F3C 20 1B OUTCH2 BRA OUTCH | |
710 | + 692 * | |
711 | + 693 4F3E 0D OKM FCB $0D | |
712 | + 694 4F3F 0A FCB $0A | |
713 | + 695 4F40 4F 4B FCC 'OK' | |
714 | + 696 4F42 00 FCB $00 | |
715 | + 697 * | |
716 | + 698 *TRMINI LDAB #40 | |
717 | + 699 *TRMILP JSR EPCRLF | |
718 | + 700 * DECB | |
719 | + 701 * BNE TRMILP | |
720 | + 702 * RTS | |
721 | + 703 * | |
722 | + 704 * MC-10 BASIC ROM vectors | |
723 | + 705 FFDC INCHV EQU $FFDC ; Scan keyboard | |
724 | + 706 FFDE OUTCHV EQU $FFDE ; Write char to screen | |
725 | + 707 * | |
726 | + 708 * RECEIVER POLLING | |
727 | + 709 4F43 36 POLCAT PSHA | |
728 | + 710 4F44 3C PSHX | |
729 | + 711 4F45 FE FF DC LDX INCHV ; at any rate, don't wait. | |
730 | + 712 4F48 AD 00 JSR 0,X ; | |
731 | + 713 4F4A 16 TAB ; MC-10 ROM says NUL is not input. | |
732 | + 714 4F4B 0D SEC | |
733 | + 715 4F4C 26 01 BNE POLCATR ; Don't wait. | |
734 | + 716 4F4E 0C CLC | |
735 | + 717 4F4F 38 POLCATR PULX | |
736 | + 718 4F50 32 PULA | |
737 | + 719 4F51 39 RTS | |
738 | + 720 *POLCAT LDAB ACIACS | |
739 | + 721 * ASRB | |
740 | + 722 * RTS | |
741 | + 723 * | |
742 | + 724 * INPUT ONE CHAR INTO B ACCUMULATOR | |
743 | + 725 4F52 8D EF INCH BSR POLCAT | |
744 | + 726 4F54 24 FC BCC INCH ; Wait here. | |
745 | + 727 4F56 8D 01 BSR OUTCH | |
746 | + 728 4F58 39 RTS | |
747 | + 729 * | |
748 | + 730 * OUTPUT ONE CHAR | |
749 | + 731 4F59 36 OUTCH PSHA | |
750 | + 732 4F5A 3C PSHX | |
751 | + 733 4F5B FE FF DE LDX OUTCHV | |
752 | + 734 4F5E 17 TBA | |
753 | + 735 4F5F AD 00 JSR 0,X | |
754 | + 736 4F61 38 PULX | |
755 | + 737 4F62 32 PULA | |
756 | + 738 4F63 39 RTS | |
757 | + 739 * | |
758 | + 740 ORG COLD | |
759 | + 741 * | |
760 | + 742 END | |
761 | + | |
762 | +***** pass 2 on VTL_6801_mc10.asm done ***** | |
763 | + | |
764 | +No syntax errors found. | |
765 | +| 4e6a:ADD || 4350:AMPR || 4cd4:AR1 | | |
766 | +| 4cdb:AR11 || 4ce0:AR2 || 4ce5:AR2RND | | |
767 | +| 4e43:ARRAY || 4304:AT || 433a:BRAK | | |
768 | +| 0003:BREAK || 433e:BRIK || 0088:BUFOFF | | |
769 | +| 4ef3:CBLOOP || 4d24:CNTLN || 00ca:CNVPTR | | |
770 | +| 4c00:COLD || 4378:COLN || 435c:COMA | | |
771 | +| 4e9f:COMBOUT || 4e99:COMOUT || 4ef1:CONT | | |
772 | +| 4e4c:CONVP || 4f36:CRLF || 4dbd:CTLC | | |
773 | +| 4eed:CVBIN || 4d7e:CVD1 || 4eeb:CVTLN | | |
774 | +| 00c4:CVTSUM || 4382:DECBUF || 4381:DECB_1 | | |
775 | +| 4387:DELIM || 4d02:DELT || 4ec2:DIV2 | | |
776 | +| 4eac:DIVIDE || 4ecc:DIVNOC || 00c6:DIVQUO | | |
777 | +| 434c:DOLLAR || 434a:DOLR || 4d52:DON | | |
778 | +| 4ee9:DONE || 00dc:DPALLOC || 00c0:DPBASE | | |
779 | +| 00d8:DST || 4eea:DUN || 00d0:EDTLIN | | |
780 | +| 437e:EQAL || 4e90:EQL || 4c41:EQSTRT | | |
781 | +| 4dd6:EVAL || 4e65:EVAL2 || 4e6d:EVAL3 | | |
782 | +| 4e75:EVAL4 || 4e82:EVAL5 || 4e92:EVAL6 | | |
783 | +| 4e9d:EVAL7 || 00c8:EVALPT || 4cc1:EVALU | | |
784 | +| 4c72:EVIL || 4346:EXCL || 4c64:EXEC | | |
785 | +| 4ca9:FIND || 4d17:FITIT || 4cac:FND2 | | |
786 | +| 4cba:FND3 || 4e1a:GETVAL || 4eaf:GOT | | |
787 | +| 4d6d:GOTIT || 4380:GRRT || 4f52:INCH | | |
788 | +| 4dc8:INCH2 || ffdc:INCHV || 4f29:INLIN3 | | |
789 | +| 4f2f:INLIN4 || 4f17:INLN || 4f20:INLN2 | | |
790 | +| 4f1a:INLN5 || 4f0b:INLN6 || 00d2:INSPTR | | |
791 | +| 4d1c:INSRT || 4386:LASTD || 437c:LESS | | |
792 | +| 4f3a:LF || 4388:LINBUF || 0048:LINLEN | | |
793 | +| 4ca2:LOOKAG || 4c2f:LOOP || 4c3f:LOOP2 | | |
794 | +| 4c60:LOOP3 || 4c87:LST2 || 4400:MI | | |
795 | +| 435e:MINS || 00c4:MLDVCT || 4d5d:MOVL | | |
796 | +| 00c6:MPLIER || 4e06:MULT || 4e0e:MULTI | | |
797 | +| 4dfe:MULTIP || 4f15:NEWLIN || 4404:NMI | | |
798 | +| 4e10:NOAD || 4ee7:NOTDEC || 4e8e:NOTEQ | | |
799 | +| 4c20:NOTRAM || 4dd8:NXTRM || 4c9f:NXTXT | | |
800 | +| 4ecb:OK || 4f3e:OKM || 4d2a:OPEN | | |
801 | +| 00ce:OPRLIN || 4f59:OUTCH || 4f3c:OUTCH2 | | |
802 | +| ffde:OUTCHV || 4e2a:OUTD || 4db0:OUTMSG | | |
803 | +| 4ddf:OUTN || 4e2b:OUTV || 4c6e:OUTX | | |
804 | +| 4e5d:PACK || 4354:PAREN || 4356:PARIN | | |
805 | +| 00c2:PARSET || 4360:PERD || 435a:PLUS | | |
806 | +| 4dac:PNTMSG || 4f43:POLCAT || 4f4f:POLCATR | | |
807 | +| 4408:PRGM || 4d75:PRNT || 4d76:PRNT2 | | |
808 | +| 4c0e:PROBE || 4c1b:PROBET || 4ea2:PWRS10 | | |
809 | +| 4352:QUITE || 4348:QUOTE || 434e:REMN | | |
810 | +| 4d72:RSTRT || 4cc0:RTS1 || 4e19:RTS2 | | |
811 | +| 4364:SAVE0 || 4366:SAVE1 || 433c:SAVE10 | | |
812 | +| 4342:SAVE11 || 4344:SAVE14 || 4368:SAVE2 | | |
813 | +| 436a:SAVE3 || 436c:SAVE4 || 436e:SAVE5 | | |
814 | +| 4370:SAVE6 || 4372:SAVE7 || 4374:SAVE8 | | |
815 | +| 4376:SAVE9 || 00d4:SAVLIN || 437a:SEMI | | |
816 | +| 4cbe:SET || 4c6a:SKIP || 4cef:SKP2 | | |
817 | +| 4362:SLASH || 4d40:SLIDE || 00d6:SRC | | |
818 | +| 43f1:STACK || 4358:STAR || 4c24:START | | |
819 | +| 00da:STKMRK || 4c7a:STMNT || 4c77:STRGT | | |
820 | +| 4dcb:STRING || 4dad:STRTMS || 4e96:SUB2 | | |
821 | +| 4e72:SUBTR || 4de8:TERM || 4edd:TSTN | | |
822 | +| 4340:UP || 4e2c:VAR || 4e35:VAR1 | | |
823 | +| 4e3c:VAR2 || 00cc:VARADR || 4306:VARS | | |
824 | +| 4300:ZERO || 4da2:ZRSUP | | |
825 | + |
@@ -0,0 +1,113 @@ | ||
1 | +S1094300000000000000B3 | |
2 | +S113430600000000000000000000000000000000A3 | |
3 | +S11343160000000000000000000000000000000093 | |
4 | +S11343260000000000000000000000000000000083 | |
5 | +S10943360000000000007D | |
6 | +S10B433C000000000000000075 | |
7 | +S11343440000000000000000000000000000000065 | |
8 | +S11343540000000000000000000000000000000055 | |
9 | +S11343640000000000000000000000000000000045 | |
10 | +S1114374000000000000000000000000000037 | |
11 | +S109438200000000000031 | |
12 | +S11343880000000000000000000000000000000021 | |
13 | +S11343980000000000000000000000000000000011 | |
14 | +S11343A80000000000000000000000000000000001 | |
15 | +S11343B800000000000000000000000000000000F1 | |
16 | +S10C43C8000000000000000000E8 | |
17 | +S10443F100C7 | |
18 | +S10B44000000000000000000B0 | |
19 | +S1054C009FDA35 | |
20 | +S1134C02CE4408FF4350865AC6A5200DA700A10032 | |
21 | +S1134C12260CE700E1002606088C4C0025EE09FF6D | |
22 | +S1054C224358F1 | |
23 | +S1084C249EDABF437A93 | |
24 | +S1094C294FCE4F3E8D4802 | |
25 | +S1134C2F4FB7434AB7434BBD4EEB243F8D2727E580 | |
26 | +S1134C3F8D6827E1EE00FF434ADED40808088D157E | |
27 | +S10E4C4F270FDED4EE00BC434A27060A | |
28 | +S1094C5A08FF434620DFC1 | |
29 | +S1074C608D5820DD6A | |
30 | +S1094C64DFCEBD4E3C084A | |
31 | +S10B4C6AA6008D04FE434A3943 | |
32 | +S10B4C728122264B087E4DCB84 | |
33 | +S10D4C7ADFD0FD434AFE434A266BD7 | |
34 | +S1134C84CE4408BC435027B5DFD4EC00BD4D76DEDA | |
35 | +S10E4C94D40808BD4DACBD4F3620E82D | |
36 | +S10D4C9FDED408086D0026FB083976 | |
37 | +S10D4CA9CE4408DFD4BC4350270DAD | |
38 | +S1084CB3EC00B3434ACC | |
39 | +S1094CB824048DE320EE4C | |
40 | +S1064CBE86FF3931 | |
41 | +S1134CC1BD4DD63736DECEBD4E4C32C1242604331B | |
42 | +S10D4CD17E4F59C03F26037E4D7547 | |
43 | +S1084CDB5C3326013FDB | |
44 | +S1084CE0ED0026015C5B | |
45 | +S10D4CE5FB4352B94353FD43523917 | |
46 | +S10E4CEF8DB82729EE00BC434A2622A2 | |
47 | +S1054CFA8DA384 | |
48 | +S1094CFCDFD6DED4DFD890 | |
49 | +S10F4D02DED6BC4350270EA60008DFD606 | |
50 | +S10C4D0EDED8A70008DFD820EB71 | |
51 | +S1084D17DED8FF43504B | |
52 | +S1114D1CDED0C6036D0027495C086D0026FA40 | |
53 | +S1114D2A4FF34350DDD2B34358243DFE4350B3 | |
54 | +S1084D38DCD2FD435034 | |
55 | +S10B4D3DDDD80809DFD6E60009 | |
56 | +S1104D45DED8E70009DFD8DED69CD422EECC | |
57 | +S10A4D52FC434AED00DFD829 | |
58 | +S1074D59DCD0DDD6F3 | |
59 | +S1134D5DDED6E60008DFD6DED808DFD8E70126F078 | |
60 | +S1084D6D9EDA7E4C2FCC | |
61 | +S1064D727E4C244C | |
62 | +S1134D7533CE4382DFCACE4EA23CEE00DFCCCE005A | |
63 | +S1134D85CCBD4EAC36DECA96C78B30A7003208DFE1 | |
64 | +S10B4D95CA3808086D0126E18B | |
65 | +S1124D9DCE4381630508E600C13027F9734386CE | |
66 | +S1074DAC4FB743872F | |
67 | +S1104DB0E60008F143872705BD4F5920F3A5 | |
68 | +S10E4DBDBD4F4324578D04C10327AAF7 | |
69 | +S1064DC87E4F52C5 | |
70 | +S10E4DCB8DE0A600813B27577E4F3689 | |
71 | +S1054DD68D4208 | |
72 | +S1134DD836A600270281293227488D04DEC220F036 | |
73 | +S1134DE83637A60036088D2ADDC8DFC2CE00C832A1 | |
74 | +S1044DF83383 | |
75 | +S1104DF9812A266832DDC6C610D7C44F5F7C | |
76 | +S1134E067400C67600C72402E300680169007A00CC | |
77 | +S1074E16C426ED3984 | |
78 | +S1134E1ABD4EED240CC13F26093CBD4F178DAD385C | |
79 | +S1054E2A083941 | |
80 | +S10C4E2CC12426058D964F0839B6 | |
81 | +S10A4E35C128260308209A9E | |
82 | +S10A4E3C8D0EEC00DECC3901 | |
83 | +S10C4E43BD4DD605F343502011C6 | |
84 | +S1134E4CE6000837C13A27EF4FC43FCB0258C3439F | |
85 | +S1044E5C0051 | |
86 | +S10B4E5DDFCCDDCADECA3339E3 | |
87 | +S10B4E65812B260432E300391D | |
88 | +S10B4E6D812D260432A3003953 | |
89 | +S1104E75812F2609328D30FD434EDCC639F5 | |
90 | +S1134E82803D260C32A30026035D2702C6FF200DB7 | |
91 | +S1074E924A3227076E | |
92 | +S10A4E96A300594FC40139C8 | |
93 | +S1084E9D8DF75320F71E | |
94 | +S10D4EA2271003E80064000A000171 | |
95 | +S1134EAC7F00C47C00C46801690024F766006601B5 | |
96 | +S1124EBC7F00C67F00C7A3002405E3000C20017C | |
97 | +S1134ECB0D7900C77900C67A00C427126400660105 | |
98 | +S1054EDB20E5CC | |
99 | +S1114EDDE600C13A2A04C1302C020D390C390A | |
100 | +S1054EEB8D2A0A | |
101 | +S1134EED8DEE25F94F5FEB008900C0308200DDC4E3 | |
102 | +S1114EFD08378DDC3325E50505D3C40520E810 | |
103 | +S10F4F0BC1402706088C434A260B8D1F6A | |
104 | +S1134F17CE4302098C430027F5BD4F52E787C15F93 | |
105 | +S1054F2727F16C | |
106 | +S1094F29C10D2BF326DC90 | |
107 | +S10A4F2F6F87CE43882004C4 | |
108 | +S10B4F36C60D8D02C60A201B02 | |
109 | +S1084F3E0D0A4F4B00B9 | |
110 | +S1124F43363CFEFFDCAD00160D26010C3832396A | |
111 | +S10A4F528DEF24FC8D0139F1 | |
112 | +S10E4F59363CFEFFDE17AD0038323995 | |
113 | +S9034C00B0 |
@@ -0,0 +1,740 @@ | ||
1 | + OPT 6801 | |
2 | +* VTL-2 for 6801 | |
3 | +* V-3.6 | |
4 | +* 9-23-76 | |
5 | +* BY GARY SHANNON | |
6 | +* & FRANK MCCOY | |
7 | +* COPYWRIGHT 1976, THE COMPUTER STORE | |
8 | +* | |
9 | +* Modifications for 6803-based MC-10 | |
10 | +* including moving variables out of direct page, etc. | |
11 | +* by Joel Matthew Rees | |
12 | +* Copyright 2022, Joel Matthew Rees | |
13 | +* | |
14 | +* Modifications explained at | |
15 | +* https://joels-programming-fun.blogspot.com/2022/08/trs-mc-10-assembly-lang-pt1-vtl-2.html | |
16 | +* | |
17 | +* DEFINE LOCATIONS IN MONITOR | |
18 | +* INCH EQU $FF00 ; per VTL.ASM | |
19 | +* EINCH EQU $F012 ; exorsim mdos Input byte with echo unless AECHO is set | |
20 | +* INCH EQU $F015 ; exorsim mdos Input char with echo (F012 -> strip bit 7) | |
21 | +* POLCAT EQU $FF24 ; from VTL.ASM | |
22 | +* OUTCH EQU $FF81 ; from VTL.ASM | |
23 | +* EOUTCH EQU $F018 ; exorsim mdos Output character with NULs | |
24 | +* OUTS EQU $FF82 ; from VTL.ASM | |
25 | +* EPCRLF EQU $F021 ; Primarily for forced initialization in exorsim. | |
26 | +* | |
27 | +* FOR SBC6800: | |
28 | +*BREAK EQU $1B ; BREAK KEY | |
29 | +* For MC-10: | |
30 | +BREAK EQU $03 | |
31 | +* For exorsim | |
32 | +*ACIACS EQU $FCF4 ; exorcisor | |
33 | +*ACIADA EQU $FCF5 ; exorcisor | |
34 | +* | |
35 | +* A few interpreter variables in the direct page won't hurt. | |
36 | +* (Yes, I can hear voices of complaint that it's not as "tight" as it could be.) | |
37 | +* (This allows us to save more ROM space and uses DP that would otherwise go wasted.) | |
38 | +* (Trade-offs.) | |
39 | +* (It also helps us understand the code, so we can do a better 6809 transliteration.) | |
40 | +* (I hope the names are meaningful.) | |
41 | +* | |
42 | +* In .c10 format, the following as ORG and RMBs will cause object code output, | |
43 | +* which will prevent the code from loading. | |
44 | +* Changed to EQU for the MC10. | |
45 | +* ORG $C0 ; Move this according to your environment's needs. | |
46 | +DPBASE EQU $C0 ; Change this to move the registers. | |
47 | +* PARSET RMB 2 ; Instead of SAVE0 in TERM/NXTRM | |
48 | +PARSET EQU DPBASE+2 | |
49 | +* CVTSUM RMB 2 ; Instead of SAVE1 in CBLOOP | |
50 | +CVTSUM EQU PARSET+2 | |
51 | +* MLDVCT EQU CVTSUM ; Instead of SAVE1 in mul/div (1 byte only) | |
52 | +MLDVCT EQU CVTSUM | |
53 | +* DIVQUO RMB 2 ; Instead of SAVE2 in DIV | |
54 | +DIVQUO EQU MLDVCT+2 | |
55 | +* MPLIER EQU DIVQUO ; Instead of SAVE2 in MULTIP | |
56 | +MPLIER EQU DIVQUO | |
57 | +* EVALPT RMB 2 ; Instead of SAVE3 | |
58 | +EVALPT EQU MPLIER+2 | |
59 | +* CNVPTR RMB 2 ; Instead of SAVE4 | |
60 | +CNVPTR EQU EVALPT+2 | |
61 | +* VARADR RMB 2 ; Instead of SAVE6 | |
62 | +VARADR EQU CNVPTR+2 | |
63 | +* OPRLIN RMB 2 ; Instead of SAVE7 | |
64 | +OPRLIN EQU VARADR+2 | |
65 | +* EDTLIN RMB 2 ; Instead of SAVE8 | |
66 | +EDTLIN EQU OPRLIN+2 | |
67 | +* INSPTR RMB 2 ; Instead of SAVE10 (maybe? Will some VTL programs want it back?) | |
68 | +INSPTR EQU EDTLIN+2 | |
69 | +* SAVLIN RMB 2 ; Instead of SAVE11 | |
70 | +SAVLIN EQU INSPTR+2 | |
71 | +* SRC RMB 2 ; For copy routine | |
72 | +SRC EQU SAVLIN+2 | |
73 | +* DST RMB 2 ; ditto | |
74 | +DST EQU SRC+2 | |
75 | +STKMRK EQU DST+2 ; to restore the stack on each pass. | |
76 | +DPALLOC EQU STKMRK+2 ; total storage declared in the direct page | |
77 | +* | |
78 | +* SET ASIDE FOUR BYTES FOR USER | |
79 | +* DEFINED INTERUPT ROUTINE IF NEEDED | |
80 | + ORG $4300 | |
81 | +* ZERO must be set at even $100 boundary for address math to work. | |
82 | +ZERO RMB 4 ; INTERUPT VECTOR | |
83 | +AT RMB 2 ; CANCEL & C-R | |
84 | +* | |
85 | +* GENERAL PURPOSE STORRGE | |
86 | +VARS RMB 52 ; VARIABLES(A-Z) | |
87 | +BRAK RMB 2 ; [ | |
88 | +* SAVE10 has me worried about implicit linkage in VTL programs. Might need to leave it here. | |
89 | +SAVE10 RMB 2 ; BACK SLASH | |
90 | +BRIK RMB 2 ; ] | |
91 | +UP RMB 2 ; ^ | |
92 | +SAVE11 RMB 2 ; Need something in each SAVE to reserve space | |
93 | +* ; to keep the math straight. | |
94 | +* ; Leave the SAVEs declared as they are. | |
95 | +* | |
96 | +SAVE14 RMB 2 ; SPACE (originally unused) | |
97 | +EXCL RMB 2 ; ! | |
98 | +QUOTE RMB 2 ; " | |
99 | +DOLR RMB 2 ; # | |
100 | +DOLLAR RMB 2 ; $ | |
101 | +REMN RMB 2 ; % | |
102 | +AMPR RMB 2 ; & | |
103 | +QUITE RMB 2 ; ' | |
104 | +PAREN RMB 2 ; ( | |
105 | +PARIN RMB 2 ; ) | |
106 | +STAR RMB 2 ; * | |
107 | +PLUS RMB 2 ; + | |
108 | +COMA RMB 2 ; , | |
109 | +MINS RMB 2 ; - | |
110 | +PERD RMB 2 ; . | |
111 | +SLASH RMB 2 ; / | |
112 | +* | |
113 | +SAVE0 RMB 2 ; unused | |
114 | +SAVE1 RMB 2 ; unused | |
115 | +SAVE2 RMB 2 ; unused | |
116 | +SAVE3 RMB 2 ; unused | |
117 | +SAVE4 RMB 2 ; unused | |
118 | +SAVE5 RMB 2 ; unused (PSH/PULX) | |
119 | +SAVE6 RMB 2 ; unused | |
120 | +SAVE7 RMB 2 ; unused | |
121 | +SAVE8 RMB 2 ; unused | |
122 | +SAVE9 RMB 2 ; unused (PSH/PULX) | |
123 | +COLN RMB 2 ; : | |
124 | +SEMI RMB 2 ; ; | |
125 | +LESS RMB 2 ; < | |
126 | +EQAL RMB 2 ; = | |
127 | +GRRT RMB 1 ; > | |
128 | +DECB_1 RMB 1 | |
129 | +* | |
130 | +DECBUF RMB 4 | |
131 | +LASTD RMB 1 | |
132 | +DELIM RMB 1 | |
133 | +LINLEN EQU 72 | |
134 | +LINBUF RMB LINLEN+1 | |
135 | +BUFOFF EQU LINBUF-ZERO ; Unmagic 87. Some assemblers will cough at this. | |
136 | +* | |
137 | + ORG $43F1 | |
138 | +STACK RMB 1 | |
139 | +* | |
140 | + ORG $4400 | |
141 | +MI RMB 4 ; INTERUPT VECTORS | |
142 | +NMI RMB 4 | |
143 | +PRGM EQU * ; PROGRAM STARTS HERE | |
144 | +* Must have some RAM here. | |
145 | +* | |
146 | + ORG $4C00 | |
147 | +* | |
148 | +* The COLD boot can be removed or ignored to restore the original behavior, | |
149 | +* but if you do that don't forget to set & (AMPR) and * (STAR) values | |
150 | +* by hand immediately after STARTing. | |
151 | +* | |
152 | +* Also, instead of PROBEing, if you know the limits for a particular ROM | |
153 | +* application, you can set STAR directly: | |
154 | +* LDX #PRGM | |
155 | +* STX AMPR | |
156 | +* LDX #RAMLIM | |
157 | +* STX STAR | |
158 | +* START ... | |
159 | +* | |
160 | +COLD STS STKMRK ; Mark the stack, | |
161 | +* LDS #STACK ; but use BASIC's stack. (S on 6800 points to next free byte.) | |
162 | +* JSR TRMINI | |
163 | + LDX #PRGM ; initialize program area base | |
164 | + STX AMPR | |
165 | + LDAA #$5A ; Probe RAM limit | |
166 | + LDAB #$A5 | |
167 | + BRA PROBET | |
168 | +PROBE STAA 0,X | |
169 | + CMPA 0,X | |
170 | + BNE NOTRAM | |
171 | + STAB 0,X | |
172 | + CMPB 0,X | |
173 | + BNE NOTRAM | |
174 | + INX ; all bits seem to be R/W. | |
175 | +PROBET CPX #COLD | |
176 | + BLO PROBE ; CPX on 6801 works right. | |
177 | +NOTRAM DEX | |
178 | + STX STAR | |
179 | +START | |
180 | +* LDS #STACK ; re-initialize at beginning of each evaluate | |
181 | + LDS STKMRK ; from mark instead of constant | |
182 | + STS SEMI ; DBG Comment this out when we no longer need to see the stack pointer BASIC gives us. | |
183 | + CLRA ; NUL delimiter | |
184 | + LDX #OKM | |
185 | + BSR STRGT | |
186 | +* | |
187 | +LOOP CLRA | |
188 | + STAA DOLR | |
189 | + STAA DOLR+1 | |
190 | + JSR CVTLN | |
191 | + BCC STMNT ; NO LINE# THEN EXEC | |
192 | + BSR EXEC | |
193 | + BEQ START | |
194 | +* | |
195 | +LOOP2 BSR FIND ; FIND LINE | |
196 | +EQSTRT BEQ START ; IF END THEN STOP | |
197 | + LDX 0,X ; LOAD REAL LINE # | |
198 | + STX DOLR ; SAVE IT | |
199 | + LDX SAVLIN ; GET LINE | |
200 | + INX ; BUMP PAST LINE # | |
201 | + INX ; BUMP PAST LINE # | |
202 | + INX ; BUMP PAST SPACE | |
203 | + BSR EXEC ; EXECUTE IT | |
204 | + BEQ LOOP3 ; IF ZERO, CONTINUE | |
205 | + LDX SAVLIN ; FIND LINE | |
206 | + LDX 0,X ; GET IT | |
207 | + CPX DOLR ; HAS IT CHANGED? | |
208 | + BEQ LOOP3 ; IF NOT GET NEXT | |
209 | +* | |
210 | + INX ; INCREMENT OLD LINE# | |
211 | + STX EXCL ; SAVE FOR RETURN | |
212 | + BRA LOOP2 ; CONTINUE | |
213 | +* | |
214 | +LOOP3 BSR FND3 ; FIND NEXT LINE | |
215 | + BRA EQSTRT ; CONTINUE | |
216 | +* | |
217 | +EXEC STX OPRLIN ; EXECUTE LINE | |
218 | + JSR VAR2 | |
219 | + INX | |
220 | +* | |
221 | +SKIP LDAA 0,X ; GET FIRST TERM | |
222 | + BSR EVIL ; EVALUATE EXPRESSION | |
223 | +OUTX LDX DOLR ; GET LINE # | |
224 | + RTS | |
225 | +* | |
226 | +EVIL CMPA #$22 ; IF " THEN BRANCH | |
227 | + BNE EVALU | |
228 | + INX | |
229 | +STRGT JMP STRING ; TO PRINT IT | |
230 | +* | |
231 | +STMNT STX EDTLIN ; SAVE LINE # | |
232 | + STD DOLR | |
233 | + LDX DOLR | |
234 | + BNE SKP2 ; IF LINE# <> 0 | |
235 | +* | |
236 | + LDX #PRGM ; LIST PROGRAM | |
237 | +LST2 CPX AMPR ; END OF PROGRAM | |
238 | + BEQ EQSTRT | |
239 | + STX SAVLIN ; LINE # FOR CVDEC | |
240 | + LDD 0,X | |
241 | + JSR PRNT2 | |
242 | + LDX SAVLIN | |
243 | + INX | |
244 | + INX | |
245 | + JSR PNTMSG | |
246 | + JSR CRLF | |
247 | + BRA LST2 | |
248 | +* | |
249 | +NXTXT LDX SAVLIN ; GET POINTER | |
250 | + INX ; BUMP PAST LINE# | |
251 | +LOOKAG INX ; FIND END OF LINE | |
252 | + TST 0,X | |
253 | + BNE LOOKAG | |
254 | + INX | |
255 | + RTS | |
256 | +* | |
257 | +FIND LDX #PRGM ; FIND LINE | |
258 | +FND2 STX SAVLIN | |
259 | + CPX AMPR | |
260 | + BEQ RTS1 | |
261 | +* LDAA 1,X ; almost missed this. | |
262 | +* SUBA DOLR+1 ; This was necessary because no SUBD | |
263 | +* LDAA 0,X ; and CPX does not affect C flag on 6800 | |
264 | +* SBCA DOLR | |
265 | +* PSHB ; B does not seem to be in use. | |
266 | + LDD 0,X ; Use D because we think we want to keep X. | |
267 | + SUBD DOLR | |
268 | +* PULB | |
269 | + BCC SET | |
270 | +FND3 BSR NXTXT | |
271 | + BRA FND2 | |
272 | +* | |
273 | +SET LDAA #$FF ; SET NOT EQUAL | |
274 | +RTS1 RTS | |
275 | +* | |
276 | +EVALU JSR EVAL ; EVALUATE LINE | |
277 | + PSHB | |
278 | + PSHA | |
279 | + LDX OPRLIN | |
280 | + JSR CONVP | |
281 | + PULA | |
282 | + CMPB #'$ ; STRING? | |
283 | + BNE AR1 | |
284 | + PULB | |
285 | + JMP OUTCH ; THEN PRINT IT | |
286 | +AR1 SUBB #'? ; PRINT? | |
287 | + BNE AR11 ; was out of range. | |
288 | + JMP PRNT ; THEN DO IT | |
289 | +* BEQ PRNT ; When we bring it back within range. | |
290 | +AR11 INCB ; MACHINE LANGUAGE? | |
291 | + PULB | |
292 | + BNE AR2 | |
293 | + SWI ; THEN INTERUPT | |
294 | +* | |
295 | +AR2 STD 0,X ; STORE NEW VALUE | |
296 | + BNE AR2RND ; Initialize/don't get stuck on zero. | |
297 | + INCB ; Keep it known cheap. | |
298 | +* ADDD QUITE ; RANDOMIZER ; NO! Don't do this. | |
299 | +AR2RND ADDB QUITE ; RANDOMIZER ; Adding the low byte to the high byte | |
300 | + ADCA QUITE+1 ; ; is cheap but intentional. | |
301 | + STD QUITE | |
302 | + RTS | |
303 | +* | |
304 | +SKP2 BSR FIND ; FIND LINE | |
305 | + BEQ INSRT ; IF NOT THERE | |
306 | + LDX 0,X ; THEN INSERT | |
307 | + CPX DOLR ; NEW LINE | |
308 | + BNE INSRT | |
309 | +* | |
310 | + BSR NXTXT ; SETUP REGISTERS | |
311 | +* LDS SAVLIN ; FOR DELETE | |
312 | + STX SRC | |
313 | + LDX SAVLIN | |
314 | + STX DST | |
315 | +* | |
316 | +DELT LDX SRC | |
317 | + CPX AMPR ; DELETE OLD LINE | |
318 | + BEQ FITIT | |
319 | + LDAA 0,X | |
320 | + INX | |
321 | + STX SRC | |
322 | +* PSHA | |
323 | +* INX | |
324 | +* INS | |
325 | +* INS | |
326 | + LDX DST | |
327 | + STA 0,X | |
328 | + INX | |
329 | + STX DST | |
330 | + BRA DELT | |
331 | +* | |
332 | +* FITIT STS AMPR ; STORE NEW END | |
333 | +FITIT LDX DST | |
334 | + STX AMPR ; STORE NEW END | |
335 | +* | |
336 | +INSRT LDX EDTLIN ; COUNT NEW LINE LENGTH | |
337 | + LDAB #$03 | |
338 | + TST 0,X | |
339 | + BEQ GOTIT ; IF NO LINE THEN STOP | |
340 | +CNTLN INCB ; count bytes | |
341 | + INX | |
342 | + TST 0,X ; Find trailing NUL | |
343 | + BNE CNTLN | |
344 | +* | |
345 | +OPEN CLRA ; CALCULATE NEW END | |
346 | + ADDD AMPR | |
347 | + STD INSPTR | |
348 | + SUBD STAR | |
349 | + BCC RSTRT ; IF TOO BIG THEN STOP | |
350 | + LDX AMPR | |
351 | +* LDS INSPTR ; remember that the 6800/6801 stack is postdecrement push. | |
352 | +* STS AMPR | |
353 | + LDD INSPTR ; remember that the 6800/6801 stack is postdecrement push. | |
354 | + STD AMPR | |
355 | +* | |
356 | +* LDS AMPR | |
357 | + STD DST | |
358 | + INX ; SLIDE OPEN GAP | |
359 | +SLIDE DEX ; going down | |
360 | + STX SRC | |
361 | + LDAB 0,X | |
362 | +* PSHB ; stack blast it | |
363 | + LDX DST | |
364 | + STAB 0,X ; mimic 6800 push | |
365 | + DEX | |
366 | + STX DST | |
367 | + LDX SRC | |
368 | + CPX SAVLIN | |
369 | + BHI SLIDE | |
370 | +* | |
371 | +* DON LDS DOLR ; STORE LINE # | |
372 | +* STS 0,X | |
373 | +DON LDD DOLR ; STORE LINE # | |
374 | + STD 0,X | |
375 | + STX DST ; will skip by offset store | |
376 | +* LDS EDTLIN ; GET NEW LINE | |
377 | +* DES ; pre-increment | |
378 | + LDD EDTLIN ; GET NEW LINE | |
379 | + STD SRC | |
380 | +* | |
381 | +*MOVL INX ; INSERT NEW LINE (skip over LINE # hi byte) | |
382 | +* PULB | |
383 | +* STAB 1,X ; (skips over low byte, BTW) | |
384 | +MOVL LDX SRC | |
385 | + LDAB 0,X | |
386 | + INX | |
387 | + STX SRC | |
388 | + LDX DST | |
389 | + INX ; skip over what was already stored (too tricky for words). | |
390 | + STX DST | |
391 | + STAB 1,X ; note offset store | |
392 | + BNE MOVL ; until NUL stored | |
393 | +* | |
394 | +GOTIT | |
395 | +* LDS #STACK ; Ready for a new line of input. | |
396 | + LDS STKMRK ; restore from mark | |
397 | + JMP LOOP | |
398 | +* | |
399 | +RSTRT JMP START ; warm start over | |
400 | +* | |
401 | +PRNT PULB ; PRINT DECIMAL | |
402 | +PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL | |
403 | + STX CNVPTR | |
404 | + LDX #PWRS10 | |
405 | +CVD1 PSHX | |
406 | + LDX 0,X | |
407 | + STX VARADR | |
408 | + LDX #VARADR | |
409 | + JSR DIVIDE | |
410 | + PSHA | |
411 | + LDX CNVPTR | |
412 | + LDAA DIVQUO+1 | |
413 | + ADDA #'0 | |
414 | + STAA 0,X | |
415 | + PULA | |
416 | + INX | |
417 | + STX CNVPTR | |
418 | + PULX | |
419 | + INX | |
420 | + INX | |
421 | + TST 1,X | |
422 | + BNE CVD1 | |
423 | +* | |
424 | + LDX #DECB_1 | |
425 | + COM 5,X ; ZERO SUPPRESS | |
426 | +ZRSUP INX | |
427 | + LDAB 0,X | |
428 | + CMPB #'0 | |
429 | + BEQ ZRSUP | |
430 | + COM LASTD | |
431 | +* | |
432 | +PNTMSG CLRA ; ZERO FOR DELIM | |
433 | +STRTMS STAA DELIM ; STORE DELIMTER | |
434 | +* | |
435 | +OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT | |
436 | + INX | |
437 | + CMPB DELIM | |
438 | + BEQ CTLC | |
439 | + JSR OUTCH | |
440 | + BRA OUTMSG | |
441 | +* | |
442 | +CTLC JSR POLCAT ; POL FOR CHARACTER | |
443 | + BCC RTS2 | |
444 | + BSR INCH2 | |
445 | + CMPB #BREAK ; BREAK KEY? | |
446 | + BEQ RSTRT | |
447 | +* | |
448 | +INCH2 JMP INCH | |
449 | +* | |
450 | +STRING BSR STRTMS ; PRINT STRING LITERAL | |
451 | + LDAA 0,X | |
452 | + CMPA #'; | |
453 | + BEQ OUTD | |
454 | + JMP CRLF | |
455 | +* | |
456 | +EVAL BSR GETVAL ; EVALUATE EXPRESSION | |
457 | +* | |
458 | +NXTRM PSHA | |
459 | + LDAA 0,X ; END OF LINE? | |
460 | + BEQ OUTN | |
461 | + CMPA #') | |
462 | +OUTN PULA | |
463 | + BEQ OUTD | |
464 | + BSR TERM | |
465 | + LDX PARSET | |
466 | + BRA NXTRM | |
467 | +* | |
468 | +TERM PSHA ; GET VALUE | |
469 | + PSHB | |
470 | + LDAA 0,X | |
471 | + PSHA | |
472 | + INX | |
473 | + BSR GETVAL | |
474 | + STD EVALPT | |
475 | + STX PARSET | |
476 | + LDX #EVALPT | |
477 | + PULA | |
478 | + PULB | |
479 | +* | |
480 | + CMPA #'* ; SEE IF * | |
481 | + BNE EVAL2 | |
482 | + PULA ; MULTIPLY | |
483 | +MULTIP STD MPLIER ; 2'S COMPLEMENT | |
484 | + LDAB #$10 | |
485 | + STAB MLDVCT | |
486 | + CLRA | |
487 | + CLRB | |
488 | +* | |
489 | +MULT LSR MPLIER | |
490 | + ROR MPLIER+1 | |
491 | + BCC NOAD | |
492 | +MULTI ADDD 0,X | |
493 | +NOAD ASL 1,X | |
494 | + ROL 0,X | |
495 | + DEC MLDVCT | |
496 | + BNE MULT ; LOOP TIL DONE | |
497 | +RTS2 RTS | |
498 | +* | |
499 | +GETVAL JSR CVBIN ; GET VALUE | |
500 | + BCC OUTV | |
501 | + CMPB #'? ; OF LITERAL | |
502 | + BNE VAR | |
503 | + PSHX ; OR INPUT | |
504 | + JSR INLN | |
505 | + BSR EVAL | |
506 | + PULX | |
507 | +OUTD INX | |
508 | +OUTV RTS | |
509 | +* | |
510 | +VAR CMPB #'$ ; OR STRING | |
511 | + BNE VAR1 | |
512 | + BSR INCH2 | |
513 | + CLRA | |
514 | + INX | |
515 | + RTS | |
516 | +* | |
517 | +VAR1 CMPB #'( | |
518 | + BNE VAR2 | |
519 | + INX | |
520 | + BRA EVAL | |
521 | +* | |
522 | +VAR2 BSR CONVP ; OR VARIABLE | |
523 | + LDD 0,X ; OR ARRAY ELEMENT | |
524 | + LDX VARADR ; LOAD OLD INDEX | |
525 | + RTS | |
526 | +* | |
527 | +ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT | |
528 | + ASLD | |
529 | + ADDD AMPR | |
530 | + BRA PACK | |
531 | +* | |
532 | +CONVP LDAB 0,X ; GET LOCATION | |
533 | + INX | |
534 | + PSHB | |
535 | + CMPB #': | |
536 | + BEQ ARRAY ; OF VARIABLE OR | |
537 | + CLRA ; ARRAY ELEMENT | |
538 | + ANDB #$3F ; mask out-of-variable-range | |
539 | + ADDB #$02 ; bump past "interrupt vectors" | |
540 | + ASLB ; make into offset (would be address in DP in original) | |
541 | + ADDD #ZERO ; The 6801 can do this right. | |
542 | +* | |
543 | +PACK STX VARADR ; STORE OLD INDEX | |
544 | + STD CNVPTR | |
545 | + LDX CNVPTR ; LOAD NEW INDEX | |
546 | + PULB | |
547 | + RTS | |
548 | +* | |
549 | +EVAL2 CMPA #'+ ; ADDITION | |
550 | + BNE EVAL3 | |
551 | + PULA | |
552 | +ADD ADDD 0,X | |
553 | + RTS | |
554 | +* | |
555 | +EVAL3 CMPA #'- ; SUBTRACTION | |
556 | + BNE EVAL4 | |
557 | + PULA | |
558 | +SUBTR SUBD 0,X | |
559 | + RTS | |
560 | +* | |
561 | +EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE | |
562 | + BNE EVAL5 | |
563 | + PULA | |
564 | + BSR DIVIDE | |
565 | + STD REMN | |
566 | + LDD DIVQUO | |
567 | + RTS | |
568 | +* | |
569 | +EVAL5 SUBA #'= ; SEE IF EQUAL TEST | |
570 | + BNE EVAL6 | |
571 | + PULA | |
572 | + SUBD 0,X | |
573 | + BNE NOTEQ | |
574 | + TSTB | |
575 | + BEQ EQL | |
576 | +NOTEQ LDAB #$FF | |
577 | +EQL BRA COMBOUT | |
578 | +* | |
579 | +EVAL6 DECA ; SEE IF LESS THAN TEST | |
580 | + PULA | |
581 | + BEQ EVAL7 | |
582 | +* | |
583 | +SUB2 SUBD 0,X | |
584 | + ROLB | |
585 | +COMOUT CLRA | |
586 | + ANDB #$01 | |
587 | + RTS | |
588 | +* | |
589 | +EVAL7 BSR SUB2 ; GT TEST | |
590 | +COMBOUT COMB | |
591 | + BRA COMOUT | |
592 | +* | |
593 | +PWRS10 FCB $27 ; 10000 | |
594 | + FCB $10 | |
595 | + FCB $03 ; 1000 | |
596 | + FCB $E8 | |
597 | + FCB $00 ; 100 | |
598 | + FCB $64 | |
599 | + FCB $00 ; 10 | |
600 | + FCB $0A | |
601 | + FCB $00 ; 1 | |
602 | + FCB $01 | |
603 | +* | |
604 | +DIVIDE CLR MLDVCT ; DEVIDE 16-BITS | |
605 | +GOT INC MLDVCT | |
606 | + ASL 1,X | |
607 | + ROL 0,X | |
608 | + BCC GOT | |
609 | + ROR 0,X | |
610 | + ROR 1,X | |
611 | + CLR DIVQUO | |
612 | + CLR DIVQUO+1 | |
613 | +DIV2 SUBD 0,X | |
614 | + BCC OK | |
615 | + ADDD 0,X | |
616 | + CLC | |
617 | + BRA DIVNOC ; instead of the trick | |
618 | +* The 6801 CPX affects all relevant flags, can't use this trick. | |
619 | +* FCB $9C ; CPX | |
620 | +OK SEC ; $0D | |
621 | +DIVNOC ROL DIVQUO+1 | |
622 | + ROL DIVQUO | |
623 | + DEC MLDVCT | |
624 | + BEQ DONE | |
625 | + LSR 0,X | |
626 | + ROR 1,X | |
627 | + BRA DIV2 | |
628 | +* | |
629 | +TSTN LDAB 0,X ; TEST FOR NUMERIC | |
630 | + CMPB #$3A | |
631 | + BPL NOTDEC | |
632 | + CMPB #'0 | |
633 | + BGE DONE | |
634 | +NOTDEC SEC | |
635 | + RTS | |
636 | +DONE CLC | |
637 | +DUN RTS | |
638 | +* | |
639 | +CVTLN BSR INLN | |
640 | +* | |
641 | +CVBIN BSR TSTN ; CONVERT TO BINARY | |
642 | + BCS DUN | |
643 | +CONT CLRA | |
644 | + CLRB | |
645 | +CBLOOP ADDB 0,X | |
646 | + ADCA #$00 | |
647 | + SUBB #'0 | |
648 | + SBCA #$00 | |
649 | + STD CVTSUM | |
650 | + INX | |
651 | + PSHB | |
652 | + BSR TSTN | |
653 | + PULB | |
654 | + BCS DONE | |
655 | + ASLD | |
656 | + ASLD | |
657 | + ADDD CVTSUM | |
658 | + ASLD | |
659 | + BRA CBLOOP | |
660 | +* | |
661 | +INLN6 CMPB #'@ ; CANCEL | |
662 | + BEQ NEWLIN | |
663 | + INX ; '.' | |
664 | + CPX #ZERO+LINLEN+2 ; (Here's part of what we had to fix for moving the variables.) | |
665 | + BNE INLN2 | |
666 | +NEWLIN BSR CRLF | |
667 | +* | |
668 | +INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL | |
669 | +INLN5 DEX | |
670 | + CPX #ZERO ; Make this explicit to enable variables moved out of DP. | |
671 | + BEQ NEWLIN ; (Was implicit zero compare X from DEX, now explicit.) | |
672 | +INLN2 JSR INCH ; INPUT CHARACTER | |
673 | + STAB BUFOFF-1,X ; STORE IT | |
674 | + CMPB #$5F ; BACKSPACE? | |
675 | + BEQ INLN5 | |
676 | +* | |
677 | +INLIN3 CMPB #$0D ; CARRIAGE RETURN | |
678 | + BMI INLN2 | |
679 | + BNE INLN6 | |
680 | +* | |
681 | +INLIN4 CLR BUFOFF-1,X ; CLEAR LAST CHAR | |
682 | + LDX #LINBUF | |
683 | + BRA LF | |
684 | +* | |
685 | +* CRLF JSR EPCRLF | |
686 | +CRLF LDAB #$0D ; CARR-RET | |
687 | + BSR OUTCH2 | |
688 | +LF LDAB #$0A ; LINE FEED | |
689 | +OUTCH2 BRA OUTCH | |
690 | +* | |
691 | +OKM FCB $0D | |
692 | + FCB $0A | |
693 | + FCC 'OK' | |
694 | + FCB $00 | |
695 | +* | |
696 | +*TRMINI LDAB #40 | |
697 | +*TRMILP JSR EPCRLF | |
698 | +* DECB | |
699 | +* BNE TRMILP | |
700 | +* RTS | |
701 | +* | |
702 | +* MC-10 BASIC ROM vectors | |
703 | +INCHV EQU $FFDC ; Scan keyboard | |
704 | +OUTCHV EQU $FFDE ; Write char to screen | |
705 | +* | |
706 | +* RECEIVER POLLING | |
707 | +POLCAT PSHA | |
708 | + PSHX | |
709 | + LDX INCHV ; at any rate, don't wait. | |
710 | + JSR 0,X ; | |
711 | + TAB ; MC-10 ROM says NUL is not input. | |
712 | + SEC | |
713 | + BNE POLCATR ; Don't wait. | |
714 | + CLC | |
715 | +POLCATR PULX | |
716 | + PULA | |
717 | + RTS | |
718 | +*POLCAT LDAB ACIACS | |
719 | +* ASRB | |
720 | +* RTS | |
721 | +* | |
722 | +* INPUT ONE CHAR INTO B ACCUMULATOR | |
723 | +INCH BSR POLCAT | |
724 | + BCC INCH ; Wait here. | |
725 | + BSR OUTCH | |
726 | + RTS | |
727 | +* | |
728 | +* OUTPUT ONE CHAR | |
729 | +OUTCH PSHA | |
730 | + PSHX | |
731 | + LDX OUTCHV | |
732 | + TBA | |
733 | + JSR 0,X | |
734 | + PULX | |
735 | + PULA | |
736 | + RTS | |
737 | +* | |
738 | + ORG COLD | |
739 | +* | |
740 | + END |
@@ -0,0 +1,823 @@ | ||
1 | + | |
2 | +pass 1 on VTL_6801_mc10.asm ***** | |
3 | + | |
4 | +pass 1 on VTL_6801_mc10.asm done ***** | |
5 | + | |
6 | + | |
7 | +pass 2 on VTL_6801_mc10.asm ***** | |
8 | + OPT 6801 | |
9 | + * VTL-2 for 6801 | |
10 | + * V-3.6 | |
11 | + * 9-23-76 | |
12 | + * BY GARY SHANNON | |
13 | + * & FRANK MCCOY | |
14 | + * COPYWRIGHT 1976, THE COMPUTER STORE | |
15 | + * | |
16 | + * Modifications for 6803-based MC-10 | |
17 | + * including moving variables out of direct page, etc. | |
18 | + * by Joel Matthew Rees | |
19 | + * Copyright 2022, Joel Matthew Rees | |
20 | + * | |
21 | + * Modifications explained at | |
22 | + * https://joels-programming-fun.blogspot.com/2022/08/trs | |
23 | + * | |
24 | + * DEFINE LOCATIONS IN MONITOR | |
25 | + * INCH EQU $FF00 ; per VTL.ASM | |
26 | + * EINCH EQU $F012 ; exorsim mdos Input byte with echo un | |
27 | + * INCH EQU $F015 ; exorsim mdos Input char with echo (F0 | |
28 | + * POLCAT EQU $FF24 ; from VTL.ASM | |
29 | + * OUTCH EQU $FF81 ; from VTL.ASM | |
30 | + * EOUTCH EQU $F018 ; exorsim mdos Output character with | |
31 | + * OUTS EQU $FF82 ; from VTL.ASM | |
32 | + * EPCRLF EQU $F021 ; Primarily for forced initialization | |
33 | + * | |
34 | + * FOR SBC6800: | |
35 | + *BREAK EQU $1B ; BREAK KEY | |
36 | + * For MC-10: | |
37 | + 0003 BREAK EQU $03 | |
38 | + * For exorsim | |
39 | + *ACIACS EQU $FCF4 ; exorcisor | |
40 | + *ACIADA EQU $FCF5 ; exorcisor | |
41 | + * | |
42 | + * A few interpreter variables in the direct page won't h | |
43 | + * (Yes, I can hear voices of complaint that it's not as | |
44 | + * (This allows us to save more ROM space and uses DP tha | |
45 | + * (Trade-offs.) | |
46 | + * (It also helps us understand the code, so we can do a | |
47 | + * (I hope the names are meaningful.) | |
48 | + * | |
49 | + * In .c10 format, the following as ORG and RMBs will cau | |
50 | + * which will prevent the code from loading. | |
51 | + * Changed to EQU for the MC10. | |
52 | + * ORG $C0 ; Move this according to your environment's n | |
53 | + 00C0 DPBASE EQU $C0 ; Change this to move the registers. | |
54 | + * PARSET RMB 2 ; Instead of SAVE0 in TERM/NXTRM | |
55 | + 00C2 PARSET EQU DPBASE+2 | |
56 | + * CVTSUM RMB 2 ; Instead of SAVE1 in CBLOOP | |
57 | + 00C4 CVTSUM EQU PARSET+2 | |
58 | + * MLDVCT EQU CVTSUM ; Instead of SAVE1 in mul/div (1 byt | |
59 | + 00C4 MLDVCT EQU CVTSUM | |
60 | + * DIVQUO RMB 2 ; Instead of SAVE2 in DIV | |
61 | + 00C6 DIVQUO EQU MLDVCT+2 | |
62 | + * MPLIER EQU DIVQUO ; Instead of SAVE2 in MULTIP | |
63 | + 00C6 MPLIER EQU DIVQUO | |
64 | + * EVALPT RMB 2 ; Instead of SAVE3 | |
65 | + 00C8 EVALPT EQU MPLIER+2 | |
66 | + * CNVPTR RMB 2 ; Instead of SAVE4 | |
67 | + 00CA CNVPTR EQU EVALPT+2 | |
68 | + * VARADR RMB 2 ; Instead of SAVE6 | |
69 | + 00CC VARADR EQU CNVPTR+2 | |
70 | + * OPRLIN RMB 2 ; Instead of SAVE7 | |
71 | + 00CE OPRLIN EQU VARADR+2 | |
72 | + * EDTLIN RMB 2 ; Instead of SAVE8 | |
73 | + 00D0 EDTLIN EQU OPRLIN+2 | |
74 | + * INSPTR RMB 2 ; Instead of SAVE10 (maybe? Will some VTL | |
75 | + 00D2 INSPTR EQU EDTLIN+2 | |
76 | + * SAVLIN RMB 2 ; Instead of SAVE11 | |
77 | + 00D4 SAVLIN EQU INSPTR+2 | |
78 | + * SRC RMB 2 ; For copy routine | |
79 | + 00D6 SRC EQU SAVLIN+2 | |
80 | + * DST RMB 2 ; ditto | |
81 | + 00D8 DST EQU SRC+2 | |
82 | + 00DA STKMRK EQU DST+2 ; to restore the stack on each pass. | |
83 | + 00DC DPALLOC EQU STKMRK+2 ; total storage declared in the dir | |
84 | + * | |
85 | + * SET ASIDE FOUR BYTES FOR USER | |
86 | + * DEFINED INTERUPT ROUTINE IF NEEDED | |
87 | + ORG $4300 | |
88 | + * ZERO must be set at even $100 boundary for address mat | |
89 | + 4300 00 00 00 00 | |
90 | + ZERO RMB 4 ; INTERUPT VECTOR | |
91 | + 4304 00 00 AT RMB 2 ; CANCEL & C-R | |
92 | + * | |
93 | + * GENERAL PURPOSE STORRGE | |
94 | + 4306 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
95 | + 431A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
96 | + 432E 00 00 00 00 00 00 00 00 00 00 00 00 | |
97 | + VARS RMB 52 ; VARIABLES(A-Z) | |
98 | + 433A 00 00 BRAK RMB 2 ; [ | |
99 | + * SAVE10 has me worried about implicit linkage in VTL pr | |
100 | + 433C 00 00 SAVE10 RMB 2 ; BACK SLASH | |
101 | + 433E 00 00 BRIK RMB 2 ; ] | |
102 | + 4340 00 00 UP RMB 2 ; ^ | |
103 | + 4342 00 00 SAVE11 RMB 2 ; Need something in each SAVE to reserve sp | |
104 | + * ; to keep the math straight. | |
105 | + * ; Leave the SAVEs declared as they are. | |
106 | + * | |
107 | + 4344 00 00 SAVE14 RMB 2 ; SPACE (originally unused) | |
108 | + 4346 00 00 EXCL RMB 2 ; ! | |
109 | + 4348 00 00 QUOTE RMB 2 ; " | |
110 | + 434A 00 00 DOLR RMB 2 ; # | |
111 | + 434C 00 00 DOLLAR RMB 2 ; $ | |
112 | + 434E 00 00 REMN RMB 2 ; % | |
113 | + 4350 00 00 AMPR RMB 2 ; & | |
114 | + 4352 00 00 QUITE RMB 2 ; ' | |
115 | + 4354 00 00 PAREN RMB 2 ; ( | |
116 | + 4356 00 00 PARIN RMB 2 ; ) | |
117 | + 4358 00 00 STAR RMB 2 ; * | |
118 | + 435A 00 00 PLUS RMB 2 ; + | |
119 | + 435C 00 00 COMA RMB 2 ; , | |
120 | + 435E 00 00 MINS RMB 2 ; - | |
121 | + 4360 00 00 PERD RMB 2 ; . | |
122 | + 4362 00 00 SLASH RMB 2 ; / | |
123 | + * | |
124 | + 4364 00 00 SAVE0 RMB 2 ; unused | |
125 | + 4366 00 00 SAVE1 RMB 2 ; unused | |
126 | + 4368 00 00 SAVE2 RMB 2 ; unused | |
127 | + 436A 00 00 SAVE3 RMB 2 ; unused | |
128 | + 436C 00 00 SAVE4 RMB 2 ; unused | |
129 | + 436E 00 00 SAVE5 RMB 2 ; unused (PSH/PULX) | |
130 | + 4370 00 00 SAVE6 RMB 2 ; unused | |
131 | + 4372 00 00 SAVE7 RMB 2 ; unused | |
132 | + 4374 00 00 SAVE8 RMB 2 ; unused | |
133 | + 4376 00 00 SAVE9 RMB 2 ; unused (PSH/PULX) | |
134 | + 4378 00 00 COLN RMB 2 ; : | |
135 | + 437A 00 00 SEMI RMB 2 ; ; | |
136 | + 437C 00 00 LESS RMB 2 ; < | |
137 | + 437E 00 00 EQAL RMB 2 ; = | |
138 | + 4380 00 GRRT RMB 1 ; > | |
139 | + 4381 00 DECB_1 RMB 1 | |
140 | + * | |
141 | + 4382 00 00 00 00 | |
142 | + DECBUF RMB 4 | |
143 | + 4386 00 LASTD RMB 1 | |
144 | + 4387 00 DELIM RMB 1 | |
145 | + 0048 LINLEN EQU 72 | |
146 | + 4388 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
147 | + 439C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
148 | + 43B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
149 | + 43C4 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
150 | + LINBUF RMB LINLEN+1 | |
151 | + 0088 BUFOFF EQU LINBUF-ZERO ; Unmagic 87. Some assemblers wil | |
152 | + * | |
153 | + ORG $43F1 | |
154 | + 43F1 00 STACK RMB 1 | |
155 | + * | |
156 | + ORG $4400 | |
157 | + 4400 00 00 00 00 | |
158 | + MI RMB 4 ; INTERUPT VECTORS | |
159 | + 4404 00 00 00 00 | |
160 | + NMI RMB 4 | |
161 | + 4408 PRGM EQU * ; PROGRAM STARTS HERE | |
162 | + * Must have some RAM here. | |
163 | + * | |
164 | + ORG $4C00 | |
165 | + * | |
166 | + * The COLD boot can be removed or ignored to restore the | |
167 | + * but if you do that don't forget to set & (AMPR) and * | |
168 | + * by hand immediately after STARTing. | |
169 | + * | |
170 | + * Also, instead of PROBEing, if you know the limits for | |
171 | + * application, you can set STAR directly: | |
172 | + * LDX #PRGM | |
173 | + * STX AMPR | |
174 | + * LDX #RAMLIM | |
175 | + * STX STAR | |
176 | + * START ... | |
177 | + * | |
178 | + 4C00 9F DA COLD STS STKMRK ; Mark the stack, | |
179 | + * LDS #STACK ; but use BASIC's stack. (S on 6800 points | |
180 | + * JSR TRMINI | |
181 | + 4C02 CE 44 08 LDX #PRGM ; initialize program area base | |
182 | + 4C05 FF 43 50 STX AMPR | |
183 | + 4C08 86 5A LDAA #$5A ; Probe RAM limit | |
184 | + 4C0A C6 A5 LDAB #$A5 | |
185 | + 4C0C 20 0D BRA PROBET | |
186 | + 4C0E A7 00 PROBE STAA 0,X | |
187 | + 4C10 A1 00 CMPA 0,X | |
188 | + 4C12 26 0C BNE NOTRAM | |
189 | + 4C14 E7 00 STAB 0,X | |
190 | + 4C16 E1 00 CMPB 0,X | |
191 | + 4C18 26 06 BNE NOTRAM | |
192 | + 4C1A 08 INX ; all bits seem to be R/W. | |
193 | + 4C1B 8C 4C 00 PROBET CPX #COLD | |
194 | + 4C1E 25 EE BLO PROBE ; CPX on 6801 works right. | |
195 | + 4C20 09 NOTRAM DEX | |
196 | + 4C21 FF 43 58 STX STAR | |
197 | + 4C24 START | |
198 | + * LDS #STACK ; re-initialize at beginning of each evalua | |
199 | + 4C24 9E DA LDS STKMRK ; from mark instead of constant | |
200 | + 4C26 BF 43 7A STS SEMI ; DBG Comment this out when we no longer need | |
201 | + 4C29 4F CLRA ; NUL delimiter | |
202 | + 4C2A CE 4F 3E LDX #OKM | |
203 | + 4C2D 8D 48 BSR STRGT | |
204 | + * | |
205 | + 4C2F 4F LOOP CLRA | |
206 | + 4C30 B7 43 4A STAA DOLR | |
207 | + 4C33 B7 43 4B STAA DOLR+1 | |
208 | + 4C36 BD 4E EB JSR CVTLN | |
209 | + 4C39 24 3F BCC STMNT ; NO LINE# THEN EXEC | |
210 | + 4C3B 8D 27 BSR EXEC | |
211 | + 4C3D 27 E5 BEQ START | |
212 | + * | |
213 | + 4C3F 8D 68 LOOP2 BSR FIND ; FIND LINE | |
214 | + 4C41 27 E1 EQSTRT BEQ START ; IF END THEN STOP | |
215 | + 4C43 EE 00 LDX 0,X ; LOAD REAL LINE # | |
216 | + 4C45 FF 43 4A STX DOLR ; SAVE IT | |
217 | + 4C48 DE D4 LDX SAVLIN ; GET LINE | |
218 | + 4C4A 08 INX ; BUMP PAST LINE # | |
219 | + 4C4B 08 INX ; BUMP PAST LINE # | |
220 | + 4C4C 08 INX ; BUMP PAST SPACE | |
221 | + 4C4D 8D 15 BSR EXEC ; EXECUTE IT | |
222 | + 4C4F 27 0F BEQ LOOP3 ; IF ZERO, CONTINUE | |
223 | + 4C51 DE D4 LDX SAVLIN ; FIND LINE | |
224 | + 4C53 EE 00 LDX 0,X ; GET IT | |
225 | + 4C55 BC 43 4A CPX DOLR ; HAS IT CHANGED? | |
226 | + 4C58 27 06 BEQ LOOP3 ; IF NOT GET NEXT | |
227 | + * | |
228 | + 4C5A 08 INX ; INCREMENT OLD LINE# | |
229 | + 4C5B FF 43 46 STX EXCL ; SAVE FOR RETURN | |
230 | + 4C5E 20 DF BRA LOOP2 ; CONTINUE | |
231 | + * | |
232 | + 4C60 8D 58 LOOP3 BSR FND3 ; FIND NEXT LINE | |
233 | + 4C62 20 DD BRA EQSTRT ; CONTINUE | |
234 | + * | |
235 | + 4C64 DF CE EXEC STX OPRLIN ; EXECUTE LINE | |
236 | + 4C66 BD 4E 3C JSR VAR2 | |
237 | + 4C69 08 INX | |
238 | + * | |
239 | + 4C6A A6 00 SKIP LDAA 0,X ; GET FIRST TERM | |
240 | + 4C6C 8D 04 BSR EVIL ; EVALUATE EXPRESSION | |
241 | + 4C6E FE 43 4A OUTX LDX DOLR ; GET LINE # | |
242 | + 4C71 39 RTS | |
243 | + * | |
244 | + 4C72 81 22 EVIL CMPA #$22 ; IF " THEN BRANCH | |
245 | + 4C74 26 4B BNE EVALU | |
246 | + 4C76 08 INX | |
247 | + 4C77 7E 4D CB STRGT JMP STRING ; TO PRINT IT | |
248 | + * | |
249 | + 4C7A DF D0 STMNT STX EDTLIN ; SAVE LINE # | |
250 | + 4C7C FD 43 4A STD DOLR | |
251 | + 4C7F FE 43 4A LDX DOLR | |
252 | + 4C82 26 6B BNE SKP2 ; IF LINE# <> 0 | |
253 | + * | |
254 | + 4C84 CE 44 08 LDX #PRGM ; LIST PROGRAM | |
255 | + 4C87 BC 43 50 LST2 CPX AMPR ; END OF PROGRAM | |
256 | + 4C8A 27 B5 BEQ EQSTRT | |
257 | + 4C8C DF D4 STX SAVLIN ; LINE # FOR CVDEC | |
258 | + 4C8E EC 00 LDD 0,X | |
259 | + 4C90 BD 4D 76 JSR PRNT2 | |
260 | + 4C93 DE D4 LDX SAVLIN | |
261 | + 4C95 08 INX | |
262 | + 4C96 08 INX | |
263 | + 4C97 BD 4D AC JSR PNTMSG | |
264 | + 4C9A BD 4F 36 JSR CRLF | |
265 | + 4C9D 20 E8 BRA LST2 | |
266 | + * | |
267 | + 4C9F DE D4 NXTXT LDX SAVLIN ; GET POINTER | |
268 | + 4CA1 08 INX ; BUMP PAST LINE# | |
269 | + 4CA2 08 LOOKAG INX ; FIND END OF LINE | |
270 | + 4CA3 6D 00 TST 0,X | |
271 | + 4CA5 26 FB BNE LOOKAG | |
272 | + 4CA7 08 INX | |
273 | + 4CA8 39 RTS | |
274 | + * | |
275 | + 4CA9 CE 44 08 FIND LDX #PRGM ; FIND LINE | |
276 | + 4CAC DF D4 FND2 STX SAVLIN | |
277 | + 4CAE BC 43 50 CPX AMPR | |
278 | + 4CB1 27 0D BEQ RTS1 | |
279 | + * LDAA 1,X ; almost missed this. | |
280 | + * SUBA DOLR+1 ; This was necessary because no SUBD | |
281 | + * LDAA 0,X ; and CPX does not affect C flag on 6800 | |
282 | + * SBCA DOLR | |
283 | + * PSHB ; B does not seem to be in use. | |
284 | + 4CB3 EC 00 LDD 0,X ; Use D because we think we want to keep X. | |
285 | + 4CB5 B3 43 4A SUBD DOLR | |
286 | + * PULB | |
287 | + 4CB8 24 04 BCC SET | |
288 | + 4CBA 8D E3 FND3 BSR NXTXT | |
289 | + 4CBC 20 EE BRA FND2 | |
290 | + * | |
291 | + 4CBE 86 FF SET LDAA #$FF ; SET NOT EQUAL | |
292 | + 4CC0 39 RTS1 RTS | |
293 | + * | |
294 | + 4CC1 BD 4D D6 EVALU JSR EVAL ; EVALUATE LINE | |
295 | + 4CC4 37 PSHB | |
296 | + 4CC5 36 PSHA | |
297 | + 4CC6 DE CE LDX OPRLIN | |
298 | + 4CC8 BD 4E 4C JSR CONVP | |
299 | + 4CCB 32 PULA | |
300 | + 4CCC C1 24 CMPB #'$ ; STRING? | |
301 | + 4CCE 26 04 BNE AR1 | |
302 | + 4CD0 33 PULB | |
303 | + 4CD1 7E 4F 59 JMP OUTCH ; THEN PRINT IT | |
304 | + 4CD4 C0 3F AR1 SUBB #'? ; PRINT? | |
305 | + 4CD6 26 03 BNE AR11 ; was out of range. | |
306 | + 4CD8 7E 4D 75 JMP PRNT ; THEN DO IT | |
307 | + * BEQ PRNT ; When we bring it back within range. | |
308 | + 4CDB 5C AR11 INCB ; MACHINE LANGUAGE? | |
309 | + 4CDC 33 PULB | |
310 | + 4CDD 26 01 BNE AR2 | |
311 | + 4CDF 3F SWI ; THEN INTERUPT | |
312 | + * | |
313 | + 4CE0 ED 00 AR2 STD 0,X ; STORE NEW VALUE | |
314 | + 4CE2 26 01 BNE AR2RND ; Initialize/don't get stuck on zero. | |
315 | + 4CE4 5C INCB ; Keep it known cheap. | |
316 | + * ADDD QUITE ; RANDOMIZER ; NO! Don't do this. | |
317 | + 4CE5 FB 43 52 AR2RND ADDB QUITE ; RANDOMIZER ; Adding the low byte to | |
318 | + 4CE8 B9 43 53 ADCA QUITE+1 ; ; is cheap but intentional. | |
319 | + 4CEB FD 43 52 STD QUITE | |
320 | + 4CEE 39 RTS | |
321 | + * | |
322 | + 4CEF 8D B8 SKP2 BSR FIND ; FIND LINE | |
323 | + 4CF1 27 29 BEQ INSRT ; IF NOT THERE | |
324 | + 4CF3 EE 00 LDX 0,X ; THEN INSERT | |
325 | + 4CF5 BC 43 4A CPX DOLR ; NEW LINE | |
326 | + 4CF8 26 22 BNE INSRT | |
327 | + * | |
328 | + 4CFA 8D A3 BSR NXTXT ; SETUP REGISTERS | |
329 | + * LDS SAVLIN ; FOR DELETE | |
330 | + 4CFC DF D6 STX SRC | |
331 | + 4CFE DE D4 LDX SAVLIN | |
332 | + 4D00 DF D8 STX DST | |
333 | + * | |
334 | + 4D02 DE D6 DELT LDX SRC | |
335 | + 4D04 BC 43 50 CPX AMPR ; DELETE OLD LINE | |
336 | + 4D07 27 0E BEQ FITIT | |
337 | + 4D09 A6 00 LDAA 0,X | |
338 | + 4D0B 08 INX | |
339 | + 4D0C DF D6 STX SRC | |
340 | + * PSHA | |
341 | + * INX | |
342 | + * INS | |
343 | + * INS | |
344 | + 4D0E DE D8 LDX DST | |
345 | + 4D10 A7 00 STA 0,X | |
346 | + 4D12 08 INX | |
347 | + 4D13 DF D8 STX DST | |
348 | + 4D15 20 EB BRA DELT | |
349 | + * | |
350 | + * FITIT STS AMPR ; STORE NEW END | |
351 | + 4D17 DE D8 FITIT LDX DST | |
352 | + 4D19 FF 43 50 STX AMPR ; STORE NEW END | |
353 | + * | |
354 | + 4D1C DE D0 INSRT LDX EDTLIN ; COUNT NEW LINE LENGTH | |
355 | + 4D1E C6 03 LDAB #$03 | |
356 | + 4D20 6D 00 TST 0,X | |
357 | + 4D22 27 49 BEQ GOTIT ; IF NO LINE THEN STOP | |
358 | + 4D24 5C CNTLN INCB ; count bytes | |
359 | + 4D25 08 INX | |
360 | + 4D26 6D 00 TST 0,X ; Find trailing NUL | |
361 | + 4D28 26 FA BNE CNTLN | |
362 | + * | |
363 | + 4D2A 4F OPEN CLRA ; CALCULATE NEW END | |
364 | + 4D2B F3 43 50 ADDD AMPR | |
365 | + 4D2E DD D2 STD INSPTR | |
366 | + 4D30 B3 43 58 SUBD STAR | |
367 | + 4D33 24 3D BCC RSTRT ; IF TOO BIG THEN STOP | |
368 | + 4D35 FE 43 50 LDX AMPR | |
369 | + * LDS INSPTR ; remember that the 6800/6801 stack is post | |
370 | + * STS AMPR | |
371 | + 4D38 DC D2 LDD INSPTR ; remember that the 6800/6801 stack is postd | |
372 | + 4D3A FD 43 50 STD AMPR | |
373 | + * | |
374 | + * LDS AMPR | |
375 | + 4D3D DD D8 STD DST | |
376 | + 4D3F 08 INX ; SLIDE OPEN GAP | |
377 | + 4D40 09 SLIDE DEX ; going down | |
378 | + 4D41 DF D6 STX SRC | |
379 | + 4D43 E6 00 LDAB 0,X | |
380 | + * PSHB ; stack blast it | |
381 | + 4D45 DE D8 LDX DST | |
382 | + 4D47 E7 00 STAB 0,X ; mimic 6800 push | |
383 | + 4D49 09 DEX | |
384 | + 4D4A DF D8 STX DST | |
385 | + 4D4C DE D6 LDX SRC | |
386 | + 4D4E 9C D4 CPX SAVLIN | |
387 | + 4D50 22 EE BHI SLIDE | |
388 | + * | |
389 | + * DON LDS DOLR ; STORE LINE # | |
390 | + * STS 0,X | |
391 | + 4D52 FC 43 4A DON LDD DOLR ; STORE LINE # | |
392 | + 4D55 ED 00 STD 0,X | |
393 | + 4D57 DF D8 STX DST ; will skip by offset store | |
394 | + * LDS EDTLIN ; GET NEW LINE | |
395 | + * DES ; pre-increment | |
396 | + 4D59 DC D0 LDD EDTLIN ; GET NEW LINE | |
397 | + 4D5B DD D6 STD SRC | |
398 | + * | |
399 | + *MOVL INX ; INSERT NEW LINE (skip over LINE # hi byte) | |
400 | + * PULB | |
401 | + * STAB 1,X ; (skips over low byte, BTW) | |
402 | + 4D5D DE D6 MOVL LDX SRC | |
403 | + 4D5F E6 00 LDAB 0,X | |
404 | + 4D61 08 INX | |
405 | + 4D62 DF D6 STX SRC | |
406 | + 4D64 DE D8 LDX DST | |
407 | + 4D66 08 INX ; skip over what was already stored (too tricky fo | |
408 | + 4D67 DF D8 STX DST | |
409 | + 4D69 E7 01 STAB 1,X ; note offset store | |
410 | + 4D6B 26 F0 BNE MOVL ; until NUL stored | |
411 | + * | |
412 | + 4D6D GOTIT | |
413 | + * LDS #STACK ; Ready for a new line of input. | |
414 | + 4D6D 9E DA LDS STKMRK ; restore from mark | |
415 | + 4D6F 7E 4C 2F JMP LOOP | |
416 | + * | |
417 | + 4D72 7E 4C 24 RSTRT JMP START ; warm start over | |
418 | + * | |
419 | + 4D75 33 PRNT PULB ; PRINT DECIMAL | |
420 | + 4D76 CE 43 82 PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL | |
421 | + 4D79 DF CA STX CNVPTR | |
422 | + 4D7B CE 4E A2 LDX #PWRS10 | |
423 | + 4D7E 3C CVD1 PSHX | |
424 | + 4D7F EE 00 LDX 0,X | |
425 | + 4D81 DF CC STX VARADR | |
426 | + 4D83 CE 00 CC LDX #VARADR | |
427 | + 4D86 BD 4E AC JSR DIVIDE | |
428 | + 4D89 36 PSHA | |
429 | + 4D8A DE CA LDX CNVPTR | |
430 | + 4D8C 96 C7 LDAA DIVQUO+1 | |
431 | + 4D8E 8B 30 ADDA #'0 | |
432 | + 4D90 A7 00 STAA 0,X | |
433 | + 4D92 32 PULA | |
434 | + 4D93 08 INX | |
435 | + 4D94 DF CA STX CNVPTR | |
436 | + 4D96 38 PULX | |
437 | + 4D97 08 INX | |
438 | + 4D98 08 INX | |
439 | + 4D99 6D 01 TST 1,X | |
440 | + 4D9B 26 E1 BNE CVD1 | |
441 | + * | |
442 | + 4D9D CE 43 81 LDX #DECB_1 | |
443 | + 4DA0 63 05 COM 5,X ; ZERO SUPPRESS | |
444 | + 4DA2 08 ZRSUP INX | |
445 | + 4DA3 E6 00 LDAB 0,X | |
446 | + 4DA5 C1 30 CMPB #'0 | |
447 | + 4DA7 27 F9 BEQ ZRSUP | |
448 | + 4DA9 73 43 86 COM LASTD | |
449 | + * | |
450 | + 4DAC 4F PNTMSG CLRA ; ZERO FOR DELIM | |
451 | + 4DAD B7 43 87 STRTMS STAA DELIM ; STORE DELIMTER | |
452 | + * | |
453 | + 4DB0 E6 00 OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT | |
454 | + 4DB2 08 INX | |
455 | + 4DB3 F1 43 87 CMPB DELIM | |
456 | + 4DB6 27 05 BEQ CTLC | |
457 | + 4DB8 BD 4F 59 JSR OUTCH | |
458 | + 4DBB 20 F3 BRA OUTMSG | |
459 | + * | |
460 | + 4DBD BD 4F 43 CTLC JSR POLCAT ; POL FOR CHARACTER | |
461 | + 4DC0 24 57 BCC RTS2 | |
462 | + 4DC2 8D 04 BSR INCH2 | |
463 | + 4DC4 C1 03 CMPB #BREAK ; BREAK KEY? | |
464 | + 4DC6 27 AA BEQ RSTRT | |
465 | + * | |
466 | + 4DC8 7E 4F 52 INCH2 JMP INCH | |
467 | + * | |
468 | + 4DCB 8D E0 STRING BSR STRTMS ; PRINT STRING LITERAL | |
469 | + 4DCD A6 00 LDAA 0,X | |
470 | + 4DCF 81 3B CMPA #'; | |
471 | + 4DD1 27 57 BEQ OUTD | |
472 | + 4DD3 7E 4F 36 JMP CRLF | |
473 | + * | |
474 | + 4DD6 8D 42 EVAL BSR GETVAL ; EVALUATE EXPRESSION | |
475 | + * | |
476 | + 4DD8 36 NXTRM PSHA | |
477 | + 4DD9 A6 00 LDAA 0,X ; END OF LINE? | |
478 | + 4DDB 27 02 BEQ OUTN | |
479 | + 4DDD 81 29 CMPA #') | |
480 | + 4DDF 32 OUTN PULA | |
481 | + 4DE0 27 48 BEQ OUTD | |
482 | + 4DE2 8D 04 BSR TERM | |
483 | + 4DE4 DE C2 LDX PARSET | |
484 | + 4DE6 20 F0 BRA NXTRM | |
485 | + * | |
486 | + 4DE8 36 TERM PSHA ; GET VALUE | |
487 | + 4DE9 37 PSHB | |
488 | + 4DEA A6 00 LDAA 0,X | |
489 | + 4DEC 36 PSHA | |
490 | + 4DED 08 INX | |
491 | + 4DEE 8D 2A BSR GETVAL | |
492 | + 4DF0 DD C8 STD EVALPT | |
493 | + 4DF2 DF C2 STX PARSET | |
494 | + 4DF4 CE 00 C8 LDX #EVALPT | |
495 | + 4DF7 32 PULA | |
496 | + 4DF8 33 PULB | |
497 | + * | |
498 | + 4DF9 81 2A CMPA #'* ; SEE IF * | |
499 | + 4DFB 26 68 BNE EVAL2 | |
500 | + 4DFD 32 PULA ; MULTIPLY | |
501 | + 4DFE DD C6 MULTIP STD MPLIER ; 2'S COMPLEMENT | |
502 | + 4E00 C6 10 LDAB #$10 | |
503 | + 4E02 D7 C4 STAB MLDVCT | |
504 | + 4E04 4F CLRA | |
505 | + 4E05 5F CLRB | |
506 | + * | |
507 | + 4E06 74 00 C6 MULT LSR MPLIER | |
508 | + 4E09 76 00 C7 ROR MPLIER+1 | |
509 | + 4E0C 24 02 BCC NOAD | |
510 | + 4E0E E3 00 MULTI ADDD 0,X | |
511 | + 4E10 68 01 NOAD ASL 1,X | |
512 | + 4E12 69 00 ROL 0,X | |
513 | + 4E14 7A 00 C4 DEC MLDVCT | |
514 | + 4E17 26 ED BNE MULT ; LOOP TIL DONE | |
515 | + 4E19 39 RTS2 RTS | |
516 | + * | |
517 | + 4E1A BD 4E ED GETVAL JSR CVBIN ; GET VALUE | |
518 | + 4E1D 24 0C BCC OUTV | |
519 | + 4E1F C1 3F CMPB #'? ; OF LITERAL | |
520 | + 4E21 26 09 BNE VAR | |
521 | + 4E23 3C PSHX ; OR INPUT | |
522 | + 4E24 BD 4F 17 JSR INLN | |
523 | + 4E27 8D AD BSR EVAL | |
524 | + 4E29 38 PULX | |
525 | + 4E2A 08 OUTD INX | |
526 | + 4E2B 39 OUTV RTS | |
527 | + * | |
528 | + 4E2C C1 24 VAR CMPB #'$ ; OR STRING | |
529 | + 4E2E 26 05 BNE VAR1 | |
530 | + 4E30 8D 96 BSR INCH2 | |
531 | + 4E32 4F CLRA | |
532 | + 4E33 08 INX | |
533 | + 4E34 39 RTS | |
534 | + * | |
535 | + 4E35 C1 28 VAR1 CMPB #'( | |
536 | + 4E37 26 03 BNE VAR2 | |
537 | + 4E39 08 INX | |
538 | + 4E3A 20 9A BRA EVAL | |
539 | + * | |
540 | + 4E3C 8D 0E VAR2 BSR CONVP ; OR VARIABLE | |
541 | + 4E3E EC 00 LDD 0,X ; OR ARRAY ELEMENT | |
542 | + 4E40 DE CC LDX VARADR ; LOAD OLD INDEX | |
543 | + 4E42 39 RTS | |
544 | + * | |
545 | + 4E43 BD 4D D6 ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT | |
546 | + 4E46 05 ASLD | |
547 | + 4E47 F3 43 50 ADDD AMPR | |
548 | + 4E4A 20 11 BRA PACK | |
549 | + * | |
550 | + 4E4C E6 00 CONVP LDAB 0,X ; GET LOCATION | |
551 | + 4E4E 08 INX | |
552 | + 4E4F 37 PSHB | |
553 | + 4E50 C1 3A CMPB #': | |
554 | + 4E52 27 EF BEQ ARRAY ; OF VARIABLE OR | |
555 | + 4E54 4F CLRA ; ARRAY ELEMENT | |
556 | + 4E55 C4 3F ANDB #$3F ; mask out-of-variable-range | |
557 | + 4E57 CB 02 ADDB #$02 ; bump past "interrupt vectors" | |
558 | + 4E59 58 ASLB ; make into offset (would be address in DP in ori | |
559 | + 4E5A C3 43 00 ADDD #ZERO ; The 6801 can do this right. | |
560 | + * | |
561 | + 4E5D DF CC PACK STX VARADR ; STORE OLD INDEX | |
562 | + 4E5F DD CA STD CNVPTR | |
563 | + 4E61 DE CA LDX CNVPTR ; LOAD NEW INDEX | |
564 | + 4E63 33 PULB | |
565 | + 4E64 39 RTS | |
566 | + * | |
567 | + 4E65 81 2B EVAL2 CMPA #'+ ; ADDITION | |
568 | + 4E67 26 04 BNE EVAL3 | |
569 | + 4E69 32 PULA | |
570 | + 4E6A E3 00 ADD ADDD 0,X | |
571 | + 4E6C 39 RTS | |
572 | + * | |
573 | + 4E6D 81 2D EVAL3 CMPA #'- ; SUBTRACTION | |
574 | + 4E6F 26 04 BNE EVAL4 | |
575 | + 4E71 32 PULA | |
576 | + 4E72 A3 00 SUBTR SUBD 0,X | |
577 | + 4E74 39 RTS | |
578 | + * | |
579 | + 4E75 81 2F EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE | |
580 | + 4E77 26 09 BNE EVAL5 | |
581 | + 4E79 32 PULA | |
582 | + 4E7A 8D 30 BSR DIVIDE | |
583 | + 4E7C FD 43 4E STD REMN | |
584 | + 4E7F DC C6 LDD DIVQUO | |
585 | + 4E81 39 RTS | |
586 | + * | |
587 | + 4E82 80 3D EVAL5 SUBA #'= ; SEE IF EQUAL TEST | |
588 | + 4E84 26 0C BNE EVAL6 | |
589 | + 4E86 32 PULA | |
590 | + 4E87 A3 00 SUBD 0,X | |
591 | + 4E89 26 03 BNE NOTEQ | |
592 | + 4E8B 5D TSTB | |
593 | + 4E8C 27 02 BEQ EQL | |
594 | + 4E8E C6 FF NOTEQ LDAB #$FF | |
595 | + 4E90 20 0D EQL BRA COMBOUT | |
596 | + * | |
597 | + 4E92 4A EVAL6 DECA ; SEE IF LESS THAN TEST | |
598 | + 4E93 32 PULA | |
599 | + 4E94 27 07 BEQ EVAL7 | |
600 | + * | |
601 | + 4E96 A3 00 SUB2 SUBD 0,X | |
602 | + 4E98 59 ROLB | |
603 | + 4E99 4F COMOUT CLRA | |
604 | + 4E9A C4 01 ANDB #$01 | |
605 | + 4E9C 39 RTS | |
606 | + * | |
607 | + 4E9D 8D F7 EVAL7 BSR SUB2 ; GT TEST | |
608 | + 4E9F 53 COMBOUT COMB | |
609 | + 4EA0 20 F7 BRA COMOUT | |
610 | + * | |
611 | + 4EA2 27 PWRS10 FCB $27 ; 10000 | |
612 | + 4EA3 10 FCB $10 | |
613 | + 4EA4 03 FCB $03 ; 1000 | |
614 | + 4EA5 E8 FCB $E8 | |
615 | + 4EA6 00 FCB $00 ; 100 | |
616 | + 4EA7 64 FCB $64 | |
617 | + 4EA8 00 FCB $00 ; 10 | |
618 | + 4EA9 0A FCB $0A | |
619 | + 4EAA 00 FCB $00 ; 1 | |
620 | + 4EAB 01 FCB $01 | |
621 | + * | |
622 | + 4EAC 7F 00 C4 DIVIDE CLR MLDVCT ; DEVIDE 16-BITS | |
623 | + 4EAF 7C 00 C4 GOT INC MLDVCT | |
624 | + 4EB2 68 01 ASL 1,X | |
625 | + 4EB4 69 00 ROL 0,X | |
626 | + 4EB6 24 F7 BCC GOT | |
627 | + 4EB8 66 00 ROR 0,X | |
628 | + 4EBA 66 01 ROR 1,X | |
629 | + 4EBC 7F 00 C6 CLR DIVQUO | |
630 | + 4EBF 7F 00 C7 CLR DIVQUO+1 | |
631 | + 4EC2 A3 00 DIV2 SUBD 0,X | |
632 | + 4EC4 24 05 BCC OK | |
633 | + 4EC6 E3 00 ADDD 0,X | |
634 | + 4EC8 0C CLC | |
635 | + 4EC9 20 01 BRA DIVNOC ; instead of the trick | |
636 | + * The 6801 CPX affects all relevant flags, can't use thi | |
637 | + * FCB $9C ; CPX | |
638 | + 4ECB 0D OK SEC ; $0D | |
639 | + 4ECC 79 00 C7 DIVNOC ROL DIVQUO+1 | |
640 | + 4ECF 79 00 C6 ROL DIVQUO | |
641 | + 4ED2 7A 00 C4 DEC MLDVCT | |
642 | + 4ED5 27 12 BEQ DONE | |
643 | + 4ED7 64 00 LSR 0,X | |
644 | + 4ED9 66 01 ROR 1,X | |
645 | + 4EDB 20 E5 BRA DIV2 | |
646 | + * | |
647 | + 4EDD E6 00 TSTN LDAB 0,X ; TEST FOR NUMERIC | |
648 | + 4EDF C1 3A CMPB #$3A | |
649 | + 4EE1 2A 04 BPL NOTDEC | |
650 | + 4EE3 C1 30 CMPB #'0 | |
651 | + 4EE5 2C 02 BGE DONE | |
652 | + 4EE7 0D NOTDEC SEC | |
653 | + 4EE8 39 RTS | |
654 | + 4EE9 0C DONE CLC | |
655 | + 4EEA 39 DUN RTS | |
656 | + * | |
657 | + 4EEB 8D 2A CVTLN BSR INLN | |
658 | + * | |
659 | + 4EED 8D EE CVBIN BSR TSTN ; CONVERT TO BINARY | |
660 | + 4EEF 25 F9 BCS DUN | |
661 | + 4EF1 4F CONT CLRA | |
662 | + 4EF2 5F CLRB | |
663 | + 4EF3 EB 00 CBLOOP ADDB 0,X | |
664 | + 4EF5 89 00 ADCA #$00 | |
665 | + 4EF7 C0 30 SUBB #'0 | |
666 | + 4EF9 82 00 SBCA #$00 | |
667 | + 4EFB DD C4 STD CVTSUM | |
668 | + 4EFD 08 INX | |
669 | + 4EFE 37 PSHB | |
670 | + 4EFF 8D DC BSR TSTN | |
671 | + 4F01 33 PULB | |
672 | + 4F02 25 E5 BCS DONE | |
673 | + 4F04 05 ASLD | |
674 | + 4F05 05 ASLD | |
675 | + 4F06 D3 C4 ADDD CVTSUM | |
676 | + 4F08 05 ASLD | |
677 | + 4F09 20 E8 BRA CBLOOP | |
678 | + * | |
679 | + 4F0B C1 40 INLN6 CMPB #'@ ; CANCEL | |
680 | + 4F0D 27 06 BEQ NEWLIN | |
681 | + 4F0F 08 INX ; '.' | |
682 | + 4F10 8C 43 4A CPX #ZERO+LINLEN+2 ; (Here's part of what we had to fix | |
683 | + 4F13 26 0B BNE INLN2 | |
684 | + 4F15 8D 1F NEWLIN BSR CRLF | |
685 | + * | |
686 | + 4F17 CE 43 02 INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL | |
687 | + 4F1A 09 INLN5 DEX | |
688 | + 4F1B 8C 43 00 CPX #ZERO ; Make this explicit to enable variables move | |
689 | + 4F1E 27 F5 BEQ NEWLIN ; (Was implicit zero compare X from DEX, now | |
690 | + 4F20 BD 4F 52 INLN2 JSR INCH ; INPUT CHARACTER | |
691 | + 4F23 E7 87 STAB BUFOFF-1,X ; STORE IT | |
692 | + 4F25 C1 5F CMPB #$5F ; BACKSPACE? | |
693 | + 4F27 27 F1 BEQ INLN5 | |
694 | + * | |
695 | + 4F29 C1 0D INLIN3 CMPB #$0D ; CARRIAGE RETURN | |
696 | + 4F2B 2B F3 BMI INLN2 | |
697 | + 4F2D 26 DC BNE INLN6 | |
698 | + * | |
699 | + 4F2F 6F 87 INLIN4 CLR BUFOFF-1,X ; CLEAR LAST CHAR | |
700 | + 4F31 CE 43 88 LDX #LINBUF | |
701 | + 4F34 20 04 BRA LF | |
702 | + * | |
703 | + * CRLF JSR EPCRLF | |
704 | + 4F36 C6 0D CRLF LDAB #$0D ; CARR-RET | |
705 | + 4F38 8D 02 BSR OUTCH2 | |
706 | + 4F3A C6 0A LF LDAB #$0A ; LINE FEED | |
707 | + 4F3C 20 1B OUTCH2 BRA OUTCH | |
708 | + * | |
709 | + 4F3E 0D OKM FCB $0D | |
710 | + 4F3F 0A FCB $0A | |
711 | + 4F40 4F 4B FCC 'OK' | |
712 | + 4F42 00 FCB $00 | |
713 | + * | |
714 | + *TRMINI LDAB #40 | |
715 | + *TRMILP JSR EPCRLF | |
716 | + * DECB | |
717 | + * BNE TRMILP | |
718 | + * RTS | |
719 | + * | |
720 | + * MC-10 BASIC ROM vectors | |
721 | + FFDC INCHV EQU $FFDC ; Scan keyboard | |
722 | + FFDE OUTCHV EQU $FFDE ; Write char to screen | |
723 | + * | |
724 | + * RECEIVER POLLING | |
725 | + 4F43 36 POLCAT PSHA | |
726 | + 4F44 3C PSHX | |
727 | + 4F45 FE FF DC LDX INCHV ; at any rate, don't wait. | |
728 | + 4F48 AD 00 JSR 0,X ; | |
729 | + 4F4A 16 TAB ; MC-10 ROM says NUL is not input. | |
730 | + 4F4B 0D SEC | |
731 | + 4F4C 26 01 BNE POLCATR ; Don't wait. | |
732 | + 4F4E 0C CLC | |
733 | + 4F4F 38 POLCATR PULX | |
734 | + 4F50 32 PULA | |
735 | + 4F51 39 RTS | |
736 | + *POLCAT LDAB ACIACS | |
737 | + * ASRB | |
738 | + * RTS | |
739 | + * | |
740 | + * INPUT ONE CHAR INTO B ACCUMULATOR | |
741 | + 4F52 8D EF INCH BSR POLCAT | |
742 | + 4F54 24 FC BCC INCH ; Wait here. | |
743 | + 4F56 8D 01 BSR OUTCH | |
744 | + 4F58 39 RTS | |
745 | + * | |
746 | + * OUTPUT ONE CHAR | |
747 | + 4F59 36 OUTCH PSHA | |
748 | + 4F5A 3C PSHX | |
749 | + 4F5B FE FF DE LDX OUTCHV | |
750 | + 4F5E 17 TBA | |
751 | + 4F5F AD 00 JSR 0,X | |
752 | + 4F61 38 PULX | |
753 | + 4F62 32 PULA | |
754 | + 4F63 39 RTS | |
755 | + * | |
756 | + ORG COLD | |
757 | + * | |
758 | + END | |
759 | + | |
760 | +pass 2 on VTL_6801_mc10.asm done ***** | |
761 | + | |
762 | +tax errors found. | |
763 | +:ADD || 4350:AMPR || 4cd4:AR1 | | |
764 | +:AR11 || 4ce0:AR2 || 4ce5:AR2RND | | |
765 | +:ARRAY || 4304:AT || 433a:BRAK | | |
766 | +:BREAK || 433e:BRIK || 0088:BUFOFF | | |
767 | +:CBLOOP || 4d24:CNTLN || 00ca:CNVPTR | | |
768 | +:COLD || 4378:COLN || 435c:COMA | | |
769 | +:COMBOUT || 4e99:COMOUT || 4ef1:CONT | | |
770 | +:CONVP || 4f36:CRLF || 4dbd:CTLC | | |
771 | +:CVBIN || 4d7e:CVD1 || 4eeb:CVTLN | | |
772 | +:CVTSUM || 4382:DECBUF || 4381:DECB_1 | | |
773 | +:DELIM || 4d02:DELT || 4ec2:DIV2 | | |
774 | +:DIVIDE || 4ecc:DIVNOC || 00c6:DIVQUO | | |
775 | +:DOLLAR || 434a:DOLR || 4d52:DON | | |
776 | +:DONE || 00dc:DPALLOC || 00c0:DPBASE | | |
777 | +:DST || 4eea:DUN || 00d0:EDTLIN | | |
778 | +:EQAL || 4e90:EQL || 4c41:EQSTRT | | |
779 | +:EVAL || 4e65:EVAL2 || 4e6d:EVAL3 | | |
780 | +:EVAL4 || 4e82:EVAL5 || 4e92:EVAL6 | | |
781 | +:EVAL7 || 00c8:EVALPT || 4cc1:EVALU | | |
782 | +:EVIL || 4346:EXCL || 4c64:EXEC | | |
783 | +:FIND || 4d17:FITIT || 4cac:FND2 | | |
784 | +:FND3 || 4e1a:GETVAL || 4eaf:GOT | | |
785 | +:GOTIT || 4380:GRRT || 4f52:INCH | | |
786 | +:INCH2 || ffdc:INCHV || 4f29:INLIN3 | | |
787 | +:INLIN4 || 4f17:INLN || 4f20:INLN2 | | |
788 | +:INLN5 || 4f0b:INLN6 || 00d2:INSPTR | | |
789 | +:INSRT || 4386:LASTD || 437c:LESS | | |
790 | +:LF || 4388:LINBUF || 0048:LINLEN | | |
791 | +:LOOKAG || 4c2f:LOOP || 4c3f:LOOP2 | | |
792 | +:LOOP3 || 4c87:LST2 || 4400:MI | | |
793 | +:MINS || 00c4:MLDVCT || 4d5d:MOVL | | |
794 | +:MPLIER || 4e06:MULT || 4e0e:MULTI | | |
795 | +:MULTIP || 4f15:NEWLIN || 4404:NMI | | |
796 | +:NOAD || 4ee7:NOTDEC || 4e8e:NOTEQ | | |
797 | +:NOTRAM || 4dd8:NXTRM || 4c9f:NXTXT | | |
798 | +:OK || 4f3e:OKM || 4d2a:OPEN | | |
799 | +:OPRLIN || 4f59:OUTCH || 4f3c:OUTCH2 | | |
800 | +:OUTCHV || 4e2a:OUTD || 4db0:OUTMSG | | |
801 | +:OUTN || 4e2b:OUTV || 4c6e:OUTX | | |
802 | +:PACK || 4354:PAREN || 4356:PARIN | | |
803 | +:PARSET || 4360:PERD || 435a:PLUS | | |
804 | +:PNTMSG || 4f43:POLCAT || 4f4f:POLCATR | | |
805 | +:PRGM || 4d75:PRNT || 4d76:PRNT2 | | |
806 | +:PROBE || 4c1b:PROBET || 4ea2:PWRS10 | | |
807 | +:QUITE || 4348:QUOTE || 434e:REMN | | |
808 | +:RSTRT || 4cc0:RTS1 || 4e19:RTS2 | | |
809 | +:SAVE0 || 4366:SAVE1 || 433c:SAVE10 | | |
810 | +:SAVE11 || 4344:SAVE14 || 4368:SAVE2 | | |
811 | +:SAVE3 || 436c:SAVE4 || 436e:SAVE5 | | |
812 | +:SAVE6 || 4372:SAVE7 || 4374:SAVE8 | | |
813 | +:SAVE9 || 00d4:SAVLIN || 437a:SEMI | | |
814 | +:SET || 4c6a:SKIP || 4cef:SKP2 | | |
815 | +:SLASH || 4d40:SLIDE || 00d6:SRC | | |
816 | +:STACK || 4358:STAR || 4c24:START | | |
817 | +:STKMRK || 4c7a:STMNT || 4c77:STRGT | | |
818 | +:STRING || 4dad:STRTMS || 4e96:SUB2 | | |
819 | +:SUBTR || 4de8:TERM || 4edd:TSTN | | |
820 | +:UP || 4e2c:VAR || 4e35:VAR1 | | |
821 | +:VAR2 || 00cc:VARADR || 4306:VARS | | |
822 | +:ZERO || 4da2:ZRSUP | | |
823 | + |
@@ -0,0 +1,825 @@ | ||
1 | + | |
2 | +pass 1 on VTL_6801_mc10.asm ***** | |
3 | + | |
4 | +pass 1 on VTL_6801_mc10.asm done ***** | |
5 | + | |
6 | + | |
7 | +pass 2 on VTL_6801_mc10.asm ***** | |
8 | + OPT 6801 | |
9 | + * VTL-2 for 6801 | |
10 | + * V-3.6 | |
11 | + * 9-23-76 | |
12 | + * BY GARY SHANNON | |
13 | + * & FRANK MCCOY | |
14 | + * COPYWRIGHT 1976, THE COMPUTER STORE | |
15 | + * | |
16 | + * Modifications for 6803-based MC-10 | |
17 | + * including moving variables out of direct page, etc. | |
18 | + * by Joel Matthew Rees | |
19 | + * Copyright 2022, Joel Matthew Rees | |
20 | + * | |
21 | + * Modifications explained at | |
22 | + * https://joels-programming-fun.blogspot.com/2022/08/trs | |
23 | + * | |
24 | + * DEFINE LOCATIONS IN MONITOR | |
25 | + * INCH EQU $FF00 ; per VTL.ASM | |
26 | + * EINCH EQU $F012 ; exorsim mdos Input byte with echo un | |
27 | + * INCH EQU $F015 ; exorsim mdos Input char with echo (F0 | |
28 | + * POLCAT EQU $FF24 ; from VTL.ASM | |
29 | + * OUTCH EQU $FF81 ; from VTL.ASM | |
30 | + * EOUTCH EQU $F018 ; exorsim mdos Output character with | |
31 | + * OUTS EQU $FF82 ; from VTL.ASM | |
32 | + * EPCRLF EQU $F021 ; Primarily for forced initialization | |
33 | + * | |
34 | + * FOR SBC6800: | |
35 | + *BREAK EQU $1B ; BREAK KEY | |
36 | + * For MC-10: | |
37 | + 0003 BREAK EQU $03 | |
38 | + * For exorsim | |
39 | + *ACIACS EQU $FCF4 ; exorcisor | |
40 | + *ACIADA EQU $FCF5 ; exorcisor | |
41 | + * | |
42 | + * A few interpreter variables in the direct page won't h | |
43 | + * (Yes, I can hear voices of complaint that it's not as | |
44 | + * (This allows us to save more ROM space and uses DP tha | |
45 | + * (Trade-offs.) | |
46 | + * (It also helps us understand the code, so we can do a | |
47 | + * (I hope the names are meaningful.) | |
48 | + * | |
49 | + * In .c10 format, the following as ORG and RMBs will cau | |
50 | + * which will prevent the code from loading. | |
51 | + * Changed to EQU for the MC10. | |
52 | + * ORG $C0 ; Move this according to your environment's n | |
53 | + 00C0 DPBASE EQU $C0 ; Change this to move the registers. | |
54 | + * PARSET RMB 2 ; Instead of SAVE0 in TERM/NXTRM | |
55 | + 00C2 PARSET EQU DPBASE+2 | |
56 | + * CVTSUM RMB 2 ; Instead of SAVE1 in CBLOOP | |
57 | + 00C4 CVTSUM EQU PARSET+2 | |
58 | + * MLDVCT EQU CVTSUM ; Instead of SAVE1 in mul/div (1 byt | |
59 | + 00C4 MLDVCT EQU CVTSUM | |
60 | + * DIVQUO RMB 2 ; Instead of SAVE2 in DIV | |
61 | + 00C6 DIVQUO EQU MLDVCT+2 | |
62 | + * MPLIER EQU DIVQUO ; Instead of SAVE2 in MULTIP | |
63 | + 00C6 MPLIER EQU DIVQUO | |
64 | + * EVALPT RMB 2 ; Instead of SAVE3 | |
65 | + 00C8 EVALPT EQU MPLIER+2 | |
66 | + * CNVPTR RMB 2 ; Instead of SAVE4 | |
67 | + 00CA CNVPTR EQU EVALPT+2 | |
68 | + * VARADR RMB 2 ; Instead of SAVE6 | |
69 | + 00CC VARADR EQU CNVPTR+2 | |
70 | + * OPRLIN RMB 2 ; Instead of SAVE7 | |
71 | + 00CE OPRLIN EQU VARADR+2 | |
72 | + * EDTLIN RMB 2 ; Instead of SAVE8 | |
73 | + 00D0 EDTLIN EQU OPRLIN+2 | |
74 | + * INSPTR RMB 2 ; Instead of SAVE10 (maybe? Will some VTL | |
75 | + 00D2 INSPTR EQU EDTLIN+2 | |
76 | + * SAVLIN RMB 2 ; Instead of SAVE11 | |
77 | + 00D4 SAVLIN EQU INSPTR+2 | |
78 | + * SRC RMB 2 ; For copy routine | |
79 | + 00D6 SRC EQU SAVLIN+2 | |
80 | + * DST RMB 2 ; ditto | |
81 | + 00D8 DST EQU SRC+2 | |
82 | + 00DA STKMRK EQU DST+2 ; to restore the stack on each pass. | |
83 | + 00DC DPALLOC EQU STKMRK+2 ; total storage declared in the dir | |
84 | + * | |
85 | + * SET ASIDE FOUR BYTES FOR USER | |
86 | + * DEFINED INTERUPT ROUTINE IF NEEDED | |
87 | + ORG $4300 | |
88 | + * ZERO must be set at even $100 boundary for address mat | |
89 | + 4300 00 00 00 00 | |
90 | + ZERO RMB 4 ; INTERUPT VECTOR | |
91 | + 4304 00 00 AT RMB 2 ; CANCEL & C-R | |
92 | + * | |
93 | + * GENERAL PURPOSE STORRGE | |
94 | + 4306 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
95 | + 431A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
96 | + 432E 00 00 00 00 00 00 00 00 00 00 00 00 | |
97 | + VARS RMB 52 ; VARIABLES(A-Z) | |
98 | + 433A 00 00 BRAK RMB 2 ; [ | |
99 | + * SAVE10 has me worried about implicit linkage in VTL pr | |
100 | + 433C 00 00 SAVE10 RMB 2 ; BACK SLASH | |
101 | + 433E 00 00 BRIK RMB 2 ; ] | |
102 | + 4340 00 00 UP RMB 2 ; ^ | |
103 | + 4342 00 00 SAVE11 RMB 2 ; Need something in each SAVE to reserve sp | |
104 | + * ; to keep the math straight. | |
105 | + * ; Leave the SAVEs declared as they are. | |
106 | + * | |
107 | + 4344 00 00 SAVE14 RMB 2 ; SPACE (originally unused) | |
108 | + 4346 00 00 EXCL RMB 2 ; ! | |
109 | + 4348 00 00 QUOTE RMB 2 ; " | |
110 | + 434A 00 00 DOLR RMB 2 ; # | |
111 | + 434C 00 00 DOLLAR RMB 2 ; $ | |
112 | + 434E 00 00 REMN RMB 2 ; % | |
113 | + 4350 00 00 AMPR RMB 2 ; & | |
114 | + 4352 00 00 QUITE RMB 2 ; ' | |
115 | + 4354 00 00 PAREN RMB 2 ; ( | |
116 | + 4356 00 00 PARIN RMB 2 ; ) | |
117 | + 4358 00 00 STAR RMB 2 ; * | |
118 | + 435A 00 00 PLUS RMB 2 ; + | |
119 | + 435C 00 00 COMA RMB 2 ; , | |
120 | + 435E 00 00 MINS RMB 2 ; - | |
121 | + 4360 00 00 PERD RMB 2 ; . | |
122 | + 4362 00 00 SLASH RMB 2 ; / | |
123 | + * | |
124 | + 4364 00 00 SAVE0 RMB 2 ; unused | |
125 | + 4366 00 00 SAVE1 RMB 2 ; unused | |
126 | + 4368 00 00 SAVE2 RMB 2 ; unused | |
127 | + 436A 00 00 SAVE3 RMB 2 ; unused | |
128 | + 436C 00 00 SAVE4 RMB 2 ; unused | |
129 | + 436E 00 00 SAVE5 RMB 2 ; unused (PSH/PULX) | |
130 | + 4370 00 00 SAVE6 RMB 2 ; unused | |
131 | + 4372 00 00 SAVE7 RMB 2 ; unused | |
132 | + 4374 00 00 SAVE8 RMB 2 ; unused | |
133 | + 4376 00 00 SAVE9 RMB 2 ; unused (PSH/PULX) | |
134 | + 4378 00 00 COLN RMB 2 ; : | |
135 | + 437A 00 00 SEMI RMB 2 ; ; | |
136 | + 437C 00 00 LESS RMB 2 ; < | |
137 | + 437E 00 00 EQAL RMB 2 ; = | |
138 | + 4380 00 GRRT RMB 1 ; > | |
139 | + 4381 00 DECB_1 RMB 1 | |
140 | + * | |
141 | + 4382 00 00 00 00 | |
142 | + DECBUF RMB 4 | |
143 | + 4386 00 LASTD RMB 1 | |
144 | + 4387 00 DELIM RMB 1 | |
145 | + 0048 LINLEN EQU 72 | |
146 | + 4388 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
147 | + 439C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
148 | + 43B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
149 | + 43C4 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
150 | + LINBUF RMB LINLEN+1 | |
151 | + 0088 BUFOFF EQU LINBUF-ZERO ; Unmagic 87. Some assemblers wil | |
152 | + * | |
153 | + ORG $43F1 | |
154 | + 43F1 00 STACK RMB 1 | |
155 | + * | |
156 | + ORG $4400 | |
157 | + 4400 00 00 00 00 | |
158 | + MI RMB 4 ; INTERUPT VECTORS | |
159 | + 4404 00 00 00 00 | |
160 | + NMI RMB 4 | |
161 | + 4408 PRGM EQU * ; PROGRAM STARTS HERE | |
162 | + * Must have some RAM here. | |
163 | + * | |
164 | + ORG $4C00 | |
165 | + * | |
166 | + * The COLD boot can be removed or ignored to restore the | |
167 | + * but if you do that don't forget to set & (AMPR) and * | |
168 | + * by hand immediately after STARTing. | |
169 | + * | |
170 | + * Also, instead of PROBEing, if you know the limits for | |
171 | + * application, you can set STAR directly: | |
172 | + * LDX #PRGM | |
173 | + * STX AMPR | |
174 | + * LDX #RAMLIM | |
175 | + * STX STAR | |
176 | + * START ... | |
177 | + * | |
178 | + 4C00 9F DA COLD STS STKMRK ; Mark the stack, | |
179 | + * LDS #STACK ; but use BASIC's stack. (S on 6800 points | |
180 | + * JSR TRMINI | |
181 | + 4C02 CE 44 08 LDX #PRGM ; initialize program area base | |
182 | + 4C05 FF 43 50 STX AMPR | |
183 | + 4C08 86 5A LDAA #$5A ; Probe RAM limit | |
184 | + 4C0A C6 A5 LDAB #$A5 | |
185 | + 4C0C 20 0D BRA PROBET | |
186 | + 4C0E A7 00 PROBE STAA 0,X | |
187 | + 4C10 A1 00 CMPA 0,X | |
188 | + 4C12 26 0C BNE NOTRAM | |
189 | + 4C14 E7 00 STAB 0,X | |
190 | + 4C16 E1 00 CMPB 0,X | |
191 | + 4C18 26 06 BNE NOTRAM | |
192 | + 4C1A 08 INX ; all bits seem to be R/W. | |
193 | + 4C1B 8C 4C 00 PROBET CPX #COLD | |
194 | + 4C1E 25 EE BLO PROBE ; CPX on 6801 works right. | |
195 | + 4C20 09 NOTRAM DEX | |
196 | + 4C21 FF 43 58 STX STAR | |
197 | + 4C24 START | |
198 | + * LDS #STACK ; re-initialize at beginning of each evalua | |
199 | + 4C24 9E DA LDS STKMRK ; from mark instead of constant | |
200 | + 4C26 BF 43 7A STS SEMI ; DBG Comment this out when we no longer need | |
201 | + * NOTE: Instead of clearing A here, call PNTMSG instead | |
202 | + 4C29 4F CLRA ; NUL delimiter | |
203 | + 4C2A CE 4F 3E LDX #OKM | |
204 | + 4C2D 8D 48 BSR STRGT | |
205 | + * | |
206 | + 4C2F 4F LOOP CLRA | |
207 | + 4C30 B7 43 4A STAA DOLR | |
208 | + 4C33 B7 43 4B STAA DOLR+1 | |
209 | + 4C36 BD 4E EB JSR CVTLN | |
210 | + 4C39 24 3F BCC STMNT ; NO LINE# THEN EXEC | |
211 | + 4C3B 8D 27 BSR EXEC | |
212 | + 4C3D 27 E5 BEQ START | |
213 | + * | |
214 | + 4C3F 8D 68 LOOP2 BSR FIND ; FIND LINE | |
215 | + 4C41 27 E1 EQSTRT BEQ START ; IF END THEN STOP | |
216 | + 4C43 EE 00 LDX 0,X ; LOAD REAL LINE # | |
217 | + 4C45 FF 43 4A STX DOLR ; SAVE IT | |
218 | + 4C48 DE D4 LDX SAVLIN ; GET LINE | |
219 | + 4C4A 08 INX ; BUMP PAST LINE # | |
220 | + 4C4B 08 INX ; BUMP PAST LINE # | |
221 | + 4C4C 08 INX ; BUMP PAST SPACE | |
222 | + 4C4D 8D 15 BSR EXEC ; EXECUTE IT | |
223 | + 4C4F 27 0F BEQ LOOP3 ; IF ZERO, CONTINUE | |
224 | + 4C51 DE D4 LDX SAVLIN ; FIND LINE | |
225 | + 4C53 EE 00 LDX 0,X ; GET IT | |
226 | + 4C55 BC 43 4A CPX DOLR ; HAS IT CHANGED? | |
227 | + 4C58 27 06 BEQ LOOP3 ; IF NOT GET NEXT | |
228 | + * | |
229 | + 4C5A 08 INX ; INCREMENT OLD LINE# | |
230 | + 4C5B FF 43 46 STX EXCL ; SAVE FOR RETURN | |
231 | + 4C5E 20 DF BRA LOOP2 ; CONTINUE | |
232 | + * | |
233 | + 4C60 8D 58 LOOP3 BSR FND3 ; FIND NEXT LINE | |
234 | + 4C62 20 DD BRA EQSTRT ; CONTINUE | |
235 | + * | |
236 | + 4C64 DF CE EXEC STX OPRLIN ; EXECUTE LINE | |
237 | + 4C66 BD 4E 3C JSR VAR2 | |
238 | + 4C69 08 INX | |
239 | + * | |
240 | + 4C6A A6 00 SKIP LDAA 0,X ; GET FIRST TERM | |
241 | + 4C6C 8D 04 BSR EVIL ; EVALUATE EXPRESSION | |
242 | + 4C6E FE 43 4A OUTX LDX DOLR ; GET LINE # | |
243 | + 4C71 39 RTS | |
244 | + * | |
245 | + 4C72 81 22 EVIL CMPA #$22 ; IF " THEN BRANCH | |
246 | + 4C74 26 4B BNE EVALU | |
247 | + 4C76 08 INX | |
248 | + 4C77 7E 4D CB STRGT JMP STRING ; TO PRINT IT | |
249 | + * | |
250 | + 4C7A DF D0 STMNT STX EDTLIN ; SAVE LINE # | |
251 | + 4C7C FD 43 4A STD DOLR | |
252 | + 4C7F FE 43 4A LDX DOLR | |
253 | + 4C82 26 6B BNE SKP2 ; IF LINE# <> 0 | |
254 | + * | |
255 | + 4C84 CE 44 08 LDX #PRGM ; LIST PROGRAM | |
256 | + 4C87 BC 43 50 LST2 CPX AMPR ; END OF PROGRAM | |
257 | + 4C8A 27 B5 BEQ EQSTRT | |
258 | + 4C8C DF D4 STX SAVLIN ; LINE # FOR CVDEC | |
259 | + 4C8E EC 00 LDD 0,X | |
260 | + 4C90 BD 4D 76 JSR PRNT2 | |
261 | + 4C93 DE D4 LDX SAVLIN | |
262 | + 4C95 08 INX | |
263 | + 4C96 08 INX | |
264 | + 4C97 BD 4D AC JSR PNTMSG | |
265 | + 4C9A BD 4F 36 JSR CRLF | |
266 | + 4C9D 20 E8 BRA LST2 | |
267 | + * | |
268 | + 4C9F DE D4 NXTXT LDX SAVLIN ; GET POINTER | |
269 | + 4CA1 08 INX ; BUMP PAST LINE# | |
270 | + 4CA2 08 LOOKAG INX ; FIND END OF LINE | |
271 | + 4CA3 6D 00 TST 0,X | |
272 | + 4CA5 26 FB BNE LOOKAG | |
273 | + 4CA7 08 INX | |
274 | + 4CA8 39 RTS | |
275 | + * | |
276 | + 4CA9 CE 44 08 FIND LDX #PRGM ; FIND LINE | |
277 | + 4CAC DF D4 FND2 STX SAVLIN | |
278 | + 4CAE BC 43 50 CPX AMPR | |
279 | + 4CB1 27 0D BEQ RTS1 | |
280 | + * LDAA 1,X ; almost missed this. | |
281 | + * SUBA DOLR+1 ; This was necessary because no SUBD | |
282 | + * LDAA 0,X ; and CPX does not affect C flag on 6800 | |
283 | + * SBCA DOLR | |
284 | + * PSHB ; B does not seem to be in use. | |
285 | + 4CB3 EC 00 LDD 0,X ; Use D because we think we want to keep X. | |
286 | + 4CB5 B3 43 4A SUBD DOLR | |
287 | + * PULB | |
288 | + 4CB8 24 04 BCC SET | |
289 | + 4CBA 8D E3 FND3 BSR NXTXT | |
290 | + 4CBC 20 EE BRA FND2 | |
291 | + * | |
292 | + 4CBE 86 FF SET LDAA #$FF ; SET NOT EQUAL | |
293 | + 4CC0 39 RTS1 RTS | |
294 | + * | |
295 | + 4CC1 BD 4D D6 EVALU JSR EVAL ; EVALUATE LINE | |
296 | + 4CC4 37 PSHB | |
297 | + 4CC5 36 PSHA | |
298 | + 4CC6 DE CE LDX OPRLIN | |
299 | + 4CC8 BD 4E 4C JSR CONVP | |
300 | + 4CCB 32 PULA | |
301 | + 4CCC C1 24 CMPB #'$ ; STRING? | |
302 | + 4CCE 26 04 BNE AR1 | |
303 | + 4CD0 33 PULB | |
304 | + 4CD1 7E 4F 59 JMP OUTCH ; THEN PRINT IT | |
305 | + 4CD4 C0 3F AR1 SUBB #'? ; PRINT? | |
306 | + 4CD6 26 03 BNE AR11 ; was out of range. | |
307 | + 4CD8 7E 4D 75 JMP PRNT ; THEN DO IT | |
308 | + * BEQ PRNT ; When we bring it back within range. | |
309 | + 4CDB 5C AR11 INCB ; MACHINE LANGUAGE? | |
310 | + 4CDC 33 PULB | |
311 | + 4CDD 26 01 BNE AR2 | |
312 | + 4CDF 3F SWI ; THEN INTERUPT | |
313 | + * | |
314 | + 4CE0 ED 00 AR2 STD 0,X ; STORE NEW VALUE | |
315 | + 4CE2 26 01 BNE AR2RND ; Initialize/don't get stuck on zero. | |
316 | + 4CE4 5C INCB ; Keep it known cheap. | |
317 | + * ADDD QUITE ; RANDOMIZER ; NO! Don't do this. | |
318 | + 4CE5 FB 43 52 AR2RND ADDB QUITE ; RANDOMIZER ; Adding the low byte to | |
319 | + 4CE8 B9 43 53 ADCA QUITE+1 ; ; is cheap but intentional. | |
320 | + 4CEB FD 43 52 STD QUITE | |
321 | + 4CEE 39 RTS | |
322 | + * | |
323 | + 4CEF 8D B8 SKP2 BSR FIND ; FIND LINE | |
324 | + 4CF1 27 29 BEQ INSRT ; IF NOT THERE | |
325 | + 4CF3 EE 00 LDX 0,X ; THEN INSERT | |
326 | + 4CF5 BC 43 4A CPX DOLR ; NEW LINE | |
327 | + 4CF8 26 22 BNE INSRT | |
328 | + * | |
329 | + 4CFA 8D A3 BSR NXTXT ; SETUP REGISTERS | |
330 | + * LDS SAVLIN ; FOR DELETE | |
331 | + 4CFC DF D6 STX SRC | |
332 | + 4CFE DE D4 LDX SAVLIN | |
333 | + 4D00 DF D8 STX DST | |
334 | + * | |
335 | + 4D02 DE D6 DELT LDX SRC | |
336 | + 4D04 BC 43 50 CPX AMPR ; DELETE OLD LINE | |
337 | + 4D07 27 0E BEQ FITIT | |
338 | + 4D09 A6 00 LDAA 0,X | |
339 | + 4D0B 08 INX | |
340 | + 4D0C DF D6 STX SRC | |
341 | + * PSHA | |
342 | + * INX | |
343 | + * INS | |
344 | + * INS | |
345 | + 4D0E DE D8 LDX DST | |
346 | + 4D10 A7 00 STA 0,X | |
347 | + 4D12 08 INX | |
348 | + 4D13 DF D8 STX DST | |
349 | + 4D15 20 EB BRA DELT | |
350 | + * | |
351 | + * FITIT STS AMPR ; STORE NEW END | |
352 | + 4D17 DE D8 FITIT LDX DST | |
353 | + 4D19 FF 43 50 STX AMPR ; STORE NEW END | |
354 | + * | |
355 | + 4D1C DE D0 INSRT LDX EDTLIN ; COUNT NEW LINE LENGTH | |
356 | + 4D1E C6 03 LDAB #$03 | |
357 | + 4D20 6D 00 TST 0,X | |
358 | + 4D22 27 49 BEQ GOTIT ; IF NO LINE THEN STOP | |
359 | + 4D24 5C CNTLN INCB ; count bytes | |
360 | + 4D25 08 INX | |
361 | + 4D26 6D 00 TST 0,X ; Find trailing NUL | |
362 | + 4D28 26 FA BNE CNTLN | |
363 | + * | |
364 | + * Could use ABX in here, if we reorganized the code. | |
365 | + 4D2A 4F OPEN CLRA ; CALCULATE NEW END | |
366 | + 4D2B F3 43 50 ADDD AMPR | |
367 | + 4D2E DD D2 STD INSPTR | |
368 | + 4D30 B3 43 58 SUBD STAR | |
369 | + 4D33 24 3D BCC RSTRT ; IF TOO BIG THEN STOP | |
370 | + 4D35 FE 43 50 LDX AMPR | |
371 | + * LDS INSPTR ; Remember that the 6800/6801 stack is post | |
372 | + * STS AMPR | |
373 | + 4D38 DC D2 LDD INSPTR ; (Since we're imitating stack blast.) | |
374 | + 4D3A FD 43 50 STD AMPR | |
375 | + * | |
376 | + * LDS AMPR | |
377 | + 4D3D DD D8 STD DST | |
378 | + 4D3F 08 INX ; SLIDE OPEN GAP | |
379 | + 4D40 09 SLIDE DEX ; going down | |
380 | + 4D41 DF D6 STX SRC | |
381 | + 4D43 E6 00 LDAB 0,X | |
382 | + * PSHB ; stack blast it | |
383 | + 4D45 DE D8 LDX DST | |
384 | + 4D47 E7 00 STAB 0,X ; mimic 6800 push | |
385 | + 4D49 09 DEX | |
386 | + 4D4A DF D8 STX DST | |
387 | + 4D4C DE D6 LDX SRC | |
388 | + 4D4E 9C D4 CPX SAVLIN | |
389 | + 4D50 22 EE BHI SLIDE | |
390 | + * | |
391 | + * DON LDS DOLR ; STORE LINE # | |
392 | + * STS 0,X | |
393 | + 4D52 FC 43 4A DON LDD DOLR ; STORE LINE # | |
394 | + 4D55 ED 00 STD 0,X ; Note MSB1st byte order implicit dependency he | |
395 | + 4D57 DF D8 STX DST ; will skip by offset on store | |
396 | + * LDS EDTLIN ; GET NEW LINE | |
397 | + * DES ; pre-increment | |
398 | + 4D59 DC D0 LDD EDTLIN ; GET NEW LINE | |
399 | + 4D5B DD D6 STD SRC | |
400 | + * | |
401 | + *MOVL INX ; INSERT NEW LINE (skip over LINE # hi byte) | |
402 | + * PULB | |
403 | + * STAB 1,X ; (skips over low byte, BTW) | |
404 | + 4D5D DE D6 MOVL LDX SRC | |
405 | + 4D5F E6 00 LDAB 0,X | |
406 | + 4D61 08 INX | |
407 | + 4D62 DF D6 STX SRC | |
408 | + 4D64 DE D8 LDX DST | |
409 | + 4D66 08 INX ; skip over what was already stored (too tricky fo | |
410 | + 4D67 DF D8 STX DST | |
411 | + 4D69 E7 01 STAB 1,X ; note offset store | |
412 | + 4D6B 26 F0 BNE MOVL ; until NUL stored | |
413 | + * | |
414 | + 4D6D GOTIT | |
415 | + * LDS #STACK ; Ready for a new line of input. | |
416 | + 4D6D 9E DA LDS STKMRK ; restore from mark | |
417 | + 4D6F 7E 4C 2F JMP LOOP | |
418 | + * | |
419 | + 4D72 7E 4C 24 RSTRT JMP START ; warm start over | |
420 | + * | |
421 | + 4D75 33 PRNT PULB ; PRINT DECIMAL | |
422 | + 4D76 CE 43 82 PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL | |
423 | + 4D79 DF CA STX CNVPTR | |
424 | + 4D7B CE 4E A2 LDX #PWRS10 | |
425 | + 4D7E 3C CVD1 PSHX | |
426 | + 4D7F EE 00 LDX 0,X | |
427 | + 4D81 DF CC STX VARADR | |
428 | + 4D83 CE 00 CC LDX #VARADR | |
429 | + 4D86 BD 4E AC JSR DIVIDE | |
430 | + 4D89 36 PSHA | |
431 | + 4D8A DE CA LDX CNVPTR | |
432 | + 4D8C 96 C7 LDAA DIVQUO+1 | |
433 | + 4D8E 8B 30 ADDA #'0 | |
434 | + 4D90 A7 00 STAA 0,X | |
435 | + 4D92 32 PULA | |
436 | + 4D93 08 INX | |
437 | + 4D94 DF CA STX CNVPTR | |
438 | + 4D96 38 PULX | |
439 | + 4D97 08 INX | |
440 | + 4D98 08 INX | |
441 | + 4D99 6D 01 TST 1,X | |
442 | + 4D9B 26 E1 BNE CVD1 | |
443 | + * | |
444 | + 4D9D CE 43 81 LDX #DECB_1 | |
445 | + 4DA0 63 05 COM 5,X ; ZERO SUPPRESS | |
446 | + 4DA2 08 ZRSUP INX | |
447 | + 4DA3 E6 00 LDAB 0,X | |
448 | + 4DA5 C1 30 CMPB #'0 | |
449 | + 4DA7 27 F9 BEQ ZRSUP | |
450 | + 4DA9 73 43 86 COM LASTD | |
451 | + * | |
452 | + 4DAC 4F PNTMSG CLRA ; ZERO FOR DELIM | |
453 | + 4DAD B7 43 87 STRTMS STAA DELIM ; STORE DELIMTER | |
454 | + * | |
455 | + 4DB0 E6 00 OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT | |
456 | + 4DB2 08 INX | |
457 | + 4DB3 F1 43 87 CMPB DELIM | |
458 | + 4DB6 27 05 BEQ CTLC | |
459 | + 4DB8 BD 4F 59 JSR OUTCH | |
460 | + 4DBB 20 F3 BRA OUTMSG | |
461 | + * | |
462 | + 4DBD BD 4F 43 CTLC JSR POLCAT ; POL FOR CHARACTER | |
463 | + 4DC0 24 57 BCC RTS2 | |
464 | + 4DC2 8D 04 BSR INCH2 | |
465 | + 4DC4 C1 03 CMPB #BREAK ; BREAK KEY? | |
466 | + 4DC6 27 AA BEQ RSTRT | |
467 | + * | |
468 | + 4DC8 7E 4F 52 INCH2 JMP INCH | |
469 | + * | |
470 | + 4DCB 8D E0 STRING BSR STRTMS ; PRINT STRING LITERAL | |
471 | + 4DCD A6 00 LDAA 0,X | |
472 | + 4DCF 81 3B CMPA #'; | |
473 | + 4DD1 27 57 BEQ OUTD | |
474 | + 4DD3 7E 4F 36 JMP CRLF | |
475 | + * | |
476 | + 4DD6 8D 42 EVAL BSR GETVAL ; EVALUATE EXPRESSION | |
477 | + * | |
478 | + 4DD8 36 NXTRM PSHA | |
479 | + 4DD9 A6 00 LDAA 0,X ; END OF LINE? | |
480 | + 4DDB 27 02 BEQ OUTN | |
481 | + 4DDD 81 29 CMPA #') | |
482 | + 4DDF 32 OUTN PULA | |
483 | + 4DE0 27 48 BEQ OUTD | |
484 | + 4DE2 8D 04 BSR TERM | |
485 | + 4DE4 DE C2 LDX PARSET | |
486 | + 4DE6 20 F0 BRA NXTRM | |
487 | + * | |
488 | + 4DE8 36 TERM PSHA ; GET VALUE | |
489 | + 4DE9 37 PSHB | |
490 | + 4DEA A6 00 LDAA 0,X | |
491 | + 4DEC 36 PSHA | |
492 | + 4DED 08 INX | |
493 | + 4DEE 8D 2A BSR GETVAL | |
494 | + 4DF0 DD C8 STD EVALPT | |
495 | + 4DF2 DF C2 STX PARSET | |
496 | + 4DF4 CE 00 C8 LDX #EVALPT | |
497 | + 4DF7 32 PULA | |
498 | + 4DF8 33 PULB | |
499 | + * | |
500 | + 4DF9 81 2A CMPA #'* ; SEE IF * | |
501 | + 4DFB 26 68 BNE EVAL2 | |
502 | + 4DFD 32 PULA ; MULTIPLY | |
503 | + 4DFE DD C6 MULTIP STD MPLIER ; 2'S COMPLEMENT | |
504 | + 4E00 C6 10 LDAB #$10 | |
505 | + 4E02 D7 C4 STAB MLDVCT | |
506 | + 4E04 4F CLRA | |
507 | + 4E05 5F CLRB | |
508 | + * | |
509 | + 4E06 74 00 C6 MULT LSR MPLIER | |
510 | + 4E09 76 00 C7 ROR MPLIER+1 | |
511 | + 4E0C 24 02 BCC NOAD | |
512 | + 4E0E E3 00 MULTI ADDD 0,X | |
513 | + 4E10 68 01 NOAD ASL 1,X | |
514 | + 4E12 69 00 ROL 0,X | |
515 | + 4E14 7A 00 C4 DEC MLDVCT | |
516 | + 4E17 26 ED BNE MULT ; LOOP TIL DONE | |
517 | + 4E19 39 RTS2 RTS | |
518 | + * | |
519 | + 4E1A BD 4E ED GETVAL JSR CVBIN ; GET VALUE | |
520 | + 4E1D 24 0C BCC OUTV | |
521 | + 4E1F C1 3F CMPB #'? ; OF LITERAL | |
522 | + 4E21 26 09 BNE VAR | |
523 | + 4E23 3C PSHX ; OR INPUT | |
524 | + 4E24 BD 4F 17 JSR INLN | |
525 | + 4E27 8D AD BSR EVAL | |
526 | + 4E29 38 PULX | |
527 | + 4E2A 08 OUTD INX | |
528 | + 4E2B 39 OUTV RTS | |
529 | + * | |
530 | + 4E2C C1 24 VAR CMPB #'$ ; OR STRING | |
531 | + 4E2E 26 05 BNE VAR1 | |
532 | + 4E30 8D 96 BSR INCH2 | |
533 | + 4E32 4F CLRA | |
534 | + 4E33 08 INX | |
535 | + 4E34 39 RTS | |
536 | + * | |
537 | + 4E35 C1 28 VAR1 CMPB #'( | |
538 | + 4E37 26 03 BNE VAR2 | |
539 | + 4E39 08 INX | |
540 | + 4E3A 20 9A BRA EVAL | |
541 | + * | |
542 | + 4E3C 8D 0E VAR2 BSR CONVP ; OR VARIABLE | |
543 | + 4E3E EC 00 LDD 0,X ; OR ARRAY ELEMENT | |
544 | + 4E40 DE CC LDX VARADR ; LOAD OLD INDEX | |
545 | + 4E42 39 RTS | |
546 | + * | |
547 | + 4E43 BD 4D D6 ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT | |
548 | + 4E46 05 ASLD | |
549 | + 4E47 F3 43 50 ADDD AMPR | |
550 | + 4E4A 20 11 BRA PACK | |
551 | + * | |
552 | + 4E4C E6 00 CONVP LDAB 0,X ; GET LOCATION | |
553 | + 4E4E 08 INX | |
554 | + 4E4F 37 PSHB | |
555 | + 4E50 C1 3A CMPB #': | |
556 | + 4E52 27 EF BEQ ARRAY ; OF VARIABLE OR | |
557 | + 4E54 4F CLRA ; ARRAY ELEMENT | |
558 | + 4E55 C4 3F ANDB #$3F ; mask out-of-variable-range | |
559 | + 4E57 CB 02 ADDB #$02 ; bump past "interrupt vectors" | |
560 | + 4E59 58 ASLB ; make into offset (would be address in DP in ori | |
561 | + 4E5A C3 43 00 ADDD #ZERO ; The 6801 can do this right. | |
562 | + * | |
563 | + 4E5D DF CC PACK STX VARADR ; STORE OLD INDEX | |
564 | + 4E5F DD CA STD CNVPTR | |
565 | + 4E61 DE CA LDX CNVPTR ; LOAD NEW INDEX | |
566 | + 4E63 33 PULB | |
567 | + 4E64 39 RTS | |
568 | + * | |
569 | + 4E65 81 2B EVAL2 CMPA #'+ ; ADDITION | |
570 | + 4E67 26 04 BNE EVAL3 | |
571 | + 4E69 32 PULA | |
572 | + 4E6A E3 00 ADD ADDD 0,X | |
573 | + 4E6C 39 RTS | |
574 | + * | |
575 | + 4E6D 81 2D EVAL3 CMPA #'- ; SUBTRACTION | |
576 | + 4E6F 26 04 BNE EVAL4 | |
577 | + 4E71 32 PULA | |
578 | + 4E72 A3 00 SUBTR SUBD 0,X | |
579 | + 4E74 39 RTS | |
580 | + * | |
581 | + 4E75 81 2F EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE | |
582 | + 4E77 26 09 BNE EVAL5 | |
583 | + 4E79 32 PULA | |
584 | + 4E7A 8D 30 BSR DIVIDE | |
585 | + 4E7C FD 43 4E STD REMN | |
586 | + 4E7F DC C6 LDD DIVQUO | |
587 | + 4E81 39 RTS | |
588 | + * | |
589 | + 4E82 80 3D EVAL5 SUBA #'= ; SEE IF EQUAL TEST | |
590 | + 4E84 26 0C BNE EVAL6 | |
591 | + 4E86 32 PULA | |
592 | + 4E87 A3 00 SUBD 0,X | |
593 | + 4E89 26 03 BNE NOTEQ | |
594 | + 4E8B 5D TSTB | |
595 | + 4E8C 27 02 BEQ EQL | |
596 | + 4E8E C6 FF NOTEQ LDAB #$FF | |
597 | + 4E90 20 0D EQL BRA COMBOUT | |
598 | + * | |
599 | + 4E92 4A EVAL6 DECA ; SEE IF LESS THAN TEST | |
600 | + 4E93 32 PULA | |
601 | + 4E94 27 07 BEQ EVAL7 | |
602 | + * | |
603 | + 4E96 A3 00 SUB2 SUBD 0,X | |
604 | + 4E98 59 ROLB | |
605 | + 4E99 4F COMOUT CLRA | |
606 | + 4E9A C4 01 ANDB #$01 | |
607 | + 4E9C 39 RTS | |
608 | + * | |
609 | + 4E9D 8D F7 EVAL7 BSR SUB2 ; GT TEST | |
610 | + 4E9F 53 COMBOUT COMB | |
611 | + 4EA0 20 F7 BRA COMOUT | |
612 | + * | |
613 | + 4EA2 27 PWRS10 FCB $27 ; 10000 | |
614 | + 4EA3 10 FCB $10 | |
615 | + 4EA4 03 FCB $03 ; 1000 | |
616 | + 4EA5 E8 FCB $E8 | |
617 | + 4EA6 00 FCB $00 ; 100 | |
618 | + 4EA7 64 FCB $64 | |
619 | + 4EA8 00 FCB $00 ; 10 | |
620 | + 4EA9 0A FCB $0A | |
621 | + 4EAA 00 FCB $00 ; 1 | |
622 | + 4EAB 01 FCB $01 | |
623 | + * | |
624 | + 4EAC 7F 00 C4 DIVIDE CLR MLDVCT ; DEVIDE 16-BITS | |
625 | + 4EAF 7C 00 C4 GOT INC MLDVCT | |
626 | + 4EB2 68 01 ASL 1,X | |
627 | + 4EB4 69 00 ROL 0,X | |
628 | + 4EB6 24 F7 BCC GOT | |
629 | + 4EB8 66 00 ROR 0,X | |
630 | + 4EBA 66 01 ROR 1,X | |
631 | + 4EBC 7F 00 C6 CLR DIVQUO | |
632 | + 4EBF 7F 00 C7 CLR DIVQUO+1 | |
633 | + 4EC2 A3 00 DIV2 SUBD 0,X | |
634 | + 4EC4 24 05 BCC OK | |
635 | + 4EC6 E3 00 ADDD 0,X | |
636 | + 4EC8 0C CLC | |
637 | + 4EC9 20 01 BRA DIVNOC ; instead of the trick | |
638 | + * The 6801 CPX affects all relevant flags, can't use thi | |
639 | + * FCB $9C ; CPX | |
640 | + 4ECB 0D OK SEC ; $0D | |
641 | + 4ECC 79 00 C7 DIVNOC ROL DIVQUO+1 | |
642 | + 4ECF 79 00 C6 ROL DIVQUO | |
643 | + 4ED2 7A 00 C4 DEC MLDVCT | |
644 | + 4ED5 27 12 BEQ DONE | |
645 | + 4ED7 64 00 LSR 0,X | |
646 | + 4ED9 66 01 ROR 1,X | |
647 | + 4EDB 20 E5 BRA DIV2 | |
648 | + * | |
649 | + 4EDD E6 00 TSTN LDAB 0,X ; TEST FOR NUMERIC | |
650 | + 4EDF C1 3A CMPB #$3A | |
651 | + 4EE1 2A 04 BPL NOTDEC | |
652 | + 4EE3 C1 30 CMPB #'0 | |
653 | + 4EE5 2C 02 BGE DONE | |
654 | + 4EE7 0D NOTDEC SEC | |
655 | + 4EE8 39 RTS | |
656 | + 4EE9 0C DONE CLC | |
657 | + 4EEA 39 DUN RTS | |
658 | + * | |
659 | + 4EEB 8D 2A CVTLN BSR INLN | |
660 | + * | |
661 | + 4EED 8D EE CVBIN BSR TSTN ; CONVERT TO BINARY | |
662 | + 4EEF 25 F9 BCS DUN | |
663 | + 4EF1 4F CONT CLRA | |
664 | + 4EF2 5F CLRB | |
665 | + 4EF3 EB 00 CBLOOP ADDB 0,X | |
666 | + 4EF5 89 00 ADCA #$00 | |
667 | + 4EF7 C0 30 SUBB #'0 | |
668 | + 4EF9 82 00 SBCA #$00 | |
669 | + 4EFB DD C4 STD CVTSUM | |
670 | + 4EFD 08 INX | |
671 | + 4EFE 37 PSHB | |
672 | + 4EFF 8D DC BSR TSTN | |
673 | + 4F01 33 PULB | |
674 | + 4F02 25 E5 BCS DONE | |
675 | + 4F04 05 ASLD | |
676 | + 4F05 05 ASLD | |
677 | + 4F06 D3 C4 ADDD CVTSUM | |
678 | + 4F08 05 ASLD | |
679 | + 4F09 20 E8 BRA CBLOOP | |
680 | + * | |
681 | + 4F0B C1 40 INLN6 CMPB #'@ ; CANCEL | |
682 | + 4F0D 27 06 BEQ NEWLIN | |
683 | + 4F0F 08 INX ; '.' | |
684 | + 4F10 8C 43 4A CPX #ZERO+LINLEN+2 ; (Here's part of what we had to fix | |
685 | + 4F13 26 0B BNE INLN2 | |
686 | + 4F15 8D 1F NEWLIN BSR CRLF | |
687 | + * | |
688 | + 4F17 CE 43 02 INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL | |
689 | + 4F1A 09 INLN5 DEX | |
690 | + 4F1B 8C 43 00 CPX #ZERO ; Make this explicit to enable variables move | |
691 | + 4F1E 27 F5 BEQ NEWLIN ; (Was implicit zero compare X from DEX, now | |
692 | + 4F20 BD 4F 52 INLN2 JSR INCH ; INPUT CHARACTER | |
693 | + 4F23 E7 87 STAB BUFOFF-1,X ; STORE IT | |
694 | + 4F25 C1 5F CMPB #$5F ; BACKSPACE? | |
695 | + 4F27 27 F1 BEQ INLN5 | |
696 | + * | |
697 | + 4F29 C1 0D INLIN3 CMPB #$0D ; CARRIAGE RETURN | |
698 | + 4F2B 2B F3 BMI INLN2 | |
699 | + 4F2D 26 DC BNE INLN6 | |
700 | + * | |
701 | + 4F2F 6F 87 INLIN4 CLR BUFOFF-1,X ; CLEAR LAST CHAR | |
702 | + 4F31 CE 43 88 LDX #LINBUF | |
703 | + 4F34 20 04 BRA LF | |
704 | + * | |
705 | + * CRLF JSR EPCRLF | |
706 | + 4F36 C6 0D CRLF LDAB #$0D ; CARR-RET | |
707 | + 4F38 8D 02 BSR OUTCH2 | |
708 | + 4F3A C6 0A LF LDAB #$0A ; LINE FEED | |
709 | + 4F3C 20 1B OUTCH2 BRA OUTCH | |
710 | + * | |
711 | + 4F3E 0D OKM FCB $0D | |
712 | + 4F3F 0A FCB $0A | |
713 | + 4F40 4F 4B FCC 'OK' | |
714 | + 4F42 00 FCB $00 | |
715 | + * | |
716 | + *TRMINI LDAB #40 | |
717 | + *TRMILP JSR EPCRLF | |
718 | + * DECB | |
719 | + * BNE TRMILP | |
720 | + * RTS | |
721 | + * | |
722 | + * MC-10 BASIC ROM vectors | |
723 | + FFDC INCHV EQU $FFDC ; Scan keyboard | |
724 | + FFDE OUTCHV EQU $FFDE ; Write char to screen | |
725 | + * | |
726 | + * RECEIVER POLLING | |
727 | + 4F43 36 POLCAT PSHA | |
728 | + 4F44 3C PSHX | |
729 | + 4F45 FE FF DC LDX INCHV ; at any rate, don't wait. | |
730 | + 4F48 AD 00 JSR 0,X ; | |
731 | + 4F4A 16 TAB ; MC-10 ROM says NUL is not input. | |
732 | + 4F4B 0D SEC | |
733 | + 4F4C 26 01 BNE POLCATR ; Don't wait. | |
734 | + 4F4E 0C CLC | |
735 | + 4F4F 38 POLCATR PULX | |
736 | + 4F50 32 PULA | |
737 | + 4F51 39 RTS | |
738 | + *POLCAT LDAB ACIACS | |
739 | + * ASRB | |
740 | + * RTS | |
741 | + * | |
742 | + * INPUT ONE CHAR INTO B ACCUMULATOR | |
743 | + 4F52 8D EF INCH BSR POLCAT | |
744 | + 4F54 24 FC BCC INCH ; Wait here. | |
745 | + 4F56 8D 01 BSR OUTCH | |
746 | + 4F58 39 RTS | |
747 | + * | |
748 | + * OUTPUT ONE CHAR | |
749 | + 4F59 36 OUTCH PSHA | |
750 | + 4F5A 3C PSHX | |
751 | + 4F5B FE FF DE LDX OUTCHV | |
752 | + 4F5E 17 TBA | |
753 | + 4F5F AD 00 JSR 0,X | |
754 | + 4F61 38 PULX | |
755 | + 4F62 32 PULA | |
756 | + 4F63 39 RTS | |
757 | + * | |
758 | + ORG COLD | |
759 | + * | |
760 | + END | |
761 | + | |
762 | +pass 2 on VTL_6801_mc10.asm done ***** | |
763 | + | |
764 | +tax errors found. | |
765 | +:ADD || 4350:AMPR || 4cd4:AR1 | | |
766 | +:AR11 || 4ce0:AR2 || 4ce5:AR2RND | | |
767 | +:ARRAY || 4304:AT || 433a:BRAK | | |
768 | +:BREAK || 433e:BRIK || 0088:BUFOFF | | |
769 | +:CBLOOP || 4d24:CNTLN || 00ca:CNVPTR | | |
770 | +:COLD || 4378:COLN || 435c:COMA | | |
771 | +:COMBOUT || 4e99:COMOUT || 4ef1:CONT | | |
772 | +:CONVP || 4f36:CRLF || 4dbd:CTLC | | |
773 | +:CVBIN || 4d7e:CVD1 || 4eeb:CVTLN | | |
774 | +:CVTSUM || 4382:DECBUF || 4381:DECB_1 | | |
775 | +:DELIM || 4d02:DELT || 4ec2:DIV2 | | |
776 | +:DIVIDE || 4ecc:DIVNOC || 00c6:DIVQUO | | |
777 | +:DOLLAR || 434a:DOLR || 4d52:DON | | |
778 | +:DONE || 00dc:DPALLOC || 00c0:DPBASE | | |
779 | +:DST || 4eea:DUN || 00d0:EDTLIN | | |
780 | +:EQAL || 4e90:EQL || 4c41:EQSTRT | | |
781 | +:EVAL || 4e65:EVAL2 || 4e6d:EVAL3 | | |
782 | +:EVAL4 || 4e82:EVAL5 || 4e92:EVAL6 | | |
783 | +:EVAL7 || 00c8:EVALPT || 4cc1:EVALU | | |
784 | +:EVIL || 4346:EXCL || 4c64:EXEC | | |
785 | +:FIND || 4d17:FITIT || 4cac:FND2 | | |
786 | +:FND3 || 4e1a:GETVAL || 4eaf:GOT | | |
787 | +:GOTIT || 4380:GRRT || 4f52:INCH | | |
788 | +:INCH2 || ffdc:INCHV || 4f29:INLIN3 | | |
789 | +:INLIN4 || 4f17:INLN || 4f20:INLN2 | | |
790 | +:INLN5 || 4f0b:INLN6 || 00d2:INSPTR | | |
791 | +:INSRT || 4386:LASTD || 437c:LESS | | |
792 | +:LF || 4388:LINBUF || 0048:LINLEN | | |
793 | +:LOOKAG || 4c2f:LOOP || 4c3f:LOOP2 | | |
794 | +:LOOP3 || 4c87:LST2 || 4400:MI | | |
795 | +:MINS || 00c4:MLDVCT || 4d5d:MOVL | | |
796 | +:MPLIER || 4e06:MULT || 4e0e:MULTI | | |
797 | +:MULTIP || 4f15:NEWLIN || 4404:NMI | | |
798 | +:NOAD || 4ee7:NOTDEC || 4e8e:NOTEQ | | |
799 | +:NOTRAM || 4dd8:NXTRM || 4c9f:NXTXT | | |
800 | +:OK || 4f3e:OKM || 4d2a:OPEN | | |
801 | +:OPRLIN || 4f59:OUTCH || 4f3c:OUTCH2 | | |
802 | +:OUTCHV || 4e2a:OUTD || 4db0:OUTMSG | | |
803 | +:OUTN || 4e2b:OUTV || 4c6e:OUTX | | |
804 | +:PACK || 4354:PAREN || 4356:PARIN | | |
805 | +:PARSET || 4360:PERD || 435a:PLUS | | |
806 | +:PNTMSG || 4f43:POLCAT || 4f4f:POLCATR | | |
807 | +:PRGM || 4d75:PRNT || 4d76:PRNT2 | | |
808 | +:PROBE || 4c1b:PROBET || 4ea2:PWRS10 | | |
809 | +:QUITE || 4348:QUOTE || 434e:REMN | | |
810 | +:RSTRT || 4cc0:RTS1 || 4e19:RTS2 | | |
811 | +:SAVE0 || 4366:SAVE1 || 433c:SAVE10 | | |
812 | +:SAVE11 || 4344:SAVE14 || 4368:SAVE2 | | |
813 | +:SAVE3 || 436c:SAVE4 || 436e:SAVE5 | | |
814 | +:SAVE6 || 4372:SAVE7 || 4374:SAVE8 | | |
815 | +:SAVE9 || 00d4:SAVLIN || 437a:SEMI | | |
816 | +:SET || 4c6a:SKIP || 4cef:SKP2 | | |
817 | +:SLASH || 4d40:SLIDE || 00d6:SRC | | |
818 | +:STACK || 4358:STAR || 4c24:START | | |
819 | +:STKMRK || 4c7a:STMNT || 4c77:STRGT | | |
820 | +:STRING || 4dad:STRTMS || 4e96:SUB2 | | |
821 | +:SUBTR || 4de8:TERM || 4edd:TSTN | | |
822 | +:UP || 4e2c:VAR || 4e35:VAR1 | | |
823 | +:VAR2 || 00cc:VARADR || 4306:VARS | | |
824 | +:ZERO || 4da2:ZRSUP | | |
825 | + |