]> cloudbase.mooo.com Git - kermit-80.git/blame - cpxsyo.asm
Bugfix in outmdm (output buffer flush)
[kermit-80.git] / cpxsyo.asm
CommitLineData
e58a7a25
L
1IF NOT lasm\r
2.printx * CPXSYO.ASM *\r
3ENDIF ;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 Sanyo MBC 1100\r
22; systems, and has been extracted from the CPMSYO.ASM code (kermit\r
23; version 3.5)\r
24;\r
25; revision history:\r
26;\r
27; edit 1, 27 October, 1987, by OBSchou. Extracted Sanyo code from CPMSYO.ASM\r
28; and massaged fort CP/M kermit V4.09\r
29;\r
30; Keep module name, edit number, and last revision date in memory.\r
31family: db 'CPXSYO.ASM (1) 27-Oct-87 $'\r
32;\f\r
33\r
34; Assembly time message to let me know I'm building the right version.\r
35; LASM generates an 'S' error along with the message, which is messy, but\r
36; better than trying to put everything inside a IF m80 OR mac80 conditional,\r
37; because LASM doesn't like nested IF's, either.\r
38\r
39IF sanyo\r
40.printx * Assembling Kermit-80 for Sanyo MBC 1100 *\r
41ENDIF\r
42\r
43iobyte EQU 03H ;Location of I/O byte\r
44\r
45if sanyo\r
46baudrt EQU 0DAH ;BAUD RATE MEMORY LOCATION\r
47MNPORT EQU 0DCH ;COMMUNICATIONS PORT\r
48MNPRTS EQU 0DDH ;COMMUNICATIONS PORT STATUS\r
49OUTPUT EQU 01H ;OUTPUT READY BIT\r
50INPUT EQU 02H ;INPUT READY BIT\r
51ENDIF;SANYO\r
52\r
53defesc EQU '\'-100O ;The default escape character.\r
54\r
55; Select initial setting for VT-52 emulation flag.\r
56vtval EQU 1\r
57\r
58\r
59sysxin: ;system initialisation not covered by sysinit\r
60 ret ; return from system-dependent routine\r
61\r
62;\f\r
63\r
64;\r
65; system-dependent termination processing\r
66; If we've changed anything, this is our last chance to put it back.\r
67sysexit:\r
68 ret\r
69\r
70;\r
71; system-dependent processing for start of CONNECT command\r
72;\r
73syscon:\r
74 ret\r
75\r
76;\f\r
77\r
78;\r
79; syscls - system-dependent close routine\r
80; called when exiting transparent session.\r
81;\r
82syscls:\r
83 ret\r
84;\f\r
85\r
86;\r
87; sysinh - help for system-dependent special functions.\r
88; called in response to <escape>?, after listing all the\r
89; system-independent escape sequences.\r
90;\r
91sysinh: \r
92 lxi d,inhlps ; we got options...\r
93 call prtstr ; print them.\r
94 ret\r
95inhlps:\r
96 db '$' ;[hh] table terminator\r
97\r
98;\r
99; sysint - system dependent special functions\r
100; called when transparent escape character has been typed;\r
101; the second character of the sequence is in A (and in B).\r
102; returns:\r
103; non-skip: sequence has been processed\r
104; skip: sequence was not recognized\r
105sysint:\r
106 ani 137O ; convert lower case to upper, for testing...\r
107 ret\r
108\r
109; sysflt - system-dependent filter.\r
110; called with the character in E.\r
111; preserves bc, de, hl.\r
112; note: <xon>,<xoff>,<del>, and <nul> are always discarded.\r
113sysflt:\r
114 mov a,e ; get character for testing\r
115 ret\r
116\r
117; mdmflt - modem filter [30]\r
118; called with character to be sent to printer in E\r
119; with parity set as appropriate.\r
120; return with accumulator = 0 do do nothing,\r
121; <> 0 to send char in E.\r
122mdmflt:\r
123 mov a,e ;[30] get character to test\r
124 ret\r
125\r
126\r
127; prtflt - printer filter [30]\r
128; called with character to be sent to printer in E\r
129; returns with a = 0 to do nothing\r
130; a <> 0 to print it.\r
131;\r
132; this routine for those printer that automatically insert\r
133; a lf on cr, or cr for lf. Should this be shifted to \r
134; the system indep. stuff, in say 4.06?\r
135prtflt:\r
136 mov a,e ; [30] get character to test\r
137 ret\r
138\r
139\r
140;\f\r
141\r
142;\r
143; system-dependent processing for BYE command.\r
144; for apmmdm, heath, and lobo, hang up the phone.\r
145sysbye:\r
146 ret\r
147;\f\r
148\r
149; This is the system-dependent command to change the baud rate.\r
150; DE contains the two-byte value from the baud rate table; this\r
151; value is also stored in 'speed'.\r
152sysspd:\r
153 ret\r
154\r
155;\f\r
156\r
157; Speed tables\r
158; (Note that speed tables MUST be in alphabetical order for later\r
159; lookup procedures, and must begin with a value showing the total\r
160; number of entries. The speed help tables are just for us poor\r
161; humans.\r
162\r
163; db string length,string,divisor (2 identical bytes or 1 word)\r
164; [Toad Hall]\r
165\r
166IF sanyo \r
167spdtbl EQU 0 ; No speed table for the Sanyo\r
168sphtbl EQU 0 ; ditto help for speed.\r
169\r
170; The following conditionals were once a huge if not statement. There\r
171; wasn't enough room to add the lobo to the list, so it had to be broken\r
172; into 2, which you can't do with an if not. I redid it as two ifs and\r
173; applied them to those that wouldn't set baud. [Hal Hostetler]\r
174;\f\r
175\r
176; This is the system-dependent SET PORT command.\r
177; HL contains the argument from the command table.\r
178sysprt:\r
179 ret\r
180;\f\r
181\r
182;\r
183; Port table not applicable tot he Sanyo...\r
184prttbl EQU 0\r
185prhtbl EQU 0 ;\r
186\r
187;\f\r
188\r
189;\r
190; selmdm - select modem port\r
191; selcon - select console port\r
192; selmdm is called before using inpmdm or outmdm;\r
193; selcon is called before using inpcon or outcon.\r
194; For iobyt systems, diddle the I/O byte to select console or comm port;\r
195; For Decision I, switches Multi I/O board to console or modem serial\r
196; port. [Toad Hall]\r
197; For the rest, does nothing.\r
198; preserves bc, de, hl.\r
199selmdm:\r
200 ret\r
201\r
202selcon:\r
203 ret\r
204;\f\r
205\r
206; Get character from console, or return zero.\r
207; result is returned in A. destroys bc, de, hl.\r
208;\r
209inpcon:\r
210 mvi c,dconio ;Direct console I/O BDOS call.\r
211 mvi e,0FFH ;Input.\r
212 call BDOS\r
213 ret\r
214;\f\r
215\r
216;\r
217; Output character in E to the console.\r
218; destroys bc, de, hl\r
219;\r
220outcon:\r
221 mvi c,dconio ;Console output bdos call.\r
222 call bdos ;Output the char to the console.\r
223 ret\r
224;\f\r
225\r
226;\r
227; outmdm - output a char from E to the modem.\r
228; the parity bit has been set as necessary.\r
229; returns nonskip; bc, de, hl preserved.\r
230outmdm:\r
231IF inout\r
232 in mnprts ;Get the output done flag.\r
233 ani output ;Is it set?\r
234 jz outmdm ;If not, loop until it is.\r
235 mov a,e\r
236 out mnport ;Output it.\r
237 ret\r
238ENDIF;inout\r
239\r
240;\f\r
241\r
242;\r
243; get character from modem; return zero if none available.\r
244; for IOBYT systems, the modem port has already been selected.\r
245; destroys bc, de, hl.\r
246inpmdm:\r
247IF inout\r
248;Note: modem port should already be selected for mdI. [Toad Hall]\r
249 in mnprts ;Get the port status into A.\r
250 ani input ;See if the input ready bit is on.\r
251 rz ;If not then return.\r
252 in mnport ;If so, get the char.\r
253ENDIF;inout\r
254 ret ; return with character in A\r
255\r
256\r
257;\r
258; flsmdm - flush comm line.\r
259; Modem is selected.\r
260; Currently, just gets characters until none are available.\r
261\r
262flsmdm: call inpmdm ; Try to get a character\r
263 ora a ; Got one?\r
264 jnz flsmdm ; If so, try for another\r
265 ret ; Receiver is drained. Return.\r
266\r
267\r
268;\f\r
269\r
270;\r
271; lptstat - get the printer status. Return a=0 if ok, or 0ffh if not.\r
272lptstat:\r
273 xra a ; assume it is ok.. this may not be necessary\r
274 ret\r
275;\f\r
276\r
277;\r
278; outlpt - output character in E to printer\r
279; console is selected.\r
280; preserves de.\r
281outlpt:\r
282 push d ; save DE in either case\r
283 call prtflt ; go through printer filter [30]\r
284 ana a ; if A = 0 do nothing,\r
285 jz outlp1 ; [30] if a=0 do nothing\r
286 mvi c,lstout\r
287 call bdos ;Char to printer\r
288outlp1: pop d ; restore saved register pair\r
289 ret\r
290;\f\r
291\r
292;\r
293; Screen manipulation routines\r
294; csrpos - move to row B, column C\r
295;\r
296; csrpos for terminals that use a leadin sequence followed\r
297; by (row + 31.) and (column + 31.)\r
298;\r
299csrpos: push b ; save coordinates\r
300 lxi d,curldn ; get cursor leadin sequence\r
301 call prtstr ; print it\r
302 pop h ; restore coordinates\r
303 mov a,h ; get row\r
304 adi (' '-1) ; space is row one\r
305 mov e,a\r
306 push h\r
307 call outcon ; output row\r
308 pop h\r
309 mov a,l ; get column\r
310 adi (' '-1) ; space is column one\r
311 mov e,a\r
312 jmp outcon ; output it and return\r
313ENDIF;NOT (robin OR dmII OR osi OR vector OR termin)\r
314\r
315 ret ; Can the Sany do cursor opsitioning??\r
316\r
317;\r
318;\r
319; delchr - make delete look like a backspace. Unless delete is a printing\r
320; character, we just need to print a backspace. (we'll output clrspc\r
321; afterwards)\r
322; For Kaypro and Vector General, delete puts a blotch on the screen.\r
323; For Apple and Osborne 1, delete moves but doesn't print.\r
324delchr:\r
325 mvi e,bs\r
326 call outcon\r
327\r
328; erase the character at the current cursor position\r
329clrspc: mvi e,' '\r
330 call outcon\r
331 mvi e,bs ;get a backspace\r
332 jmp outcon\r
333\r
334; erase the current line\r
335clrlin: lxi d,eralin\r
336 jmp prtstr\r
337\r
338; erase the whole screen, and go home. preserves b (but not c)\r
339clrtop: lxi d,erascr\r
340 jmp prtstr\r
341\r
342\r
343\r
344IF SANYO\r
345outlin: DB ESC,'E',ESC,'H',CR,LF,TAB ;WHATEVER\r
346sysver: DB 'KERMIT-80 V3.9 [SANYO MBC-1100]',CR,LF,'$' ;VERSION HEADING\r
347DELSTR: DB ESC,'K','$' ;WHATS A STRING?\r
348eralin: DB ESC,'P','$' ;CLEAR SPACE\r
349;CLRLIN: DB ESC,'K','$' ;CLEAR LINE\r
350erascr: DB ESC,'E',ESC,'H','$' ;CLEAR SCREEN AND CURSOR HOME\r
351curldn: db esc,'=','$',0 ;cursor lead in\r
352;SCRNP: DB ESC,'=',24H,25H,'$' ;SPOT FOR SCREEN PACKETS\r
353;SCRNRT: DB ESC,'=',25H,25H,'$' ;SPOT FOR # OF RETRIES\r
354;SCRFLN: DB ESC,'=',26H,25H,'$' ;SPOT FOR FILE NAME\r
355;SCRST: DB ESC,'=',28H,25H,'$' ;SPOT FOR STATUS\r
356;SCREND: DB ESC,'=',2AH,25H,'$' ;SPOT FOR PROMPT\r
357;SCRERR: DB ESC,'=',2DH,25H,'$' ;SPOT FOR ERRORS\r
358ttab: ;NO TRANSLATION TABLE\r
359ta: DB ESC,'A',0,0 ;CURSOR UP\r
360tb: DB ESC,'B',0,0 ;CURSOR DOWN\r
361tc: DB ESC,'D',0,0 ;CURSOR RIGHT\r
362td: DB ESC,'C',0,0 ;CURSOR LEFT\r
363te: DB ESC,'E',0,0 ;CLEAR SCREEN\r
364tf: DB 0,0,0,0 ;WHAT???\r
365tg: DB 0,0,0,0 ;WHAT???\r
366th: DB ESC,'H',0,0 ;CURSOR HOME\r
367ti: DB ESC,'A',ESC,'C',0,0 ;REVERSE LINEFEED??\r
368tj: DB ESC,'J',0,0 ;CLEAR TO END OF SCREEN\r
369tk: DB ESC,'K',0,0 ;CLEAR TO END OF LINE\r
370ENDIF;SANYO\r
371\r
372ovlend equ $ ; End of overlay\r
373\r
374 END\r
375\1a\r
376\1a\r
377\1a\r
378\1a\r
379\1a\r
380\1a\r
381\1a\r
382\1a\r
383\1a\r
384\1a\r
385\1a\r
386\1a\r
387\1a\r
388\1a\r
389\r