]> cloudbase.mooo.com Git - kermit-80.git/blob - cpxhea.asm
Add AVR-CP/M system (cpxac.asm) and a Makefile
[kermit-80.git] / cpxhea.asm
1 IF NOT lasm
2 .printx * CPXHEA.ASM *
3 ENDIF ;NOT lasm
4 ; KERMIT - (Celtic for "FREE")
5 ;
6 ; This is the CP/M-80 implementation of the Columbia University
7 ; KERMIT file transfer protocol.
8 ;
9 ; Version 4.0
10 ;
11 ; Copyright June 1981,1982,1983,1984,1985
12 ; Columbia University
13 ;
14 ; Originally written by Bill Catchings of the Columbia University Center for
15 ; Computing Activities, 612 W. 115th St., New York, NY 10025.
16 ;
17 ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
18 ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
19 ; others.
20 ;
21 ; This file contains the system-dependent code and data for KERMIT
22 ; specific to the Heath/Zenith H89 and Z100, the Telcon Zorba,
23 ; and the OEM ScreenTyper. All but the latter use VT52 (or a
24 ; replica thereof) for screen output; the ScreenTyper uses the
25 ; same serial port chip as the H89 (an Intel 8250).
26 ;
27 ; revision history:
28 ;
29 ; Edit 4, 31-Aug-1989 by Mike Freeman, 301 N.E. 107th Street; Vancouver wa
30 ; 98685 USA; Telephone (206)574-8221: Added Baud-rate Selection and
31 ; Break-sending ability for the Telcon Zorba portable.
32 ;
33 ; edit 3, 22 July, 1987 by OBSchou to massage code to conform to new set
34 ; of overlay files (stripping out common code to CPXCOM.ASM)
35 ;
36 ; edit 2 by OBSchou to add in old Kermit-80 V3.5 heath-8 code, formerly
37 ; in CPM directory. Entry from CP/M file:
38 ;
39 ; This file contains an upgrade to the CPMBASE.M80 KERMIT
40 ; to allow setting and display of baud rates, a bug fix in
41 ; telnet, and an extension of the HELP to show GET (which works
42 ; in this release, on the H8). Look for the new symbol "h8quad"
43 ; (for the heath quad i/o board that it uses) in the conditionals.
44 ; Note that the Heath H8 is NOT the same machine as the H89. The H89
45 ; code does not run 'as is' on the H8, and does NOT initialize the
46 ; UART. Also there was a bug in the telnet section that is fixed
47 ; here, though I expect that it has already been found and fixed
48 ; by now - this is from the DECUS FALL 83 tape. The comments were
49 ; stripped out of this file to make it small enough for my H8 to
50 ; assemble, however, I have put the first section back in to make
51 ; it easier for you to identify. Thanks for a nice product to use
52 ; and work on. Major insertions are heavily commented, edit as needed.
53 ;
54 ; This modification done by John Mealing, InteCom Inc, 601 Intecom Dr.,
55 ; Allen, TX 75002 (214)797-9141, x-2493, 5 Nov 84.
56 ;
57 ; [OBSchou notes: This is the header, and the bugs in telnet are
58 ; unknown. telnet routine has been substantially changed anyway with
59 ; 4.08-4.09 revision. As for the major insertions: they probably went
60 ; with the 4.xx re-write. I am unable to test this version: can
61 ; anyone else do so??]
62 ;
63 ;
64 ; edit 01 5th Mar 1987 by M J Carter, Nottingham Uni [majoc]
65 ; Split off from CPXSYS.ASM, in order to install support for
66 ; the OEM ScreenTyper. I can't test anything other than the
67 ; ScreenTyper as I haven't the hardware. Any offers?
68 ; Thanks are due to Paul Bartlett of John Elmer
69 ; Electronics Ltd, who provided me with his modified sources
70 ; for (a slightly antiquated) CP/M 4.05 Kermit on which this
71 ; is based.
72 ;
73 ; Keep module name, edit number, and last revision date in memory.
74 ;sysedt: db 'CPXSYS.ASM (35) 01-Dec-86 $'
75 ; [majoc 870305] Now in CPXFRK. I'll have to consult on this ...
76 ;
77 ;\f
78 ;
79 ; Assembly time message to let me know I'm building the right version.
80 ; LASM generates an 'S' error along with the message, which is messy, but
81 ; better than trying to put everything inside a IF m80 OR mac80 conditional,
82 ; because LASM doesn't like nested IF's, either.
83
84 IF heath
85 .printx * Assembling KERMIT-80 for the Heath/Zenith 89 *
86 ENDIF
87
88 IF h8quad
89 .printx * Assembling KERMIT-80 for the Heath-8 with Quad IO board *
90 ENDIF
91
92 IF z100
93 .printx * Assembling KERMIT-80 for the Heath/Zenith Z100 *
94 ENDIF
95
96 IF telcon
97 .printx * Assembling KERMIT-80 for the Telcon Zorba *
98 ENDIF
99
100 IF scntpr
101 .printx * Assembling KERMIT-80 for the OEM ScreenTyper *
102 ENDIF
103 ;
104
105 ;\f
106
107 IF heath
108 mnport EQU 330O ;Modem data port
109 ENDIF ; heath
110
111 IF h8quad
112 mnport EQU 330O ;all port addresses can be set by user -
113 mnprts EQU mnport + 05 ; in octal cause heath wrote documents that
114 output EQU 20H ; way -- relative addressing on the UART
115 input EQU 01H ; registers, just to be nice
116 baudls EQU mnport ;ls baud divisor latch when DALB set
117 baudms EQU mnport + 1 ;ms baud divisor latch when DALB set
118 linctl EQU mnport + 3 ;line control register
119 modctl EQU mnport + 4 ;MODEM control register
120 dalbon EQU 80H ;enables speed selection
121 linset EQU 03H ;force hardware 8 bit, even parity
122 ;
123 ; The line control register (linctl) is bit mapped as follows:
124 ; bit # function value
125 ; 0,1 select word size 00 -> 5 bit, 10 -> 7 bit
126 ; 01 -> 6 bit, 11 -> 8 bit
127 ; 2 select stop bits 0 -> 1 stop bit, 1 -> 1 1/2 for 5 bit,
128 ; 1 -> 2 for 6 bit words
129 ; 3 parity enable 0 -> no parity, 1 -> parity as set by 4
130 ; 4 Even parity select 0 -> Odd parity, 1 -> Even parity
131 ; 5 Stick parity 1 -> Parity of bit 4 is inverted
132 ; 6 Break control 1 -> output forced to spacing (break)
133 ; 7 DALB 1 -> access divisor latches to set baud rate
134 ;
135 ; The value in linset is loaded into linctl when KERMIT comes up.
136 ;
137 ms300 EQU 001O ;set for 300 baud as default
138 ls300 EQU 200O
139 rtsoff EQU 20O ;direct control of modem lines
140 rtson EQU 11O
141 z80 EQU FALSE ;[2] or is it?
142 ENDIF ;h8quad
143
144 IF scntpr
145 mnport EQU 8 ;Modem data port
146 ENDIF ; scntpr
147 IF heath OR scntpr
148
149 ; Definitions for the 8250 ACE
150
151 acerbr EQU 0 ; ACE Receiver Buffer Register offset (R/O) (DLAB = 0)
152 acethr EQU 0 ; ACE Transmitter Holding Register offset (W/O)
153 acedll EQU 0 ; ACE Divisor Latch (Low) (DLAB = 1)
154 acedlh EQU 1 ; ACE Divisor Latch (High) (DLAB = 1)
155 aceier EQU 1 ; ACE Interrupt Enable Register (DLAB = 0)
156 aceiir EQU 2 ; ACE Interrupt Identification Register
157 acelcr EQU 3 ; ACE Line Control Register
158 acemcr EQU 4 ; ACE Modem Control Register
159 acelsr EQU 5 ; ACE Line Status Register offset
160 acemsr EQU 6 ; ACE Modem Status Register
161
162 ace8bw EQU 00000011b ; 8 bit words
163 acesb EQU 01000000b ; set break
164 acedla EQU 10000000b ; divisor latch access
165 acedtr EQU 00000001b ; data terminal ready
166 aceloo EQU 00010000b ; loopback mode
167 acedr EQU 00000001b ; data ready
168 acethe EQU 00100000b ; transmitter holding register empty
169
170 ;mnport EQU 330O ;Modem data port
171 ; [35a: majoc 870305] Shifted up above joint IF, to save nesting.
172 mnprts EQU mnport+acelsr ;Modem status port
173 output EQU acethe ;Transmitter empty
174 input EQU acedr ;Input data available
175 z80 EQU TRUE ;H89 uses the Z80
176 ENDIF;heath OR scntpr
177
178 IF z100
179 mnport EQU 0ECH ;Modem data port
180 mnprts EQU 0EDH ;Modem status port
181 output EQU 01H ;Transmitter empty
182 input EQU 02H ;Input data available
183 z80 EQU FALSE ;[hh] this one's an 8085.
184 ENDIF;z100
185
186
187 IF telcon
188 MNPORT EQU 20H ;Modem data port
189 MNPRTS EQU 21H ;Modem status port
190 OUTPUT EQU 01H ;Transmitter empty
191 INPUT EQU 02H ;Input data available
192 BRPORT EQU 00H ;8254-2 Baud Rate Generator Timer for Port A
193 COMMND EQU 03H ;8254-2 Timer Control Port
194 z80 EQU TRUE ;[MF]A real Z80
195 ENDIF;telcon
196 ;\f
197
198 IF telcon
199 defesc EQU ']'-100O ;The default escape character.
200 ENDIF;telcon
201
202 IF heath OR h8quad OR z100 OR scntpr
203 defesc EQU '\'-100O ;The default is Control \ -- it's easier B.E.
204 ENDIF;heath OR h8quad OR z100 OR scntpr
205
206 ; Select initial setting for VT-52 emulation flag.
207 IF (heath OR h8quad OR z100 OR telcon)
208 vtval EQU 0 ; we don't need VT52 emulation
209 ENDIF;heath OR h8quad OR z100 OR telcon OR vt52 [OBS question - ok for h8quad?]
210 ; If none of the above, default to VT52-EMULATION ON.
211 IF scntpr
212 vtval EQU 1 ; we do VT52 emulation
213 ENDIF;scntpr
214
215
216 ;\f
217 ; Family is the string used in VERSION to say which of several
218 ; smaller overlay files are used. These are (will be) derived from
219 ; the juge CPXSYS.ASM file, in which case we will never get here.
220 ; Just a Dollar, but put a sting in for a family of machines.
221 ;
222 family: db 'CPXHEA.ASM (4) 31-Aug-1989$' ; Used for family versions....
223
224 ;\f
225 sysxin: ; continuation of initialisation code
226 IF heath OR scntpr
227 ;
228 ; System dependent startup for H89 and OEM ScreenTyper
229 ;
230
231 call mdmofl ; keep the line safe from garbage
232
233 ; First, tell Kermit the modem port's current speed
234 in mnport+acelcr
235 ori acedla
236 out mnport+acelcr ; access the ACE's divisor latch
237 in mnport+acedll ; get the low byte
238 sta speed
239 in mnport+acedlh ; and the high byte
240 sta speed+1
241
242 ; Now set up the port for Kermit
243 mvi a,ace8bw ; 8 data bits, 1 stop bit, no parity
244 out mnport+acelcr
245 in mnport+acemcr
246 ori acedtr ; raise DTR (just in case)
247 out mnport+acemcr
248 call mdmonl ; and put the ACE back on line
249 ret
250
251 ; Take the ACE off line before modifying its state
252 mdmofl:
253 in mnport+aceier ; save the ACE's interrupt state
254 sta iersav
255 xra a
256 out mnport+aceier ; and disable ACE interrupts
257 in mnport+acemcr ; now put the ACE in loopback mode
258 ori aceloo
259 out mnport+acemcr
260 ret
261
262 ; Put the ACE back on line
263 mdmonl:
264 in mnport ; flush left-over garbage in the receive buffer
265 mvi a,7 ; wait about 2 300-baud character times
266 call delay
267 in mnport ; and flush more garbage
268 in mnport+acemcr ; take the ACE out of loopback mode
269 ani 0FFH-aceloo
270 out mnport+acemcr
271 lda iersav
272 out mnport+aceier ; and restore the ACE's interrupt state
273 ret
274
275 iersav: ds 1
276 ENDIF;heath OR scntpr
277
278 IF h8quad
279 h8init: lxi d,180h ; [2] set up for 300 baud
280 h8baud: mvi a,rtsoff ;disable modem for now
281 out modctl
282 mvi a,dalbon ;set for UART speed programming
283 out linctl
284 mov a,d ; [2] get ms bits for rate
285 out baudms
286 mov a,e ; [2] get ls bits for rate
287 out baudls
288 mvi a,linset ;force 8 bit, no parity and clear dalb
289 out linctl
290 in mnport ;clear the recieve side
291 mvi a,rtson ;get ready
292 out modctl ;modem is on and ready to go
293 ENDIF ;h8quad
294
295 ret ; return from system-dependent routine
296
297 ;\f
298 ;
299 ; system-dependent termination processing
300 ; If we've changed anything, this is our last chance to put it back.
301 sysexit:
302 ret
303
304 ;
305 ; system-dependent processing for start of CONNECT command
306 ;
307 syscon:
308 ret
309
310 conmsg: ; Messages printed when entering transparent (CONNECT) mode:
311 ;\f
312 ;
313 ; syscls - system-dependent close routine
314 ; called when exiting transparent session.
315 ;
316 syscls:
317 ret
318 ;\f
319 ;
320 ; sysinh - help for system-dependent special functions.
321 ; called in response to <escape>?, after listing all the
322 ; system-independent escape sequences.
323 ;
324 sysinh:
325 IF heath OR scntpr OR telcon;[4]
326 lxi d,inhlps ; we got options...
327 call prtstr ; print them.
328 ENDIF;heath OR scntpr OR telcon
329
330 ret
331
332
333 ;additional, system-dependent help for transparent mode
334 ; (two-character escape sequences)
335 inhlps:
336 IF heath OR scntpr OR telcon;[4]
337 db cr,lf,'B Transmit a BREAK'
338 ENDIF;heath OR scntpr OR telcon
339
340 IF heath OR scntpr
341 db cr,lf,'D Drop the line'
342 ENDIF;heath OR scntpr
343
344 db '$' ;[hh] table terminator
345
346 ;
347 ; sysint - system dependent special functions
348 ; called when transparent escape character has been typed;
349 ; the second character of the sequence is in A (and in B).
350 ; returns:
351 ; non-skip: sequence has been processed
352 ; skip: sequence was not recognized
353 sysint: ani 137O ; convert lower case to upper, for testing...
354
355 IF heath OR scntpr
356 cpi 'D' ; drop line?
357 jnz intc00 ; no: try next function character
358
359 mdmdrp: in mnport+acemcr ; (we also get here from sysbye)
360 ani 0FFH-acedtr
361 out mnport+acemcr ; yes: drop DTR
362 mvi a,50 ; for half a second
363 call delay
364 in mnport+acemcr
365 ori acedtr
366 out mnport+acemcr ; and then restore it
367 ret
368 intc00:
369 ENDIF;heath OR scntpr
370
371 IF heath OR scntpr OR telcon;[4]
372 cpi 'B' ; send break?
373 jz sendbr ; yes, go do it. return nonskip when through.
374 ENDIF;heath OR scntpr OR telcon
375 jmp rskp ; take skip return - command not recognized.
376
377
378 ;\f
379 IF heath OR scntpr
380 ;
381 ; Send BREAK on H89 or ScreenTyper
382 ;
383 sendbr: in mnport+acelcr
384 ori acesb
385 out mnport+acelcr ; set ACE break condition
386 mvi a,30
387 call delay ; wait 300 milliseconds
388 in mnport+acelcr
389 ani 0FFH-acesb
390 out mnport+acelcr ; and clear ACE break condition
391 ret
392
393 ENDIF;heath OR scntpr
394 ;
395 IF telcon ;[4]
396 ;
397 ; Send break on Telcon Zorba
398 ;
399 sendbr: mvi a,3fH ;DTR normal, break on
400 out mnprts ;Set break on
401 mvi a,30 ;Wait 300 ms
402 call delay ;...
403 mvi a,37h ;DTR normal, tx, rx enabled
404 out mnprts ;Restore normal condition
405 ret ;and return
406 ;
407 ENDIF ;telcon
408
409 ;\f
410 ;
411 ; sysflt - system-dependent filter
412 ; called with character in E.
413 ; if this character should not be printed, return with A = zero.
414 ; preserves bc, de, hl.
415 ; note: <xon>,<xoff>,<del>, and <nul> are always discarded.
416 sysflt:
417 mov a,e ; get character for testing
418 ret
419
420 ; mdmflt - modem filter [30]
421 ; called with character to be sent to printer in E
422 ; with parity set as appropriate.
423 ; return with accumulator = 0 do do nothing,
424 ; <> 0 to send char in E.
425 mdmflt:
426 mov a,e ;[30] get character to test
427 ret
428
429
430
431 ; prtflt - printer filter [30]
432 ; called with character to be sent to printer in E
433 ; returns with a = 0 to do nothing
434 ; a <> 0 to print it.
435 ;
436 ; this routine for those printer that automatically insert
437 ; a lf on cr, or cr for lf. Should this be shifted to
438 ; the system indep. stuff, in say 4.06?
439 prtflt:
440 mov a,e ; [30] get character to test
441 ret
442
443
444 ;\f
445 ;
446 ; system-dependent processing for BYE command.
447 ; for apmmdm, heath, scntpr, and lobo, hang up the phone.
448 sysbye:
449 IF heath OR scntpr
450 call mdmdrp ; Sleazy but effective
451 ENDIF;heath OR scntpr
452
453 ret
454 ;\f
455 ; This is the system-dependent command to change the baud rate.
456 ; DE contains the two-byte value from the baud rate table; this
457 ; value is also stored in 'speed'.
458 sysspd:
459
460 IF heath OR scntpr
461 ;
462 ; Set speed for H89
463 ;
464 call mdmofl ; keep the line safe from garbage
465 in mnport+acelcr
466 ori acedla
467 out mnport+acelcr ; access the ACE's divisor latch
468 mov a,e ; low byte of speed is in E
469 out mnport+acedll ; set the low byte
470 mov a,d ; high byte of speed is in D
471 out mnport+acedlh ; set the high byte
472 in mnport+acelcr
473 ani 0FFH-acedla
474 out mnport+acelcr ; de-access the ACE's divisor latch
475 call mdmonl ; and put the ACE back on line
476 ENDIF;heath OR scntpr
477
478 IF h8quad ;[2][obs] A bit of guesswork this. Enter with date in de
479 call h8baud ; [2] routine is in initialisation bit
480 ENDIF ; h8quad[2]
481 ;
482 IF telcon ;[4]
483 MVI A,36H ;Set square wave
484 OUT COMMND ;...
485 MOV A,E ;Get LSB of Baud rate
486 OUT BRPORT ;Send to generator
487 MOV A,D ;Get msb of baud rate
488 OUT BRPORT ;Send to Baud rate generator
489 ENDIF ;telcon
490 ;
491 ret
492
493 ;
494 ;\f
495 ; Speed tables
496 ; (Note that speed tables MUST be in alphabetical order for later
497 ; lookup procedures, and must begin with a value showing the total
498 ; number of entries. The speed help tables are just for us poor
499 ; humans.
500 ;
501 ; db string length,string,divisor (2 identical bytes or 1 word)
502 ; [Toad Hall]
503
504 IF heath
505 ;
506 ; Speed selection table for H89 (OK, so I got a little carried away...)
507 ;
508
509 spdtbl: db 19 ; 19 entries
510 db 3,'110$'
511 dw 1047
512 db 4,'1200$'
513 dw 96
514 db 5,'134.5$'
515 dw 857
516 db 4,'1800$'
517 dw 64
518 db 5,'19200$'
519 dw 6
520 db 3,'200$'
521 dw 576
522 db 4,'2400$'
523 dw 48
524 db 3,'300$'
525 dw 384
526 db 4,'3600$'
527 dw 32
528 db 5,'38400$'
529 dw 3
530 db 3,'450$'
531 dw 256
532 db 4,'4800$'
533 dw 24
534 db 2,'50$'
535 dw 2304
536 db 5,'56000$'
537 dw 2
538 db 3,'600$'
539 dw 192
540 db 4,'7200$'
541 dw 16
542 db 2,'75$'
543 dw 1536
544 db 3,'900$'
545 dw 128
546 db 4,'9600$'
547 dw 12
548
549 sphtbl: db cr,lf
550 db ' 50 75 110 134.5 200 300 450 600 900 1200'
551 db cr,lf,' 1800 2400 3600 4800 7200 9600 19200 38400 56000$'
552 ENDIF;heath
553
554 IF h8quad
555 spdtbl: db 6 ;[2] 6 entries
556 db 3,'300$', 1,80h ; divisor for 300 baud
557 db 3,'600$', 0,0c0h
558 db 4,'1200$', 0,60h
559 db 4,'2400$', 0,30h
560 db 4,'4800$', 0,18h
561 db 4,'9600$', 0,0ch
562 ;
563 ; The strings to display the speed selected from the table above
564 ;
565 sphtbl: db cr,lf,' 300 600 1200 2400 4800 9600$'
566 ENDIF ;h8quad
567
568 IF scntpr
569 ; [35a: majoc 870305]
570 ;
571 ; Speed selection table for ScreenTyper
572 ;
573
574 spdtbl: db 14 ; 14 entries
575 db 3,'110$'
576 dw 470H
577 db 4,'1200$'
578 dw 68H
579 db 5,'134.5$'
580 dw 3a1H
581 db 4,'1800$'
582 dw 45H
583 db 5,'19200$' ; This was in PB's table, but not in the
584 dw 7H ; accompanying text string. Oversight?
585 ; db 3,'200$'
586 ; dw 576
587 db 4,'2400$'
588 dw 34H
589 db 3,'300$'
590 dw 1a1H
591 db 4,'3600$'
592 dw 23H
593 ; db 5,'38400$'
594 ; dw 3
595 ; db 3,'450$'
596 ; dw 256
597 db 4,'4800$'
598 dw 1aH
599 db 2,'50$'
600 dw 964H
601 ; db 5,'56000$'
602 ; dw 2
603 db 3,'600$'
604 dw 0d0H
605 db 4,'7200$'
606 dw 11H
607 db 2,'75$'
608 dw 683H
609 ; db 3,'900$'
610 ; dw 128
611 db 4,'9600$'
612 dw 0dH
613
614 sphtbl: db cr,lf,' 50 75 110 134.5 300 600 1200'
615 db cr,lf,' 1800 2400 3600 4800 7200 9600 (19200?)$'
616 ENDIF;scntpr
617 ;
618 IF telcon ;[4]
619 ;
620 ; Speed selection tables for the Telcon Zorba (I overdid it, also)
621 ;
622 ; **NOTE** that when Kermit is first executed, the baud rate is
623 ; unknown to Kermit, having been set by CP/M upon cold-boot, SETUP.COM,
624 ; another communications program, etc. The easiest way to insure that
625 ; the baud rate is known upon Kermit start-up is to set it
626 ; in KERMIT.INI.
627 ;
628 spdtbl: db 20 ;[4]Number of entries (some of these
629 ;speeds are *weird* but the Zorba
630 ;supports them so I'll put them in
631 db 3,'110$'
632 dw 4545
633 db 4,'1200$'
634 dw 417
635 db 5,'134.5$'
636 dw 3717
637 db 3,'150$'
638 dw 3333
639 db 4,'1760$'
640 dw 284
641 db 4,'1800$'
642 dw 278
643 db 5,'19200$'
644 dw 26
645 db 3,'200$'
646 dw 2500
647 db 4,'2000$'
648 dw 250
649 db 4,'2400$'
650 dw 208
651 db 3,'300$'
652 dw 1667
653 db 4,'3520$'
654 dw 142
655 db 4,'3600$'
656 dw 139
657 db 4,'4800$'
658 dw 104
659 db 2,'50$'
660 dw 10000
661 db 3,'600$'
662 dw 833
663 db 4,'62.5$'
664 dw 8000
665 db 4,'7200$'
666 dw 69
667 db 2,'75$'
668 dw 6667
669 db 4,'9600$'
670 dw 52
671 ;
672 ; Help table
673 ;
674 sphtbl: db cr,lf
675 db ' 50 62.5 75 110 134.5 150 200 300 600 1200'
676 db cr,lf,' 1760 1800 2000 2400 3520 3600 4800 7200'
677 db cr,lf,' 9600 19200$'
678 ;
679 ENDIF ;Telcon
680
681 ; The following conditionals were once a huge if not statement. There
682 ; wasn't enough room to add the lobo to the list, so it had to be broken
683 ; into 2, which you can't do with an if not. I redid it as two ifs and
684 ; applied them to those that wouldn't set baud. [Hal Hostetler]
685 IF z100
686 spdtbl equ 0 ; SET BAUD not supported.
687 sphtbl equ 0
688 ENDIF;z100
689 ;
690 ;\f
691 ; This is the system-dependent SET PORT command.
692 ; HL contains the argument from the command table.
693 sysprt:
694 ret
695 ;
696 prttbl equ 0 ; SET PORT is not supported
697 prhtbl equ 0
698 ;
699 ;\f
700 ;
701 ; selmdm - select modem port
702 ; selcon - select console port
703 ; selmdm is called before using inpmdm or outmdm;
704 ; selcon is called before using inpcon or outcon.
705 ; For iobyt systems, diddle the I/O byte to select console or comm port;
706 ; For Decision I, switches Multi I/O board to console or modem serial
707 ; port. [Toad Hall]
708 ; For the rest, does nothing.
709 ; preserves bc, de, hl.
710 selmdm:
711 ret
712
713 selcon:
714 ret
715
716 ; Get character from console, or return zero.
717 ; result is returned in A. destroys bc, de, hl.
718 ;
719 inpcon:
720 IF NOT iobyt
721 mvi c,dconio ;Direct console I/O BDOS call.
722 mvi e,0FFH ;Input.
723 call BDOS
724 ENDIF;NOT iobyt
725
726 ret
727 ;\f
728 ;
729 ; Output character in E to the console.
730 ; destroys bc, de, hl
731 ;
732 outcon:
733 IF NOT iobyt
734 mvi c,dconio ;Console output bdos call.
735 call bdos ;Output the char to the console.
736 ENDIF;NOT iobyt
737 ret
738 ;\f
739 ;
740 ; outmdm - output a char from E to the modem.
741 ; the parity bit has been set as necessary.
742 ; returns nonskip; bc, de, hl preserved.
743 outmdm:
744 IF inout
745 in mnprts ;Get the output done flag.
746 ani output ;Is it set?
747 jz outmdm ;If not, loop until it is.
748 mov a,e
749 out mnport ;Output it.
750 ret
751 ENDIF;inout
752
753 IF iobyt
754 ;**** Note that we enter from outpkt with the I/O byte already set up for
755 ; output to go to the comm port
756 push h
757 push b
758 lda prtfun ;Get the output function
759 mov c,a ;Into C
760 call bdos ;And output the character
761 pop b
762 pop h
763 ret
764 ENDIF;iobyt
765
766 ;\f
767 ;
768 ; get character from modem; return zero if none available.
769 ; for IOBYT systems, the modem port has already been selected.
770 ; destroys bc, de, hl.
771 inpmdm:
772 IF NOT iobyt ;[2] this routine not in submitted file, so I guess
773 ; guess this is what it is supposed to do.
774 in mnprts ; input status port
775 ani input ; anything t read in?
776 rz ; nope
777 in mnport ; else read in the data
778 ret ; return with character in A
779 ENDIF ; NOT iobyte [2]
780
781 ;
782 ; flsmdm - flush comm line.
783 ; Modem is selected.
784 ; Currently, just gets characters until none are available.
785
786 flsmdm: call inpmdm ; Try to get a character
787 ora a ; Got one?
788 jnz flsmdm ; If so, try for another
789 ret ; Receiver is drained. Return.
790 ;\f
791 ;
792 ; lptstat - get the printer status. Return a=0ffh if ok, or 0 if not.
793 lptstat:
794 call bprtst ; assume it is ok.. this may not be necessary
795 ret
796
797 ;
798 ; outlpt - output character in E to printer
799 ; console is selected.
800 ; preserves de.
801 outlpt:
802 push d ; save DE in either case
803 call prtflt ; go through printer filter [30]
804 ana a ; if A = 0 do nothing,
805 jz outlp1 ; [30] if a=0 do nothing
806
807 IF NOT iobyt
808 mvi c,lstout
809 call bdos ;Char to printer
810 ENDIF;NOT iobyt
811 outlp1: pop d ; restore saved register pair
812 ret
813 ;\f
814 ;
815 ; Screen manipulation routines
816 ; csrpos - move to row B, column C
817 ;
818 ; csrpos for terminals that use a leadin sequence followed
819 ; by (row + 31.) and (column + 31.)
820 ;
821 csrpos: push b ; save coordinates
822 lxi d,curldn ; get cursor leadin sequence
823 call prtstr ; print it
824 pop h ; restore coordinates
825 mov a,h ; get row
826 adi (' '-1) ; space is row one
827 mov e,a
828 push h
829 call outcon ; output row
830 pop h
831 mov a,l ; get column
832 adi (' '-1) ; space is column one
833 mov e,a
834 jmp outcon ; output it and return
835
836 ;
837 ; delchr - make delete look like a backspace. Unless delete is a printing
838 ; character, we just need to print a backspace. (we'll output clrspc
839 ; afterwards)
840 ; For Kaypro and Vector General, delete puts a blotch on the screen.
841 ; For Apple and Osborne 1, delete moves but doesn't print.
842 delchr:
843 mvi e,bs ;get a backspace
844 jmp outcon
845
846 ; erase the character at the current cursor position
847 clrspc: mvi e,' '
848 call outcon
849 mvi e,bs ;get a backspace
850 jmp outcon
851
852 ; erase the current line
853 clrlin: lxi d,eralin
854 jmp prtstr
855
856 ; erase the whole screen, and go home. preserves b (but not c)
857 clrtop: lxi d,erascr
858 jmp prtstr
859
860 IF telcon
861 sysver: db 'Telcon Zorba$'
862 ENDIF;telcon
863
864 IF heath
865 sysver: db 'Heath/Zenith 89$'
866 ENDIF;heath
867
868 IF h8quad
869 sysver: db 'Heath H8 with quad I/O card$'
870 ENDIF
871
872 IF z100
873 sysver: db 'Heath/Zenith Z-100 CP/M$'
874 ENDIF;z100
875
876 IF scntpr
877 ; [35a: majoc 870305]
878 sysver: db 'OEM ScreenTyper: 4MHz Z80 running OS/M$'
879 ENDIF;scntpr
880
881 IF heath OR h8quad OR z100 OR telcon
882 outlin: db esc,'H',esc,'J',cr,lf,tab,tab,'$'
883 erascr: db esc,'H',esc,'J$' ;Clear screen and go home.
884 eralin: db cr,esc,'K$' ;Clear line.
885 curldn: db esc,'Y$' ;cursor leadin
886 ttab: ;Table start location.
887 ta: db esc,'A$',0 ;Cursor up.
888 tb: db esc,'B$',0 ;Cursor down.
889 tc: db esc,'C$',0 ;Cursor right.
890 td: db esc,'D$',0 ;Cursor left
891 te: db esc,'E$',0 ;Clear display
892 tf: db esc,'F$',0 ;Enter Graphics Mode
893 tg: db esc,'G$',0 ;Exit Graphics mode
894 th: db esc,'H$',0 ;Cursor home.
895 ti: db esc,'I$',0 ;Reverse linefeed.
896 tj: db esc,'J$',0 ;Clear to end of screen.
897 tk: db esc,'K$',0 ;Clear to end of line.
898 ENDIF;heath OR h8quad OR z100 OR telcon
899 ;
900
901 IF scntpr ; [35a: majoc 870305]
902 outlin: db 1aH, cr, lf, '$'
903 erascr: db 1aH, '$' ;Clear screen and go home.
904 eralin: db cr,esc,'*$' ;Clear line.
905 curldn: db esc,'=$' ;cursor leadin
906 ttab: ;Table start location.
907 ta: db 1eH,'$',0,0 ;Cursor up.
908 tb: db 1fH,'$',0,0 ;Cursor down.
909 tc: db 1cH,'$',0,0 ;Cursor right.
910 td: db 1dH,'$',0,0 ;Cursor left
911 te: db 1aH,'$',0,0 ;Clear display
912 tf: db 0,0,0,0 ;(Can't)Enter Graphics Mode
913 tg: db 0,0,0,0 ;(Can't)Exit Graphics mode
914 th: db 15H,'$',0,0 ;Cursor home.
915 ti: db 1eH,'$',0,0 ;Reverse linefeed.
916 tj: db esc,'%$',0 ;Clear to end of screen.
917 tk: db esc,'*$',0 ;Clear to end of line.
918 ENDIF;scntpr
919
920 ovlend EQU $ ; End of overlay
921 END ; Phew ... [majoc 870305]