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 part for Sanyo MBC 1100
22 ; systems, and has been extracted from the CPMSYO.ASM code (kermit
27 ; edit 1, 27 October, 1987, by OBSchou. Extracted Sanyo code from CPMSYO.ASM
28 ; and massaged fort CP/M kermit V4.09
30 ; Keep module name, edit number, and last revision date in memory.
31 family: db 'CPXSYO.ASM (1) 27-Oct-87 $'
34 ; Assembly time message to let me know I'm building the right version.
35 ; LASM generates an 'S' error along with the message, which is messy, but
36 ; better than trying to put everything inside a IF m80 OR mac80 conditional,
37 ; because LASM doesn't like nested IF's, either.
40 .printx * Assembling Kermit-80 for Sanyo MBC 1100 *
43 iobyte EQU 03H ;Location of I/O byte
46 baudrt EQU 0DAH ;BAUD RATE MEMORY LOCATION
47 MNPORT EQU 0DCH ;COMMUNICATIONS PORT
48 MNPRTS EQU 0DDH ;COMMUNICATIONS PORT STATUS
49 OUTPUT EQU 01H ;OUTPUT READY BIT
50 INPUT EQU 02H ;INPUT READY BIT
53 defesc EQU '\'-100O ;The default escape character.
55 ; Select initial setting for VT-52 emulation flag.
59 sysxin: ;system initialisation not covered by sysinit
60 ret ; return from system-dependent routine
65 ; system-dependent termination processing
66 ; If we've changed anything, this is our last chance to put it back.
71 ; system-dependent processing for start of CONNECT command
79 ; syscls - system-dependent close routine
80 ; called when exiting transparent session.
87 ; sysinh - help for system-dependent special functions.
88 ; called in response to <escape>?, after listing all the
89 ; system-independent escape sequences.
92 lxi d,inhlps ; we got options...
93 call prtstr ; print them.
96 db '$' ;[hh] table terminator
99 ; sysint - system dependent special functions
100 ; called when transparent escape character has been typed;
101 ; the second character of the sequence is in A (and in B).
103 ; non-skip: sequence has been processed
104 ; skip: sequence was not recognized
106 ani 137O ; convert lower case to upper, for testing...
109 ; sysflt - system-dependent filter.
110 ; called with the character in E.
111 ; preserves bc, de, hl.
112 ; note: <xon>,<xoff>,<del>, and <nul> are always discarded.
114 mov a,e ; get character for testing
117 ; mdmflt - modem filter [30]
118 ; called with character to be sent to printer in E
119 ; with parity set as appropriate.
120 ; return with accumulator = 0 do do nothing,
121 ; <> 0 to send char in E.
123 mov a,e ;[30] get character to test
127 ; prtflt - printer filter [30]
128 ; called with character to be sent to printer in E
129 ; returns with a = 0 to do nothing
130 ; a <> 0 to print it.
132 ; this routine for those printer that automatically insert
133 ; a lf on cr, or cr for lf. Should this be shifted to
134 ; the system indep. stuff, in say 4.06?
136 mov a,e ; [30] get character to test
143 ; system-dependent processing for BYE command.
144 ; for apmmdm, heath, and lobo, hang up the phone.
149 ; This is the system-dependent command to change the baud rate.
150 ; DE contains the two-byte value from the baud rate table; this
151 ; value is also stored in 'speed'.
158 ; (Note that speed tables MUST be in alphabetical order for later
159 ; lookup procedures, and must begin with a value showing the total
160 ; number of entries. The speed help tables are just for us poor
163 ; db string length,string,divisor (2 identical bytes or 1 word)
167 spdtbl EQU 0 ; No speed table for the Sanyo
168 sphtbl EQU 0 ; ditto help for speed.
170 ; The following conditionals were once a huge if not statement. There
171 ; wasn't enough room to add the lobo to the list, so it had to be broken
172 ; into 2, which you can't do with an if not. I redid it as two ifs and
173 ; applied them to those that wouldn't set baud. [Hal Hostetler]
176 ; This is the system-dependent SET PORT command.
177 ; HL contains the argument from the command table.
183 ; Port table not applicable tot he Sanyo...
190 ; selmdm - select modem port
191 ; selcon - select console port
192 ; selmdm is called before using inpmdm or outmdm;
193 ; selcon is called before using inpcon or outcon.
194 ; For iobyt systems, diddle the I/O byte to select console or comm port;
195 ; For Decision I, switches Multi I/O board to console or modem serial
197 ; For the rest, does nothing.
198 ; preserves bc, de, hl.
206 ; Get character from console, or return zero.
207 ; result is returned in A. destroys bc, de, hl.
210 mvi c,dconio ;Direct console I/O BDOS call.
217 ; Output character in E to the console.
218 ; destroys bc, de, hl
221 mvi c,dconio ;Console output bdos call.
222 call bdos ;Output the char to the console.
227 ; outmdm - output a char from E to the modem.
228 ; the parity bit has been set as necessary.
229 ; returns nonskip; bc, de, hl preserved.
232 in mnprts ;Get the output done flag.
233 ani output ;Is it set?
234 jz outmdm ;If not, loop until it is.
236 out mnport ;Output it.
243 ; get character from modem; return zero if none available.
244 ; for IOBYT systems, the modem port has already been selected.
245 ; destroys bc, de, hl.
248 ;Note: modem port should already be selected for mdI. [Toad Hall]
249 in mnprts ;Get the port status into A.
250 ani input ;See if the input ready bit is on.
251 rz ;If not then return.
252 in mnport ;If so, get the char.
254 ret ; return with character in A
258 ; flsmdm - flush comm line.
260 ; Currently, just gets characters until none are available.
262 flsmdm: call inpmdm ; Try to get a character
264 jnz flsmdm ; If so, try for another
265 ret ; Receiver is drained. Return.
271 ; lptstat - get the printer status. Return a=0 if ok, or 0ffh if not.
273 xra a ; assume it is ok.. this may not be necessary
278 ; outlpt - output character in E to printer
279 ; console is selected.
282 push d ; save DE in either case
283 call prtflt ; go through printer filter [30]
284 ana a ; if A = 0 do nothing,
285 jz outlp1 ; [30] if a=0 do nothing
287 call bdos ;Char to printer
288 outlp1: pop d ; restore saved register pair
293 ; Screen manipulation routines
294 ; csrpos - move to row B, column C
296 ; csrpos for terminals that use a leadin sequence followed
297 ; by (row + 31.) and (column + 31.)
299 csrpos: push b ; save coordinates
300 lxi d,curldn ; get cursor leadin sequence
301 call prtstr ; print it
302 pop h ; restore coordinates
304 adi (' '-1) ; space is row one
307 call outcon ; output row
310 adi (' '-1) ; space is column one
312 jmp outcon ; output it and return
313 ENDIF;NOT (robin OR dmII OR osi OR vector OR termin)
315 ret ; Can the Sany do cursor opsitioning??
319 ; delchr - make delete look like a backspace. Unless delete is a printing
320 ; character, we just need to print a backspace. (we'll output clrspc
322 ; For Kaypro and Vector General, delete puts a blotch on the screen.
323 ; For Apple and Osborne 1, delete moves but doesn't print.
328 ; erase the character at the current cursor position
331 mvi e,bs ;get a backspace
334 ; erase the current line
338 ; erase the whole screen, and go home. preserves b (but not c)
345 outlin: DB ESC,'E',ESC,'H',CR,LF,TAB ;WHATEVER
346 sysver: DB 'KERMIT-80 V3.9 [SANYO MBC-1100]',CR,LF,'$' ;VERSION HEADING
347 DELSTR: DB ESC,'K','$' ;WHATS A STRING?
348 eralin: DB ESC,'P','$' ;CLEAR SPACE
349 ;CLRLIN: DB ESC,'K','$' ;CLEAR LINE
350 erascr: DB ESC,'E',ESC,'H','$' ;CLEAR SCREEN AND CURSOR HOME
351 curldn: db esc,'=','$',0 ;cursor lead in
352 ;SCRNP: DB ESC,'=',24H,25H,'$' ;SPOT FOR SCREEN PACKETS
353 ;SCRNRT: DB ESC,'=',25H,25H,'$' ;SPOT FOR # OF RETRIES
354 ;SCRFLN: DB ESC,'=',26H,25H,'$' ;SPOT FOR FILE NAME
355 ;SCRST: DB ESC,'=',28H,25H,'$' ;SPOT FOR STATUS
356 ;SCREND: DB ESC,'=',2AH,25H,'$' ;SPOT FOR PROMPT
357 ;SCRERR: DB ESC,'=',2DH,25H,'$' ;SPOT FOR ERRORS
358 ttab: ;NO TRANSLATION TABLE
359 ta: DB ESC,'A',0,0 ;CURSOR UP
360 tb: DB ESC,'B',0,0 ;CURSOR DOWN
361 tc: DB ESC,'D',0,0 ;CURSOR RIGHT
362 td: DB ESC,'C',0,0 ;CURSOR LEFT
363 te: DB ESC,'E',0,0 ;CLEAR SCREEN
364 tf: DB 0,0,0,0 ;WHAT???
365 tg: DB 0,0,0,0 ;WHAT???
366 th: DB ESC,'H',0,0 ;CURSOR HOME
367 ti: DB ESC,'A',ESC,'C',0,0 ;REVERSE LINEFEED??
368 tj: DB ESC,'J',0,0 ;CLEAR TO END OF SCREEN
369 tk: DB ESC,'K',0,0 ;CLEAR TO END OF LINE
372 ovlend equ $ ; End of overlay