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