]>
Commit | Line | Data |
---|---|---|
e58a7a25 L |
1 | IF NOT lasm\r |
2 | .printx * CPXCIF.ASM *\r | |
3 | ENDIF ;NOT lasm\r | |
4 | ; KERMIT - (Celtic for "FREE")\r | |
5 | ;\r | |
6 | ; This is the CP/M-80 implementation of the Columbia University\r | |
7 | ; KERMIT file transfer protocol.\r | |
8 | ;\r | |
9 | ; Version 4.0\r | |
10 | ;\r | |
11 | ; Copyright June 1981,1982,1983,1984,1985\r | |
12 | ; Columbia University\r | |
13 | ;\r | |
14 | ; Originally written by Bill Catchings of the Columbia University Center for\r | |
15 | ; Computing Activities, 612 W. 115th St., New York, NY 10025.\r | |
16 | ;\r | |
17 | ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,\r | |
18 | ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many\r | |
19 | ; others.\r | |
20 | ;\r | |
21 | ; This file contains the system dependent part for Cifer systems, and\r | |
22 | ; is based on code contributed by John Shearwood of Birmingham\r | |
23 | ; University. This file was originally CPXTOR.ASM but now an \r | |
24 | ; FAMILY file on its own.\r | |
25 | ;\r | |
26 | ; This file has code that supports Cifer 1886/2886 systems, running \r | |
27 | ; either CP/M Version 2.2 or 3.0, and driving the VL or AUX port.\r | |
28 | ; xxx is a three letter abbrev. for the system you are adding.\r | |
29 | ;\r | |
30 | ; revision history:\r | |
31 | ;\r | |
32 | ; edit 2, 21 July, 1987 by OBSchou to bring it into line for use with \r | |
33 | ; CPXCOM.ASM.\r | |
34 | ;\r | |
35 | ; edit 1, 14 July by OBSchou for John Shearwood of Birmingham University, UK.\r | |
36 | ; His edits ar based on the former CPXTOR.ASM family file.\r | |
37 | ;\r | |
38 | ; edit 4, Apr 7 1987, JA Shearwood. Add support for Cifer Aux port.\r | |
39 | ; edit 2, Mar 17 1987, JA Shearwood Add support for Cifer CP/M Plus\r | |
40 | ;\r | |
41 | ; Keep module name, edit number, and last revision date in memory.\r | |
42 | family: db 'CPXCIF.ASM (2) 14-Jul-87 $'\r | |
43 | ;\f\r | |
44 | ; Assembly time message to let me know I'm building the right version.\r | |
45 | ; LASM generates an 'S' error along with the message, which is messy, but\r | |
46 | ; better than trying to put everything inside a IF m80 OR mac80 conditional,\r | |
47 | ; because LASM doesn't like nested IF's, either.\r | |
48 | \r | |
49 | IF cifer\r | |
50 | .printx * Assembling Kermit-80 for Cifer 1886 *\r | |
51 | ENDIF\r | |
52 | \r | |
53 | IF cifer3\r | |
54 | .printx * with CP/M Plus\r | |
55 | ENDIF\r | |
56 | \r | |
57 | IF cifaux\r | |
58 | .printx * with AUX port\r | |
59 | ENDIF\r | |
60 | \r | |
61 | ;\f\r | |
62 | ;=========================================================================\r | |
63 | ; I/O Byte assignments (2-bit fields for 4 devices at loc 3)\r | |
64 | ;\r | |
65 | ;bits 6+7 LIST field\r | |
66 | ; 0 LIST is Teletype device (TTY:)\r | |
67 | ; 1 LIST is CRT device (CRT:)\r | |
68 | ; 2 LIST is Lineprinter (LPT:)\r | |
69 | ; 3 LIST is user defined (UL1:)\r | |
70 | ;\r | |
71 | ;bits 4+5 PUNCH field\r | |
72 | ; 0 PUNCH is Teletype device (TTY:)\r | |
73 | ; 1 PUNCH is high speed punch (PUN:)\r | |
74 | ; 2 PUNCH is user defined #1 (UP1:)\r | |
75 | ; 3 PUNCH is user defined #2 (UP2:)\r | |
76 | ;\r | |
77 | ;bits 2+3 READER field\r | |
78 | ; 0 READER is Teletype device (TTY:)\r | |
79 | ; 1 READER is high speed reader (RDR:)\r | |
80 | ; 2 READER is user defined #1 (UR1:)\r | |
81 | ; 3 READER is user defined #2 (UR2:)\r | |
82 | ;\r | |
83 | ;bits 0+1 CONSOLE field\r | |
84 | ; 0 CONSOLE is console printer (TTY:)\r | |
85 | ; 1 CONSOLE is CRT device (CRT:)\r | |
86 | ; 2 CONSOLE is in Batch-mode (BAT:);READER = Input,\r | |
87 | ; LIST = Output\r | |
88 | ; 3 CONSOLE is user defined (UC1:)\r | |
89 | ;\r | |
90 | ;=========================================================================\r | |
91 | \r | |
92 | iobyte EQU 03H ;Location of I/O byte\r | |
93 | \r | |
94 | IF cifer ;[13]\r | |
95 | batio equ 80h ; tty: as console\r | |
96 | defio equ 81h ; crt: as console\r | |
97 | z80 SET TRUE ; although it really is...\r | |
98 | ENDIF;cifer [13]\r | |
99 | \r | |
100 | defesc EQU ']'-100O ;The default escape character.\r | |
101 | \r | |
102 | ; Select initial setting for VT-52 emulation flag.\r | |
103 | vtval EQU 1\r | |
104 | \r | |
105 | IF iobyt ; only CP/M 2.2 and VL port use coniob in CPXCOM\r | |
106 | ; rest use this one\r | |
107 | coniob: db 0 ; default console bit pattern\r | |
108 | ENDIF ;iobyt\r | |
109 | \r | |
110 | \r | |
111 | \r | |
112 | sysxin: ;system initialisation not covered by sysinit\r | |
113 | mvi a,defio\r | |
114 | sta coniob\r | |
115 | \r | |
116 | IF cifer AND NOT cifaux ; [JAS] Not if AUX port\r | |
117 | lxi d,ciferi\r | |
118 | call prtstr\r | |
119 | ENDIF ;cifer AND NOT cifaux\r | |
120 | \r | |
121 | IF cifaux ; [JAS] Only Aux Port\r | |
122 | lhld 00047h ; Get address of CIOPS table\r | |
123 | lxi d,6fh\r | |
124 | dad d ; Calculate address of SETLNSPD\r | |
125 | shld cifiop\r | |
126 | inx h\r | |
127 | inx h\r | |
128 | inx h\r | |
129 | shld ciflod ; Next entry LODEF\r | |
130 | lxi d,81h-72h\r | |
131 | dad d ; Calculate address of LIDEF\r | |
132 | shld ciflid\r | |
133 | lhld 00045h ; Get address of SYSPTRS table\r | |
134 | lxi d,12h ; Offset for LIDEF pointer\r | |
135 | dad d ; Add to table address\r | |
136 | mov e,m ; Get low byte LIDEF pointer\r | |
137 | inx h\r | |
138 | mov d,m ; Get high byte LIDEF pointer\r | |
139 | push d\r | |
140 | inx h ; LIPARM pointer next\r | |
141 | mov a,m ; Get low byte of LIPARM pointer\r | |
142 | sta ciptbl ; Keep\r | |
143 | inx h\r | |
144 | mov a,m ; Get high byte\r | |
145 | sta ciptbl+1 ; Keep\r | |
146 | lxi d,1eh-15h ; Offset to LODEF\r | |
147 | dad d\r | |
148 | mov e,m ; Low byte\r | |
149 | inx h\r | |
150 | mov d,m ; High byte\r | |
151 | inx h ; LOPARM is next entry\r | |
152 | mov a,m\r | |
153 | sta coptbl ; Keep low byte LOPARM\r | |
154 | inx h\r | |
155 | mov a,m\r | |
156 | sta coptbl+1 ; Keep high byte\r | |
157 | ; Now set up port for no parity 8 bits xon/xoff protocol both ways\r | |
158 | xchg ; LODEF into hl register\r | |
159 | push h ; Needed later\r | |
160 | mvi a,0\r | |
161 | mov m,a ; Clear byte 0\r | |
162 | inx h\r | |
163 | mov m,a ; Clear byte 1\r | |
164 | inx h\r | |
165 | mvi a,099h ; XON/XOFF protocol, 8bits, no parity\r | |
166 | mov m,a ; Flag into byte 2\r | |
167 | pop h ; Restore address of LODEF\r | |
168 | ciflod equ $+1\r | |
169 | call $ ; LODEF routine (poked above)\r | |
170 | pop h ; LIDEF (PUSHed from de earlier)\r | |
171 | push h ; Needed later\r | |
172 | mvi a,0\r | |
173 | mov m,a ; Clear byte 0\r | |
174 | inx h\r | |
175 | mov m,a ; Clear byte 1\r | |
176 | inx h\r | |
177 | mvi a,099h ; XON/XOFF protocol, 8bits, no parity\r | |
178 | mov m,a ; Flag into byte 2\r | |
179 | pop h ; Restore address of LIDEF\r | |
180 | ciflid equ $+1\r | |
181 | call $ ; LIDEF routine (poked above)\r | |
182 | lhld ciptbl ; Get current input speed\r | |
183 | mov a,m\r | |
184 | sta speed\r | |
185 | sta speed+1\r | |
186 | mov e,a\r | |
187 | mov d,a\r | |
188 | call sysspd ; Make sure ip and op are the same\r | |
189 | ENDIF; cifer AND cifaux \r | |
190 | \r | |
191 | ret ; return from system-dependent routine\r | |
192 | \r | |
193 | ;\f\r | |
194 | ;\r | |
195 | ; system-dependent termination processing\r | |
196 | ; If we've changed anything, this is our last chance to put it back.\r | |
197 | sysexit:\r | |
198 | \r | |
199 | IF cifer AND NOT cifaux\r | |
200 | lxi d,cifero\r | |
201 | call prtstr\r | |
202 | ENDIF;cifer AND NOT cifaux\r | |
203 | \r | |
204 | ret\r | |
205 | \r | |
206 | ;\r | |
207 | ; system-dependent processing for start of CONNECT command\r | |
208 | ;\r | |
209 | syscon:\r | |
210 | ret\r | |
211 | \r | |
212 | conmsg: ; Messages printed when entering transparent (CONNECT) mode:\r | |
213 | ;\f\r | |
214 | ;\r | |
215 | ; syscls - system-dependent close routine\r | |
216 | ; called when exiting transparent session.\r | |
217 | ;\r | |
218 | syscls:\r | |
219 | ret\r | |
220 | ;\f\r | |
221 | ;\r | |
222 | ; sysinh - help for system-dependent special functions.\r | |
223 | ; called in response to <escape>?, after listing all the\r | |
224 | ; system-independent escape sequences.\r | |
225 | ;\r | |
226 | sysinh: lxi d,inhlps ; we got options...\r | |
227 | call prtstr ; print them.\r | |
228 | \r | |
229 | ret\r | |
230 | \r | |
231 | \r | |
232 | ;additional, system-dependent help for transparent mode\r | |
233 | ; (two-character escape sequences)\r | |
234 | inhlps:\r | |
235 | \r | |
236 | ; [16] [18] have added super brain and Torch to the list of Breaking machines.\r | |
237 | \r | |
238 | IF (cifer AND NOT cifaux)\r | |
239 | db cr,lf,'B Transmit a BREAK'\r | |
240 | ENDIF ;(cifer AND NOT cifaux)\r | |
241 | db '$' ;[hh] table terminator\r | |
242 | \r | |
243 | ;\r | |
244 | ; sysint - system dependent special functions\r | |
245 | ; called when transparent escape character has been typed;\r | |
246 | ; the second character of the sequence is in A (and in B).\r | |
247 | ; returns:\r | |
248 | ; non-skip: sequence has been processed\r | |
249 | ; skip: sequence was not recognized\r | |
250 | sysint: ani 137O ; convert lower case to upper, for testing...\r | |
251 | \r | |
252 | ; [19] have added superbrain and torch to the list\r | |
253 | \r | |
254 | IF (cifer AND NOT cifaux)\r | |
255 | cpi 'B' ; send break?\r | |
256 | jz sendbr ; yes, go do it. return nonskip when through.\r | |
257 | ENDIF ;(cifer AND NOT cifaux)\r | |
258 | \r | |
259 | jmp rskp ; take skip return - command not recognized.\r | |
260 | \r | |
261 | ;\f\r | |
262 | \r | |
263 | IF (cifer AND NOT cifaux)\r | |
264 | sendbr: lxi d,brkmes ; send a break by sending esc * "\r | |
265 | call prtstr ; send to screen => breaks to port\r | |
266 | ret\r | |
267 | ENDIF;cifer\r | |
268 | \r | |
269 | ; sysflt - system-dependent filter.\r | |
270 | ; called with the character in E.\r | |
271 | ; preserves bc, de, hl.\r | |
272 | ; note: <xon>,<xoff>,<del>, and <nul> are always discarded.\r | |
273 | sysflt:\r | |
274 | mov a,e ; get character for testing\r | |
275 | ret\r | |
276 | \r | |
277 | ; mdmflt - modem filter [30]\r | |
278 | ; called with character to be sent to printer in E\r | |
279 | ; with parity set as appropriate.\r | |
280 | ; return with accumulator = 0 do do nothing,\r | |
281 | ; <> 0 to send char in E.\r | |
282 | mdmflt:\r | |
283 | mov a,e ;[30] get character to test\r | |
284 | ret\r | |
285 | \r | |
286 | \r | |
287 | \r | |
288 | ; prtflt - printer filter [30]\r | |
289 | ; called with character to be sent to printer in E\r | |
290 | ; returns with a = 0 to do nothing\r | |
291 | ; a <> 0 to print it.\r | |
292 | ;\r | |
293 | ; this routine for those printer that automatically insert\r | |
294 | ; a lf on cr, or cr for lf. Should this be shifted to \r | |
295 | ; the system indep. stuff, in say 4.06?\r | |
296 | prtflt:\r | |
297 | mov a,e ; [30] get character to test\r | |
298 | ret\r | |
299 | \r | |
300 | \r | |
301 | ;\f\r | |
302 | ;\r | |
303 | ; system-dependent processing for BYE command.\r | |
304 | ; for apmmdm, heath, and lobo, hang up the phone.\r | |
305 | sysbye:\r | |
306 | ret\r | |
307 | ;\f\r | |
308 | ; This is the system-dependent command to change the baud rate.\r | |
309 | ; DE contains the two-byte value from the baud rate table; this\r | |
310 | ; value is also stored in 'speed'.\r | |
311 | sysspd:\r | |
312 | \r | |
313 | IF (cifer AND NOT cifaux); This one is wierd.. \r | |
314 | ; send an escape string to the screen to set rate.\r | |
315 | push d ; Save the data returned\r | |
316 | lxi d,cifbrt ; send the start of the escape string (esc ?)\r | |
317 | call prtstr ;\r | |
318 | pop psw ; get data into a (and flags>..)\r | |
319 | inr a ; need to send (a+1-1) 'N' to screen\r | |
320 | push psw ; we will need the data again\r | |
321 | call cifnos ; send a set of Ns to the screen\r | |
322 | pop psw ; (which then sets the VL line on the screen \r | |
323 | call cifnos ; processor card)\r | |
324 | call prcrlf ; cr will terminate.. a crlf is handy\r | |
325 | ret\r | |
326 | \r | |
327 | cifnos: dcr a ; if result = 0 then done\r | |
328 | jz cifno1 ; if done then say 'Y' for yes.\r | |
329 | push psw\r | |
330 | mvi e,'N' ; else send a string of Ns to screen processor\r | |
331 | mvi c,dconio\r | |
332 | call bdos\r | |
333 | pop psw\r | |
334 | jmp cifnos\r | |
335 | cifno1: mvi e,'Y'\r | |
336 | mvi c,dconio\r | |
337 | call bdos\r | |
338 | ret ; sent a sring of 0 or more N then a Y\r | |
339 | \r | |
340 | cifbrt: db esc,'?$' ; start setting baud rate string\r | |
341 | ENDIF ;cifer AND NOT cifaux\r | |
342 | \r | |
343 | IF cifaux; [JAS] Set baud rate by massaging LIPARM/LOPARM and calling\r | |
344 | ;CIOPS routine\r | |
345 | ; Set up speed byte in first location of tables\r | |
346 | lhld coptbl ; Now sort out baud rate\r | |
347 | mov a,e ; That's output speed\r | |
348 | mov m,a\r | |
349 | xchg\r | |
350 | lhld ciptbl\r | |
351 | mov m,a ; Input speed\r | |
352 | ; Call CIOPS routine SETLNSPD with tables in appropriate rp's\r | |
353 | cifiop equ $+1\r | |
354 | call $ ; Poked by sysinit\r | |
355 | ret\r | |
356 | \r | |
357 | coptbl: dw 0\r | |
358 | ciptbl: dw 0\r | |
359 | ENDIF; cifaux\r | |
360 | \r | |
361 | ;\f\r | |
362 | ; Speed tables\r | |
363 | ; (Note that speed tables MUST be in alphabetical order for later\r | |
364 | ; lookup procedures, and must begin with a value showing the total\r | |
365 | ; number of entries. The speed help tables are just for us poor\r | |
366 | ; humans.\r | |
367 | \r | |
368 | ; db string length,string,divisor (2 identical bytes or 1 word)\r | |
369 | ; [Toad Hall]\r | |
370 | \r | |
371 | IF cifer \r | |
372 | spdtbl: db 10h ;16 entries\r | |
373 | db 03h,'110$', 02h,02h\r | |
374 | db 04h,'1200$', 07h,07h\r | |
375 | db 05h,'134.5$', 03h,03h\r | |
376 | db 03h,'150$', 04h,04h\r | |
377 | db 04h,'1800$', 08h,08h\r | |
378 | db 05h,'19200$', 0fh,0fh\r | |
379 | db 04h,'2000$', 09h,09h\r | |
380 | db 04h,'2400$', 0ah,0ah\r | |
381 | db 03h,'300$', 05h,05h\r | |
382 | db 04h,'3600$', 0bh,0bh\r | |
383 | db 04h,'4800$', 0ch,0ch\r | |
384 | db 02h,'50$', 00h,00h\r | |
385 | db 03h,'600$', 06h,06h\r | |
386 | db 04h,'7200$', 0dh,0dh\r | |
387 | db 02h,'75$', 01h,01h\r | |
388 | db 04h,'9600$', 0eh,0eh\r | |
389 | \r | |
390 | sphtbl: db cr,lf,' 50 75 110 134.5 150 300 600 1200'\r | |
391 | db cr,lf,' 1800 2000 2400 3600 4800 7200 9600 19200$'\r | |
392 | ENDIF;cifer \r | |
393 | \r | |
394 | ; The following conditionals were once a huge if not statement. There\r | |
395 | ; wasn't enough room to add the lobo to the list, so it had to be broken\r | |
396 | ; into 2, which you can't do with an if not. I redid it as two ifs and\r | |
397 | ; applied them to those that wouldn't set baud. [Hal Hostetler]\r | |
398 | ;\f\r | |
399 | ; This is the system-dependent SET PORT command.\r | |
400 | ; HL contains the argument from the command table.\r | |
401 | sysprt:\r | |
402 | IF iobyt\r | |
403 | mov a,m ;Get the I/O byte\r | |
404 | sta prtiob ;Save the desired IO byte for this port\r | |
405 | inx h ;Point at next entry\r | |
406 | mov a,m ;Get the output function\r | |
407 | sta prtfun ;Save it\r | |
408 | ENDIF;iobyt\r | |
409 | \r | |
410 | ret\r | |
411 | ;\f\r | |
412 | ;\r | |
413 | ;\r | |
414 | ; Port tables for GENERIC CPM 2.2\r | |
415 | IF gener\r | |
416 | ; help text\r | |
417 | prhtbl: db cr,lf,'CRT device'\r | |
418 | db cr,lf,'PTR device'\r | |
419 | db cr,lf,'TTY device'\r | |
420 | db cr,lf,'UC1 device'\r | |
421 | db cr,lf,'UR1 device'\r | |
422 | db cr,lf,'UR2 device$'\r | |
423 | \r | |
424 | ; command table\r | |
425 | prttbl: db 06H ;Six devices to choose from\r | |
426 | db 03H,'CRT$'\r | |
427 | dw crtptb\r | |
428 | db 03H,'PTR$'\r | |
429 | dw ptrptb\r | |
430 | db 03H,'TTY$'\r | |
431 | dw ttyptb\r | |
432 | db 03H,'UC1$'\r | |
433 | dw uc1ptb\r | |
434 | db 03H,'UR1$'\r | |
435 | dw ur1ptb\r | |
436 | db 03H,'UR2$'\r | |
437 | dw ur2ptb\r | |
438 | \r | |
439 | ; port entry table\r | |
440 | ; table entries are:\r | |
441 | ; db iobyte-value, BDOS output function, reserved\r | |
442 | crtptb: db crtio,conout,0\r | |
443 | ptrptb: db ptrio,punout,0\r | |
444 | ttyptb: db ttyio,conout,0\r | |
445 | uc1ptb: db uc1io,conout,0\r | |
446 | ur1ptb: db ur1io,punout,0\r | |
447 | ur2ptb: db ur2io,punout,0\r | |
448 | ENDIF;gener\r | |
449 | \r | |
450 | ;\f\r | |
451 | ;\r | |
452 | IF cifer ; no ports yet...\r | |
453 | prttbl EQU 0\r | |
454 | prhtbl EQU 0 ;\r | |
455 | ENDIF; cifer\r | |
456 | \r | |
457 | IF iobyt\r | |
458 | prtfun: db punout ;Function to use for output to comm port\r | |
459 | prtiob: db batio ;I/O byte to use for communicating\r | |
460 | ENDIF;iobyt\r | |
461 | \r | |
462 | IF NOT (iobyt OR lobo OR cifer) ;[hh]\r | |
463 | prttbl equ 0 ; SET PORT is not supported\r | |
464 | prhtbl equ 0\r | |
465 | ENDIF;NOT (iobyt OR lobo OR cifer)\r | |
466 | \r | |
467 | ;\f\r | |
468 | ;\r | |
469 | ; selmdm - select modem port\r | |
470 | ; selcon - select console port\r | |
471 | ; selmdm is called before using inpmdm or outmdm;\r | |
472 | ; selcon is called before using inpcon or outcon.\r | |
473 | ; For iobyt systems, diddle the I/O byte to select console or comm port;\r | |
474 | ; For Decision I, switches Multi I/O board to console or modem serial\r | |
475 | ; port. [Toad Hall]\r | |
476 | ; For the rest, does nothing.\r | |
477 | ; preserves bc, de, hl.\r | |
478 | selmdm:\r | |
479 | IF iobyt\r | |
480 | lda prtiob ;Set up for output to go to the comm port\r | |
481 | sta iobyte ;Switch byte directly\r | |
482 | ENDIF;iobyt\r | |
483 | \r | |
484 | ret\r | |
485 | \r | |
486 | selcon:\r | |
487 | IF iobyt\r | |
488 | lda coniob ;Set up for output to go to the console port\r | |
489 | sta iobyte ;Switch directly\r | |
490 | ENDIF;iobyt\r | |
491 | \r | |
492 | ret\r | |
493 | ;\f\r | |
494 | ; Get character from console, or return zero.\r | |
495 | ; result is returned in A. destroys bc, de, hl.\r | |
496 | ;\r | |
497 | inpcon:\r | |
498 | IF NOT iobyt\r | |
499 | mvi c,dconio ;Direct console I/O BDOS call.\r | |
500 | mvi e,0FFH ;Input.\r | |
501 | call BDOS\r | |
502 | ENDIF;NOT iobyt\r | |
503 | \r | |
504 | IF iobyt\r | |
505 | call bconst ;Get the status\r | |
506 | ora a ;Anything there?\r | |
507 | rz ;No, forget it\r | |
508 | call bconin ;Yes, get the character\r | |
509 | ENDIF;iobyt\r | |
510 | ret\r | |
511 | ;\f\r | |
512 | ;\r | |
513 | ; Output character in E to the console.\r | |
514 | ; destroys bc, de, hl\r | |
515 | ;\r | |
516 | outcon:\r | |
517 | \r | |
518 | IF NOT iobyt\r | |
519 | mvi c,dconio ;Console output bdos call.\r | |
520 | call bdos ;Output the char to the console.\r | |
521 | ENDIF;NOT iobyt\r | |
522 | \r | |
523 | IF iobyt\r | |
524 | mov c,e ;Character\r | |
525 | call bcnout ;to Console\r | |
526 | ENDIF;iobyt\r | |
527 | ret\r | |
528 | ;\f\r | |
529 | ;\r | |
530 | ; outmdm - output a char from E to the modem.\r | |
531 | ; the parity bit has been set as necessary.\r | |
532 | ; returns nonskip; bc, de, hl preserved.\r | |
533 | outmdm:\r | |
534 | IF inout\r | |
535 | in mnprts ;Get the output done flag.\r | |
536 | ani output ;Is it set?\r | |
537 | jz outmdm ;If not, loop until it is.\r | |
538 | mov a,e\r | |
539 | out mnport ;Output it.\r | |
540 | ret\r | |
541 | ENDIF;inout\r | |
542 | \r | |
543 | IF iobyt\r | |
544 | ;**** Note that we enter from outpkt with the I/O byte already set up for\r | |
545 | ; output to go to the comm port\r | |
546 | push h\r | |
547 | push b\r | |
548 | lda prtfun ;Get the output function\r | |
549 | mov c,a ;Into C\r | |
550 | call bdos ;And output the character\r | |
551 | pop b\r | |
552 | pop h\r | |
553 | ret\r | |
554 | ENDIF;iobyt\r | |
555 | \r | |
556 | IF cifer3 ; [JAS]\r | |
557 | push h\r | |
558 | push b\r | |
559 | mvi c,auxout ;Output to the aux output device\r | |
560 | call bdos\r | |
561 | pop b\r | |
562 | pop h\r | |
563 | ret\r | |
564 | ENDIF;cifer3\r | |
565 | \r | |
566 | \r | |
567 | ;\f\r | |
568 | ;\r | |
569 | ; get character from modem; return zero if none available.\r | |
570 | ; for IOBYT systems, the modem port has already been selected.\r | |
571 | ; destroys bc, de, hl.\r | |
572 | inpmdm:\r | |
573 | IF iobyt\r | |
574 | call bconst ;Is Char at COMM-Port?\r | |
575 | ora a ;something there?\r | |
576 | rz ; return if nothing there\r | |
577 | call bconin ; data present. read data.\r | |
578 | ENDIF;iobyt\r | |
579 | \r | |
580 | IF inout\r | |
581 | ;Note: modem port should already be selected for mdI. [Toad Hall]\r | |
582 | in mnprts ;Get the port status into A.\r | |
583 | ani input ;See if the input ready bit is on.\r | |
584 | rz ;If not then return.\r | |
585 | in mnport ;If so, get the char.\r | |
586 | ENDIF;inout\r | |
587 | \r | |
588 | IF cifer3 ; [JAS]\r | |
589 | mvi c,auxist\r | |
590 | call bdos ;is char at auxin?\r | |
591 | ora a ;something there?\r | |
592 | rz ;no\r | |
593 | mvi c,auxin\r | |
594 | call bdos ;read char from auxin\r | |
595 | ENDIF;cifer3\r | |
596 | \r | |
597 | ret ; return with character in A\r | |
598 | \r | |
599 | \r | |
600 | ;\r | |
601 | ; flsmdm - flush comm line.\r | |
602 | ; Modem is selected.\r | |
603 | ; Currently, just gets characters until none are available.\r | |
604 | \r | |
605 | flsmdm: call inpmdm ; Try to get a character\r | |
606 | ora a ; Got one?\r | |
607 | jnz flsmdm ; If so, try for another\r | |
608 | ret ; Receiver is drained. Return.\r | |
609 | \r | |
610 | \r | |
611 | ;\f\r | |
612 | ;\r | |
613 | ; lptstat - get the printer status. Return a=0 if ok, or 0ffh if not.\r | |
614 | lptstat:\r | |
615 | IF iobyte ;[33]\r | |
616 | call bprtst ; get status\r | |
617 | ENDIF ;iobyte[33]\r | |
618 | IF NOT iobyte ;[33]\r | |
619 | xra a ; assume it is ok.. this may not be necessary\r | |
620 | ENDIF ;iobyte [33]\r | |
621 | ret\r | |
622 | ;\f\r | |
623 | ;\r | |
624 | ; outlpt - output character in E to printer\r | |
625 | ; console is selected.\r | |
626 | ; preserves de.\r | |
627 | outlpt:\r | |
628 | push d ; save DE in either case\r | |
629 | call prtflt ; go through printer filter [30]\r | |
630 | ana a ; if A = 0 do nothing,\r | |
631 | jz outlp1 ; [30] if a=0 do nothing\r | |
632 | \r | |
633 | IF NOT iobyte\r | |
634 | mvi c,lstout\r | |
635 | call bdos ;Char to printer\r | |
636 | ENDIF;NOT iobyt\r | |
637 | IF iobyt\r | |
638 | mov c,e\r | |
639 | call blsout\r | |
640 | ENDIF;iobyt\r | |
641 | \r | |
642 | outlp1: pop d ; restore saved register pair\r | |
643 | ret\r | |
644 | ;\f\r | |
645 | ;\r | |
646 | ; Screen manipulation routines\r | |
647 | ; csrpos - move to row B, column C\r | |
648 | ;\r | |
649 | ; csrpos for terminals that use a leadin sequence followed\r | |
650 | ; by (row + 31.) and (column + 31.)\r | |
651 | ;\r | |
652 | IF cifer ; [14] cifer does it colums then rows.. swap b and c\r | |
653 | csrpos: push b ; save coordinates\r | |
654 | lxi d,curldn ; get cursor leadin sequence\r | |
655 | call prtstr ; print it\r | |
656 | pop h ; restore coordinates\r | |
657 | mov a,l ; [obs] get column\r | |
658 | adi (' '-1) ; space is column one\r | |
659 | mov e,a\r | |
660 | push h\r | |
661 | call outcon ; output row\r | |
662 | pop h\r | |
663 | mov a,h ; [obs] get row\r | |
664 | adi (' '-1) ; space is row one\r | |
665 | mov e,a\r | |
666 | jmp outcon ; output it and return\r | |
667 | ENDIF; cifer \r | |
668 | \r | |
669 | ;\r | |
670 | ;\r | |
671 | ; delchr - make delete look like a backspace. Unless delete is a printing\r | |
672 | ; character, we just need to print a backspace. (we'll output clrspc\r | |
673 | ; afterwards)\r | |
674 | ; For Kaypro and Vector General, delete puts a blotch on the screen.\r | |
675 | ; For Apple and Osborne 1, delete moves but doesn't print.\r | |
676 | delchr:\r | |
677 | mvi e,bs\r | |
678 | call outcon\r | |
679 | \r | |
680 | ; erase the character at the current cursor position\r | |
681 | clrspc: mvi e,' '\r | |
682 | call outcon\r | |
683 | mvi e,bs ;get a backspace\r | |
684 | jmp outcon\r | |
685 | \r | |
686 | ; erase the current line\r | |
687 | clrlin: lxi d,eralin\r | |
688 | jmp prtstr\r | |
689 | \r | |
690 | ; erase the whole screen, and go home. preserves b (but not c)\r | |
691 | clrtop: lxi d,erascr\r | |
692 | jmp prtstr\r | |
693 | \r | |
694 | \r | |
695 | IF cifer AND NOT cifaux ;[13]\r | |
696 | ttytyp: db 'Cifer 1886 (Parity set to space only)$'\r | |
697 | ENDIF; cifer AND NOT cifaux\r | |
698 | \r | |
699 | IF cifaux ;JAS\r | |
700 | ttytyp: db ' Cifer 1886 $'\r | |
701 | ENDIF; cifaux\r | |
702 | \r | |
703 | IF cifer ;[JAS]\r | |
704 | sysver: db ' Cifer 1886 $' ;\r | |
705 | outlin: db esc,'J',cr,lf,tab,tab,'$'\r | |
706 | eralin: db esc,'^K$' ;Clear to end of line.\r | |
707 | erascr: db esc,'J$' ;Clear screen and go home.\r | |
708 | curldn: db esc,'P$' ;Cursor lead-in\r | |
709 | ttab: ;Table start location.\r | |
710 | ta: db esc,'A$',0 ;Cursor up.\r | |
711 | tb: db esc,'@$',0 ;Cursor down.\r | |
712 | tc: db esc,'C$',0 ;Cursor right.\r | |
713 | td: db esc,'D$',0 ;Cursor left.\r | |
714 | te: db esc,'J',0,0 ;Clear screen and home cursor\r | |
715 | tf: db '$',0,0,0 ;(can't) Enter Graphics mode\r | |
716 | tg: db '$',0,0,0 ;(can't) Exit Graphics mode\r | |
717 | th: db esc,'H$',0 ;Cursor home.\r | |
718 | ti: db esc,'@$',0 ;reverse linfeed\r | |
719 | tj: db esc,'B$',0 ;Clear to end of screen\r | |
720 | tk: db esc,'K$',0 ;Clear to end of line.\r | |
721 | ENDIF;cifer\r | |
722 | ;\r | |
723 | IF cifer AND NOT cifaux ;[JAS]\r | |
724 | ; Setup string for the Cifer.. called as a prtstr param. from sysinit\r | |
725 | ciferi: db esc,'/' ;Setup cifer for on line\r | |
726 | db esc,'*[' ; direct mode on\r | |
727 | db esc,'%' ; protocol on host line on\r | |
728 | db esc,'*~x' ; protocol is xon/xoff\r | |
729 | db esc,'*(' ; protocol out on host is xon/xoff\r | |
730 | db esc,'? NNNY',cr ; set VL port to space parity\r | |
731 | ; It cannot do NONE.. Thanks a lot\r | |
732 | db '$' ; all done\r | |
733 | ; Finish string for the Cifer.. called as a prtstr param. from sysexit\r | |
734 | cifero: db esc,'&' ; Host input protocol off\r | |
735 | db esc,'*)' ; Host output protocol off\r | |
736 | db esc,'*]' ; Direct mode off\r | |
737 | db esc,'\' ; Setup cifer for off line\r | |
738 | db '$'\r | |
739 | ; Break string for cifer VL port.\r | |
740 | brkmes: db esc,'*"$' ;Send a break command string\r | |
741 | ENDIF;cifer AND NOT cifaux [13]\r | |
742 | \r | |
743 | ovlend equ $ ; End of overlay\r | |
744 | \r | |
745 | END\r | |
746 | \1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\1a\r |