-; CPXLNK.ASM
-; KERMIT - (Celtic for "FREE")
-;
-; This is the CP/M-80 implementation of the Columbia University
-; KERMIT file transfer protocol.
-;
-; Version 4.0
-;
-; Copyright June 1981,1982,1983,1984
-; Columbia University
-;
-; Originally written by Bill Catchings of the Columbia University Center for
-; Computing Activities, 612 W. 115th St., New York, NY 10025.
-;
-; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
-; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
-; others.
-;
-; This file describes the areas used to communicate between KERMIT
-; and the customizing overlay. It is included by the overlay.
-; This file should be changed only to reflect changes in the
-; system-independent portion of Kermit (enhancements, I hope).
-;
-; revision history:
-;edit 8, 14-Sep-1990 by MF. Added variable "incflg" to hold incomplete-
-; file status for SET INCOMPLETE-FILES command.
-; edit 7: 8 April, 1987 by OBSchou. Added a new entry EXTERN to leap off to
-; code written by the user to emulate any terminal they want. All
-; characters are sent here in stead of conout during connect state.
-; In due course, Ill trap all prtstrs and dconio as well.
-;
-; edit 6: May 30, 1986 by OBSchou. Added two more entries to the link area:
-; first to point to a "family" string giving the family name of the
-; system. If the older CP4SYS.ASM still has the code, then the
-; string is null. Secondly, a JMP to give printer status (should be
-; a BIOS function). If 0 then printer is ready, if 0ffh then printer
-; busy. This makes version 4.07 incompatable with 4.05
-;
-; edit 5: February 6, 1985
-; Added a storage variable, "PORT", for the port-in-use value
-; required for the port status routine (same purpose as SPEED).
-; Also moved the printer copy flag (PRNFLG:) into the commun-
-; ications storage area so machine dependant overlay can access it.
-; [Hal Hostetler]
-; Also, replace assembly-time conditional "ffussy" with run-time
-; switch (CJC).
-;
-; edit 4: August 21, 1984 (CJC)
-; Define a use for the third word of the linkage section: it points
-; to the version string for CP4SYS.ASM. Add flsmdm, to flush comm line
-; on startup. Add bufadr and bufsec for multiple-sector buffer support.
-; Shift the entry section up two bytes so we can exit cleanly from DDT.
-;
-; edit 3: August 3, 1984 (CJC)
-; put "mover" in CP4SYS, so we can do a Z80 block move if so inclined.
-;
-; edit 2: July 10, 1984 (CJC)
-; integrate Toad Hall changes for LASM compatibility: CP4LNK is linked
-; by CP4DEF, and links CP4SYS.
-;
-; edit 1: May, 1984 (CJC)
-; extracted from CPMBASE.M80 version 3.9; modifications are described
-; in the accompanying .UPD file.
-;
-
-; Define the entry section. These addresses contain jumps to
-; useful routines in KERMIT. To show we know what we're doing,
-; we store the length of this section (entsiz) in our linkage
-; section. I didn't use ORG and DS because I don't want zeroes
-; generated for all the space between here and the actual start
-; of cp4sys.
-entry equ 105H ; start of entry section
-kermit equ entry+0 ; reentry address
-nout equ entry+3 ; output HL in decimal
-entsiz equ 2*3 ; 2 entries, so far.
-;
-; End of entry section.
-;
-; Linkage section. This block (through the definition of lnksiz)
-; is used by Kermit to reach the routines and data in the overlay.
-; The section length is stored at the beginning of the overlay
-; area so Kermit can verify that the overlay section is (a) present,
-; (b) in the right place, and (c) the same size as (and therefore
-; presumably the same as) the linkage section Kermit is expecting.
-;
- ASEG
- ORG OVLADR
-;
-lnkflg: dw lnksiz ; linkage information for consistency check.
- dw entsiz ; length of entry table, for same.
- dw swtver ; address of switcher. CPXSYS now a family
- dw family ;*NEW* for V4.08. Address of the family string
-;
-; hooks for system-dependent routines:
-;
-; Input/output routines.
-;
- jmp selmdm ; select modem for I/O
- jmp outmdm ; output character in E to modem
- jmp inpmdm ; read character from modem. return character or 0 in A.
- jmp flsmdm ; flush pending input from modem
- jmp selcon ; select console for I/O
- jmp outcon ; output character in E to console
- jmp inpcon ; read char from console. return character or 0 in A
- jmp outlpt ; output character in E to printer
- jmp lptstat ;*NEW* get the status for the printer.
- ; 0=>ok, 0ffh=> not ok
- jmp 0 ;*NEW for 4.09* Terminal Emulation code (optional)
- ; If terminal is set to EXTERNAL and this address
- ; has been filled, then user uses their own code.
-xbdos: jmp 0 ;*NEW* Address of the BDOS trap in the independent
- ; code. Use this enty for BDOS calls if you want
- ; the printer handler to work properly.
-
-; screen formatting routines
- jmp clrlin ; erase current line
- jmp clrspc ; erase current position (after backspace)
- jmp delchr ; make delete look like backspace
- jmp clrtop ; erase screen and go home
-;
-; these routines are called to display a field on the screen.
- jmp scrend ; move to prompt field
- jmp screrr ; move to error message field
- jmp scrfln ; move to filename field
- jmp scrnp ; move to packet count field
- jmp scrnrt ; move to retry count field
- jmp scrst ; move to status field
- jmp rppos ; move to receive packet field (debug)
- jmp sppos ; move to send packet field (debug)
-;
- jmp sysinit ; program initialization
- jmp sysexit ; program termination
- jmp syscon ; remote session initialization
- jmp syscls ; return to local command level
- jmp sysinh ; help text for interrupt (escape) extensions
- jmp sysint ; interrupt (escape) extensions, including break
- jmp sysflt ; filter for incoming characters.
- ; called with character in E.
- jmp sysbye ; terminate remote session
- jmp sysspd ; baud rate change routine.
- ; called with value from table in DE
- jmp sysprt ; port change routine.
- ; called with value from table in HL
- jmp sysscr ; screen setup for file transfer
- ; called with Kermit's version string in DE
- jmp csrpos ; move cursor to row B, column C
- jmp sysspc ; calculate free space for current drive
- jmp mover ; do block move
- jmp prtstr ; *** NEW *** Link from system indep equivalent
-;
-; Local parameter values
-;
-pttab: dw ttab ; points to local equivalents to VT52 escape sequences
-spdtab: dw spdtbl ; address of baud rate command table, or zero
-spdhlp: dw sphtbl ; address of baud rate help table, or zero
-prttab: dw prttbl ; address of port command table, or zero
-prthlp: dw prhtbl ; address of port help table, or zero
-timout: dw fuzval ; Fuzzy timeout.
-vtflg: db vtval ; VT52 emulation flag
-escchr: db defesc ; Storage for the escape character.
-speed: dw 0FFFFH ; storage for the baud rate (initially unknown)
-port: dw 0FFFFH ; storage for port value (initially unknown) [hh]
-prnflg: db 0 ; printer copy flag [hh]
-dbgflg: db 0 ; debugging flag
-ecoflg: db 0 ; Local echo flag (default off).
-flwflg: db 1 ; File warning flag (default on).
-ibmflg: db 0 ; IBM flag (default off).
-cpmflg: db 0 ;[bt] file-mode flag (default is DEFAULT)
-incflg: db 0 ;[MF]incomplete-file flag (default is DISCARD)
-parity: db defpar ; Parity.
-spsiz: db dspsiz ; Send packet size.
-rpsiz: db drpsiz ; Receive packet size.
-stime: db dstime ; Send time out.
-rtime: db drtime ; Receive time out.
-spad: db dspad ; Send padding.
-rpad: db drpad ; Receive padding.
-spadch: db dspadc ; Send padding char.
-rpadch: db drpadc ; Receive padding char.
-seol: db dseol ; Send EOL char.
-reol: db dreol ; Receive EOL char.
-squote: db dsquot ; Send quote char.
-rquote: db drquot ; Receive quote char.
-chktyp: db dschkt ; Checksum type desired
-tacflg: ; TACtrap status:
-IF tac
- db tacval ; when non-zero, is current TAC intercept character;
-ENDIF;tac
-IF NOT tac
- db 0 ; when zero, TACtrap is off.
-ENDIF;tac
-tacchr: db tacval ; Desired TAC intercept character (even when off)
-bufadr: dw buff ; Address of possibly multi-sector buffer for I/O
-bufsec: db 1 ; Number of sectors big buffer can hold (0 means 256)
-ffussy: db 1 ; if nonzero, don't permit <>.,;?*[] in CP/M filespec.
-; space used by directory command; here because space calculation is
-; (operating) system-dependent
-bmax: ds 2 ; highest block number on drive
-bmask: ds 1 ; (records/block)-1
-bshiftf: ds 1 ; number of shifts to multiply by rec/block
-nnams: ds 1 ; counter for filenames per line
-
-lnksiz equ $-lnkflg ; length of linkage section, for consistency check.
-
-IF lasm ; If we're assembling with LASM,
- LINK CPXCOM ; get the next section.
-ENDIF;lasm
+; CPXLNK.ASM\r
+; KERMIT - (Celtic for "FREE")\r
+;\r
+; This is the CP/M-80 implementation of the Columbia University\r
+; KERMIT file transfer protocol.\r
+;\r
+; Version 4.0\r
+;\r
+; Copyright June 1981,1982,1983,1984\r
+; Columbia University\r
+;\r
+; Originally written by Bill Catchings of the Columbia University Center for\r
+; Computing Activities, 612 W. 115th St., New York, NY 10025.\r
+;\r
+; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,\r
+; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many\r
+; others. \r
+;\r
+; This file describes the areas used to communicate between KERMIT\r
+; and the customizing overlay. It is included by the overlay.\r
+; This file should be changed only to reflect changes in the\r
+; system-independent portion of Kermit (enhancements, I hope).\r
+;\r
+; revision history:\r
+;edit 8, 14-Sep-1990 by MF. Added variable "incflg" to hold incomplete-\r
+; file status for SET INCOMPLETE-FILES command.\r
+; edit 7: 8 April, 1987 by OBSchou. Added a new entry EXTERN to leap off to\r
+; code written by the user to emulate any terminal they want. All \r
+; characters are sent here in stead of conout during connect state. \r
+; In due course, Ill trap all prtstrs and dconio as well.\r
+;\r
+; edit 6: May 30, 1986 by OBSchou. Added two more entries to the link area:\r
+; first to point to a "family" string giving the family name of the \r
+; system. If the older CP4SYS.ASM still has the code, then the \r
+; string is null. Secondly, a JMP to give printer status (should be \r
+; a BIOS function). If 0 then printer is ready, if 0ffh then printer \r
+; busy. This makes version 4.07 incompatable with 4.05\r
+;\r
+; edit 5: February 6, 1985\r
+; Added a storage variable, "PORT", for the port-in-use value \r
+; required for the port status routine (same purpose as SPEED).\r
+; Also moved the printer copy flag (PRNFLG:) into the commun-\r
+; ications storage area so machine dependant overlay can access it.\r
+; [Hal Hostetler]\r
+; Also, replace assembly-time conditional "ffussy" with run-time\r
+; switch (CJC).\r
+;\r
+; edit 4: August 21, 1984 (CJC)\r
+; Define a use for the third word of the linkage section: it points\r
+; to the version string for CP4SYS.ASM. Add flsmdm, to flush comm line\r
+; on startup. Add bufadr and bufsec for multiple-sector buffer support.\r
+; Shift the entry section up two bytes so we can exit cleanly from DDT.\r
+;\r
+; edit 3: August 3, 1984 (CJC)\r
+; put "mover" in CP4SYS, so we can do a Z80 block move if so inclined.\r
+;\r
+; edit 2: July 10, 1984 (CJC)\r
+; integrate Toad Hall changes for LASM compatibility: CP4LNK is linked\r
+; by CP4DEF, and links CP4SYS.\r
+;\r
+; edit 1: May, 1984 (CJC)\r
+; extracted from CPMBASE.M80 version 3.9; modifications are described\r
+; in the accompanying .UPD file.\r
+;\r
+\r
+; Define the entry section. These addresses contain jumps to\r
+; useful routines in KERMIT. To show we know what we're doing,\r
+; we store the length of this section (entsiz) in our linkage\r
+; section. I didn't use ORG and DS because I don't want zeroes\r
+; generated for all the space between here and the actual start\r
+; of cp4sys.\r
+entry equ 105H ; start of entry section\r
+kermit equ entry+0 ; reentry address\r
+nout equ entry+3 ; output HL in decimal\r
+entsiz equ 2*3 ; 2 entries, so far.\r
+;\r
+; End of entry section.\r
+;\r
+; Linkage section. This block (through the definition of lnksiz)\r
+; is used by Kermit to reach the routines and data in the overlay.\r
+; The section length is stored at the beginning of the overlay\r
+; area so Kermit can verify that the overlay section is (a) present,\r
+; (b) in the right place, and (c) the same size as (and therefore\r
+; presumably the same as) the linkage section Kermit is expecting.\r
+;\r
+ ASEG\r
+ ORG OVLADR\r
+;\r
+lnkflg: dw lnksiz ; linkage information for consistency check.\r
+ dw entsiz ; length of entry table, for same.\r
+ dw swtver ; address of switcher. CPXSYS now a family\r
+ dw family ;*NEW* for V4.08. Address of the family string\r
+;\r
+; hooks for system-dependent routines:\r
+;\r
+; Input/output routines. \r
+;\r
+ jmp selmdm ; select modem for I/O\r
+ jmp outmdm ; output character in E to modem\r
+ jmp inpmdm ; read character from modem. return character or 0 in A.\r
+ jmp flsmdm ; flush pending input from modem\r
+ jmp selcon ; select console for I/O\r
+ jmp outcon ; output character in E to console\r
+ jmp inpcon ; read char from console. return character or 0 in A\r
+ jmp outlpt ; output character in E to printer\r
+ jmp lptstat ;*NEW* get the status for the printer. \r
+ ; 0=>ok, 0ffh=> not ok\r
+ jmp 0 ;*NEW for 4.09* Terminal Emulation code (optional)\r
+ ; If terminal is set to EXTERNAL and this address\r
+ ; has been filled, then user uses their own code.\r
+xbdos: jmp 0 ;*NEW* Address of the BDOS trap in the independent \r
+ ; code. Use this enty for BDOS calls if you want \r
+ ; the printer handler to work properly.\r
+\r
+; screen formatting routines\r
+ jmp clrlin ; erase current line\r
+ jmp clrspc ; erase current position (after backspace)\r
+ jmp delchr ; make delete look like backspace\r
+ jmp clrtop ; erase screen and go home\r
+;\r
+; these routines are called to display a field on the screen.\r
+ jmp scrend ; move to prompt field\r
+ jmp screrr ; move to error message field\r
+ jmp scrfln ; move to filename field\r
+ jmp scrnp ; move to packet count field\r
+ jmp scrnrt ; move to retry count field\r
+ jmp scrst ; move to status field\r
+ jmp rppos ; move to receive packet field (debug)\r
+ jmp sppos ; move to send packet field (debug)\r
+;\r
+ jmp sysinit ; program initialization\r
+ jmp sysexit ; program termination\r
+ jmp syscon ; remote session initialization\r
+ jmp syscls ; return to local command level\r
+ jmp sysinh ; help text for interrupt (escape) extensions\r
+ jmp sysint ; interrupt (escape) extensions, including break\r
+ jmp sysflt ; filter for incoming characters.\r
+ ; called with character in E.\r
+ jmp sysbye ; terminate remote session\r
+ jmp sysspd ; baud rate change routine.\r
+ ; called with value from table in DE\r
+ jmp sysprt ; port change routine.\r
+ ; called with value from table in HL\r
+ jmp sysscr ; screen setup for file transfer\r
+ ; called with Kermit's version string in DE\r
+ jmp csrpos ; move cursor to row B, column C\r
+ jmp sysspc ; calculate free space for current drive\r
+ jmp mover ; do block move\r
+ jmp prtstr ; *** NEW *** Link from system indep equivalent\r
+;\r
+; Local parameter values\r
+;\r
+pttab: dw ttab ; points to local equivalents to VT52 escape sequences\r
+spdtab: dw spdtbl ; address of baud rate command table, or zero\r
+spdhlp: dw sphtbl ; address of baud rate help table, or zero\r
+prttab: dw prttbl ; address of port command table, or zero\r
+prthlp: dw prhtbl ; address of port help table, or zero\r
+timout: dw fuzval ; Fuzzy timeout.\r
+vtflg: db vtval ; VT52 emulation flag\r
+escchr: db defesc ; Storage for the escape character.\r
+speed: dw 0FFFFH ; storage for the baud rate (initially unknown)\r
+port: dw 0FFFFH ; storage for port value (initially unknown) [hh]\r
+prnflg: db 0 ; printer copy flag [hh]\r
+dbgflg: db 0 ; debugging flag\r
+ecoflg: db 0 ; Local echo flag (default off).\r
+flwflg: db 1 ; File warning flag (default on).\r
+ibmflg: db 0 ; IBM flag (default off).\r
+cpmflg: db 0 ;[bt] file-mode flag (default is DEFAULT)\r
+incflg: db 0 ;[MF]incomplete-file flag (default is DISCARD)\r
+parity: db defpar ; Parity.\r
+spsiz: db dspsiz ; Send packet size.\r
+rpsiz: db drpsiz ; Receive packet size.\r
+stime: db dstime ; Send time out.\r
+rtime: db drtime ; Receive time out.\r
+spad: db dspad ; Send padding.\r
+rpad: db drpad ; Receive padding.\r
+spadch: db dspadc ; Send padding char.\r
+rpadch: db drpadc ; Receive padding char.\r
+seol: db dseol ; Send EOL char.\r
+reol: db dreol ; Receive EOL char.\r
+squote: db dsquot ; Send quote char.\r
+rquote: db drquot ; Receive quote char.\r
+chktyp: db dschkt ; Checksum type desired\r
+tacflg: ; TACtrap status:\r
+IF tac\r
+ db tacval ; when non-zero, is current TAC intercept character;\r
+ENDIF;tac\r
+IF NOT tac\r
+ db 0 ; when zero, TACtrap is off.\r
+ENDIF;tac\r
+tacchr: db tacval ; Desired TAC intercept character (even when off)\r
+bufadr: dw buff ; Address of possibly multi-sector buffer for I/O\r
+bufsec: db 1 ; Number of sectors big buffer can hold (0 means 256)\r
+ffussy: db 1 ; if nonzero, don't permit <>.,;?*[] in CP/M filespec.\r
+; space used by directory command; here because space calculation is\r
+; (operating) system-dependent\r
+bmax: ds 2 ; highest block number on drive\r
+bmask: ds 1 ; (records/block)-1\r
+bshiftf: ds 1 ; number of shifts to multiply by rec/block\r
+nnams: ds 1 ; counter for filenames per line\r
+\r
+lnksiz equ $-lnkflg ; length of linkage section, for consistency check.\r
+\r
+IF lasm ; If we're assembling with LASM,\r
+ LINK CPXCOM ; get the next section.\r
+ENDIF;lasm\r