]> cloudbase.mooo.com Git - kermit-80.git/blob - cpxvdu.asm
Import of "Kermit 80 for CP/M-80 and CP/M-85" from http://www.columbia.edu/kermit...
[kermit-80.git] / cpxvdu.asm
1 IF NOT lasm
2 .printx * CPXVDU.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
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 ;edit 6, 12-Oct-1990 by MF. Added a semicolon to the comment "If we
22 ; need cursor ..." so it isn't seen as an undefined symbol
23 ; edit 5, 20 July by OBSchou. Put in the cursor positioning code for
24 ; all the terminal supported, and moved the vtval EQUs and defesc EQUs
25 ; here if the system requires andn external terminal. If the system
26 ; has a 'built in' terminal (ie own scrteen driver) you will not come
27 ; to this file, so you must declare these three lables etc in your
28 ; own code.
29 ; This will allow only those systems requiring a terminal to require
30 ; CPXVDU.ASM during assembly.
31 ;
32 ; edit 4, 16 July, 1987 by OBSchou for will Rose.
33 ; Added code for Ampro 230 terminal
34 ;
35 ; edit 3, 15 July, 1987 by OBSchou for David Moore. Added adm22 terminal
36 ; codes.
37 ;
38 ; edit 2 21 May, 1987 by OBSchou. Added in definitions for Hazeltine 1500
39 ; submitted by Colin Burns of the Institute of Neurological Sciences
40 ; in Glasgow.
41 ; edit 1 ??? date. Split the terminal codes off from the CPXSYS.ASM file
42 ;
43 vduver: db 'CPXVDU.ASM (6) 12-Oct-1990 $' ;file, edit version,, date.
44
45
46 ; First, print out what terminal (if any) we are assembling for
47
48 IF crt
49 .printx * generic CRT selected *
50 ENDIF
51
52 IF adm3a
53 .printx * ADM3A selected *
54 ENDIF
55
56 IF adm22
57 .printx * ADM22 selected *
58 ENDIF
59
60 IF smrtvd ;[7]
61 .printx * Netronics Smartvid-80 selected *
62 ENDIF ;[7]
63
64 IF tvi912
65 .printx * TVI912/920 selected *
66 ENDIF
67
68 IF tvi925
69 .printx * TVI925 selected *
70 ENDIF
71
72 IF vt52
73 .printx * VT52 selected *
74 ENDIF
75
76 IF vt100
77 .printx * VT100 selected *
78 ENDIF
79
80 IF am230
81 .printx * Ampro 230 terminal selected *
82 ENDIF
83
84 IF wyse
85 .printx * Wyse 100 terminal selected *
86 ENDIF
87 ;
88
89 ;\f
90 ; If we need cursor positioning, here is the code to do it
91 ;
92 ; Screen manipulation routines
93 ; csrpos - move to row B, column C
94 ;
95 ; csrpos for terminals that use a leadin sequence followed
96 ; by (row + 31.) and (column + 31.)
97 ;
98 IF NOT (vt100 OR crt OR h1500)
99 csrpos: push b ; save coordinates
100 lxi d,curldn ; get cursor leadin sequence
101 call prtstr ; print it
102 pop h ; restore coordinates
103 mov a,h ; get row
104 adi (' '-1) ; space is row one
105 mov e,a
106 push h
107 call outcon ; output row
108 pop h
109 mov a,l ; get column
110 adi (' '-1) ; space is column one
111 mov e,a
112 jmp outcon ; output it and return
113 ENDIF;NOT (vt100 OR crt OR h1500)
114 ;
115 ;
116 ;
117 ;
118 ; csrpos for ANSI terminals
119 ;
120 IF vt100
121 csrpos: push b ; save coordinates
122 lxi d,curldn ; get cursor leadin sequence
123 call prtstr ; print it
124 pop h ; peek at coordinates
125 push h ; then save away again
126 mov l,h ; l = row
127 mvi h,0 ; hl = row
128 call nout ; output in decimal
129 mvi e,';' ; follow with semicolon
130 call outcon ; print it
131 pop h ; restore column
132 mvi h,0 ; hl = column
133 call nout
134 mvi e,'H' ; terminate with 'move cursor' command
135 jmp outcon ; output it and return
136 ENDIF;vt100
137
138 ;Definition for Hazeltine 1500 does things a little strange.
139 ;
140 IF h1500
141 csrpos: push b ; save coordinates
142 lxi d,curldn ; get cursor leadin sequence
143 call prtstr ; print it
144 pop h ; restore coordinates
145 mov a,l ; get col
146 nop
147 nop
148 ; adi (' '-1) ; space is row one
149 mov e,a
150 push h
151 call outcon ; output row
152 pop h
153 mov a,h ; get row
154 adi (' '-1) ; space is column one
155 mov e,a
156 jmp outcon ; output it and return
157 ENDIF; h1500
158
159
160 IF crt ; systems without cursor positioning
161 csrpos: ret ; dummy routine referenced by linkage section
162 ENDIF;crt
163 ;
164 ;
165 ;
166 ; Now for the rest of CPXVDU.ASM
167 ;
168 ;
169 ;
170 IF crt ;Set flags etc for systems with CRT selected
171 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
172 vtval EQU 0FFH ; we can't support VT52 emulation
173 ttytyp: db 'Generic (Dumb) CRT Terminal type selected $'
174 ENDIF;crt
175
176 ;\f
177
178 IF vt52 ; DEC VT52
179 ttytyp: db 'VT52$'
180 ENDIF;vt52
181
182 IF vt52
183 vtval EQU 0 ; we don't need VT52 emulation
184 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
185 outlin: db esc,'H',esc,'J',cr,lf,tab,tab,'$'
186 erascr: db esc,'H',esc,'J$' ;Clear screen and go home.
187 eralin: db cr,esc,'K$' ;Clear line.
188 curldn: db esc,'Y$' ;cursor leadin
189 ttab: ;Table start location.
190 ta: db esc,'A$',0 ;Cursor up.
191 tb: db esc,'B$',0 ;Cursor down.
192 tc: db esc,'C$',0 ;Cursor right.
193 td: db esc,'D$',0 ;Cursor left
194 te: db esc,'E$',0 ;Clear display
195 tf: db esc,'F$',0 ;Enter Graphics Mode
196 tg: db esc,'G$',0 ;Exit Graphics mode
197 th: db esc,'H$',0 ;Cursor home.
198 ti: db esc,'I$',0 ;Reverse linefeed.
199 tj: db esc,'J$',0 ;Clear to end of screen.
200 tk: db esc,'K$',0 ;Clear to end of line.
201 ENDIF;vt52
202 ;\f
203
204 IF adm22
205 vtval EQU 1 ; we can do VT52 emulation
206 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
207 ttytyp: db 'ADM22$'
208 outlin: db 1ah,cr,lf,tab,tab,'$'
209 erascr: db 1ah,'$' ;Clear screen and go home.
210 eralin: db esc,'>$' ;Clear line.
211 curldn: db esc,'=$' ;Cursor lead-in
212 ttab: ;Table start location.
213 ta: db 0BH,'$',0,0 ;Cursor up.
214 tb: db lf,'$',0,0 ;Cursor down.
215 tc: db 0CH,'$',0,0 ;Cursor right.
216 td: db bs,'$',0,0 ;Cursor left
217 te: db 1ah,':$',0 ;Clear display
218 tf: db '$',0,0,0 ;(can't) Enter Graphics Mode
219 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
220 th: db 1EH,'$',0,0 ;Cursor home.
221 ti: db 0BH,'$',0,0 ;Reverse linefeed.
222 tj: db esc,'Y$',0 ;Clear to end of screen.
223 tk: db esc,'T$',0 ;Clear to end of line.
224 ENDIF;adm22
225 ;\f
226
227 IF am230
228 ; Select initial setting for VT-52 emulation flag.
229 vtval EQU 1
230 defesc EQU '\'-100O ;The default is Control-\ -- it's easier
231 ttytyp: db 'Am230$'
232 outlin: db 'Z'-64,0,0,cr,lf,'$'
233 erascr: db 'Z'-64,0,0,'$' ;Clear screen and home
234 eralin: db esc,'R$',0 ;Erase line
235 curldn: db cr,esc,'=$' ;Cursor lead-in
236 ttab: ;Table start location ;(MUST be 4 bytes each)
237 ta: db 'K'-64,'$',0,0 ;Cursor up, stop at top
238 tb: db 'V'-64,'$',0,0 ;Cursor down, stop at bottom
239 tc: db 'L'-64,'$',0,0 ;Cursor right, stop at right
240 td: db 'H'-64,'$',0,0 ;Cursor left, stop at left
241 te: db 'Z'-64,0,0,'$' ;Clear display (2 pad nulls)
242 tf: db '$',0,0,0 ;(can't) Enter Graphics mode
243 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
244 th: db 1EH,'$',0,0 ;Cursor home
245 ti: db esc,'j$',0 ;Reverse linefeed, scroll
246 tj: db esc,'Y$',0 ;Clear to end of sreen
247 tk: db esc,'T$',0 ;Clear to end of line
248 ENDIF
249 ;
250 ;\f
251
252
253 IF vt100
254 ttytyp: db 'VT100$'
255 ENDIF;vt100
256
257
258 IF vt100
259 ; Note that we cannot support Graphics Mode or the H19 erase-screen command
260 ; (<esc>E), because the sequences are more than three bytes.
261 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
262 vtval EQU 0 ; we probably don't want VT52 emulation
263 outlin: db esc,3CH,esc,'[H',esc,'[J',cr,lf,tab,tab,'$'
264 erascr: db esc,'[H',esc,'[J$' ;Clear screen and go home.
265 eralin: db cr,esc,'[K$' ;Clear line.
266 curldn: db esc,'[$' ; Cursor leadin
267 ttab:
268 ta: db esc,'[A$' ; Cursor up.
269 tb: db esc,'[B$' ; Cursor down.
270 tc: db esc,'[C$' ; Cursor right.
271 td: db esc,'[D$' ; Cursor left
272 te: db '$',0,0,0 ; (can't) Clear display
273 tf: db '$',0,0,0 ; (don't) Enter Graphics Mode
274 tg: db '$',0,0,0 ; (don't) Exit Graphics mode
275 th: db esc,'[H$' ; Cursor home.
276 ti: db esc,'M$',0 ; Reverse linefeed.
277 tj: db esc,'[J$' ; Clear to end of screen.
278 tk: db esc,'[K$' ; Clear to end of line.
279 ENDIF;vt100
280 ;\f
281
282 IF gener or cpm3
283 sysver: db 'Generic CP/M-80$'
284 ENDIF;gener or cpm3
285
286
287 IF soroq ;[29] Should this not be with terminals.....
288 ttytyp: db 'Soroc IQ-120$'
289 outlin: db 1EH,esc,'Y',cr,lf,tab,tab,'$'
290 erascr: db 1EH,esc,'Y$' ;clear screen and home cursor
291 eralin: db cr,esc,'T$' ;clear line
292 curldn: db esc,'=$' ;cursor lead-in string
293 delstr: db bs,' ',bs,bs,'$' ;??adjust for echoing delete
294 ttab: ;table start location
295 ta: db 0BH,'$',0 ;cursor up
296 tb: db 0AH,'$',0 ;cursor down
297 tc: db 0CH,'$',0 ;cursor right
298 td: db 08H,'$',0 ;cursor left
299 te: db esc,'*$',0 ;clear display (homes cursor)
300 tf: db esc,')$',0 ;enter inverse video mode
301 tg: db esc,'($',0 ;exit inverse video mode
302 th: db 01EH,'$',0 ;home cursor
303 ti: db 0BH,'$',0 ;reverse linefeed (insert line)
304 tj: db esc,'Y$',0 ;clear to end of screen
305 tk: db esc,'T$',0 ;clear to end of line
306 ENDIF;soroq
307
308 IF crt
309 outlin: db cr,lf,'Starting ...$'
310 erascr equ crlf ;"Home & clear" (best we can do).
311 eralin: db '^U',cr,lf,'$' ;Clear line.
312 prpack: db cr,lf,'RPack: $'
313 pspack: db cr,lf,'SPack: $'
314 ttab equ 0 ; no VT52 table
315 ENDIF;crt
316 ;\f
317
318 IF tvi912
319 vtval EQU 1 ; we do emulation
320 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
321 ttytyp: db 'TVI912/920$'
322 outlin: db 'Z'-64,0,0,cr,lf,'$'
323 erascr: db 'Z'-64,0,0,'$' ;Clear screen and home
324 eralin: db esc,'Y$',0 ;Clear to end of sreen
325 curldn: db cr,esc,'=$' ;Cursor lead-in
326 ttab: ;Table start location ;(MUST be 4 bytes each)
327 ta: db 'K'-64,'$',0,0 ;Cursor up, stop at top
328 tb: db 'J'-64,'$',0,0 ;Cursor down, stop at bottom
329 tc: db 'L'-64,'$',0,0 ;Cursor right, stop at right
330 td: db 'H'-64,'$',0,0 ;Cursor left, stop at left
331 te: db 'Z'-64,0,0,'$' ;Clear display (2 pad nulls)
332 tf: db '$',0,0,0 ;(can't) Enter Graphics mode
333 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
334 th: db 1EH,'$',0,0 ;Cursor home
335 ti: db esc,'j$',0 ;Reverse linefeed, scroll
336 tj: db esc,'Y$',0 ;Clear to end of sreen
337 tk: db esc,'T$',0 ;Clear to end of line
338 ENDIF;tvi912
339 ;
340 ;\f
341
342 IF tvi925
343 ;(incidentally, works fine for Freedom 100 also [Toad Hall])
344 ;adm3a entry and tvi925 entry separated to remove warning message.
345 vtval EQU 1 ; we VT52 emulation
346 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
347 ttytyp: db 'TVI925$'
348 outlin: db 'Z'-64,0,0,cr,lf,'$'
349 erascr: db 'Z'-64,0,0,'$' ;Clear screen and home
350 eralin: db esc,'Y$',0 ;Clear to end of sreen
351 curldn: db cr,esc,'=$' ;Cursor lead-in
352 ttab: ;Table start location ;(MUST be 4 bytes each)
353 ta: db 'K'-64,'$',0,0 ;Cursor up, stop at top
354 tb: db 'V'-64,'$',0,0 ;Cursor down, stop at bottom
355 tc: db 'L'-64,'$',0,0 ;Cursor right, stop at right
356 td: db 'H'-64,'$',0,0 ;Cursor left, stop at left
357 te: db 'Z'-64,0,0,'$' ;Clear display (2 pad nulls)
358 tf: db '$',0,0,0 ;(can't) Enter Graphics mode
359 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
360 th: db 1EH,'$',0,0 ;Cursor home
361 ti: db esc,'j$',0 ;Reverse linefeed, scroll
362 tj: db esc,'Y$',0 ;Clear to end of sreen
363 tk: db esc,'T$',0 ;Clear to end of line
364 ENDIF;tvi925
365 ;
366 ;\f
367
368 IF adm3a
369 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
370 ttytyp: db 'ADM3A$'
371 outlin: db 'Z'-64,0,0,cr,lf,'$'
372 erascr: db 'Z'-64,0,0,'$' ;Clear screen and home
373 eralin: db esc,'Y$',0 ;Clear to end of sreen
374 curldn: db cr,esc,'=$' ;Cursor lead-in
375 ttab: ;Table start location ;(MUST be 4 bytes each)
376 ta: db 'K'-64,'$',0,0 ;Cursor up, stop at top
377 tb: db 'J'-64,'$',0,0 ;Cursor down CTRL-J
378 tc: db 'L'-64,'$',0,0 ;Cursor right, stop at right
379 td: db 'H'-64,'$',0,0 ;Cursor left, stop at left
380 te: db 'Z'-64,0,0,'$' ;Clear display (2 pad nulls)
381 tf: db '$',0,0,0 ;(can't) Enter Graphics mode
382 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
383 th: db 1EH,'$',0,0 ;Cursor home
384 ti: db 'K'-64,'$',0,0 ;Reverse linefeed
385 tj: db '$',0,0,0 ;(can't) Clear to end of screen
386 tk: db '$',0,0,0 ;(can't) Clear to end of line
387 ENDIF;adm3a
388
389
390 IF smrtvd ; [7] new terminal
391 vtval EQU 1 ; we do VT52 emulation
392 defesc EQU '\'-100O ; escpae character, ok?
393 ttytyp: db 'Smartvid-80$'
394 outlin: db esc,'+',cr,lf,tab,tab,'$'
395 eralin: db cr,esc,'T$' ;Clear to end of line.
396 erascr: db esc,'+$' ;Clear screen and go home.
397 curldn: db esc,'=$' ;Cursor lead-in
398 ttab: ;Table start location.
399 ta: db ('K'-100O),'$',0,0 ;Cursor up.
400 tb: db 12O,'$',0,0 ;Cursor down.
401 tc: db ('A'-100O),'$',0,0 ;Cursor right.
402 td: db ('H'-100O),'$',0,0 ;Cursor left.
403 te: db ('L'-100O),'$',0,0 ;Clear screen and home cursor
404 tf: db '$',0,0,0 ;(can't) Enter Graphics mode
405 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
406 th: db ('Z'-100O),'$',0,0 ;Cursor home.
407 ti: db ('K'-100O),'$',0,0 ;Reverse linefeed.
408 tj: db esc,'Y$',0 ;Clear to end of screen.
409 tk: db esc,'T$',0 ;Clear to end of line.
410 ENDIF;smrtvd
411
412 IF h1500
413 vtval EQU 1 ; we can do VT52 emulation
414 defesc EQU '\'-100O ;Still Control-\ (just ran out of room...)
415 ttytyp: db 'Hazeltine$'
416 outlin: db 7eh,1ch,7eh,12h,'$'
417 erascr: db 7eh,1ch,7eh,12h,'$' ;Clear screen and home
418 eralin: db 7eh,13h,'$',0 ;Clear to end of sreen
419 curldn: db 7eh,11h,'$',0 ;Cursor lead-in
420 ttab: ;Table start location ;(MUST be 4 bytes each)
421 ta: db 7eh,0ch,'$',0 ;Cursor up, stop at top
422 tb: db 7eh,0bh,'$',0 ;Cursor down CTRL-J
423 tc: db 10h,'$',0,0 ;Cursor right, stop at right
424 td: db 8h,'$',0,0 ;Cursor left, stop at left
425 te: db 7eh,1ch,'$',0 ;Clear display (2 pad nulls)
426 tf: db '$',0,0,0 ;(can't) Enter Graphics mode
427 tg: db '$',0,0,0 ;(can't) Exit Graphics mode
428 th: db 7eh,0ch,'$',0 ;Cursor home
429 ti: db 7eh,0ch,'$',0 ;Reverse linefeed
430 tj: db '$',0,0,0 ;(can't) Clear to end of screen
431 tk: db 7eh,0fh,'$',0 ;Clear to end of line
432 ENDIF;h1500
433
434 IF wyse ;[gv]
435 vtval equ 1 ; we can do VT52 emulation
436 defesc EQU '\' ;Still Control-\ (just ran out of room...)
437 ttytyp: db ' [Wyse 100]',cr,lf,'$'
438 outlin: db esc,'+$',0 ;Clear screen and home
439 erascr: db esc,'+$',0 ;Clear screen and home
440 eralin: db esc,'Y$',0 ;Clear to end of sreen
441 curldn: db cr,esc,'=$' ;Cursor lead-in
442 ttab: ;Table start location ;(MUST be 4 bytes each)
443 ta: db 03h,'$',0,0 ;Cursor up, stop at top
444 tb: db lf,'$',0,0 ;Cursor down, stop at bottom
445 tc: db ff,'$',0,0 ;Cursor right, stop at right
446 td: db bs,'$',0,0 ;Cursor left, stop at left
447 te: db sub,0,0,'$' ;Clear display (2 pad nulls)
448 tf: db '$',0,0,0 ;Enter Graphics mode NONE
449 tg: db '$',0,0,0 ;Exit Graphics mode NONE
450 th: db 1eh,'$',0,0 ;Cursor home
451 ti: db esc,'v$',0 ;Reverse linefeed, scroll ???
452 tj: db esc,'Y$',0 ;Clear to end of sreen
453 tk: db esc,'T$',0 ;Clear to end of line
454 ENDIF;wyse
455
456
457
458 ovlend equ $ ; End of overlay
459
460 IF lasm ;Not really needed, as M80 ignores END in include files
461 END
462 ENDIF ;lasm