]> cloudbase.mooo.com Git - kermit-80.git/blob - cpxz80.asm
Add AVR-CP/M system (cpxac.asm) and a Makefile
[kermit-80.git] / cpxz80.asm
1 IF NOT LASM
2 .printx * CPXZ80.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
22 ; Kermit-80 emulated on an IBM PC or clone running Z80MU.
23 ;
24 ; revision history (last edit first)
25 ;
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.
28 ;
29
30 .printx * Assembling for Z80MU system *
31
32 ;\f
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.
37 ;
38 family: db 'CPXZ80.ASM (1) 2-Dec-87$' ; Used for family versions....
39
40
41
42 sysxin: ; continuation of system dependent initialisation code
43 ret ; return from system-dependent routine
44 ;
45 ;
46 ; system-dependent termination processing
47 ; If we've changed anything, this is our last chance to put it back.
48 sysexit:
49 ret
50
51 ;
52 ; system-dependent processing for start of CONNECT command
53 ;
54 syscon:
55 ret
56
57 conmsg: ; Messages printed when entering transparent (CONNECT) mode:
58 ;
59 ;
60 ; syscls - system-dependent close routine
61 ; called when exiting transparent session.
62 ;
63 syscls:
64 ret
65 ;
66 ; sysinh - help for system-dependent special functions.
67 ; called in response to <escape>?, after listing all the
68 ; system-independent escape sequences.
69 ;
70 sysinh:
71 ret
72
73 ;
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).
77 ; returns:
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.
82
83
84 ;
85 ;
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.
91 sysflt:
92 mov a,e ; get character for testing
93 ret
94
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.
100 mdmflt:
101 mov a,e ;[30] get character to test
102 ret
103
104
105
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.
110 ;
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?
114 prtflt:
115 mov a,e ; [30] get character to test
116 ret
117
118
119 ;
120 ; system-dependent processing for BYE command.
121 ; for apmmdm, heath, and lobo, hang up the phone.
122 sysbye:
123 ret
124 ;
125 ;
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'.
129 sysspd:
130 ret
131 ;
132 ;
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...
139 ;
140 ;
141 ; This is the system-dependent SET PORT command.
142 ; HL contains the argument from the command table.
143 sysprt:
144 ret
145
146 prttbl equ 0 ; SET PORT not supported
147 prhtbl equ 0
148 ;\f
149
150 ;
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
157 ; port. [Toad Hall]
158 ; For the rest, does nothing.
159 ; preserves bc, de, hl.
160 selmdm:
161 selcon:
162 ret
163 ;\f
164
165 ; Get character from console, or return zero.
166 ; result is returned in A. destroys bc, de, hl.
167 ;
168 inpcon:
169 mvi c,dconio ;Direct console I/O BDOS call.
170 mvi e,0FFH ;Input.
171 call BDOS
172 ret
173 ;\f
174
175 ;
176 ; Output character in E to the console.
177 ; destroys bc, de, hl
178 ;
179 outcon:
180 mov c,e ;Console output via BIOS
181 jmp bcnout
182 ;\f
183
184 ;
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.
188 outmdm:
189 mov c,e ; get char to c
190 call 0ff12h ; send to com1 via PC BIOS
191 ret
192 ;
193 ;
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.
197 inpmdm:
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.
202
203
204 ;
205 ; flsmdm - flush comm line.
206 ; Modem is selected.
207 ; Currently, just gets characters until none are available.
208
209 flsmdm: call inpmdm ; Try to get a character
210 ora a ; Got one?
211 jnz flsmdm ; If so, try for another
212 ret ; Receiver is drained. Return.
213 ;\f
214
215 ;
216 ; lptstat - get the printer status. Return a=0ffh if ok, or 0 if not.
217 lptstat:
218 xra a ; assume it is ok.. this may not be necessary
219 ret
220
221 ;
222 ; outlpt - output character in E to printer
223 ; console is selected.
224 ; preserves de.
225 outlpt:
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
230 mvi c,lstout
231 call bdos ;Char to printer
232 outlp1: pop d ; restore saved register pair
233 ret
234
235 ;
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
238 ; afterwards)
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.
241 delchr:
242 mvi e,bs ;get a backspace
243 jmp outcon
244
245 ; erase the character at the current cursor position
246 clrspc: mvi e,' '
247 call outcon
248 mvi e,bs ;get a backspace
249 jmp outcon
250
251 ; erase the current line
252 clrlin: lxi d,eralin
253 jmp prtstr
254
255 ; erase the whole screen, and go home. preserves b (but not c)
256 clrtop: lxi d,erascr
257 jmp prtstr
258
259
260 sysver: db 'Z80MU on IBM PC $'
261 IF lasm
262 LINK CPXVDU.ASM
263 ENDIF ;lasm - m80 will INCLUDE CPXVDU.ASM
264 \1a
265 \1a
266 \1a
267 \1a
268 \1a
269 \1a
270 \1a
271 \1a
272 \1a
273 \1a
274 \1a
275 \1a
276 \1a
277 \1a
278 \1a
279 \1a
280 \1a
281 \1a
282 \1a
283 \1a
284 \1a
285 \1a
286 \1a
287 \1a
288 \1a
289 \1a
290 \1a
291 \1a
292 \1a
293 \1a
294 \1a
295 \1a
296 \1a
297 \1a
298 \1a
299 \1a
300 \1a
301 \1a
302 \1a
303 \1a
304 \1a
305 \1a
306 \1a
307 \1a
308 \1a
309 \1a
310 \1a
311 \1a
312 \1a
313 \1a
314 \1a
315 \1a
316 \1a
317 \1a
318 \1a
319 \1a
320 \1a
321 \1a
322 \1a
323 \1a
324 \1a
325 \1a
326 \1a
327 \1a
328 \1a
329 \1a
330 \1a
331 \1a
332 \1a
333 \1a
334 \1a
335 \1a
336 \1a
337 \1a
338 \1a
339 \1a
340 \1a
341 \1a
342 \1a
343 \1a
344 \1a
345 \1a
346 \1a
347 \1a
348 \1a
349 \1a
350