4 ; KERMIT - (Celtic for "FREE")
6 ; This is the CP/M-80 implementation of the Columbia University
7 ; KERMIT file transfer protocol.
11 ; Copyright June 1981,1982,1983,1984,1985
14 ; Originally written by Bill Catchings of the Columbia University Center for
15 ; Computing Activities, 612 W. 115th St., New York, NY 10025.
17 ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
18 ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
21 ; This file contains the system-dependent code and data for
22 ; Kermit-80 emulated on an IBM PC or clone running Z80MU.
24 ; revision history (last edit first)
26 ; edit 1, 2 December, 1987. Built code for Z80MU emulation. Uses BIOS
27 ; calls to 0FF12-15 to read/write from/to the PC COM1 port.
30 .printx * Assembling for Z80MU system *
33 ; Family is the string used in VERSION to say which of several
34 ; smaller overlay files are used. These are (will be) derived from
35 ; the juge CP4SYS.ASM file, in which case we will never get here.
36 ; Just a Dollar, but put a sting in for a family of machines.
38 family: db 'CPXZ80.ASM (1) 2-Dec-87$' ; Used for family versions....
42 sysxin: ; continuation of system dependent initialisation code
43 ret ; return from system-dependent routine
46 ; system-dependent termination processing
47 ; If we've changed anything, this is our last chance to put it back.
52 ; system-dependent processing for start of CONNECT command
57 conmsg: ; Messages printed when entering transparent (CONNECT) mode:
60 ; syscls - system-dependent close routine
61 ; called when exiting transparent session.
66 ; sysinh - help for system-dependent special functions.
67 ; called in response to <escape>?, after listing all the
68 ; system-independent escape sequences.
74 ; sysint - system dependent special functions
75 ; called when transparent escape character has been typed;
76 ; the second character of the sequence is in A (and in B).
78 ; non-skip: sequence has been processed
79 ; skip: sequence was not recognized
80 sysint: ani 137O ; convert lower case to upper, for testing...
81 jmp rskp ; take skip return - command not recognized.
86 ; sysflt - system-dependent filter
87 ; called with character in E.
88 ; if this character should not be printed, return with A = zero.
89 ; preserves bc, de, hl.
90 ; note: <xon>,<xoff>,<del>, and <nul> are always discarded.
92 mov a,e ; get character for testing
95 ; mdmflt - modem filter [30]
96 ; called with character to be sent to printer in E
97 ; with parity set as appropriate.
98 ; return with accumulator = 0 do do nothing,
99 ; <> 0 to send char in E.
101 mov a,e ;[30] get character to test
106 ; prtflt - printer filter [30]
107 ; called with character to be sent to printer in E
108 ; returns with a = 0 to do nothing
109 ; a <> 0 to print it.
111 ; this routine for those printer that automatically insert
112 ; a lf on cr, or cr for lf. Should this be shifted to
113 ; the system indep. stuff, in say 4.06?
115 mov a,e ; [30] get character to test
120 ; system-dependent processing for BYE command.
121 ; for apmmdm, heath, and lobo, hang up the phone.
126 ; This is the system-dependent command to change the baud rate.
127 ; DE contains the two-byte value from the baud rate table; this
128 ; value is also stored in 'speed'.
133 ; The following conditionals were once a huge if not statement. There
134 ; wasn't enough room to add the lobo to the list, so it had to be broken
135 ; into 2, which you can't do with an if not. I redid it as two ifs and
136 ; applied them to those that wouldn't set baud. [Hal Hostetler]
137 spdtbl EQU 0 ;[hh] SET BAUD not supported.
138 sphtbl EQU 0 ;[hh] ran out of room above...
141 ; This is the system-dependent SET PORT command.
142 ; HL contains the argument from the command table.
146 prttbl equ 0 ; SET PORT not supported
151 ; selmdm - select modem port
152 ; selcon - select console port
153 ; selmdm is called before using inpmdm or outmdm;
154 ; selcon is called before using inpcon or outcon.
155 ; For iobyt systems, diddle the I/O byte to select console or comm port;
156 ; For Decision I, switches Multi I/O board to console or modem serial
158 ; For the rest, does nothing.
159 ; preserves bc, de, hl.
165 ; Get character from console, or return zero.
166 ; result is returned in A. destroys bc, de, hl.
169 mvi c,dconio ;Direct console I/O BDOS call.
176 ; Output character in E to the console.
177 ; destroys bc, de, hl
180 mov c,e ;Console output via BIOS
185 ; outmdm - output a char from E to the modem.
186 ; the parity bit has been set as necessary.
187 ; returns nonskip; bc, de, hl preserved.
189 mov c,e ; get char to c
190 call 0ff12h ; send to com1 via PC BIOS
194 ; get character from modem; return zero if none available.
195 ; for IOBYT systems, the modem port has already been selected.
196 ; destroys bc, de, hl.
198 ;Note: modem port should already be selected for mdI. [Toad Hall]
199 call 0ff15h ;Get the port status into A.
200 ana a ;See if the is non-null.
201 ret ; return with character or NULL in A.
205 ; flsmdm - flush comm line.
207 ; Currently, just gets characters until none are available.
209 flsmdm: call inpmdm ; Try to get a character
211 jnz flsmdm ; If so, try for another
212 ret ; Receiver is drained. Return.
216 ; lptstat - get the printer status. Return a=0ffh if ok, or 0 if not.
218 xra a ; assume it is ok.. this may not be necessary
222 ; outlpt - output character in E to printer
223 ; console is selected.
226 push d ; save DE in either case
227 call prtflt ; go through printer filter [30]
228 ana a ; if A = 0 do nothing,
229 jz outlp1 ; [30] if a=0 do nothing
231 call bdos ;Char to printer
232 outlp1: pop d ; restore saved register pair
236 ; delchr - make delete look like a backspace. Unless delete is a printing
237 ; character, we just need to print a backspace. (we'll output clrspc
239 ; For Kaypro and Vector General, delete puts a blotch on the screen.
240 ; For Apple and Osborne 1, delete moves but doesn't print.
242 mvi e,bs ;get a backspace
245 ; erase the character at the current cursor position
248 mvi e,bs ;get a backspace
251 ; erase the current line
255 ; erase the whole screen, and go home. preserves b (but not c)
260 sysver: db 'Z80MU on IBM PC $'
263 ENDIF ;lasm - m80 will INCLUDE CPXVDU.ASM