1 |
3 |
zpekic |
1: ;-------------------------------------------------------------------------
|
2 |
|
|
2: ; ALTMON.ASM - 1K ROM monitor for the Altair 8800.
|
3 |
|
|
3: ;
|
4 |
|
|
4: ; This monitor is based on the 2.0C monitor from Vector Graphic. The
|
5 |
|
|
5: ; original version has been updated to use Altair 2SIO serial ports
|
6 |
|
|
6: ; for I/O and several commands have been added and/or modified.
|
7 |
|
|
7: ;
|
8 |
|
|
8: ; A typical location for this PROM in an Altair is at F800, though
|
9 |
|
|
9: ; it can be assembled at most any address. The stack is typically
|
10 |
|
|
10: ; placed at the top of the minimum RAM you expect to have in your
|
11 |
|
|
11: ; system.
|
12 |
|
|
12: ;
|
13 |
|
|
13: ; Version Date Author
|
14 |
|
|
14: ; ------- ---------- ---------------------------------------
|
15 |
|
|
15: ; 1.0 01/10/2016 Mike Douglas (Original)
|
16 |
|
|
16: ;
|
17 |
|
|
17: ; 1.1 02/29/2016 Mike Douglas
|
18 |
|
|
18: ; Fix bug in DUMP code that caused improper range of bytes
|
19 |
|
|
19: ; to display. Also in DUMP, display '.' for all characters
|
20 |
|
|
20: ; 7Fh or above.
|
21 |
|
|
21: ;
|
22 |
|
|
22: ; Initialize 2nd 2SIO port so that loading of Intel HEX
|
23 |
|
|
23: ; files works over the 2nd port. Only flush hex file
|
24 |
|
|
24: ; input on the console serial port to free up code space
|
25 |
|
|
25: ; and because it's not really required for the 2nd port.
|
26 |
|
|
26: ;
|
27 |
|
|
27: ;-------------------------------------------------------------------------
|
28 |
|
|
28: ;
|
29 |
|
|
29: ; Following is a summary of changes from the original VG 2.0c monitor:
|
30 |
|
|
30: ;
|
31 |
|
|
31: ; All commands immediately echo a full command name as soon as the
|
32 |
|
|
32: ; first command letter is typed (e.g., typing "M" immediately
|
33 |
|
|
33: ; displays "MOVE"). This makes it easier to identify commands
|
34 |
|
|
34: ; without a list of commands present.
|
35 |
|
|
35: ;
|
36 |
|
|
36: ; The ESC key can be pressed to abort input or commands as in
|
37 |
|
|
37: ; the later 4.x monitors from VG. The original ctrl-c abort is
|
38 |
|
|
38: ; still present as well.
|
39 |
|
|
39: ;
|
40 |
|
|
40: ; The B (boot) command jumps to the Altair disk boot loader PROM
|
41 |
|
|
41: ; at FF00 instead of the North Star boot ROM.
|
42 |
|
|
42: ;
|
43 |
|
|
43: ; A (ASCII dump) command removed and D (hex dump) updated to display
|
44 |
|
|
44: ; both hex and ASCII.
|
45 |
|
|
45: ;
|
46 |
|
|
46: ; X (exchange) command changed to the E command.
|
47 |
|
|
47: ;
|
48 |
|
|
48: ; H command added to load Intel hex file via either serial port
|
49 |
|
|
49: ; on a 2SIO. The L (load and go from tape) does a hex file load
|
50 |
|
|
50: ; as well (all tape commands eliminated).
|
51 |
|
|
51: ;
|
52 |
|
|
52: ; J treated as jump (i.e., go to) command instead of jump to North
|
53 |
|
|
53: ; Star DOS.
|
54 |
|
|
54: ;
|
55 |
|
|
55: ; K treated as fill memory with "K"onstant instead of jump to zero
|
56 |
|
|
56: ; (was the Z command which has been removed).
|
57 |
|
|
57: ;
|
58 |
|
|
58: ; R command sizes RAM (i.e., runs the N non-destructive memory test)
|
59 |
|
|
59: ; Was previously a read from cassette command. All cassette commands
|
60 |
|
|
60: ; have been removed.
|
61 |
|
|
61: ;
|
62 |
|
|
62: ; The Y command (Vector Graphic relocating loader) command has been
|
63 |
|
|
63: ; removed.
|
64 |
|
|
64: ;
|
65 |
|
|
65: ; The T test memory command skips the 256 byte page the stack is on
|
66 |
|
|
66: ; to prevent crashing the program. A "." pacifier is displayed
|
67 |
|
|
67: ; after each cycle through the memory test range is completed
|
68 |
|
|
68: ;
|
69 |
|
|
69: ;-------------------------------------------------------------------------
|
70 |
|
|
70: ;
|
71 |
|
|
71: ; Command Summary:
|
72 |
|
|
72: ;
|
73 |
|
|
73: ; B jump to Altair disk boot loader (FF00)
|
74 |
|
|
74: ; C SSSS FFFF CCCC compare blocks
|
75 |
|
|
75: ; D SSSS FFFF dump in hex and ASCII
|
76 |
|
|
76: ; E SSSS FFFF DDDD exchange block
|
77 |
|
|
77: ; F SSSS FFFF DD DD find two byte sequence
|
78 |
|
|
78: ; G SSSS go to and execute
|
79 |
|
|
79: ; H P load Intel hex file from 2SIO port 0 or 1
|
80 |
|
|
80: ; I PP input from I/O port
|
81 |
|
|
81: ; J SSSS go to and execute (G)
|
82 |
|
|
82: ; K SSSS FFFF DD fill with "K"onstant
|
83 |
|
|
83: ; L P load Intel hex file from 2SIO port 0 or 1
|
84 |
|
|
84: ; M SSSS FFFF DDDD move block
|
85 |
|
|
85: ; N non destructive memory test (size RAM)
|
86 |
|
|
86: ; O PP DD output to port
|
87 |
|
|
87: ; P LLLL program memory
|
88 |
|
|
88: ; Q SSSS FFFF compute checksum
|
89 |
|
|
89: ; R non destructive memory test (size RAM)
|
90 |
|
|
90: ; S SSSS FFFF DD search for single byte sequence
|
91 |
|
|
91: ; T SSSS FFFF test memory
|
92 |
|
|
92: ;
|
93 |
|
|
93: ;-------------------------------------------------------------------------
|
94 |
|
|
94: ;
|
95 |
|
|
95: ; Memory location equates
|
96 |
|
|
96:
|
97 |
|
|
97: - 0400 org 00400h ;ROM location
|
98 |
|
|
98:
|
99 |
|
|
99: - FFFF SPTR equ 0ffffh ;stack pointer (use 256 byte boundary)
|
100 |
|
|
100: - FFDF SIOPORT equ SPTR-32 ;2SIO port used for hex load
|
101 |
|
|
101: - FF00 BOOT equ 0ff00h ;Altair disk boot loader ROM
|
102 |
|
|
102:
|
103 |
|
|
103: ; 88-2SIO equates
|
104 |
|
|
104:
|
105 |
|
|
105: - 0010 CONS equ 10h ;console status port
|
106 |
|
|
106: - 0011 COND equ 11h ;console data port
|
107 |
|
|
107: - 0002 TBE equ 2 ;transmit buffer entry
|
108 |
|
|
108: - 0001 RDA equ 1 ;receive data available
|
109 |
|
|
109:
|
110 |
|
|
110: ; Misc Equates
|
111 |
|
|
111:
|
112 |
|
|
112: - 000D CR equ 13 ;ASCII carriage return
|
113 |
|
|
113: - 000A LF equ 10 ;ASCII line feed
|
114 |
|
|
114: - 0003 CTRLC equ 3 ;ASCII control-c
|
115 |
|
|
115: - 001B ESC equ 27 ;ASCII ESCAPE
|
116 |
|
|
116:
|
117 |
|
|
117: ;---------------------------------------------------------
|
118 |
|
|
118: ; monit - monitor entry point
|
119 |
|
|
119: ;---------------------------------------------------------
|
120 |
|
|
120: 0+7 0400 3E03 monit mvi a,3 ;reset 6850 uart
|
121 |
|
|
121: 7+10 0402 D310 out CONS
|
122 |
|
|
122: 17+10 0404 D312 out CONS+2 ;2nd 2SIO port as well
|
123 |
|
|
123: 27+7 0406 3E11 mvi a,11h ;8N2
|
124 |
|
|
124: 34+10 0408 D310 out CONS
|
125 |
|
|
125: 44+10 040A D312 out CONS+2 ;2nd 2SIO port as well
|
126 |
|
|
126:
|
127 |
|
|
127: 54+10 040C 31FFFF lxi sp,SPTR
|
128 |
|
|
128: 64+17 040F CDA507 call dspMsg ;display welcome banner
|
129 |
|
|
129: - 0412 0D0A0A41 db CR,LF,LF,'ALTMON 1.','1'+80h
|
130 |
|
|
4C544D4F
|
131 |
|
|
4E20312E
|
132 |
|
|
B1
|
133 |
|
|
130:
|
134 |
|
|
131: ; start - command processing loop
|
135 |
|
|
132:
|
136 |
|
|
133: 81+10 041F 31FFFF start lxi sp,SPTR ;re-init stack pointer
|
137 |
|
|
134: 91+10 0422 211F04 lxi h,start ;RET's go back to start
|
138 |
|
|
135: 101+11 0425 E5 push h
|
139 |
|
|
136:
|
140 |
|
|
137: 112+17 0426 CD6307 call crlf ;display '*' prompt after CR/LF
|
141 |
|
|
138: 129+7 0429 3E2A mvi a,'*'
|
142 |
|
|
139: 136+17 042B CD4807 call ptcn
|
143 |
|
|
140:
|
144 |
|
|
141: 153+17 042E CDBC07 call getCon ;read command from keyboard
|
145 |
|
|
142: 170+7 0431 E65F ani 05FH ;lower case to upper case
|
146 |
|
|
143: 177+7 0433 FE42 cpi 'B'
|
147 |
|
|
144: 184+5+6 0435 D8 rc ;too small
|
148 |
|
|
145: 189+7 0436 FE55 cpi 'U'
|
149 |
|
|
146: 196+5+6 0438 D0 rnc ;too large
|
150 |
|
|
147:
|
151 |
|
|
148: 201+10 0439 21C004 lxi h,cmdTbl+100h-2*'B' ;'B' indexes to start of cmdtbl
|
152 |
|
|
149: 211+4 043C 87 add a ;2 bytes per entry
|
153 |
|
|
150: 215+4 043D 85 add l
|
154 |
|
|
151: 219+5 043E 6F mov l,a
|
155 |
|
|
152:
|
156 |
|
|
153: 224+7 043F 5E mov e,m ;e=lsb of jump address
|
157 |
|
|
154: 231+5 0440 23 inx h
|
158 |
|
|
155: 236+7 0441 56 mov d,m ;d=high byte of jump address
|
159 |
|
|
156: 243+5 0442 EB xchg
|
160 |
|
|
157: 248+5 0443 E9 pchl ;away we go
|
161 |
|
|
158:
|
162 |
|
|
159: ; Command Table
|
163 |
|
|
160:
|
164 |
|
|
161: - 0444 7604 cmdTbl dw doboot ;B jump to Altair disk boot loader
|
165 |
|
|
162: - 0446 CF05 dw compr ;C SSSS FFFF CCCC compare blocks
|
166 |
|
|
163: - 0448 F104 dw disp ;D SSSS FFFF dump in hex
|
167 |
|
|
164: - 044A 8F05 dw exchg ;E SSSS FFFF DDDD exchange block
|
168 |
|
|
165: - 044C FB05 dw srch2 ;F SSSS FFFF DD DD two byte search
|
169 |
|
|
166: - 044E 6A04 dw exec ;G SSSS go to and execute
|
170 |
|
|
167: - 0450 7606 dw hexLoad ;H P load Intel hex file from port
|
171 |
|
|
168: - 0452 5C06 dw pinpt ;I PP input from I/O port
|
172 |
|
|
169: - 0454 6A04 dw exec ;J SSSS jump to and execute (G)
|
173 |
|
|
170: - 0456 6905 dw fill ;K SSSS FFFF DD fill RAM with "k"onstant
|
174 |
|
|
171: - 0458 7606 dw hexLoad ;L P load Intel hex file from port
|
175 |
|
|
172: - 045A 8405 dw moveb ;M SSSS FFFF DDDD move block
|
176 |
|
|
173: - 045C B605 dw ndmt ;N non destructive memory test (RAM size)
|
177 |
|
|
174: - 045E 3F06 dw poutp ;O PP DD output to port
|
178 |
|
|
175: - 0460 3205 dw pgm ;P LLLL program memory
|
179 |
|
|
176: - 0462 8004 dw chksum ;Q SSSS FFFF compute checksum
|
180 |
|
|
177: - 0464 B605 dw ndmt ;R non destructive memory test (RAM size)
|
181 |
|
|
178: - 0466 EF05 dw srch1 ;S SSSS FFFF DD search for single byte
|
182 |
|
|
179: - 0468 9904 dw tmem ;T SSSS FFFF test memory
|
183 |
|
|
180:
|
184 |
|
|
181: ;--------------------------------------------------------------------------
|
185 |
|
|
182: ; exec (G or J) - execute the program at the address
|
186 |
|
|
183: ;--------------------------------------------------------------------------
|
187 |
|
|
184: 253+17 046A CDA507 exec call dspMsg
|
188 |
|
|
185: - 046D 474F54CF db 'GOT','O'+80h
|
189 |
|
|
186:
|
190 |
|
|
187: 270+17 0471 CD2007 call ahex ;read address from keyboard
|
191 |
|
|
188: 287+5 0474 EB xchg
|
192 |
|
|
189: 292+5 0475 E9 pchl
|
193 |
|
|
190:
|
194 |
|
|
191: ;--------------------------------------------------------------------------
|
195 |
|
|
192: ; doBoot (B) - boot floppy disk by jumping to DBL PROM at FF00
|
196 |
|
|
193: ;--------------------------------------------------------------------------
|
197 |
|
|
194: 297+17 0476 CDA507 doBoot call dspMsg
|
198 |
|
|
195: - 0479 424F4FD4 db 'BOO','T'+80h
|
199 |
|
|
196:
|
200 |
|
|
197: 314+10 047D C300FF jmp BOOT
|
201 |
|
|
198:
|
202 |
|
|
199: ;--------------------------------------------------------------------------
|
203 |
|
|
200: ; chksum (Q) - compute checksum
|
204 |
|
|
201: ;--------------------------------------------------------------------------
|
205 |
|
|
202: 324+17 0480 CDA507 chksum call dspMsg
|
206 |
|
|
203: - 0483 435355CD db 'CSU','M'+80h
|
207 |
|
|
204:
|
208 |
|
|
205: 341+17 0487 CD1D07 call tahex
|
209 |
|
|
206: 358+7 048A 0600 mvi b,0 ;start checksum = 0
|
210 |
|
|
207:
|
211 |
|
|
208: 365+7 048C 7E csloop mov a,m ;get data from memory
|
212 |
|
|
209: 372+4 048D 80 add b ;add to checksum
|
213 |
|
|
210: 376+5 048E 47 mov b,a
|
214 |
|
|
211: 381+17 048F CDEA07 call bmp
|
215 |
|
|
212: 398+10 0492 C28C04 jnz csloop ;repeat loop
|
216 |
|
|
213:
|
217 |
|
|
214: 408+5 0495 78 mov a,b ;a=checksum
|
218 |
|
|
215: 413+10 0496 C37907 jmp pt2 ;print checksum and exit
|
219 |
|
|
216:
|
220 |
|
|
217: ;--------------------------------------------------------------------------
|
221 |
|
|
218: ; tmem (T) - memory test routine
|
222 |
|
|
219: ;--------------------------------------------------------------------------
|
223 |
|
|
220: 423+17 0499 CDA507 tmem call dspMsg
|
224 |
|
|
221: - 049C 544553D4 db 'TES','T'+80h
|
225 |
|
|
222:
|
226 |
|
|
223: 440+17 04A0 CD1D07 call tahex ;read addresses
|
227 |
|
|
224: 457+10 04A3 015A5A lxi b,05a5ah ;init b,c
|
228 |
|
|
225:
|
229 |
|
|
226: 467+7 04A6 3E2E cycl mvi a,'.' ;display '.' before each cycle
|
230 |
|
|
227: 474+17 04A8 CD4807 call ptcn
|
231 |
|
|
228: 491+17 04AB CDE204 call rndm
|
232 |
|
|
229: 508+11 04AE C5 push b ;keep all registers
|
233 |
|
|
230: 519+11 04AF E5 push h
|
234 |
|
|
231: 530+11 04B0 D5 push d
|
235 |
|
|
232:
|
236 |
|
|
233: 541+5 04B1 7C tlop mov a,h ;on stack page?
|
237 |
|
|
234: 546+7 04B2 FEFE cpi (SPTR shr 8)-1 ;compare to msb of stack
|
238 |
|
|
235: 553+10 04B4 CABB04 jz skipWr ;in stack, skip write
|
239 |
|
|
236: 563+17 04B7 CDE204 call rndm
|
240 |
|
|
237: 580+7 04BA 70 mov m,b ;write in memory
|
241 |
|
|
238: 587+17 04BB CDEA07 skipWr call bmp
|
242 |
|
|
239: 604+10 04BE C2B104 jnz tlop ;repeat loop
|
243 |
|
|
240:
|
244 |
|
|
241: 614+10 04C1 D1 pop d
|
245 |
|
|
242: 624+10 04C2 E1 pop h ;restore original
|
246 |
|
|
243: 634+10 04C3 C1 pop b ;values
|
247 |
|
|
244: 644+11 04C4 E5 push h
|
248 |
|
|
245: 655+11 04C5 D5 push d
|
249 |
|
|
246:
|
250 |
|
|
247: 666+5 04C6 7C rlop mov a,h ;on stack page?
|
251 |
|
|
248: 671+7 04C7 FEFE cpi (SPTR shr 8)-1 ;compare to msb of stack
|
252 |
|
|
249: 678+10 04C9 CAD404 jz skipRd ;in stack, skip the read
|
253 |
|
|
250: 688+17 04CC CDE204 call rndm ;generate new sequence
|
254 |
|
|
251: 705+7 04CF 7E mov a,m ;read memory
|
255 |
|
|
252: 712+4 04D0 B8 cmp b ;compare memory
|
256 |
|
|
253: 716+11+6 04D1 C46D07 cnz err ;call error routine
|
257 |
|
|
254: 727+17 04D4 CDEA07 skipRd call bmp
|
258 |
|
|
255: 744+10 04D7 C2C604 jnz rlop
|
259 |
|
|
256:
|
260 |
|
|
257: 754+10 04DA D1 pop d
|
261 |
|
|
258: 764+10 04DB E1 pop h
|
262 |
|
|
259: 774+17 04DC CDC707 call pause
|
263 |
|
|
260: 791+10 04DF C3A604 jmp cycl
|
264 |
|
|
261:
|
265 |
|
|
262: ; rndm - this routine generates random numbers
|
266 |
|
|
263:
|
267 |
|
|
264: 801+5 04E2 78 rndm mov a,b ;look at b
|
268 |
|
|
265: 806+7 04E3 E6B4 ani 0b4h ;mask bits
|
269 |
|
|
266: 813+4 04E5 A7 ana a ;clear carry
|
270 |
|
|
267: 817+10 04E6 EAEA04 jpe peve ;jump if even
|
271 |
|
|
268: 827+4 04E9 37 stc
|
272 |
|
|
269: 831+5 04EA 79 peve mov a,c ;look at c
|
273 |
|
|
270: 836+4 04EB 17 ral ;rotate carry in
|
274 |
|
|
271: 840+5 04EC 4F mov c,a ;restore c
|
275 |
|
|
272: 845+5 04ED 78 mov a,b ;look at b
|
276 |
|
|
273: 850+4 04EE 17 ral ;rotate carry in
|
277 |
|
|
274: 854+5 04EF 47 mov b,a ;restore b
|
278 |
|
|
275: 859+10 04F0 C9 ret ;return with new b,c
|
279 |
|
|
276:
|
280 |
|
|
277: ;--------------------------------------------------------------------------
|
281 |
|
|
278: ; disp (D) - display memory contents
|
282 |
|
|
279: ;--------------------------------------------------------------------------
|
283 |
|
|
280: 869+17 04F1 CDA507 disp call dspMsg
|
284 |
|
|
281: - 04F4 44554DD0 db 'DUM','P'+80h
|
285 |
|
|
282:
|
286 |
|
|
283: 886+17 04F8 CD1D07 call tahex ;read addresses
|
287 |
|
|
284:
|
288 |
|
|
285: 903+11 04FB E5 dmpLine push h ;save address at start of line
|
289 |
|
|
286: 914+7 04FC 0E10 mvi c,16 ;16 locations per line
|
290 |
|
|
287: 921+17 04FE CD8107 call ptad ;print current address
|
291 |
|
|
288:
|
292 |
|
|
289: ; dump line in hex
|
293 |
|
|
290:
|
294 |
|
|
291: 938+7 0501 7E dmpHex mov a,m ;a=byte to display
|
295 |
|
|
292: 945+17 0502 CD7907 call pt2 ;display it
|
296 |
|
|
293: 962+17 0505 CD4607 call spce
|
297 |
|
|
294: 979+5 0508 23 inx h
|
298 |
|
|
295: 984+5 0509 0D dcr c ;decrement line byte count
|
299 |
|
|
296: 989+10 050A C20105 jnz dmpHex ;loop until 16 bytes done
|
300 |
|
|
297:
|
301 |
|
|
298: ; dump line in ASCII
|
302 |
|
|
299:
|
303 |
|
|
300: 999+17 050D CD4607 call spce
|
304 |
|
|
301: 1016+10 0510 E1 pop h ;hl->start of line
|
305 |
|
|
302: 1026+7 0511 0E10 mvi c,16 ;16 locations per line
|
306 |
|
|
303:
|
307 |
|
|
304: 1033+7 0513 7E dmpAsc mov a,m ;a=byte to display
|
308 |
|
|
305: 1040+7 0514 FE7F cpi 7Fh ;test if >= 7Fh
|
309 |
|
|
306: 1047+10 0516 D21E05 jnc dspDot ;non printable, show '.'
|
310 |
|
|
307:
|
311 |
|
|
308: 1057+7 0519 FE20 cpi ' ' ;displayable character?
|
312 |
|
|
309: 1064+10 051B D22005 jnc dspAsc ;yes, go display it
|
313 |
|
|
310:
|
314 |
|
|
311: 1074+7 051E 3E2E dspDot mvi a,'.' ;display '.' instead
|
315 |
|
|
312:
|
316 |
|
|
313: 1081+17 0520 CD4807 dspAsc call ptcn ;display the character
|
317 |
|
|
314: 1098+17 0523 CDEA07 call bmp ;increment hl, possibly de
|
318 |
|
|
315: 1115+5 0526 0D dcr c ;decrement line byte count
|
319 |
|
|
316: 1120+10 0527 C21305 jnz dmpAsc ;loop until 16 bytes done
|
320 |
|
|
317:
|
321 |
|
|
318: 1130+17 052A CDEA07 call bmp ;done?
|
322 |
|
|
319: 1147+5+6 052D C8 rz ;yes
|
323 |
|
|
320: 1152+5 052E 2B dcx h ;undo extra bump of hl
|
324 |
|
|
321: 1157+10 052F C3FB04 jmp dmpLine ;do another line
|
325 |
|
|
322:
|
326 |
|
|
323: ;--------------------------------------------------------------------------
|
327 |
|
|
324: ; pgm (P) - program memory
|
328 |
|
|
325: ;--------------------------------------------------------------------------
|
329 |
|
|
326: 1167+17 0532 CDA507 pgm call dspMsg
|
330 |
|
|
327: - 0535 5047CD db 'PG','M'+80h
|
331 |
|
|
328:
|
332 |
|
|
329: 1184+17 0538 CD2007 call ahex ;read address
|
333 |
|
|
330: 1201+5 053B EB xchg
|
334 |
|
|
331: 1206+17 053C CD6307 call crlf
|
335 |
|
|
332:
|
336 |
|
|
333: 1223+7 053F 7E pglp mov a,m ;read memory
|
337 |
|
|
334: 1230+17 0540 CD7907 call pt2 ;print 2 digits
|
338 |
|
|
335: 1247+7 0543 3E2D mvi a,'-' ;load dash
|
339 |
|
|
336: 1254+17 0545 CD4807 call ptcn ;print dash
|
340 |
|
|
337:
|
341 |
|
|
338: 1271+17 0548 CDB307 crig call rdcn ;get user input
|
342 |
|
|
339: 1288+7 054B FE20 cpi ' ' ;space
|
343 |
|
|
340: 1295+10 054D CA6505 jz con2 ;skip if space
|
344 |
|
|
341: 1305+7 0550 FE0D cpi CR ;skip if CR
|
345 |
|
|
342: 1312+10 0552 C25B05 jnz con1
|
346 |
|
|
343: 1322+17 0555 CD6307 call crlf ;print CR,LF
|
347 |
|
|
344: 1339+10 0558 C34805 jmp crig ;back for more
|
348 |
|
|
345:
|
349 |
|
|
346: 1349+5 055B EB con1 xchg ;HL->DE
|
350 |
|
|
347: 1354+10 055C 210000 lxi h,0 ;get 16 bit zero
|
351 |
|
|
348: 1364+7 055F 0E02 mvi c,2 ;count 2 digits
|
352 |
|
|
349: 1371+17 0561 CD2807 call ahexNr ;convert to hex (no read)
|
353 |
|
|
350: 1388+7 0564 73 mov m,e
|
354 |
|
|
351: 1395+5 0565 23 con2 inx h
|
355 |
|
|
352: 1400+10 0566 C33F05 jmp pglp
|
356 |
|
|
353:
|
357 |
|
|
354: ;--------------------------------------------------------------------------
|
358 |
|
|
355: ; fill (K) - fill memory with a constant
|
359 |
|
|
356: ;--------------------------------------------------------------------------
|
360 |
|
|
357: 1410+17 0569 CDA507 fill call dspMsg
|
361 |
|
|
358: - 056C 46494CCC db 'FIL','L'+80h
|
362 |
|
|
359:
|
363 |
|
|
360: 1427+17 0570 CD1D07 call tahex ;read addresses
|
364 |
|
|
361: 1444+11 0573 E5 push h ;start addr on stack
|
365 |
|
|
362: 1455+7 0574 0E02 mvi c,2 ;reading 2 digits
|
366 |
|
|
363: 1462+17 0576 CD2207 call ahe0 ;input fill byte
|
367 |
|
|
364: 1479+5 0579 EB xchg ;byte to write from e to l
|
368 |
|
|
365: 1484+18 057A E3 xthl ;hl=start addr, stack=fill byte
|
369 |
|
|
366: 1502+10 057B C1 pop b ;c=fill byte from stack
|
370 |
|
|
367:
|
371 |
|
|
368: 1512+7 057C 71 zloop mov m,c ;write into memory
|
372 |
|
|
369: 1519+17 057D CDEA07 call bmp ;compare address, increment h
|
373 |
|
|
370: 1536+5+6 0580 C8 rz
|
374 |
|
|
371: 1541+10 0581 C37C05 jmp zloop
|
375 |
|
|
372:
|
376 |
|
|
373: ;--------------------------------------------------------------------------
|
377 |
|
|
374: ; moveb (M) - move a block of memory
|
378 |
|
|
375: ; exchg (E) - exhange block of memory
|
379 |
|
|
376: ;--------------------------------------------------------------------------
|
380 |
|
|
377: 1551+17 0584 CDA507 moveb call dspMsg
|
381 |
|
|
378: - 0587 4D4F56C5 db 'MOV','E'+80h
|
382 |
|
|
379: 1568+4 058B AF xra a ;a=0 means "move" command
|
383 |
|
|
380: 1572+10 058C C39605 jmp doMove
|
384 |
|
|
381:
|
385 |
|
|
382: 1582+17 058F CDA507 exchg call dspMsg
|
386 |
|
|
383: - 0592 455843C8 db 'EXC','H'+80h
|
387 |
|
|
384: ;a returned <> 0 means "exchange" command
|
388 |
|
|
385:
|
389 |
|
|
386: 1599+5 0596 47 doMove mov b,a ;save move/exchange flag in b
|
390 |
|
|
387: 1604+17 0597 CD1D07 call tahex ;read addresses
|
391 |
|
|
388: 1621+11 059A E5 push h
|
392 |
|
|
389: 1632+17 059B CD2007 call ahex
|
393 |
|
|
390: 1649+5 059E EB xchg
|
394 |
|
|
391: 1654+18 059F E3 xthl ;HL->start, DE->end, stack has dest
|
395 |
|
|
392:
|
396 |
|
|
393: 1672+7 05A0 4E mloop mov c,m ;c=byte from source
|
397 |
|
|
394: 1679+18 05A1 E3 xthl ;hl->destination
|
398 |
|
|
395:
|
399 |
|
|
396: 1697+5 05A2 78 mov a,b ;move or exchange?
|
400 |
|
|
397: 1702+4 05A3 B7 ora a
|
401 |
|
|
398: 1706+10 05A4 CAAB05 jz nexch ;0 means move only
|
402 |
|
|
399:
|
403 |
|
|
400: 1716+7 05A7 7E mov a,m ;a=from destination
|
404 |
|
|
401: 1723+18 05A8 E3 xthl ;hl->source
|
405 |
|
|
402: 1741+7 05A9 77 mov m,a ;move destination to source
|
406 |
|
|
403: 1748+18 05AA E3 xthl ;hl->destination
|
407 |
|
|
404:
|
408 |
|
|
405: 1766+7 05AB 71 nexch mov m,c ;move source to destination
|
409 |
|
|
406: 1773+5 05AC 23 inx h ;increment destination
|
410 |
|
|
407: 1778+18 05AD E3 xthl ;hl->source
|
411 |
|
|
408: 1796+17 05AE CDEA07 call bmp ;increment source and compare to end
|
412 |
|
|
409: 1813+10 05B1 C2A005 jnz mloop
|
413 |
|
|
410:
|
414 |
|
|
411: 1823+10 05B4 E1 pop h ;remove temp pointer from stack
|
415 |
|
|
412: 1833+10 05B5 C9 ret ;and exit
|
416 |
|
|
413:
|
417 |
|
|
414: ;--------------------------------------------------------------------------
|
418 |
|
|
415: ; ndmt (N or R) - non destructive memory test (size RAM)
|
419 |
|
|
416: ;--------------------------------------------------------------------------
|
420 |
|
|
417: 1843+17 05B6 CDA507 ndmt call dspMsg
|
421 |
|
|
418: - 05B9 52414D54 db 'RAMTO','P'+80h
|
422 |
|
|
4FD0
|
423 |
|
|
419:
|
424 |
|
|
420: 1860+10 05BF 21FFFF lxi h,0ffffh ;start at zero
|
425 |
|
|
421:
|
426 |
|
|
422: 1870+5 05C2 23 ndlop inx h
|
427 |
|
|
423: 1875+7 05C3 7E mov a,m ;read from address in hl
|
428 |
|
|
424: 1882+5 05C4 47 mov b,a ;save original value in b
|
429 |
|
|
425: 1887+4 05C5 2F cma ;form and write inverted value
|
430 |
|
|
426: 1891+7 05C6 77 mov m,a
|
431 |
|
|
427: 1898+7 05C7 BE cmp m ;read and compare
|
432 |
|
|
428: 1905+7 05C8 70 mov m,b ;restore original value
|
433 |
|
|
429: 1912+10 05C9 CAC205 jz ndlop ;keep going if still RAM
|
434 |
|
|
430:
|
435 |
|
|
431: 1922+10 05CC C36D07 jmp err ;display end of RAM
|
436 |
|
|
432:
|
437 |
|
|
433: ;--------------------------------------------------------------------------
|
438 |
|
|
434: ; compr (C) - compare two blocks of memory
|
439 |
|
|
435: ;--------------------------------------------------------------------------
|
440 |
|
|
436: 1932+17 05CF CDA507 compr call dspMsg
|
441 |
|
|
437: - 05D2 434F4DD0 db 'COM','P'+80h
|
442 |
|
|
438:
|
443 |
|
|
439: 1949+17 05D6 CD1D07 call tahex ;read addresses
|
444 |
|
|
440: 1966+11 05D9 E5 push h ;source start on stack
|
445 |
|
|
441: 1977+17 05DA CD2007 call ahex
|
446 |
|
|
442: 1994+5 05DD EB xchg ;de=source end, hl=compare start
|
447 |
|
|
443:
|
448 |
|
|
444: 1999+7 05DE 7E vmlop mov a,m ;a=compare byte
|
449 |
|
|
445: 2006+5 05DF 23 inx h
|
450 |
|
|
446: 2011+18 05E0 E3 xthl ;hl->source byte
|
451 |
|
|
447: 2029+7 05E1 BE cmp m ;same?
|
452 |
|
|
448: 2036+7 05E2 46 mov b,m ;b=source byte
|
453 |
|
|
449: 2043+11+6 05E3 C46D07 cnz err ;display the error
|
454 |
|
|
450: 2054+17 05E6 CDEA07 call bmp ;increment pointers
|
455 |
|
|
451: 2071+18 05E9 E3 xthl ;hl->compare byte
|
456 |
|
|
452: 2089+10 05EA C2DE05 jnz vmlop
|
457 |
|
|
453:
|
458 |
|
|
454: 2099+10 05ED E1 pop h ;remove temp pointer from stack
|
459 |
|
|
455: 2109+10 05EE C9 ret ;and exit
|
460 |
|
|
456:
|
461 |
|
|
457: ;--------------------------------------------------------------------------
|
462 |
|
|
458: ; srch1 (S) - search for one byte
|
463 |
|
|
459: ; srch2 (F) - search for two bytes
|
464 |
|
|
460: ;--------------------------------------------------------------------------
|
465 |
|
|
461: 2119+17 05EF CDA507 srch1 call dspMsg
|
466 |
|
|
462: - 05F2 46494E44 db 'FIND','1'+80h
|
467 |
|
|
B1
|
468 |
|
|
463: 2136+4 05F7 AF xra a ;zero flag means one byte search
|
469 |
|
|
464: 2140+10 05F8 C30306 jmp doSrch
|
470 |
|
|
465:
|
471 |
|
|
466: 2150+17 05FB CDA507 srch2 call dspMsg
|
472 |
|
|
467: - 05FE 46494E44 db 'FIND','2'+80h
|
473 |
|
|
B2
|
474 |
|
|
468: ;a returned <> 0 means two byte search
|
475 |
|
|
469:
|
476 |
|
|
470: 2167+11 0603 F5 doSrch push psw ;save 1/2 byte flag on stack
|
477 |
|
|
471: 2178+17 0604 CD1D07 call tahex
|
478 |
|
|
472:
|
479 |
|
|
473: 2195+11 0607 E5 push h ;save h, getting 1st byte to find
|
480 |
|
|
474: 2206+7 0608 0E02 mvi c,2 ;reading 2 hex digits
|
481 |
|
|
475: 2213+17 060A CD2207 call ahe0 ;
|
482 |
|
|
476: 2230+5 060D EB xchg ;h=code, d=f
|
483 |
|
|
477: 2235+5 060E 45 mov b,l ;put code in b
|
484 |
|
|
478: 2240+10 060F E1 pop h ;restore h
|
485 |
|
|
479:
|
486 |
|
|
480: 2250+10 0610 F1 pop psw ;a=one/two byte flag
|
487 |
|
|
481: 2260+4 0611 B7 ora a ;zero true if one byte search
|
488 |
|
|
482: 2264+11 0612 F5 push psw
|
489 |
|
|
483: 2275+10 0613 CA1F06 jz cont
|
490 |
|
|
484:
|
491 |
|
|
485: 2285+11 0616 E5 push h ;save h, getting 2nd byte to find
|
492 |
|
|
486: 2296+7 0617 0E02 mvi c,2
|
493 |
|
|
487: 2303+17 0619 CD2207 call ahe0
|
494 |
|
|
488: 2320+5 061C EB xchg
|
495 |
|
|
489: 2325+5 061D 4D mov c,l
|
496 |
|
|
490: 2330+10 061E E1 pop h
|
497 |
|
|
491:
|
498 |
|
|
492: 2340+7 061F 7E cont mov a,m ;read memory
|
499 |
|
|
493: 2347+4 0620 B8 cmp b ;compare to code
|
500 |
|
|
494: 2351+10 0621 C23706 jnz skp ;skip if no compare
|
501 |
|
|
495:
|
502 |
|
|
496: 2361+10 0624 F1 pop psw ;a=one/two byte flag
|
503 |
|
|
497: 2371+4 0625 B7 ora a ;zero true if one byte serach
|
504 |
|
|
498: 2375+11 0626 F5 push psw
|
505 |
|
|
499: 2386+10 0627 CA3106 jz obcp
|
506 |
|
|
500:
|
507 |
|
|
501: 2396+5 062A 23 inx h ;two byte search
|
508 |
|
|
502: 2401+7 062B 7E mov a,m
|
509 |
|
|
503: 2408+5 062C 2B dcx h
|
510 |
|
|
504: 2413+4 062D B9 cmp c
|
511 |
|
|
505: 2417+10 062E C23706 jnz skp
|
512 |
|
|
506:
|
513 |
|
|
507: 2427+5 0631 23 obcp inx h
|
514 |
|
|
508: 2432+7 0632 7E mov a,m ;read next byte
|
515 |
|
|
509: 2439+5 0633 2B dcx h ;decr address
|
516 |
|
|
510: 2444+17 0634 CD6D07 call err ;print data found
|
517 |
|
|
511:
|
518 |
|
|
512: 2461+17 0637 CDEA07 skp call bmp ;check if done
|
519 |
|
|
513: 2478+10 063A C21F06 jnz cont ;back for more
|
520 |
|
|
514: 2488+10 063D F1 pop psw ;remove flag saved on stack
|
521 |
|
|
515: 2498+10 063E C9 ret
|
522 |
|
|
516:
|
523 |
|
|
517: ;--------------------------------------------------------------------------
|
524 |
|
|
518: ; poutp (O) - output data to a port
|
525 |
|
|
519: ;--------------------------------------------------------------------------
|
526 |
|
|
520: 2508+17 063F CDA507 poutp call dspMsg
|
527 |
|
|
521: - 0642 4F55D4 db 'OU','T'+80h
|
528 |
|
|
522:
|
529 |
|
|
523: 2525+7 0645 0E02 mvi c,2
|
530 |
|
|
524: 2532+17 0647 CD2207 call ahe0 ;port number in e
|
531 |
|
|
525:
|
532 |
|
|
526: 2549+7 064A 0E02 mvi c,2
|
533 |
|
|
527: 2556+17 064C CD2207 call ahe0 ;port to l, data in e
|
534 |
|
|
528:
|
535 |
|
|
529: 2573+5 064F 55 mov d,l ;d=port
|
536 |
|
|
530: 2578+10 0650 21CFFF lxi h,SPTR-30h ;form OUT nn, RET in memory at h
|
537 |
|
|
531: 2588+10 0653 36C9 mvi m,0c9h ;RET opcode
|
538 |
|
|
532: 2598+5 0655 2B dcx h
|
539 |
|
|
533: 2603+7 0656 72 mov m,d ;output port for OUT instruction
|
540 |
|
|
534: 2610+5 0657 2B dcx h
|
541 |
|
|
535: 2615+10 0658 36D3 mvi m,0D3H ;OUT opcode
|
542 |
|
|
536: 2625+5 065A 7B mov a,e
|
543 |
|
|
537: 2630+5 065B E9 pchl ;call OUT, RET
|
544 |
|
|
538:
|
545 |
|
|
539: ;--------------------------------------------------------------------------
|
546 |
|
|
540: ; pinpt (I) - input data from a port
|
547 |
|
|
541: ;--------------------------------------------------------------------------
|
548 |
|
|
542: 2635+17 065C CDA507 pinpt call dspMsg
|
549 |
|
|
543: - 065F 49CE db 'I','N'+80h
|
550 |
|
|
544:
|
551 |
|
|
545: 2652+7 0661 0E02 mvi c,2
|
552 |
|
|
546: 2659+17 0663 CD2207 call ahe0 ;port number to e
|
553 |
|
|
547:
|
554 |
|
|
548: 2676+10 0666 21CFFF lxi h,SPTR-30H ;form IN nn, RET in memory at h
|
555 |
|
|
549: 2686+10 0669 36C9 mvi m,0C9H ;RET opcode
|
556 |
|
|
550: 2696+5 066B 2B dcx h
|
557 |
|
|
551: 2701+7 066C 73 mov m,e ;input port of IN instruction
|
558 |
|
|
552: 2708+5 066D 2B dcx h
|
559 |
|
|
553: 2713+10 066E 36DB mvi m,0DBH ;IN opcode
|
560 |
|
|
554: 2723+17 0670 CDCDFF call SPTR-32H
|
561 |
|
|
555: 2740+10 0673 C37907 jmp pt2
|
562 |
|
|
556:
|
563 |
|
|
557: ;---------------------------------------------------------------------
|
564 |
|
|
558: ; hexLoad (H or L) - load intel hex through 2SIO serial port 0 or 1
|
565 |
|
|
559: ;---------------------------------------------------------------------
|
566 |
|
|
560: 2750+17 0676 CDA507 hexload call dspMsg
|
567 |
|
|
561: - 0679 4845584C db 'HEXLOA','D'+80h
|
568 |
|
|
4F41C4
|
569 |
|
|
562:
|
570 |
|
|
563: 2767+7 0680 0E01 mvi c,1 ;read one hex digit
|
571 |
|
|
564: 2774+17 0682 CD2207 call ahe0 ;digit is in e
|
572 |
|
|
565: 2791+10 0685 21DFFF lxi h,SIOPORT ;hl->location on stack to save port
|
573 |
|
|
566: 2801+7 0688 73 mov m,e ;SIOPORT = 0 or 1
|
574 |
|
|
567:
|
575 |
|
|
568: ; rcvLine - receive a hex file line
|
576 |
|
|
569:
|
577 |
|
|
570: 2808+17 0689 CD6307 rcvLine call crlf
|
578 |
|
|
571: 2825+7 068C 0E00 mvi c,0 ;clear echo character flag
|
579 |
|
|
572:
|
580 |
|
|
573: 2832+17 068E CDF306 wtMark call getChar ;read next character
|
581 |
|
|
574: 2849+7 0691 D63A sui ':' ;record marker?
|
582 |
|
|
575: 2856+10 0693 C28E06 jnz wtMark ;no, keep looking
|
583 |
|
|
576:
|
584 |
|
|
577: ; Have start of new record. Save the byte count and load address.
|
585 |
|
|
578: ; The load address is echoed to the screen so the user can
|
586 |
|
|
579: ; see the file load progress.
|
587 |
|
|
580:
|
588 |
|
|
581: 2866+5 0696 57 mov d,a ;init checksum in D to zero
|
589 |
|
|
582:
|
590 |
|
|
583: 2871+17 0697 CDD506 call iByte ;input two hex digits (byte count)
|
591 |
|
|
584: 2888+5 069A 7B mov a,e ;test for zero byte count
|
592 |
|
|
585: 2893+4 069B B7 ora a
|
593 |
|
|
586: 2897+10 069C CAC306 jz flush ;count of 0 means end
|
594 |
|
|
587:
|
595 |
|
|
588: 2907+5 069F 43 mov b,e ;B = byte count on line
|
596 |
|
|
589:
|
597 |
|
|
590: 2912+5 06A0 0C inr c ;set echo flag for address bytes
|
598 |
|
|
591: 2917+17 06A1 CDD506 call iByte ;get MSB of address
|
599 |
|
|
592: 2934+5 06A4 63 mov h,e ;H = address MSB
|
600 |
|
|
593: 2939+17 06A5 CDD506 call iByte ;get LSB of address
|
601 |
|
|
594: 2956+5 06A8 6B mov l,e ;L = address LSB
|
602 |
|
|
595: 2961+5 06A9 0D dcr c ;clear echo flag
|
603 |
|
|
596:
|
604 |
|
|
597: 2966+17 06AA CDD506 call iByte ;ignore/discard record type
|
605 |
|
|
598:
|
606 |
|
|
599: ; Receive the data bytes of the record and move to memory
|
607 |
|
|
600:
|
608 |
|
|
601: 2983+17 06AD CDD506 data call iByte ;read a data byte (2 hex digits)
|
609 |
|
|
602: 3000+7 06B0 73 mov m,e ;store in memory
|
610 |
|
|
603: 3007+5 06B1 23 inx h
|
611 |
|
|
604: 3012+5 06B2 05 dcr b
|
612 |
|
|
605: 3017+10 06B3 C2AD06 jnz data
|
613 |
|
|
606:
|
614 |
|
|
607: ; Validate checksum
|
615 |
|
|
608:
|
616 |
|
|
609: 3027+17 06B6 CDD506 call iByte ;read and add checksum
|
617 |
|
|
610: 3044+10 06B9 CA8906 jz rcvLine ;checksum good, receive next line
|
618 |
|
|
611:
|
619 |
|
|
612: 3054+17 06BC CDA507 call dspMsg ;display error message
|
620 |
|
|
613: - 06BF 204552D2 db ' ER','R'+80h
|
621 |
|
|
614: ;fall into flush
|
622 |
|
|
615:
|
623 |
|
|
616: ; flush - flush rest of file as it comes in until no characters
|
624 |
|
|
617: ; received for about 1/4 second to prevent incoming file
|
625 |
|
|
618: ; data looking like typed monitor commands. Only the console
|
626 |
|
|
619: ; port needs to be flushed.
|
627 |
|
|
620:
|
628 |
|
|
621: 3071+10 06C3 DB11 flush in COND ;clear possible received char
|
629 |
|
|
622: 3081+10 06C5 11B128 lxi d,10417 ;.25s timeout for 48 cycle loop
|
630 |
|
|
623:
|
631 |
|
|
624: 3091+10 06C8 DB10 flshLp in CONS ;(10) look for character on console
|
632 |
|
|
625: 3101+4 06CA 0F rrc ;(4) data flag in carry
|
633 |
|
|
626: 3105+10 06CB DAC306 jc flush ;(10) data received, restart
|
634 |
|
|
627:
|
635 |
|
|
628: 3115+5 06CE 1B dcx d ;(5) decrement timeout
|
636 |
|
|
629: 3120+5 06CF 7A mov a,d ;(5)
|
637 |
|
|
630: 3125+4 06D0 B3 ora e ;(4)
|
638 |
|
|
631: 3129+10 06D1 C2C806 jnz flshLp ;(10) loop until zero
|
639 |
|
|
632: 3139+10 06D4 C9 ret ;done
|
640 |
|
|
633:
|
641 |
|
|
634: ;-----------------------------------------------------------
|
642 |
|
|
635: ; iByte - read two ascii hex bytes and return binary
|
643 |
|
|
636: ; value in e.
|
644 |
|
|
637: ;-----------------------------------------------------------
|
645 |
|
|
638: 3149+17 06D5 CDF306 iByte call getChar ;get a character
|
646 |
|
|
639: 3166+17 06D8 CDEB06 call asc2Bin ;ascii hex digit to binary
|
647 |
|
|
640: 3183+4 06DB 87 add a ;put in msn, zero lsn
|
648 |
|
|
641: 3187+4 06DC 87 add a
|
649 |
|
|
642: 3191+4 06DD 87 add a
|
650 |
|
|
643: 3195+4 06DE 87 add a
|
651 |
|
|
644: 3199+5 06DF 5F mov e,a ;save byte with MSN in E
|
652 |
|
|
645:
|
653 |
|
|
646: ; 2nd byte (LSN)
|
654 |
|
|
647:
|
655 |
|
|
648: 3204+17 06E0 CDF306 call getChar ;get a character
|
656 |
|
|
649: 3221+17 06E3 CDEB06 call asc2Bin ;ascii hex digit to binary
|
657 |
|
|
650: 3238+4 06E6 83 add e ;combine msn and lsn
|
658 |
|
|
651: 3242+5 06E7 5F mov e,a ;save in EH
|
659 |
|
|
652: 3247+4 06E8 82 add d ;add character to checksum
|
660 |
|
|
653: 3251+5 06E9 57 mov d,a
|
661 |
|
|
654: 3256+10 06EA C9 ret
|
662 |
|
|
655:
|
663 |
|
|
656: ;-------------------------------------------------------------
|
664 |
|
|
657: ; asc2Bin - ASCII hex digit to binary conversion. Digit
|
665 |
|
|
658: ; passed in a, returned in a. Errors ignored as checksum
|
666 |
|
|
659: ; will eventually kick this out.
|
667 |
|
|
660: ;-------------------------------------------------------------
|
668 |
|
|
661: 3266+7 06EB D630 asc2Bin sui '0' ;'0' to 0
|
669 |
|
|
662: 3273+7 06ED FE0A cpi 10 ;0-9 ?
|
670 |
|
|
663: 3280+5+6 06EF D8 rc
|
671 |
|
|
664:
|
672 |
|
|
665: 3285+7 06F0 D607 sui 7 ;'A-F' to A-F
|
673 |
|
|
666: 3292+10 06F2 C9 ret
|
674 |
|
|
667:
|
675 |
|
|
668: ;-------------------------------------------------------------
|
676 |
|
|
669: ; getChar - read a character from the 2SIO port specified in
|
677 |
|
|
670: ; SIOPORT. The character is also echoed to the console port
|
678 |
|
|
671: ; if the echo flag (c) is set (non-zero)
|
679 |
|
|
672: ;-------------------------------------------------------------
|
680 |
|
|
673: 3302+11 06F3 C5 getChar push b ;save b,c
|
681 |
|
|
674: 3313+13 06F4 3ADFFF lda SIOPORT ;a=pseudo port to use
|
682 |
|
|
675: 3326+4 06F7 B7 ora a ;port zero?
|
683 |
|
|
676: 3330+10 06F8 C20407 jnz inWait1 ;no, use port 1
|
684 |
|
|
677:
|
685 |
|
|
678: ; in through 1st port (0) on 2SIO
|
686 |
|
|
679:
|
687 |
|
|
680: 3340+17 06FB CDD607 inWait0 call cntlc ;test for character from console
|
688 |
|
|
681: 3357+10 06FE CAFB06 jz inWait0
|
689 |
|
|
682: 3367+10 0701 C30F07 jmp haveChr
|
690 |
|
|
683:
|
691 |
|
|
684: ; in through 2nd port (1) on 2SIO, check for ctrl-c on console
|
692 |
|
|
685: ; while waiting
|
693 |
|
|
686:
|
694 |
|
|
687: 3377+17 0704 CDD607 inWait1 call cntlc ;look for ctrl-c on console
|
695 |
|
|
688: 3394+10 0707 DB12 in CONS+2 ;wait for character on 2nd 2SIO
|
696 |
|
|
689: 3404+4 0709 0F rrc ;data flag in carry
|
697 |
|
|
690: 3408+10 070A D20407 jnc inWait1
|
698 |
|
|
691: 3418+10 070D DB13 in COND+2 ;a=character read
|
699 |
|
|
692:
|
700 |
|
|
693: ; process new character in a. Echo to console if c is non-zero
|
701 |
|
|
694:
|
702 |
|
|
695: 3428+5 070F 47 haveChr mov b,a ;save character in b
|
703 |
|
|
696: 3433+5 0710 79 mov a,c ;echo flag (c) set?
|
704 |
|
|
697: 3438+4 0711 B7 ora a
|
705 |
|
|
698: 3442+10 0712 CA1A07 jz noEcho ;no echo
|
706 |
|
|
699:
|
707 |
|
|
700: 3452+5 0715 78 mov a,b ;a=character to send
|
708 |
|
|
701: 3457+10 0716 C1 pop b ;restore b,c
|
709 |
|
|
702: 3467+10 0717 C34807 jmp ptcn ;display character and exit
|
710 |
|
|
703:
|
711 |
|
|
704: 3477+5 071A 78 noEcho mov a,b ;a=byte read
|
712 |
|
|
705: 3482+10 071B C1 pop b ;restore b,c
|
713 |
|
|
706: 3492+10 071C C9 ret
|
714 |
|
|
707:
|
715 |
|
|
708: ;********************************************************************
|
716 |
|
|
709: ;
|
717 |
|
|
710: ; Type conversion, input, output subroutines
|
718 |
|
|
711: ;
|
719 |
|
|
712: ;********************************************************************
|
720 |
|
|
713:
|
721 |
|
|
714: ;------------------------------------------------------------
|
722 |
|
|
715: ; tahex - read two 16 bit addresses. 1st returned in HL, 2nd in DE
|
723 |
|
|
716: ;------------------------------------------------------------
|
724 |
|
|
717: 3502+17 071D CD2007 tahex call ahex ;get first address param
|
725 |
|
|
718: ;fall into ahex to get 2nd param
|
726 |
|
|
719:
|
727 |
|
|
720: ;------------------------------------------------------------
|
728 |
|
|
721: ; ahex - read up to 4 hex digits to binary, return in de
|
729 |
|
|
722: ;------------------------------------------------------------
|
730 |
|
|
723: 3519+7 0720 0E04 ahex mvi c,4 ;count of 4 digits
|
731 |
|
|
724: 3526+10 0722 210000 ahe0 lxi h,0 ;16 bit zero
|
732 |
|
|
725: 3536+17 0725 CDB307 ahe1 call rdcn ;read a byte
|
733 |
|
|
726: 3553+7 0728 FE30 ahexNr cpi '0'
|
734 |
|
|
727: 3560+10 072A DA1F04 jc start ;below '0', abort
|
735 |
|
|
728: 3570+7 072D FE3A cpi ':'
|
736 |
|
|
729: 3577+11+6 072F D45607 cnc alph
|
737 |
|
|
730: 3588+10 0732 29 dad h
|
738 |
|
|
731: 3598+10 0733 29 dad h
|
739 |
|
|
732: 3608+10 0734 29 dad h
|
740 |
|
|
733: 3618+10 0735 29 dad h
|
741 |
|
|
734: 3628+7 0736 D630 sui '0' ;ascii bias
|
742 |
|
|
735: 3635+7 0738 FE0A cpi 10 ;digit 0-10
|
743 |
|
|
736: 3642+10 073A DA3F07 jc alf
|
744 |
|
|
737: 3652+7 073D D607 sui 7 ;alpha bias
|
745 |
|
|
738: 3659+4 073F 85 alf add l
|
746 |
|
|
739: 3663+5 0740 6F mov l,a
|
747 |
|
|
740: 3668+5 0741 0D dcr c
|
748 |
|
|
741: 3673+10 0742 C22507 jnz ahe1 ;keep reading
|
749 |
|
|
742: 3683+5 0745 EB xchg ;result in de
|
750 |
|
|
743: ;fall through to print a space
|
751 |
|
|
744: ;------------------------------------------------------------
|
752 |
|
|
745: ; spce - print a space
|
753 |
|
|
746: ; ptcn - print character passed in a
|
754 |
|
|
747: ;------------------------------------------------------------
|
755 |
|
|
748: 3688+7 0746 3E20 spce mvi a,' ' ;print space
|
756 |
|
|
749: 3695+11 0748 F5 ptcn push psw
|
757 |
|
|
750:
|
758 |
|
|
751: 3706+10 0749 DB10 ptlop in CONS ;wait for OK to transmit
|
759 |
|
|
752: 3716+7 074B E602 ani TBE
|
760 |
|
|
753: 3723+10 074D CA4907 jz ptlop
|
761 |
|
|
754:
|
762 |
|
|
755: 3733+10 0750 F1 pop psw ;recover a
|
763 |
|
|
756: 3743+7 0751 E67F ani 07fh ;get rid of msbit
|
764 |
|
|
757: 3750+10 0753 D311 out COND ;and print it
|
765 |
|
|
758: 3760+10 0755 C9 ret ;return from ptcn
|
766 |
|
|
759:
|
767 |
|
|
760: ;------------------------------------------------------------
|
768 |
|
|
761: ; alph - verify valid hex digit, abort to command loop if not
|
769 |
|
|
762: ;------------------------------------------------------------
|
770 |
|
|
763: 3770+7 0756 FE41 alph cpi 'A'
|
771 |
|
|
764: 3777+10 0758 DA1F04 jc start
|
772 |
|
|
765: 3787+7 075B E65F ani 05fh
|
773 |
|
|
766: 3794+7 075D FE47 cpi 'G'
|
774 |
|
|
767: 3801+10 075F D21F04 jnc start
|
775 |
|
|
768: 3811+10 0762 C9 ret
|
776 |
|
|
769:
|
777 |
|
|
770: ;------------------------------------------------------------
|
778 |
|
|
771: ; crlf - print CR/LF
|
779 |
|
|
772: ;------------------------------------------------------------
|
780 |
|
|
773: 3821+7 0763 3E0D crlf mvi a,CR
|
781 |
|
|
774: 3828+17 0765 CD4807 call ptcn
|
782 |
|
|
775: 3845+7 0768 3E0A mvi a,LF
|
783 |
|
|
776: 3852+10 076A C34807 jmp ptcn
|
784 |
|
|
777:
|
785 |
|
|
778: ;------------------------------------------------------------
|
786 |
|
|
779: ; err - display the address in hl followed by the value
|
787 |
|
|
780: ; in b, then the value in a.
|
788 |
|
|
781: ;------------------------------------------------------------
|
789 |
|
|
782: 3862+11 076D F5 err push psw ;save A
|
790 |
|
|
783: 3873+17 076E CD8107 call ptad ;print address
|
791 |
|
|
784: 3890+5 0771 78 mov a,b ;print B
|
792 |
|
|
785: 3895+17 0772 CD7907 call pt2
|
793 |
|
|
786: 3912+17 0775 CD4607 call spce
|
794 |
|
|
787: 3929+10 0778 F1 pop psw ;print A
|
795 |
|
|
788: 3939+11 0779 F5 pt2 push psw
|
796 |
|
|
789: 3950+17 077A CD9307 call binh
|
797 |
|
|
790: 3967+10 077D F1 pop psw
|
798 |
|
|
791: 3977+10 077E C39707 jmp binl
|
799 |
|
|
792:
|
800 |
|
|
793: ;------------------------------------------------------------
|
801 |
|
|
794: ; ptad - display the address in h
|
802 |
|
|
795: ;------------------------------------------------------------
|
803 |
|
|
796: 3987+17 0781 CD6307 ptad call crlf ;print cr,lf
|
804 |
|
|
797: 4004+17 0784 CDC707 call pause
|
805 |
|
|
798: 4021+5 0787 7C mov a,h ;print
|
806 |
|
|
799: 4026+17 0788 CD7907 call pt2 ;ascii
|
807 |
|
|
800: 4043+5 078B 7D mov a,l ;codes
|
808 |
|
|
801: 4048+17 078C CD7907 call pt2 ;for
|
809 |
|
|
802: 4065+17 078F CD4607 call spce ;address
|
810 |
|
|
803: 4082+10 0792 C9 ret
|
811 |
|
|
804:
|
812 |
|
|
805: ;------------------------------------------------------------
|
813 |
|
|
806: ; binh - print MSN of byte passed in A
|
814 |
|
|
807: ; binl - print LSN of byte passed in A
|
815 |
|
|
808: ;------------------------------------------------------------
|
816 |
|
|
809: 4092+4 0793 1F binh rar
|
817 |
|
|
810: 4096+4 0794 1F rar
|
818 |
|
|
811: 4100+4 0795 1F rar
|
819 |
|
|
812: 4104+4 0796 1F rar
|
820 |
|
|
813: 4108+7 0797 E60F binl ani 0fh ;low 4 bits
|
821 |
|
|
814: 4115+7 0799 C630 adi '0' ;ascii bias
|
822 |
|
|
815: 4122+7 079B FE3A cpi 03ah ;digit 0-9
|
823 |
|
|
816: 4129+10 079D DA4807 jc ptcn
|
824 |
|
|
817: 4139+7 07A0 C607 adi 7 ;digit A-F
|
825 |
|
|
818: 4146+10 07A2 C34807 jmp ptcn
|
826 |
|
|
819:
|
827 |
|
|
820: ;------------------------------------------------------------
|
828 |
|
|
821: ; dspMsg - display in-line message. String terminated by byte
|
829 |
|
|
822: ; with msbit set.
|
830 |
|
|
823: ;------------------------------------------------------------
|
831 |
|
|
824: 4156+10 07A5 E1 dspMsg pop h ;hl->string to display
|
832 |
|
|
825:
|
833 |
|
|
826: 4166+7 07A6 7E dspLoop mov a,m ;a=next character to display
|
834 |
|
|
827: 4173+17 07A7 CD4807 call ptcn ;display character
|
835 |
|
|
828: 4190+7 07AA B6 ora m ;MSB set? (last byte)
|
836 |
|
|
829: 4197+5 07AB 23 inx h ;point to next character
|
837 |
|
|
830: 4202+10 07AC F2A607 jp dspLoop ;no, keep looping
|
838 |
|
|
831:
|
839 |
|
|
832: 4212+17 07AF CD4607 call spce ;display a trailing space
|
840 |
|
|
833: 4229+5 07B2 E9 pchl ;return past the string
|
841 |
|
|
834:
|
842 |
|
|
835: ;------------------------------------------------------------
|
843 |
|
|
836: ; rdcn - read from console to A with echo to screen
|
844 |
|
|
837: ; getCon - read from console to A without echo
|
845 |
|
|
838: ;------------------------------------------------------------
|
846 |
|
|
839: 4234+17 07B3 CDBC07 rdcn call getCon ;get character from console
|
847 |
|
|
840: 4251+7 07B6 FE1B cpi ESC ;ESC confuses smart terminals
|
848 |
|
|
841: 4258+5+6 07B8 C8 rz ; so don't echo escape
|
849 |
|
|
842: 4263+10 07B9 C34807 jmp ptcn ;echo onto printer
|
850 |
|
|
843:
|
851 |
|
|
844: 4273+10 07BC DB10 getCon in CONS ;read keyboard status
|
852 |
|
|
845: 4283+4 07BE 0F rrc ;data available flag in carry
|
853 |
|
|
846: 4287+10 07BF D2BC07 jnc getCon
|
854 |
|
|
847:
|
855 |
|
|
848: 4297+10 07C2 DB11 in COND ;read from keyboard
|
856 |
|
|
849: 4307+7 07C4 E67F ani 07fh ;strip off msb
|
857 |
|
|
850: 4314+10 07C6 C9 ret
|
858 |
|
|
851:
|
859 |
|
|
852: ;------------------------------------------------------------
|
860 |
|
|
853: ; pause - pause/resume with spacebar. Also look for a ctrl-c
|
861 |
|
|
854: ; or ESC to abort.
|
862 |
|
|
855: ;------------------------------------------------------------
|
863 |
|
|
856: 4324+17 07C7 CDD607 pause call cntlc ;look for abort or other character
|
864 |
|
|
857: 4341+7 07CA FE20 cpi ' '
|
865 |
|
|
858: 4348+5+6 07CC C0 rnz ;return if not space or abort
|
866 |
|
|
859:
|
867 |
|
|
860: 4353+17 07CD CDD607 ploop call cntlc ;loop here until space or abort pressed
|
868 |
|
|
861: 4370+7 07D0 FE20 cpi ' '
|
869 |
|
|
862: 4377+10 07D2 C2CD07 jnz ploop
|
870 |
|
|
863: 4387+10 07D5 C9 ret
|
871 |
|
|
864:
|
872 |
|
|
865: ;------------------------------------------------------------
|
873 |
|
|
866: ; cntlc - see if a character has been typed. If not, return
|
874 |
|
|
867: ; zero true. If ctrl-c or ESC typed, abort and return to
|
875 |
|
|
868: ; the command loop. Otherwise, return the character typed.
|
876 |
|
|
869: ;------------------------------------------------------------
|
877 |
|
|
870: 4397+10 07D6 DB10 cntlc in CONS ;anything typed?
|
878 |
|
|
871: 4407+7 07D8 E601 ani RDA
|
879 |
|
|
872: 4414+5+6 07DA C8 rz ;no, exit with zero true
|
880 |
|
|
873:
|
881 |
|
|
874: 4419+10 07DB DB11 in COND ;get the typed character
|
882 |
|
|
875: 4429+7 07DD E67F ani 07fh
|
883 |
|
|
876: 4436+7 07DF FE03 cpi CTRLC ;abort with ctrl-c (2.0 style)
|
884 |
|
|
877: 4443+10 07E1 CA1F04 jz start
|
885 |
|
|
878: 4453+7 07E4 FE1B cpi ESC ;or ESC (4.x style)
|
886 |
|
|
879: 4460+10 07E6 CA1F04 jz start
|
887 |
|
|
880: 4470+10 07E9 C9 ret
|
888 |
|
|
881:
|
889 |
|
|
882: ;------------------------------------------------------------
|
890 |
|
|
883: ; bmp - compare address and increment h. Return zero true
|
891 |
|
|
884: ; if hl=de. Once hl=de, then de is incremented each time
|
892 |
|
|
885: ; so the comparison remains true for subsequent calls.
|
893 |
|
|
886: ;------------------------------------------------------------
|
894 |
|
|
887: 4480+5 07EA 7B bmp mov a,e ;compare lsb's of hl,de
|
895 |
|
|
888: 4485+4 07EB 95 sub l
|
896 |
|
|
889: 4489+10 07EC C2F107 jnz goon ;not equal
|
897 |
|
|
890:
|
898 |
|
|
891: 4499+5 07EF 7A mov a,d ;compare msb's of hl,de
|
899 |
|
|
892: 4504+4 07F0 9C sbb h ;gives zero true if equal
|
900 |
|
|
893:
|
901 |
|
|
894: 4508+5 07F1 23 goon inx h ;increment hl
|
902 |
|
|
895: 4513+5+6 07F2 C0 rnz ;exit if hl <> de yet
|
903 |
|
|
896:
|
904 |
|
|
897: 4518+5 07F3 13 inx d ;increase de as well so it will
|
905 |
|
|
898: 4523+10 07F4 C9 ret ; still be equal next time
|
906 |
|
|
899:
|
907 |
|
|
900: - 07F5 end
|
908 |
|
|
|
909 |
|
|
|
910 |
|
|
|
911 |
|
|
Statistics:
|
912 |
|
|
|
913 |
|
|
4 passes
|
914 |
|
|
|
915 |
|
|
94 symbols
|
916 |
|
|
1013 bytes
|
917 |
|
|
|
918 |
|
|
|
919 |
|
|
|
920 |
|
|
Symbol Table:
|
921 |
|
|
|
922 |
|
|
ahe0 722
|
923 |
|
|
ahe1 725
|
924 |
|
|
ahex 720
|
925 |
|
|
ahexnr 728
|
926 |
|
|
alf 73f
|
927 |
|
|
alph 756
|
928 |
|
|
asc2bin 6eb
|
929 |
|
|
binh 793
|
930 |
|
|
binl 797
|
931 |
|
|
bmp 7ea
|
932 |
|
|
boot =ff00
|
933 |
|
|
chksum 480
|
934 |
|
|
cmdtbl 444
|
935 |
|
|
cntlc 7d6
|
936 |
|
|
compr 5cf
|
937 |
|
|
con1 55b
|
938 |
|
|
con2 565
|
939 |
|
|
cond = 11
|
940 |
|
|
cons = 10
|
941 |
|
|
cont 61f
|
942 |
|
|
cr = d
|
943 |
|
|
crig 548
|
944 |
|
|
crlf 763
|
945 |
|
|
csloop 48c
|
946 |
|
|
ctrlc = 3
|
947 |
|
|
cycl 4a6
|
948 |
|
|
data 6ad
|
949 |
|
|
disp 4f1
|
950 |
|
|
dmpasc 513
|
951 |
|
|
dmphex 501
|
952 |
|
|
dmpline 4fb
|
953 |
|
|
doboot 476
|
954 |
|
|
domove 596
|
955 |
|
|
dosrch 603
|
956 |
|
|
dspasc 520
|
957 |
|
|
dspdot 51e
|
958 |
|
|
dsploop 7a6
|
959 |
|
|
dspmsg 7a5
|
960 |
|
|
err 76d
|
961 |
|
|
esc = 1b
|
962 |
|
|
exchg 58f
|
963 |
|
|
exec 46a
|
964 |
|
|
fill 569
|
965 |
|
|
flshlp 6c8
|
966 |
|
|
flush 6c3
|
967 |
|
|
getchar 6f3
|
968 |
|
|
getcon 7bc
|
969 |
|
|
goon 7f1
|
970 |
|
|
havechr 70f
|
971 |
|
|
hexload 676
|
972 |
|
|
ibyte 6d5
|
973 |
|
|
inwait0 6fb
|
974 |
|
|
inwait1 704
|
975 |
|
|
lf = a
|
976 |
|
|
mloop 5a0
|
977 |
|
|
monit 400
|
978 |
|
|
moveb 584
|
979 |
|
|
ndlop 5c2
|
980 |
|
|
ndmt 5b6
|
981 |
|
|
nexch 5ab
|
982 |
|
|
noecho 71a
|
983 |
|
|
obcp 631
|
984 |
|
|
pause 7c7
|
985 |
|
|
peve 4ea
|
986 |
|
|
pglp 53f
|
987 |
|
|
pgm 532
|
988 |
|
|
pinpt 65c
|
989 |
|
|
ploop 7cd
|
990 |
|
|
poutp 63f
|
991 |
|
|
pt2 779
|
992 |
|
|
ptad 781
|
993 |
|
|
ptcn 748
|
994 |
|
|
ptlop 749
|
995 |
|
|
rcvline 689
|
996 |
|
|
rda = 1
|
997 |
|
|
rdcn 7b3
|
998 |
|
|
rlop 4c6
|
999 |
|
|
rndm 4e2
|
1000 |
|
|
sioport =ffdf
|
1001 |
|
|
skiprd 4d4
|
1002 |
|
|
skipwr 4bb
|
1003 |
|
|
skp 637
|
1004 |
|
|
spce 746
|
1005 |
|
|
sptr =ffff
|
1006 |
|
|
srch1 5ef
|
1007 |
|
|
srch2 5fb
|
1008 |
|
|
start 41f
|
1009 |
|
|
tahex 71d
|
1010 |
|
|
tbe = 2
|
1011 |
|
|
tlop 4b1
|
1012 |
|
|
tmem 499
|
1013 |
|
|
vmlop 5de
|
1014 |
|
|
wtmark 68e
|
1015 |
|
|
zloop 57c
|
1016 |
|
|
|