]> cloudbase.mooo.com Git - kermit-80.git/blame - cpsdef.asm
Convert line endings to CP/M format (cr/lf).
[kermit-80.git] / cpsdef.asm
CommitLineData
e58a7a25
L
1; KERMIT - (Celtic for "FREE")\r
2;\r
3; This is the CP/M-80 implementation of the Columbia University\r
4; KERMIT file transfer protocol.\r
5;\r
6; Version 4.0\r
7;\r
8; Copyright June 1981,1982,1983,1984,1985\r
9; Columbia University\r
10;\r
11; Originally written by Bill Catchings of the Columbia University Center for\r
12; Computing Activities, 612 W. 115th St., New York, NY 10025.\r
13;\r
14; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,\r
15; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many\r
16; others. \r
17;\r
18; This file contains definitions used by both modules of Kermit.\r
19;\r
20; revision history:\r
21;\r
22;edit 9, 30-Nov-1990 by MF. Make "fairness" count "prfair" be 50 so\r
23; console gets checked a bit more often.\r
24; edit 8, 11-Sep-1990 by MF. Make default RECEIVE and SEND packet-size\r
25; 80 (per Kermit standard) as packet size is adjustable in Version\r
26; 4.10.\r
27; edit 7 16-Jun-86 OBSchou. Added cmnum in the command opcodes. This gets a\r
28; number from the user inot variable number. No checking on overflow.\r
29;\r
30; edit 6 13-May-86 OBSchou. BDOS calls trapped to check for console use\r
31; as we want to substitute in commands from a TAKE file. Trapping\r
32; means I dont have to go through an check ever BDOS call...\r
33;\r
34; edit 5: 22-Apr-86 by Bertil Schou, Loughborough University, UK\r
35; moved some definitions from the CP4SYS.ASM file to here for \r
36; Kermit version 4.06\r
37;\r
38; edit 4: 6-Feb-85 by Charles Carvalho\r
39; modify pcc007: replace ffussy assembly switch with runtime test.\r
40; add "getvnm" - get CP/M version number.\r
41;\r
42; edit 3: 13-Jan-85 by Vanya J.Cooper Pima Commun. College Tel: 602-884-6809\r
43;\r
44;pcc007 2-Jan-85 vjc modules:cp4def,cp4cmd\r
45; Cmifil is too fussy about what characters to accept in a\r
46; filespec. My CP/M manual says any printable character is ok\r
47; except <>.,;:?*[], and lower case. In practice, even those work\r
48; sometimes. Kermit itself uses '&' if file warning is on,\r
49; and then won't let you reference the file. Allow all\r
50; printable characters except those above. Add conditional\r
51; ffussy, so that if not ffussy, all special characters will be\r
52; allowed, just convert lower to upper-case.\r
53;\r
54;pcc008 2-Jan-85 vjc modules:cp4def,cp4tt,cp4utl\r
55; Keyboard input during CONNECT mode can get locked out if\r
56; there is enough input from the modem port to keep prtchr\r
57; busy. This can happen for example, if the printer is running\r
58; at the same speed as the modem line, leaving you helpless to\r
59; turn it off or abort the host. Add a fairness count, so that\r
60; at least every prfair characters we look at console input.\r
61;\r
62; edit 2: July 10, 1984 (CJC)\r
63; Remove defines for TRUE and FALSE, during reorganization for LASM\r
64; compatibility. If we're using LASM, this file is linked by CP4KER\r
65; or CP4TYP, and links to CP4MIT or CP4LNK. Also, push comments around\r
66; a little.\r
67;\r
68; edit 1: May, 1984 (CJC)\r
69; extracted from CPMBASE.M80 version 3.9; modifications are described\r
70; in the accompanying .UPD file.\r
71;\r
72\r
73;Symbolic Definitions for some ASCII characters\r
74;\r
75soh EQU 01O ;ASCII SOH (Control-A)\r
76cntlc EQU 03O ;ASCII ETX (Control-C)\r
77ctrlc EQU 03O ;ASCII ETX (Control-C)\r
78bell EQU 07O ;ASCII BEL (Control-G)\r
79bs EQU 10O ;ASCII backspace (Control-H)\r
80tab EQU 11O ;ASCII Tab (Control-I)\r
81lf EQU 12O ;ASCII Line Feed (CTRL-J)\r
82ff EQU 14O ;ASCII Form Feed (CTRL-L)\r
83cr EQU 15O ;ASCII Carriage Return (CTRL-M)\r
84space EQU 20h ;ASCII Space\r
85xon EQU 21O ;ASCII XON (Control-Q)\r
86xoff EQU 23O ;ASCII XOFF (Control-S)\r
87esc EQU 33O ;ASCII ESCape\r
88semico EQU 3bh ;ASCII Semicolon\r
89subt EQU 32O ;ASCII SUB (CTRL-Z)\r
90cntlz EQU subt ;ASCII SUB (Control-z) [6]\r
91ctrlz EQU subt ;ASCII SUB (Control-z)\r
92del EQU 177O ;ASCII DELete (rubout)\r
93;\f\r
94;BDOS calls\r
95IF NOT cpsker ;[6] If CPSKER is truem then system indep. stuff. We want\r
96 ;to trap BDOS calls and test for console activity\r
97bdos EQU 0005H ;BDOS entry point, for the following functions:\r
98ENDIF ;NOT cpsker [6]\r
99;\r
100;Function Name Function Input Parameters Output Parameter\r
101;============= ======== ================ ================\r
102; (ALL Function Numbers are passed in Register C)\r
103conin EQU 01H ;Read Console NONE ASCII Char in A\r
104conout EQU 02H ;Write Console ASCII Char in E NONE\r
105auxin EQU 03H ;Auxiliary input\r
106rdrin EQU 03H ;Read Reader NONE ASCII Char in A\r
107lstout EQU 05H ;Write List ASCII Char in E NONE\r
108dconio EQU 06H ;Direct Con I/O ASCII Char in E I/O Status in A\r
109 ; if E=0FEH,\r
110 ; Input if E=0FFH\r
111prstr EQU 09H ;Print String String-Address NONE\r
112 ; in DE (term=$)\r
113rdstr EQU 0AH ;Read Buffer Buffer-Address Read Buffer filled\r
114; in DE\r
115; Read Buffer Byte Function\r
116; 1 Maximum Buffer Length\r
117; 2 Current Buffer Length (returned value)\r
118; 3-n Data (returned values)\r
119;\r
120consta EQU 0BH ;Console Stat NONE LSB(A)=1 if char ready\r
121getvnm EQU 0CH ;Version Number NONE H=0 (CP/M), L=BDOS ver\r
122inbdos EQU 0DH ;Init BDOS NONE NONE\r
123logdsk EQU 0EH ;LOG-In disk Value in E NONE\r
124 ; A=0,B=1,...\r
125openf EQU 0FH ;Open File FCB-Addr in DE Byte Addr.of FCB,\r
126 ; or 0FFH if not\r
127closf EQU 10H ;Close File FCB-Addr in DE Byte Addr.of FCB,\r
128 ; or 0FFH if not\r
129sfirst EQU 11H ;Search File FCB-Addr in DE Byte Addr.of FCB(0-3),\r
130 ; or 0FFH if not\r
131snext EQU 12H ;Search next FCB-Addr in DE Byte Addr.of next FCB,\r
132 ; or 0FFH if not\r
133delf EQU 13H ;Delete File FCB-Addr in DE Byte Addr.of FCB(0-3),\r
134 ; or 0FFH if not\r
135readf EQU 14H ;Read Record FCB-Addr in DE 0=successful read\r
136 ; 1=read past EOF\r
137 ; 2=reading random data\r
138writef EQU 15H ;Write Record FCB-Addr in DE 0=successful write\r
139 ; 1=ERROR extending\r
140 ; 2=End of disk data\r
141 ; 255=No more DIR space\r
142makef EQU 16H ;Make File FCB-Addr in DE 0-3= success,\r
143 ; 255= no more dir space\r
144renam EQU 17H ;Rename File FCB-Addr in DE 0-3= success,\r
145 ; 255= file not found\r
146rdlog EQU 18H ;Ret. Log Code NONE Login Vector in HL\r
147rddrv EQU 19H ;Read Drive # NONE # of logged in drive in\r
148 ; (A=0,B=1,C=2....)\r
149setdma EQU 1AH ;Set DMA Addr. Addr. of 128 NONE\r
150 ; byte buffer in DE\r
151wrtprt EQU 1CH ;Write prot dsk NONE NONE\r
152getrov EQU 1DH ;Get R/O Vect. NONE HL= R/O Vect. value\r
153setfat EQU 1EH ;Set File Attr. FCB-Addr.in DE Dir. code in A\r
154gtdpar EQU 1FH ;Get DSK par. NONE HL=DPB Address\r
155usrcod EQU 20H ;Get/Set Usr.Cd E=0FFH (get) A=current code (get)\r
156 ; E-code (set) A=no value (set)\r
157rrand EQU 21H ;Read Random FCB-Addr in DE A=Return code\r
158wrand EQU 22H ;Write Random FCB-Addr in DE 1=read'g unwritten data\r
159 ; 2=(not used)\r
160 ; 3=can't close curr. ext\r
161 ; 4=seek to unwr. ext.\r
162 ; 5=dir overflow(write)\r
163 ; 6=seek past End of DSK\r
164cflsz EQU 23H ;Comp File Sz. FCB Addr.in DE Rand.Rec.field set to\r
165 ; File size\r
166setrar EQU 24H ;Set Rand. Rec. FCB-Addr.in DE Rand.Rec.field set\r
167\r
168; CPM 2 only:\r
169punout EQU 04H ;Write Punch ASCII Char in E NONE\r
170gtiob EQU 07H ;Get I/O status NONE I/O Status in A\r
171ptiob EQU 08H ;Put I/O status I/O Status in E NONE\r
172getalv EQU 1BH ;Get All.Vect. NONE All.Vect in HL\r
173\r
174; CPM 3 only:\r
175auxout EQU 04H ;Auxiliary output\r
176auxist EQU 07H ;Get AUXIN: status A=FF if character\r
177 ; ready, A=0 if none\r
178auxost EQU 08H ;Get AUXOUT: status A=FF if ready, A=0\r
179 ; if not ready\r
180getfs EQU 2EH ;Get free space E=drive # rec free in dma addr\r
181;\f\r
182parevn EQU 00H ;Even parity.\r
183parmrk EQU 03H ;Mark parity.\r
184parnon EQU 06H ;No parity (eighth bit is data).\r
185parodd EQU 09H ;Odd parity.\r
186parspc EQU 0CH ;Space parity.\r
187\r
188defpar EQU parnon ;Default parity.\r
189ibmpar EQU parmrk ;IBM COMTEN's parity.\r
190\r
191fcb EQU 5CH ;Location of File Control Block.\r
192fcbext equ fcb+12\r
193fcbrno equ fcb+33\r
194buff EQU 80H ;Location of file output buffer (DMA).\r
195bufsiz EQU 80H ;Size of DMA.\r
196\r
197maxfcb equ 64 ; maximum of 64 fcbs to be stored in multiple fcb bock\r
198\r
199maxpkt EQU '~'-' '+2O;Maximum size of a packet.\r
200maxtry EQU 05O ; Number of retries on a packet.\r
201imxtry EQU 20O ; Number of retries send initiate.\r
202prfair EQU 50 ;[pcc008] Prtchr fairness count\r
203\r
204; opcodes for command parser\r
205cmkey EQU 01H ;Parse a keyword.\r
206cmifi EQU 02H ;Parse an input file spec (can be wild).\r
207cmofi EQU 03H ;Parse an output file spec.\r
208cmcfm EQU 04H ;Parse a confirm.\r
209cmtxt EQU 05H ;Parse text.\r
210cmnum EQU 06h ;Parse a number\r
211cmifin EQU 10H ;Parse an input file spec (but no\r
212 ;Error output\r
213\r
214;[4] from CP4SYS.ASM\r
215;\f\r
216;=========================================================================\r
217; I/O Byte assignments (2-bit fields for 4 devices at loc 3)\r
218;\r
219;bits 6+7 LIST field\r
220; 0 LIST is Teletype device (TTY:)\r
221; 1 LIST is CRT device (CRT:)\r
222; 2 LIST is Lineprinter (LPT:)\r
223; 3 LIST is user defined (UL1:)\r
224;\r
225;bits 4+5 PUNCH field\r
226; 0 PUNCH is Teletype device (TTY:)\r
227; 1 PUNCH is high speed punch (PUN:)\r
228; 2 PUNCH is user defined #1 (UP1:)\r
229; 3 PUNCH is user defined #2 (UP2:)\r
230;\r
231;bits 2+3 READER field\r
232; 0 READER is Teletype device (TTY:)\r
233; 1 READER is high speed reader (RDR:)\r
234; 2 READER is user defined #1 (UR1:)\r
235; 3 READER is user defined #2 (UR2:)\r
236;\r
237;bits 0+1 CONSOLE field\r
238; 0 CONSOLE is console printer (TTY:)\r
239; 1 CONSOLE is CRT device (CRT:)\r
240; 2 CONSOLE is in Batch-mode (BAT:);READER = Input,\r
241; LIST = Output\r
242; 3 CONSOLE is user defined (UC1:)\r
243;\r
244;=========================================================================\r
245\r
246iobyte EQU 03H ;Location of I/O byte\r
247\r
248;[4] From CP4SYS.ASM\r
249;\r
250;\f\r
251;\r
252; Protocol parameters. Some of these can be changed with commands.\r
253;\r
254\r
255drpsiz SET 50H ;Default receive packet size. (maximum is 5EH)\r
256dspsiz SET 50H ;Default send packet size. (maximum is 5EH)\r
257dstime SET 08H ;Default send time out interval.\r
258drtime SET 05 ;Default receive time out interval\r
259\r
260dspad EQU 00H ;Default send padding.\r
261drpad EQU 00H ;Default receive padding.\r
262dspadc EQU 00H ;Default send padding char.\r
263drpadc EQU 00H ;Default receive padding char.\r
264dseol EQU CR ;Default send EOL char.\r
265dreol EQU CR ;Default receive EOL char.\r
266dsquot EQU '#' ;Default send quote char.\r
267drquot EQU '#' ;Default receive quote char.\r
268dschkt EQU '1' ;Default checksum type\r
269;\r
270\r
271; Define VT or Terminal type values\r
272vtdefo EQU 0 ;VT52 emulation by terminal itself.\r
273vtdefv EQU 1 ;VT52 emulation by ttab tables in CPXVDU.ASM etc\r
274vtdefd EQU 2 ;Dumb Terminal (Just prints)\r
275vtdefe EQU 3 ;Termianl emulation done outside (in overlay)\r
276\r
277\r
278; If this is being assembled by LASM, we need to LINK to one of two modules;\r
279; if we're not using LASM, no problem.\r
280; CPSKER.ASM defines "cpsker" TRUE, and CPXTYP.ASM defines it FALSE, so we can\r
281; determine what's going on.\r
282IF lasm AND cpsker ; building CP4KER with LASM?\r
283 LINK CPSMIT ; yes, chain to next piece.\r
284ENDIF;lasm AND cpsker\r
285IF lasm AND NOT cpsker ; LASM, but not building CP4KER?\r
286 LINK CPXLNK ; yes, chain to different piece.\r
287ENDIF;lasm AND NOT cpsker\r