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