]> cloudbase.mooo.com Git - kermit-80.git/blob - cpxlnk.asm
Bugfix in outmdm (output buffer flush)
[kermit-80.git] / cpxlnk.asm
1 ; CPXLNK.ASM
2 ; KERMIT - (Celtic for "FREE")
3 ;
4 ; This is the CP/M-80 implementation of the Columbia University
5 ; KERMIT file transfer protocol.
6 ;
7 ; Version 4.0
8 ;
9 ; Copyright June 1981,1982,1983,1984
10 ; Columbia University
11 ;
12 ; Originally written by Bill Catchings of the Columbia University Center for
13 ; Computing Activities, 612 W. 115th St., New York, NY 10025.
14 ;
15 ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
16 ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
17 ; others.
18 ;
19 ; This file describes the areas used to communicate between KERMIT
20 ; and the customizing overlay. It is included by the overlay.
21 ; This file should be changed only to reflect changes in the
22 ; system-independent portion of Kermit (enhancements, I hope).
23 ;
24 ; revision history:
25 ;edit 8, 14-Sep-1990 by MF. Added variable "incflg" to hold incomplete-
26 ; file status for SET INCOMPLETE-FILES command.
27 ; edit 7: 8 April, 1987 by OBSchou. Added a new entry EXTERN to leap off to
28 ; code written by the user to emulate any terminal they want. All
29 ; characters are sent here in stead of conout during connect state.
30 ; In due course, Ill trap all prtstrs and dconio as well.
31 ;
32 ; edit 6: May 30, 1986 by OBSchou. Added two more entries to the link area:
33 ; first to point to a "family" string giving the family name of the
34 ; system. If the older CP4SYS.ASM still has the code, then the
35 ; string is null. Secondly, a JMP to give printer status (should be
36 ; a BIOS function). If 0 then printer is ready, if 0ffh then printer
37 ; busy. This makes version 4.07 incompatable with 4.05
38 ;
39 ; edit 5: February 6, 1985
40 ; Added a storage variable, "PORT", for the port-in-use value
41 ; required for the port status routine (same purpose as SPEED).
42 ; Also moved the printer copy flag (PRNFLG:) into the commun-
43 ; ications storage area so machine dependant overlay can access it.
44 ; [Hal Hostetler]
45 ; Also, replace assembly-time conditional "ffussy" with run-time
46 ; switch (CJC).
47 ;
48 ; edit 4: August 21, 1984 (CJC)
49 ; Define a use for the third word of the linkage section: it points
50 ; to the version string for CP4SYS.ASM. Add flsmdm, to flush comm line
51 ; on startup. Add bufadr and bufsec for multiple-sector buffer support.
52 ; Shift the entry section up two bytes so we can exit cleanly from DDT.
53 ;
54 ; edit 3: August 3, 1984 (CJC)
55 ; put "mover" in CP4SYS, so we can do a Z80 block move if so inclined.
56 ;
57 ; edit 2: July 10, 1984 (CJC)
58 ; integrate Toad Hall changes for LASM compatibility: CP4LNK is linked
59 ; by CP4DEF, and links CP4SYS.
60 ;
61 ; edit 1: May, 1984 (CJC)
62 ; extracted from CPMBASE.M80 version 3.9; modifications are described
63 ; in the accompanying .UPD file.
64 ;
65
66 ; Define the entry section. These addresses contain jumps to
67 ; useful routines in KERMIT. To show we know what we're doing,
68 ; we store the length of this section (entsiz) in our linkage
69 ; section. I didn't use ORG and DS because I don't want zeroes
70 ; generated for all the space between here and the actual start
71 ; of cp4sys.
72 entry equ 105H ; start of entry section
73 kermit equ entry+0 ; reentry address
74 nout equ entry+3 ; output HL in decimal
75 entsiz equ 2*3 ; 2 entries, so far.
76 ;
77 ; End of entry section.
78 ;
79 ; Linkage section. This block (through the definition of lnksiz)
80 ; is used by Kermit to reach the routines and data in the overlay.
81 ; The section length is stored at the beginning of the overlay
82 ; area so Kermit can verify that the overlay section is (a) present,
83 ; (b) in the right place, and (c) the same size as (and therefore
84 ; presumably the same as) the linkage section Kermit is expecting.
85 ;
86 ASEG
87 ORG OVLADR
88 ;
89 lnkflg: dw lnksiz ; linkage information for consistency check.
90 dw entsiz ; length of entry table, for same.
91 dw swtver ; address of switcher. CPXSYS now a family
92 dw family ;*NEW* for V4.08. Address of the family string
93 ;
94 ; hooks for system-dependent routines:
95 ;
96 ; Input/output routines.
97 ;
98 jmp selmdm ; select modem for I/O
99 jmp outmdm ; output character in E to modem
100 jmp inpmdm ; read character from modem. return character or 0 in A.
101 jmp flsmdm ; flush pending input from modem
102 jmp selcon ; select console for I/O
103 jmp outcon ; output character in E to console
104 jmp inpcon ; read char from console. return character or 0 in A
105 jmp outlpt ; output character in E to printer
106 jmp lptstat ;*NEW* get the status for the printer.
107 ; 0=>ok, 0ffh=> not ok
108 jmp 0 ;*NEW for 4.09* Terminal Emulation code (optional)
109 ; If terminal is set to EXTERNAL and this address
110 ; has been filled, then user uses their own code.
111 xbdos: jmp 0 ;*NEW* Address of the BDOS trap in the independent
112 ; code. Use this enty for BDOS calls if you want
113 ; the printer handler to work properly.
114
115 ; screen formatting routines
116 jmp clrlin ; erase current line
117 jmp clrspc ; erase current position (after backspace)
118 jmp delchr ; make delete look like backspace
119 jmp clrtop ; erase screen and go home
120 ;
121 ; these routines are called to display a field on the screen.
122 jmp scrend ; move to prompt field
123 jmp screrr ; move to error message field
124 jmp scrfln ; move to filename field
125 jmp scrnp ; move to packet count field
126 jmp scrnrt ; move to retry count field
127 jmp scrst ; move to status field
128 jmp rppos ; move to receive packet field (debug)
129 jmp sppos ; move to send packet field (debug)
130 ;
131 jmp sysinit ; program initialization
132 jmp sysexit ; program termination
133 jmp syscon ; remote session initialization
134 jmp syscls ; return to local command level
135 jmp sysinh ; help text for interrupt (escape) extensions
136 jmp sysint ; interrupt (escape) extensions, including break
137 jmp sysflt ; filter for incoming characters.
138 ; called with character in E.
139 jmp sysbye ; terminate remote session
140 jmp sysspd ; baud rate change routine.
141 ; called with value from table in DE
142 jmp sysprt ; port change routine.
143 ; called with value from table in HL
144 jmp sysscr ; screen setup for file transfer
145 ; called with Kermit's version string in DE
146 jmp csrpos ; move cursor to row B, column C
147 jmp sysspc ; calculate free space for current drive
148 jmp mover ; do block move
149 jmp prtstr ; *** NEW *** Link from system indep equivalent
150 ;
151 ; Local parameter values
152 ;
153 pttab: dw ttab ; points to local equivalents to VT52 escape sequences
154 spdtab: dw spdtbl ; address of baud rate command table, or zero
155 spdhlp: dw sphtbl ; address of baud rate help table, or zero
156 prttab: dw prttbl ; address of port command table, or zero
157 prthlp: dw prhtbl ; address of port help table, or zero
158 timout: dw fuzval ; Fuzzy timeout.
159 vtflg: db vtval ; VT52 emulation flag
160 escchr: db defesc ; Storage for the escape character.
161 speed: dw 0FFFFH ; storage for the baud rate (initially unknown)
162 port: dw 0FFFFH ; storage for port value (initially unknown) [hh]
163 prnflg: db 0 ; printer copy flag [hh]
164 dbgflg: db 0 ; debugging flag
165 ecoflg: db 0 ; Local echo flag (default off).
166 flwflg: db 1 ; File warning flag (default on).
167 ibmflg: db 0 ; IBM flag (default off).
168 cpmflg: db 0 ;[bt] file-mode flag (default is DEFAULT)
169 incflg: db 0 ;[MF]incomplete-file flag (default is DISCARD)
170 parity: db defpar ; Parity.
171 spsiz: db dspsiz ; Send packet size.
172 rpsiz: db drpsiz ; Receive packet size.
173 stime: db dstime ; Send time out.
174 rtime: db drtime ; Receive time out.
175 spad: db dspad ; Send padding.
176 rpad: db drpad ; Receive padding.
177 spadch: db dspadc ; Send padding char.
178 rpadch: db drpadc ; Receive padding char.
179 seol: db dseol ; Send EOL char.
180 reol: db dreol ; Receive EOL char.
181 squote: db dsquot ; Send quote char.
182 rquote: db drquot ; Receive quote char.
183 chktyp: db dschkt ; Checksum type desired
184 tacflg: ; TACtrap status:
185 IF tac
186 db tacval ; when non-zero, is current TAC intercept character;
187 ENDIF;tac
188 IF NOT tac
189 db 0 ; when zero, TACtrap is off.
190 ENDIF;tac
191 tacchr: db tacval ; Desired TAC intercept character (even when off)
192 bufadr: dw buff ; Address of possibly multi-sector buffer for I/O
193 bufsec: db 1 ; Number of sectors big buffer can hold (0 means 256)
194 ffussy: db 1 ; if nonzero, don't permit <>.,;?*[] in CP/M filespec.
195 ; space used by directory command; here because space calculation is
196 ; (operating) system-dependent
197 bmax: ds 2 ; highest block number on drive
198 bmask: ds 1 ; (records/block)-1
199 bshiftf: ds 1 ; number of shifts to multiply by rec/block
200 nnams: ds 1 ; counter for filenames per line
201
202 lnksiz equ $-lnkflg ; length of linkage section, for consistency check.
203
204 IF lasm ; If we're assembling with LASM,
205 LINK CPXCOM ; get the next section.
206 ENDIF;lasm