]> cloudbase.mooo.com Git - kermit-80.git/blobdiff - cpsdat.asm
Convert line endings to CP/M format (cr/lf).
[kermit-80.git] / cpsdat.asm
index 729ca5210ceb710141ca2cec9bf12b10897f8b4a..b8f3f660aaaabe8deb5452c241601fd1a41dcb81 100644 (file)
-; CPSDAT.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,1985
-;       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. 
-;
-;       Pure and impure data areas. Previously of CPSUTL.ASM
-;
-; revision history:
-;
-;edit 19, 29-Mar-1991 by MF. Add flag "initak" (nonzero) which is cleared
-;      after the initial automatic TAKE attempt of KERMIT.INI to allow
-;      "unable to find file" complaints if not doing that initial TAKE.
-;edit 18, 21-Mar-1991 by MF. Renamed parameter vermin to revno (revision
-;      level) since verno is already known as the "minor version number".
-;edit 17, 27-Feb-1991 by MF. Corrected typeo in "inms19" and commented out
-;      "typptr" pointer as the TYPE command now uses the big buffer.
-;      Also provided for a "minor version number" (1-26=A-Z) and message to
-;      facilitate display of Kermit version in VERSION command (modmsg)
-;edit 16, 12-Feb-1991 by MF. Eliminated storage (message and variable)
-;      for case sensitivity by commenting it out.
-;edit 15, 9-Dec-1990 by MF. Modified message for "directory file size"
-;      status report to make it clearer when spoken by a speech synthesizer.
-;edit 14, 4-Dec-1990 by MF. Added message for Autoreceive status report.
-;edit 13, 30-Nov-1990 by MF. Added messages to display regular/quiet status
-;      of terminal in SHOW and STATUS commands.
-;edit 12, 8-Nov-1990 by MF.  Added a new message for Set Autoreceive.
-;edit 11, 2-Nov-1990 by MF.  Moved overlay address to 7000H -- I didn't
-;      realize I was **that** close to the limit until I made a couple of
-;      cosmetic changes and REM CD bombed.  This is still ver. 4.10 as it
-;      hasn''t been released yet.
-;edit 10, 1-Nov-1990 by MF.  Changed message at "spdst" to conform with
-;      the change of "SET BAUD-RATE" to "SET SPEED".
-;      Also added message "sdpst2" for speed status (staspd) routine
-;edit 9, 17-Oct-1990 by MF.  Changed "packet-size" messages to use the
-;      word "length" to conform with the nomenclature suggested in the
-;      6th edition of the Kermit Protocol Manual.
-;edit 8, 19-Sep-1990 by MF.  Added error message for FRENAME command.
-;edit 7, 14-Sep-1990 by MF.  Added storage/strings for SET COLLISION command.
-;      Also added strings/storage for SET INCOMPLETE-FILE command.
-;edit 6, 9-Sep-1990 by MF.  Added messages and storage for Remote commands.
-;      and display of packet sizes
-;      Moved overlay address to 06C00H for Version 4.10.
-; edit 5, 8 April, 1987 by OBSchou.  Added new entry in jump table to call 
-;      code for an external terminal type.  Added some new error messages
-;      and added more to the packet space.
-;
-; edit 4, 30 March by OBSchou.  Added in space for autoreceive.
-;
-; edit 3, 19 March, 1987 by OBSchou.  Added some more strings etc, and 
-;      increased the stack space fro 32 entries to 64.
-;
-; edit 2, 11 March, 1987 by OBSchou. 
-;      Added in some more data and strings and things.  Nothing special
-;
-; edit 1, 28 January, 1987 by OBSchou
-;      Following file the data section of CPSUTL.ASM.  This part of the 
-;      CPSUTL.ASM file now seperate as it ws getting too larg.  Link to here
-;      from CPSUTL.ASM (which now has only the utlity routines). 
-;      Also added in bits submitted by Dave Roberts of Leicester:
-;       DJR  18th January 1987 - David J. Roberts.
-;           Support for cosmetic changes in CPSMIT:
-;              New strings DBGST and CURDST
-;              CRLF in front of TIMMSG
-;              LOGST changed, and new LOGST2
-;
-;
-datver:        db      'CPSDAT.ASM (19)  29-Mar-1991$'
-
-
-
-;\f
-
-version:db     'Kermit-80 v4.'
-       db      (verno/10) + '0'        ; tenth's digit of version number
-       db      (verno MOD 10) + '0'    ; hundredth's digit
-IF revno                       ;[MF]If a revision level,
-       db      revno+'@'       ;[MF]put it in (range 1-26=A-Z)
-ENDIF ;revno [MF]
-       db      ' $'
-modmsg:        db      ' has been built from the following modules:$';[MF]
-kerm:  db      'Kermit-80  '
-kerm1: db      'nnx:>$'        ;'x' filled in at startup with DRIVE name
-                               ;'nn filled at startup and user with user number
-crlf:  db      cr,lf,'$'
-ermes1:        db      cr,lf,'?Unrecognized command$'
-ermes3:        db      cr,lf,'?Not confirmed$'
-ermes4:        db      '?Unable to receive initiate',cr,lf,'$'
-ermes5:        db      '?Unable to receive file name',cr,lf,'$'
-ermes6:        db      '?Unable to receive end of file',cr,lf,'$'
-erms10:        db      '?Unable to receive data',cr,lf,'$'
-erms11:        db      '?Disk full',cr,lf,'$'
-erms12:        db      '?Directory full',cr,lf,'$'
-erms14:        db      '?Unable to receive an acknowledgement from the host',cr,lf,'$'
-erms15:        db      cr,lf,'?Unable to find file',cr,lf,'$'
-erms16:        db      '?Unable to rename file$'
-erms17:        db      cr,lf,'?Disk full$'
-erms18:        db      cr,lf,'?Unable to tell host that the session is finished$'
-erms19:        db      cr,lf,'?Unable to tell host to logout$'
-erms20:        db      cr,lf,'?Kermit has not been configured for a target system$'
-erms21:        db      cr,lf,'?Consistency check on configuration failed$'
-erms22:        db      cr,lf,'?Error writing to log file',cr,lf,'$'    ;[pcc005]
-erms23:        db      cr,lf,'?Invalid user number$'
-erms24:        db      cr,lf,'?Invalid Pause parameter$'
-erms25:        db      cr,lf,'?Invalid BUFFER-SIZE parameter$'
-erms26:        db      cr,lf,'?Invalid packet length (too long)$'
-erms27:        db      cr,lf,'?Invalid Checktype$'
-erms28:        db      cr,lf,'?Too many retries$'
-erms29:        db      cr,lf,'?Failed to exchange parameters$'
-erms30:        db      cr,lf,'?Failed to receive input string in alloted time$'
-erms31:        db      cr,lf,'?File already exists$' ;[MF]
-
-infms3:        db      bell,'Completed$'
-infms4:        db      bell,'Failed$'
-infms5:        db      '%Renaming file to $'
-infms6:        db      cr,lf,'[Closing the log file]$'
-infms7:        db      cr,lf,'[Connected to remote host.  Type $'
-infms8:        db      'C to return;',cr,lf,' type $'
-inms8a:        db      '? for command list]',cr,lf,'$'
-infms9:        db      cr,lf,'[Connection closed, back at micro]$'
-inms10:        db      'Control-$'
-inms11:        db      ' Not implemented.$'
-inms12:        db      ' (Not implemented)',cr,lf,'$'
-inms13:        db      bell,'Interrupted$'
-inms14:        db      TAB,TAB,'    Directory for drive '
-dnam14:        db      'nnx:',cr,lf,'$'                ;filled in by dir routine.
-inms15:        DB      CR,LF,TAB,TAB,'Drive $'
-inms16:        DB      '  has $';filled in by summary code with drive letter
-inms17:        DB      'K bytes free',CR,LF,'$'
-inms18:        DB      CR,LF,'File(s) erased$',CR,LF
-inms19:        db      cr,lf,'[Transmitting file to host:'
-       db      cr,lf,' 1. Lines automatically sent, and wait for possible reply'
-       db      cr,lf,' 2. CONTROL-C aborts transfer'
-       db      cr,lf,' 3. If transfer hangs, try a return to continue'
-       db      cr,lf,' 4. on exit, you will be placed in CONNECT state.'
-       db      cr,lf,'$'
-inms20:        db      'R to send the same line again,'
-       db      cr,lf,'   or type $'
-inms21:        db      'C to abort transmission.]',cr,lf,'$'
-inms22:        db      cr,lf,'[Transmission done. Connected normally '
-       db      'to remote host,'
-       db      cr,lf,' type $'
-inms23:        db      'Sending...$'
-inms24:        db      'Receiving...$'
-inms25:        db      bell,'Warning: eighth bit cannot be sent$'
-inms26:        db      cr,lf,'For help, type ? at any point in a command$'
-inms27:        db      cr,lf,'[Logging suspended]',cr,lf,'$'   ;[pcc003]
-inms28:        db      cr,lf,'[Logging resumed]',cr,lf,'$'     ;[pcc003]
-inms29:        db      cr,lf,'[Transmission Aborted. Connected normally '
-       db      'to remote host,'
-       db      cr,lf,' type $'
-autmes:        db      cr,lf,cr,lf,'[Automatically receiving; type ^C to abort]'
-       db      cr,lf,cr,lf,'$' ;[MF]
-anymes:        db      cr,lf,cr,lf,' * * * Press any key to continue * * * '
-       db      cr,lf,cr,lf,'$'
-escmes:        db      cr,lf,'Type the new escape character:  $'
-tacmes:        db      cr,lf,'Type the new TAC intercept character:  $'
-sopmes:        db      cr,lf,'Give the start-of-packet character: $'   ;[gnn]
-padcms:        db      cr,lf,'Type the new padding character: $'       ;[obs]
-xmthlp:        db      cr,lf,'R Send the same line again$'
-loghlp:        db      cr,lf,'Q  Suspend logging'              ;[pcc003]
-       db      cr,lf,'R  Resume logging$'              ;[pcc003]
-inthlp:        db      cr,lf,'?  This message'
-       db      cr,lf,'C  Close the connection'
-       db      cr,lf,'0  (zero) Transmit a NULL'
-       db      cr,lf,'P  Toggle printer on/off'        ;[pcc002]
-       db      cr,lf,'S  Status of the connection$'
-inhlp1:        db      cr,lf,'Typing another $'
-inhlp2:        db      ' will send it to the host'
-       db      cr,lf,cr,lf,'Command>$'
-
-xmtst: db      cr,lf,'Transmitting a file$'
-autrst:        db      cr,lf,'Autoreceive is$'
-locst: db      cr,lf,'Local echo$'
-onstr: db      ' on$'
-offstr:        db      ' off$'
-flost: db      cr,lf,'Flow control$'
-;senst:        db      cr,lf,'Case sensetivity$'
-vtdpst:        db      cr,lf,'Terminal display is $'
-vtdpsr:        db      'REGULAR$'
-vtdpsq:        db      'QUIET$'
-vtemst:        db      cr,lf,'Terminal emulation is $'
-cpmst: db      cr,lf,'File Mode$'
-defstr:        db      ' default$'
-ascstr:        db      ' ASCII$'
-binstr:        db      ' binary$'
-hfsod: db      cr,lf,'Display file size on DIRECTORY command$'
-ibmst: db      cr,lf,'IBM flag$'
-incst: db      cr,lf,'Disposition for incomplete files is$'
-dscstr:        db      ' discard$'
-kepstr:        db      ' keep$'
-filst: db      cr,lf,'File warning$'
-prst:  db      cr,lf,'Printer copy$'
-logst: db      cr,lf,'Logging to $'            ;[pcc003][DJR]
-logst2:        db      ' is$'                          ;[DJR]
-susstr:        db      ' suspended$'                   ;[pcc003]
-sspmsg:        db      cr,lf,'SEND start-of-pkt char  ^$' ;[gnn]
-rspmsg:        db      cr,lf,'RECEIVE start-of-pkt char  ^$' ;[gnn]
-spsmsg:        db      cr,lf,'SEND packet length  $' ;[MF]
-rpsmsg:        db      cr,lf,'RECEIVE packet length  $' ;[MF]
-escst: db      cr,lf,'Escape char: $'
-bufsz1:        db      cr,lf,'Multi-sector buffering at $'
-bufsz2:        db      ' of a maximum of $'
-xmitst:        db      cr,lf,'Transmit protocol char: $'
-bckst: db      cr,lf,'Block check type: $'
-bckst1:        db      '-character$'
-collst:        db      cr,lf,'File COLLISION:  $';[MF]
-parst: db      cr,lf,'Parity: $'
-pnonst:        db      'none$'
-pmrkst:        db      'mark$'
-pspcst:        db      'space$'
-poddst:        db      'odd$'
-pevnst:        db      'even$'
-porst: db      cr,lf,'Port in use is: $'
-spdst: db      cr,lf,'Current speed is: $'
-spdst2:        db      ' bps$'         ;[MF]
-spdust:        db      'indeterminate (not SET)$'
-timmsg:        db      cr,lf,'Timer$'                  ;[DJR] Added CRLF like the others
-tacst: db      cr,lf,'Current TACTrap Status/Intercept Character:  $'
-usrst: db      cr,lf,'Current user number:  $'
-dbgst: db      cr,lf,'Debugging$'              ;[DJR]
-curdst:        db      cr,lf,'Current default disk: $' ;[DJR]
-spac15:        db      '               $'              ; *** 15 spaces ***
-samems:        db      cr,lf,'?Source and destination files the same$'
-nofile:        db      cr,lf,'?File not found$'
-cmer00:        db      cr,lf,'?Program error:  Invalid COMND call$'
-cmer01:        db      cr,lf,'?Ambiguous$'
-cmer02:        db      cr,lf,'?Illegal CP/M file specification$'
-cmer03:        db      cr,lf,'?Wild-cards not allowed in file specification$'  ;[pcc006]
-cmer04:        db      cr,lf,'?Invalid user number$'
-cmer05:        db      cr,lf,'?Invalid \ parameter$'
-cmin00:        db      ' Confirm with carriage return$'
-cmin01:        db      ' Enter a number$'
-cmin02:        db      ' Confirm with carriage return or enter more$'
-
-;  Diagnostic messages
-sstatm:        db      '<SState:> ',0
-rstatm:        db      '<RState:> ',0
-spackm:        db      '<Data transmitted> ',0
-rpackm:        db      '<Data received   > ',0
-princr:        db      cr,lf,0
-;
-; Remote command messages [MF]
-;
-newfms:        db      cr,lf,'New file: $'
-pswdms:        db      cr,lf,'Password: $'
-acctms:        db      cr,lf,'Account: $'
-newnms:        db      cr,lf,'New name: $'
-msgms: db      cr,lf,'Message: $'
-optms: db      cr,lf,'Options: $'
-
-;\f
-       ;Impure data
-
-;COMND storage
-
-comchr:        ds      1               ;[8] save space
-floctl:        db      0               ;[8] flow control on/off flag
-;casens:       db      0               ;[8] Upper/lower case sensitive
-cmstat:        ds      1               ;What is presently being parsed.
-cmaflg:        ds      1               ;Non-zero when an action char has been found.
-cmbflg:        ds      1               ;[MF]Nonzero to allow a blank initial keyword
-cmqflg:        ds      1               ;[MF]Nonzero to prevent character echoing
-                               ;[MF]when entering commands
-cmccnt:        ds      1               ;Non-zero if a significant char is found.
-cmsflg:        ds      1               ;Non-zero when the last char was a space.
-cmostp:        ds      2               ;Old stack pointer for reparse.
-cmrprs:        ds      2               ;Address to go to on reparse.
-cmprmp:        ds      2               ;Address of prompt.
-cmptab:        ds      2               ;Address of present keyword table.
-cmhlp: ds      2               ;Address of present help.
-cmdbuf:        ds      80H             ;Buffer for command parsing.
-cmbufl equ     $-cmdbuf-3      ; set a limit on the command buffer
-cmfcb: ds      2               ;Pointer to FCB.
-cmfcb2:        ds      2               ;Pointer to position in FCB.
-cmfwld:        ds      1               ;Wildcard flag
-cmcptr:        ds      2               ;Pointer for next char input.
-cmdptr:        ds      2               ;Pointer into the command buffer.
-cmkptr:        ds      2               ;Pointer to keyword.
-cmsptr:        ds      2               ;Place to save a pointer.
-slshsn:        db      0               ; slash seen in command line
-slashc:        db      0               ; count for number of characters in slash sequence
-slashn:        db      0               ; number to be built for \xxx
-;\f
-oldsp: ds      2               ;Room for old system stack.
-       ds      80H             ;Room for 64 levels of calls.[obs]
-stack: ds      2
-eoflag:        ds      1               ;EOF flag;non-zero on EOF.
-curdsk:        db      0               ;holds "logged" disk
-curusr:        db      0               ;[8] holds "user" number
-rcvsop:        db      SOH             ;[gnn] receive start-of-packet
-sndsop:        db      SOH             ;[gnn] send start-of-packet
-prtcnt:        db      0               ;[pcc008] prtchr fairness count
-timflg:        db      0               ;[jd] timer flag: 0 -> no timer
-timval:        dw      0               ;[jd] timer value
-wrn8:  db      0               ;[jd] non-zero if 8-bit-lost warning sent
-qbchr: db      '&'             ;[jd] binary quote character.
-quot8: db      0               ;[jd] non-zero if doing 8-bit quoting
-logflg:        db      0               ;Flag for a log file.
-                               ;[pcc005] 0 = no log
-                               ;[pcc005] x1 = logging on
-                               ;[pcc005] x2 = suspended
-                               ;[pcc005] 8xH (bit 7) = file open
-lognam:        db      0               ;[pcc013] File to use for session logging
-       db      'KERMIT  '      ;[pcc013]
-       db      'LOG'           ;[pcc013]
-nexitf:        db      0               ; set to 1 for exit to CPM after command tail
-takflg:        db      0               ;[8] TAKE flag. 
-                               ; Bit zero = 1 for take file in progress
-                               ; bit 4 = 1 if command line present/in progress
-                               ; Note: Take has priority over command line.
-initak:        db      0ffh            ;[MF]Cleared after initial TAKE (KERMIT.INI)
-taknam:        db      0               ;[8] use default drive
-       db      'KERMIT  '
-       db      'INI'           ;[8] Inital file to TAKE KERMIT.INI
-takptr:        ds      2               ;[8] Pointer to position in TAKE file input
-takfcb:        ds      12              ;[8] fcb space for take file
-       dw      0               ;[8] fill up extents etc with 00
-       dw      0
-       ds      16              ;[8] used by dos
-       dw      0
-       dw      0
-takdma:        ds      128             ;[8]space to read TAKE file...
-prnbuf:        ds      1               ; printer buffer. Output pointer
-       ds      1               ; input offset pointer
-       ds      256             ; give a large buffer
-       ds      10              ; and a little spare
-;
-;
-;
-; Transmit space
-;
-repcnt:        db      0               ; repeat counter
-starc: db      0               ; star count
-rexbfl:        db      0               ; retransmit flag (1=> retransmit)
-rexcnt:        db      0               ; retransmit character count
-rexbuf:        ds      128             ; max retransmit line length 128 characters
-xmtbuff:
-       ds      128             ; 128 byte sector buffer
-xmtptr:        db      0               ; offset pointer to xmtbuff above
-xmtfcb:        ds      36              ; fcb for transmit file.
-;
-;INPUT and STRING space
-strlen:        db      0               ; length of the string from INPUT and STRING
-
-; Assorted other space
-errorc:        db      0               ; error level set to xxx
-errorl:        db      0               ; error level to test against
-
-remtxt:        db      0               ; set <> 0 if D packets to screen
-
-hosths:        ds      1               ; have we told the host to xoff? (is this duplicated)
-stbuff:        ds      80h             ; some space or the string buffer
-waitp: ds      2               ; wait command timer
-waitp1:        ds      2               ; wait/input timer (copy of waitp)
-prntmp:        ds      1               ; temporary space to put the caracter to print
-prnfl: db      0               ; printer flag.  Used by TYPE/PRINT
-;[MF][17]Following line no longer needed as TYPE uses the big buffer
-;typptr:       ds      2               ; pointer used by TYPE/PRINT
-equflg:        db      0               ; set to non zero if copy files same
-nquiet:        db      0               ; If non zero print from NOUT to display
-
-escflg:        db      0               ;Escape flag (start off).
-fileio:        db      0               ;Line-by-line from file (default off).
-xofflg:        db      0               ;X-OFF (=^S) received from COMM-line
-                               ;X-ON (=^Q) received resets this
-clkbit:        dw      0               ; 32 bit pseudo clock
-       dw      0               ; MS bits of clock
-number:        ds      2               ; Number in binary form from user input
-initflg:db     0               ; set to non zero when system initialised
-maxbsc:        ds      1               ; save space to know how big system allows
-                               ; for multi-sector buffering. (Usually 8k?)
-;
-;       Multiple FCB storage space.  Used for the DIR command
-;               Later on, I want to shift this into space after the system
-;               dependent stuff, but then it becomes messy with pointers
-;               to pointers etc... [OBS]
-;
-xfcbptr:
-       ds      2               ; pointer to current fcb space
-fcbcnt:        ds      1               ; Number of valid fcbs in space
-;
-fcb0:  ds      12              ; 36 bytes requred for a single fcb
-fcblen EQU     $-fcb0          ; length of a single fcb
-       ds      maxfcb*fcblen   ; space for maximum fcbs + 1 
-;
-hidefs:        db      0ffh            ; flag <> 0 if we show file size in DIR
-
-; FCB sapce for COPY command
-cfcbs: ds      33              ; source fcb for copy file ops.
-                               ;[MF]and FRENAME ops.
-cfcbd: ds      33              ; destination fcb for copy ops.
-                               ;[MF]and FRENAME ops.
-
-colfcb:        ds      33              ;[MF]Rename fcb for SET COLLISION
-
-; Command tail data space etc
-cbptr: db      2               ; command tail pointer (0= length of tail)
-cbuff: ds      128             ; temp. space for potential command tail
-
-strcnt:        db      0               ; string count for string operations...
-
-vtyval:        ds      1               ; holds row number for VT52 cursor positioning
-chrcnt:        ds      1               ;Number of chars in the file buffer.
-
-; Various packet variables etc
-bytes: dw      0               ; 4 byte 'byte count' space
-       dw      0
-filcnt:        ds      1               ;Number of chars left to fill.
-outpnt:        ds      2               ;Position in packet.
-bufpnt:        ds      2               ;Position in file buffer.
-fcbptr:        ds      2               ;Position in FCB.
-datptr:        ds      2               ;Position in packet data buffer.
-cbfptr:        ds      2               ;Position in character buffer.
-pktptr:        ds      2               ;Position in receive packet.
-size:  ds      1               ;Size of data from gtchr.
-curchk:        ds      1               ;Current checksum type
-inichk:        ds      1               ;Agreed upon checksum type
-czseen:        ds      1               ;Flag that control-Z was typed
-dscflg:        ds      1               ;[MF]Discard file if nonzero
-pktnum:        ds      1               ;Packet number.
-numpkt:        ds      2               ;Total number of packets sent.
-numrtr:        ds      2               ;Total number of retries.
-numtry:        ds      1               ;Number of tries on this packet.
-oldtry:        ds      1               ;Number of tries on previous packet.
-state: ds      1               ;Present state of the automaton.
-;*** start of new flags.  Do not assume that just because these flags are
-;  present that the feature is available.  I simply put them in 'for future use'
-rcapas:
-rcap1: db      0               ; receive capabilties byte 0
-rcap2: db      0               ; receive cpabilities byte 1
-scapas:
-scap1: db      0               ; send capabilities byte 0
-scap2: db      0               ; send capabilities byte 1
-rtimeo:        db      0               ; receive timeout
-stimeo:        db      0               ; send timeout
-rpadc: db      0               ; receive pad character
-spadc: db      0               ; send pad character
-rrept: db      0               ; receive repeat prefix
-srept: db      0               ; send repeat prefix
-rwindo:        db      0               ; receive window size
-swindo:        db      0               ; send window size
-rdpkt:
-rlpkt: dw      0               ; receive long packet length
-sdpkt:
-slpkt: dw      0               ; send long packet length
-sdckt: db      0               ; send default checktype
-rdckt: db      0               ; receive checktype (should be same as sdckt)
-;*** end  of new flags
-sohchr:        db      1               ;Default Start-of-header chr is cntl-a
-; Kermit packet starts here
-;      Byte 0 = start of packe character
-;           1 = length of packet
-;           2 = packet number
-;           3 = packet type (S R I Z E B etc)
-packet:        ds      4               ;Packet (data is part of it).
-; Data part of packet (variable length - include checksum)
-data:  ds      5AH             ;Data and checksum field of packet.
-recpkt:        ds      65H             ;Receive packet storage (use the following).
-recpkx:        db      cr,'$'          ;=      =       = buffer limit
-filbuf:        ds      65H             ;Character buffer.
-fnbuf: ds      20h             ;[jd] file name buffer
-autorc:        db      0               ;[obs] set to ON for autoreceive
-
-; Temporary data space.  Sometimes accesses as 16 bits (eg temp1/2)
-;** Temp 1 & 2 must be in order
-lstchr:                                ;Last console input character.
-temp1: ds      1               ;Temporary storage.
-temp2: ds      1
-lincnt:                                ; used for counting lines in p20ln
-temp3: ds      1
-temp4: ds      1
-temp5: ds      1
-temp6: ds      1
-temp7: ds      1
-temp8: ds      1
-temp9: ds      1
-temp10:        ds      1
-temp11:        ds      1
-
-
-getrxflg:
-       ds      1               ;[obs 22]
-quietd:        db      0               ;loud display during file transfers
-argblk:        ds      20H             ;Used for subroutine arguments
-
-maxfil EQU     2               ; currently, only two names used.
-fcbblk:        ds      maxfil*10H      ;Used for a list of FCB's
-
-; [gnn] secondary filename storage (remote on send, local on get)
-remnam:        ds      60              ;[gnn]
-remlen:        ds      1               ;[gnn] length of name
-
-; Bookkeeping storage for multiple-sector buffering.  The actual buffer
-; is somewhere in the system-dependent overlay. (at the end, I hope).
-nxtbuf:        ds      2               ; Pointer to next sector
-seccnt:        ds      1               ; Number of sectors buffered
-endsts:        ds      1               ; Status for last read into buffer
-;
-;
-; [MF] Storage for Remote Command processing
-;
-;
-rdl:   ds      1               ;[MF]Holds accumulated length of remote data
-;
-rcl:   ds      1               ;[MF]Holds length of Remote command line arg
-;
-remdat:        ds      95              ;[MF]Packet data buffer (plenty big)
-;
-rcom:  ds      1               ;[MF] Remote Command type
-;
-rprmpt:        dw      0               ;[MF]Address of prompt strings
-;
-rptr:  dw      0               ;[MF]Remote command packet data pointer
-;
-rscode:        ds      3               ;[MF]Holds Remote Set command ASCII code
-;
-;
-       org     7000h           ; address for Kermit 4.11
-;               ORG     ($ + 0ffH) AND 0ff00H   ; move to start of next page
-
-;
-;       hooks for system-dependent routines:
-;       This area is overwritten by the system-dependent overlay.
-;
-lnkflg:        dw      0       ; linkage information for consistency check.
-lnkent:        dw      0       ; more of the same.
-ovlver:        dw      0       ; pointer to overlay's version string
-family:        dw      0       ;*NEW* [10] address of the family overlay (not CPSSYS)
-;
-; Input/output routines.  Note that outmdm and outcon may actually be the
-;       same routine if selmdm and selcon do anything.  (the same is true
-;       of inpmdm and inpcon).
-;
-selmdm:        jmp     $-$     ; select modem for I/O
-outmdm:        jmp     $-$     ; output character in E to modem
-inpmdm:        jmp     $-$     ; read character from modem. return character or 0 in A.
-flsmdm:        jmp     $-$     ; flush pending input from modem
-selcon:        jmp     $-$     ; select console for I/O
-outcon:        jmp     $-$     ; output character in E to console
-inpcon:        jmp     $-$     ; read char from console. return character or 0 in A
-outlpt:        jmp     $-$     ; output character in E to printer
-lptstat:jmp    $-$     ;*NEW*[10] see if printer ready to print a character
-                       ; If 0ffh then ok, if 0h then not ok.
-extern:        jmp     $-$     ;*NEW for 4.09* If $-$ is not zero, then its a jump to
-                       ; a routine to emulate any terminal type the user
-                       ; wants to implement.
-xbdos: jmp     0       ;*NEW* address of the bdos trap in this section
-                       ; of code.  It is filled in initialisation.
-;
-; screen formatting routines
-clrlin:        jmp     $-$     ; erase current line
-clrspc:        jmp     $-$     ; erase current position (after backspace)
-delchr:        jmp     $-$     ; make delete look like backspace
-clrtop:        jmp     $-$     ; erase screen and go home
-;
-; these routines are called to display a field on the screen.
-scrend:        jmp     $-$     ; move to prompt field
-screrr:        jmp     $-$     ; move to error message field
-scrfln:        jmp     $-$     ; move to filename field
-scrnp: jmp     $-$     ; move to packet count field
-scrnrt:        jmp     $-$     ; move to retry count field
-scrst: jmp     $-$     ; move to status field
-rppos: jmp     $-$     ; move to receive packet field (debug)
-sppos: jmp     $-$     ; move to send packet field (debug)
-;
-sysinit: jmp   $-$     ; program initialization
-sysexit: jmp   $-$     ; program termination
-syscon:        jmp     $-$     ; remote session initialization
-syscls:        jmp     $-$     ; return to local command level
-sysinh:        jmp     $-$     ; help text for interrupt (escape) extensions
-sysint:        jmp     $-$     ; interrupt (escape) extensions, including break
-sysflt:        jmp     $-$     ; filter for incoming characters.
-                       ;  called with character in E.
-sysbye:        jmp     $-$     ; terminate remote session
-sysspd:        jmp     $-$     ; baud rate change routine.
-                       ; called with value from table in DE
-sysprt:        jmp     $-$     ; port change routine.
-                       ; called with value from table in HL
-sysscr:        jmp     $-$     ; screen setup for file transfer
-                       ; called with Kermit's version string in DE
-csrpos:        jmp     $-$     ; move cursor to row B, column C
-sysspc:        jmp     $-$     ; calculate free space for current disk
-mover: jmp     $-$     ; block move
-prtstr:        jmp     $-$     ; *** NEW *** prtstr moved to overlay
-;
-; Data initialized by system-dependent overlay:
-;
-pttab: ds      2       ; points to local equivalents to VT52 escape sequences
-spdtab:        ds      2       ; address of baud rate command table, or zero
-spdhlp:        ds      2       ; address of baud rate help table, or zero
-prttab:        ds      2       ; address of port command table, or zero
-prthlp:        ds      2       ; address of port help table, or zero
-timout:        ds      2       ; Initial value for fuzzy timeout
-vtflg: ds      1       ; VT52 emulation flag
-escchr:        ds      1       ; Storage for the escape character.
-speed: ds      2       ; storage for the baud rate
-port:  ds      2       ; storage for port value
-prnflg:        ds      1       ;[hh] printer copy flag (overlay may need it)
-dbgflg:        ds      1       ; debugging flag
-ecoflg:        ds      1       ; Local echo flag (default off).
-flwflg:        ds      1       ; File warning flag (default on).
-ibmflg:        ds      1       ; IBM flag (default off).
-cpmflg:        ds      1       ; File mode flag (ascii/binary/default)
-incflg:        ds      1               ;[MF]Incomplete flag (keep/discard)
-                               ;[MF](default discard)
-parity:        ds      1       ; Current parity.
-spsiz: ds      1       ; Send packet size.
-rpsiz: ds      1       ; Receive packet size.
-stime: ds      1       ; Send time out.
-rtime: ds      1       ; Receive time out.
-spad:  ds      1       ; Send padding.
-rpad:  ds      1       ; Receive padding.
-spadch:        ds      1       ; Send padding char.
-rpadch:        ds      1       ; Receive padding char.
-seol:  ds      1       ; Send EOL char.
-reol:  ds      1       ; Receive EOL char.
-squote:        ds      1       ; Send quote char.
-rquote:        ds      1       ; Receive quote char.
-chktyp:        ds      1       ; Checksum type desired
-tacflg:        ds      1       ; TACTrap flag (zero=off, nonzero=on; when non-zero,
-                       ;  contains current TAC intercept character)
-tacchr:        ds      1       ; TAC intercept character
-bufadr:        ds      2       ; Pointer to big buffer for multiple-sector I/O
-bufsec:        ds      1       ; Number of sectors big buffer can hold (0 means 256)
-ffussy:        ds      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.
-
-       END     START
+; CPSDAT.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,1985\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
+;       Pure and impure data areas. Previously of CPSUTL.ASM\r
+;\r
+; revision history:\r
+;\r
+;edit 19, 29-Mar-1991 by MF. Add flag "initak" (nonzero) which is cleared\r
+;      after the initial automatic TAKE attempt of KERMIT.INI to allow\r
+;      "unable to find file" complaints if not doing that initial TAKE.\r
+;edit 18, 21-Mar-1991 by MF. Renamed parameter vermin to revno (revision\r
+;      level) since verno is already known as the "minor version number".\r
+;edit 17, 27-Feb-1991 by MF. Corrected typeo in "inms19" and commented out\r
+;      "typptr" pointer as the TYPE command now uses the big buffer.\r
+;      Also provided for a "minor version number" (1-26=A-Z) and message to\r
+;      facilitate display of Kermit version in VERSION command (modmsg)\r
+;edit 16, 12-Feb-1991 by MF. Eliminated storage (message and variable)\r
+;      for case sensitivity by commenting it out.\r
+;edit 15, 9-Dec-1990 by MF. Modified message for "directory file size"\r
+;      status report to make it clearer when spoken by a speech synthesizer.\r
+;edit 14, 4-Dec-1990 by MF. Added message for Autoreceive status report.\r
+;edit 13, 30-Nov-1990 by MF. Added messages to display regular/quiet status\r
+;      of terminal in SHOW and STATUS commands.\r
+;edit 12, 8-Nov-1990 by MF.  Added a new message for Set Autoreceive.\r
+;edit 11, 2-Nov-1990 by MF.  Moved overlay address to 7000H -- I didn't\r
+;      realize I was **that** close to the limit until I made a couple of\r
+;      cosmetic changes and REM CD bombed.  This is still ver. 4.10 as it\r
+;      hasn''t been released yet.\r
+;edit 10, 1-Nov-1990 by MF.  Changed message at "spdst" to conform with\r
+;      the change of "SET BAUD-RATE" to "SET SPEED".\r
+;      Also added message "sdpst2" for speed status (staspd) routine\r
+;edit 9, 17-Oct-1990 by MF.  Changed "packet-size" messages to use the\r
+;      word "length" to conform with the nomenclature suggested in the\r
+;      6th edition of the Kermit Protocol Manual.\r
+;edit 8, 19-Sep-1990 by MF.  Added error message for FRENAME command.\r
+;edit 7, 14-Sep-1990 by MF.  Added storage/strings for SET COLLISION command.\r
+;      Also added strings/storage for SET INCOMPLETE-FILE command.\r
+;edit 6, 9-Sep-1990 by MF.  Added messages and storage for Remote commands.\r
+;      and display of packet sizes\r
+;      Moved overlay address to 06C00H for Version 4.10.\r
+; edit 5, 8 April, 1987 by OBSchou.  Added new entry in jump table to call \r
+;      code for an external terminal type.  Added some new error messages\r
+;      and added more to the packet space.\r
+;\r
+; edit 4, 30 March by OBSchou.  Added in space for autoreceive.\r
+;\r
+; edit 3, 19 March, 1987 by OBSchou.  Added some more strings etc, and \r
+;      increased the stack space fro 32 entries to 64.\r
+;\r
+; edit 2, 11 March, 1987 by OBSchou. \r
+;      Added in some more data and strings and things.  Nothing special\r
+;\r
+; edit 1, 28 January, 1987 by OBSchou\r
+;      Following file the data section of CPSUTL.ASM.  This part of the \r
+;      CPSUTL.ASM file now seperate as it ws getting too larg.  Link to here\r
+;      from CPSUTL.ASM (which now has only the utlity routines). \r
+;      Also added in bits submitted by Dave Roberts of Leicester:\r
+;       DJR  18th January 1987 - David J. Roberts.\r
+;           Support for cosmetic changes in CPSMIT:\r
+;              New strings DBGST and CURDST\r
+;              CRLF in front of TIMMSG\r
+;              LOGST changed, and new LOGST2\r
+;\r
+;\r
+datver:        db      'CPSDAT.ASM (19)  29-Mar-1991$'\r
+\r
+\r
+\r
+;\f\r
+\r
+version:db     'Kermit-80 v4.'\r
+       db      (verno/10) + '0'        ; tenth's digit of version number\r
+       db      (verno MOD 10) + '0'    ; hundredth's digit\r
+IF revno                       ;[MF]If a revision level,\r
+       db      revno+'@'       ;[MF]put it in (range 1-26=A-Z)\r
+ENDIF ;revno [MF]\r
+       db      ' $'\r
+modmsg:        db      ' has been built from the following modules:$';[MF]\r
+kerm:  db      'Kermit-80  '\r
+kerm1: db      'nnx:>$'        ;'x' filled in at startup with DRIVE name\r
+                               ;'nn filled at startup and user with user number\r
+crlf:  db      cr,lf,'$'\r
+ermes1:        db      cr,lf,'?Unrecognized command$'\r
+ermes3:        db      cr,lf,'?Not confirmed$'\r
+ermes4:        db      '?Unable to receive initiate',cr,lf,'$'\r
+ermes5:        db      '?Unable to receive file name',cr,lf,'$'\r
+ermes6:        db      '?Unable to receive end of file',cr,lf,'$'\r
+erms10:        db      '?Unable to receive data',cr,lf,'$'\r
+erms11:        db      '?Disk full',cr,lf,'$'\r
+erms12:        db      '?Directory full',cr,lf,'$'\r
+erms14:        db      '?Unable to receive an acknowledgement from the host',cr,lf,'$'\r
+erms15:        db      cr,lf,'?Unable to find file',cr,lf,'$'\r
+erms16:        db      '?Unable to rename file$'\r
+erms17:        db      cr,lf,'?Disk full$'\r
+erms18:        db      cr,lf,'?Unable to tell host that the session is finished$'\r
+erms19:        db      cr,lf,'?Unable to tell host to logout$'\r
+erms20:        db      cr,lf,'?Kermit has not been configured for a target system$'\r
+erms21:        db      cr,lf,'?Consistency check on configuration failed$'\r
+erms22:        db      cr,lf,'?Error writing to log file',cr,lf,'$'    ;[pcc005]\r
+erms23:        db      cr,lf,'?Invalid user number$'\r
+erms24:        db      cr,lf,'?Invalid Pause parameter$'\r
+erms25:        db      cr,lf,'?Invalid BUFFER-SIZE parameter$'\r
+erms26:        db      cr,lf,'?Invalid packet length (too long)$'\r
+erms27:        db      cr,lf,'?Invalid Checktype$'\r
+erms28:        db      cr,lf,'?Too many retries$'\r
+erms29:        db      cr,lf,'?Failed to exchange parameters$'\r
+erms30:        db      cr,lf,'?Failed to receive input string in alloted time$'\r
+erms31:        db      cr,lf,'?File already exists$' ;[MF]\r
+\r
+infms3:        db      bell,'Completed$'\r
+infms4:        db      bell,'Failed$'\r
+infms5:        db      '%Renaming file to $'\r
+infms6:        db      cr,lf,'[Closing the log file]$'\r
+infms7:        db      cr,lf,'[Connected to remote host.  Type $'\r
+infms8:        db      'C to return;',cr,lf,' type $'\r
+inms8a:        db      '? for command list]',cr,lf,'$'\r
+infms9:        db      cr,lf,'[Connection closed, back at micro]$'\r
+inms10:        db      'Control-$'\r
+inms11:        db      ' Not implemented.$'\r
+inms12:        db      ' (Not implemented)',cr,lf,'$'\r
+inms13:        db      bell,'Interrupted$'\r
+inms14:        db      TAB,TAB,'    Directory for drive '\r
+dnam14:        db      'nnx:',cr,lf,'$'                ;filled in by dir routine.\r
+inms15:        DB      CR,LF,TAB,TAB,'Drive $'\r
+inms16:        DB      '  has $';filled in by summary code with drive letter\r
+inms17:        DB      'K bytes free',CR,LF,'$'\r
+inms18:        DB      CR,LF,'File(s) erased$',CR,LF\r
+inms19:        db      cr,lf,'[Transmitting file to host:'\r
+       db      cr,lf,' 1. Lines automatically sent, and wait for possible reply'\r
+       db      cr,lf,' 2. CONTROL-C aborts transfer'\r
+       db      cr,lf,' 3. If transfer hangs, try a return to continue'\r
+       db      cr,lf,' 4. on exit, you will be placed in CONNECT state.'\r
+       db      cr,lf,'$'\r
+inms20:        db      'R to send the same line again,'\r
+       db      cr,lf,'   or type $'\r
+inms21:        db      'C to abort transmission.]',cr,lf,'$'\r
+inms22:        db      cr,lf,'[Transmission done. Connected normally '\r
+       db      'to remote host,'\r
+       db      cr,lf,' type $'\r
+inms23:        db      'Sending...$'\r
+inms24:        db      'Receiving...$'\r
+inms25:        db      bell,'Warning: eighth bit cannot be sent$'\r
+inms26:        db      cr,lf,'For help, type ? at any point in a command$'\r
+inms27:        db      cr,lf,'[Logging suspended]',cr,lf,'$'   ;[pcc003]\r
+inms28:        db      cr,lf,'[Logging resumed]',cr,lf,'$'     ;[pcc003]\r
+inms29:        db      cr,lf,'[Transmission Aborted. Connected normally '\r
+       db      'to remote host,'\r
+       db      cr,lf,' type $'\r
+autmes:        db      cr,lf,cr,lf,'[Automatically receiving; type ^C to abort]'\r
+       db      cr,lf,cr,lf,'$' ;[MF]\r
+anymes:        db      cr,lf,cr,lf,' * * * Press any key to continue * * * '\r
+       db      cr,lf,cr,lf,'$'\r
+escmes:        db      cr,lf,'Type the new escape character:  $'\r
+tacmes:        db      cr,lf,'Type the new TAC intercept character:  $'\r
+sopmes:        db      cr,lf,'Give the start-of-packet character: $'   ;[gnn]\r
+padcms:        db      cr,lf,'Type the new padding character: $'       ;[obs]\r
+xmthlp:        db      cr,lf,'R Send the same line again$'\r
+loghlp:        db      cr,lf,'Q  Suspend logging'              ;[pcc003]\r
+       db      cr,lf,'R  Resume logging$'              ;[pcc003]\r
+inthlp:        db      cr,lf,'?  This message'\r
+       db      cr,lf,'C  Close the connection'\r
+       db      cr,lf,'0  (zero) Transmit a NULL'\r
+       db      cr,lf,'P  Toggle printer on/off'        ;[pcc002]\r
+       db      cr,lf,'S  Status of the connection$'\r
+inhlp1:        db      cr,lf,'Typing another $'\r
+inhlp2:        db      ' will send it to the host'\r
+       db      cr,lf,cr,lf,'Command>$'\r
+\r
+xmtst: db      cr,lf,'Transmitting a file$'\r
+autrst:        db      cr,lf,'Autoreceive is$'\r
+locst: db      cr,lf,'Local echo$'\r
+onstr: db      ' on$'\r
+offstr:        db      ' off$'\r
+flost: db      cr,lf,'Flow control$'\r
+;senst:        db      cr,lf,'Case sensetivity$'\r
+vtdpst:        db      cr,lf,'Terminal display is $'\r
+vtdpsr:        db      'REGULAR$'\r
+vtdpsq:        db      'QUIET$'\r
+vtemst:        db      cr,lf,'Terminal emulation is $'\r
+cpmst: db      cr,lf,'File Mode$'\r
+defstr:        db      ' default$'\r
+ascstr:        db      ' ASCII$'\r
+binstr:        db      ' binary$'\r
+hfsod: db      cr,lf,'Display file size on DIRECTORY command$'\r
+ibmst: db      cr,lf,'IBM flag$'\r
+incst: db      cr,lf,'Disposition for incomplete files is$'\r
+dscstr:        db      ' discard$'\r
+kepstr:        db      ' keep$'\r
+filst: db      cr,lf,'File warning$'\r
+prst:  db      cr,lf,'Printer copy$'\r
+logst: db      cr,lf,'Logging to $'            ;[pcc003][DJR]\r
+logst2:        db      ' is$'                          ;[DJR]\r
+susstr:        db      ' suspended$'                   ;[pcc003]\r
+sspmsg:        db      cr,lf,'SEND start-of-pkt char  ^$' ;[gnn]\r
+rspmsg:        db      cr,lf,'RECEIVE start-of-pkt char  ^$' ;[gnn]\r
+spsmsg:        db      cr,lf,'SEND packet length  $' ;[MF]\r
+rpsmsg:        db      cr,lf,'RECEIVE packet length  $' ;[MF]\r
+escst: db      cr,lf,'Escape char: $'\r
+bufsz1:        db      cr,lf,'Multi-sector buffering at $'\r
+bufsz2:        db      ' of a maximum of $'\r
+xmitst:        db      cr,lf,'Transmit protocol char: $'\r
+bckst: db      cr,lf,'Block check type: $'\r
+bckst1:        db      '-character$'\r
+collst:        db      cr,lf,'File COLLISION:  $';[MF]\r
+parst: db      cr,lf,'Parity: $'\r
+pnonst:        db      'none$'\r
+pmrkst:        db      'mark$'\r
+pspcst:        db      'space$'\r
+poddst:        db      'odd$'\r
+pevnst:        db      'even$'\r
+porst: db      cr,lf,'Port in use is: $'\r
+spdst: db      cr,lf,'Current speed is: $'\r
+spdst2:        db      ' bps$'         ;[MF]\r
+spdust:        db      'indeterminate (not SET)$'\r
+timmsg:        db      cr,lf,'Timer$'                  ;[DJR] Added CRLF like the others\r
+tacst: db      cr,lf,'Current TACTrap Status/Intercept Character:  $'\r
+usrst: db      cr,lf,'Current user number:  $'\r
+dbgst: db      cr,lf,'Debugging$'              ;[DJR]\r
+curdst:        db      cr,lf,'Current default disk: $' ;[DJR]\r
+spac15:        db      '               $'              ; *** 15 spaces ***\r
+samems:        db      cr,lf,'?Source and destination files the same$'\r
+nofile:        db      cr,lf,'?File not found$'\r
+cmer00:        db      cr,lf,'?Program error:  Invalid COMND call$'\r
+cmer01:        db      cr,lf,'?Ambiguous$'\r
+cmer02:        db      cr,lf,'?Illegal CP/M file specification$'\r
+cmer03:        db      cr,lf,'?Wild-cards not allowed in file specification$'  ;[pcc006]\r
+cmer04:        db      cr,lf,'?Invalid user number$'\r
+cmer05:        db      cr,lf,'?Invalid \ parameter$'\r
+cmin00:        db      ' Confirm with carriage return$'\r
+cmin01:        db      ' Enter a number$'\r
+cmin02:        db      ' Confirm with carriage return or enter more$'\r
+\r
+;  Diagnostic messages\r
+sstatm:        db      '<SState:> ',0\r
+rstatm:        db      '<RState:> ',0\r
+spackm:        db      '<Data transmitted> ',0\r
+rpackm:        db      '<Data received   > ',0\r
+princr:        db      cr,lf,0\r
+;\r
+; Remote command messages [MF]\r
+;\r
+newfms:        db      cr,lf,'New file: $'\r
+pswdms:        db      cr,lf,'Password: $'\r
+acctms:        db      cr,lf,'Account: $'\r
+newnms:        db      cr,lf,'New name: $'\r
+msgms: db      cr,lf,'Message: $'\r
+optms: db      cr,lf,'Options: $'\r
+\r
+;\f\r
+       ;Impure data\r
+\r
+;COMND storage\r
+\r
+comchr:        ds      1               ;[8] save space\r
+floctl:        db      0               ;[8] flow control on/off flag\r
+;casens:       db      0               ;[8] Upper/lower case sensitive\r
+cmstat:        ds      1               ;What is presently being parsed.\r
+cmaflg:        ds      1               ;Non-zero when an action char has been found.\r
+cmbflg:        ds      1               ;[MF]Nonzero to allow a blank initial keyword\r
+cmqflg:        ds      1               ;[MF]Nonzero to prevent character echoing\r
+                               ;[MF]when entering commands\r
+cmccnt:        ds      1               ;Non-zero if a significant char is found.\r
+cmsflg:        ds      1               ;Non-zero when the last char was a space.\r
+cmostp:        ds      2               ;Old stack pointer for reparse.\r
+cmrprs:        ds      2               ;Address to go to on reparse.\r
+cmprmp:        ds      2               ;Address of prompt.\r
+cmptab:        ds      2               ;Address of present keyword table.\r
+cmhlp: ds      2               ;Address of present help.\r
+cmdbuf:        ds      80H             ;Buffer for command parsing.\r
+cmbufl equ     $-cmdbuf-3      ; set a limit on the command buffer\r
+cmfcb: ds      2               ;Pointer to FCB.\r
+cmfcb2:        ds      2               ;Pointer to position in FCB.\r
+cmfwld:        ds      1               ;Wildcard flag\r
+cmcptr:        ds      2               ;Pointer for next char input.\r
+cmdptr:        ds      2               ;Pointer into the command buffer.\r
+cmkptr:        ds      2               ;Pointer to keyword.\r
+cmsptr:        ds      2               ;Place to save a pointer.\r
+slshsn:        db      0               ; slash seen in command line\r
+slashc:        db      0               ; count for number of characters in slash sequence\r
+slashn:        db      0               ; number to be built for \xxx\r
+;\f\r
+oldsp: ds      2               ;Room for old system stack.\r
+       ds      80H             ;Room for 64 levels of calls.[obs]\r
+stack: ds      2\r
+eoflag:        ds      1               ;EOF flag;non-zero on EOF.\r
+curdsk:        db      0               ;holds "logged" disk\r
+curusr:        db      0               ;[8] holds "user" number\r
+rcvsop:        db      SOH             ;[gnn] receive start-of-packet\r
+sndsop:        db      SOH             ;[gnn] send start-of-packet\r
+prtcnt:        db      0               ;[pcc008] prtchr fairness count\r
+timflg:        db      0               ;[jd] timer flag: 0 -> no timer\r
+timval:        dw      0               ;[jd] timer value\r
+wrn8:  db      0               ;[jd] non-zero if 8-bit-lost warning sent\r
+qbchr: db      '&'             ;[jd] binary quote character.\r
+quot8: db      0               ;[jd] non-zero if doing 8-bit quoting\r
+logflg:        db      0               ;Flag for a log file.\r
+                               ;[pcc005] 0 = no log\r
+                               ;[pcc005] x1 = logging on\r
+                               ;[pcc005] x2 = suspended\r
+                               ;[pcc005] 8xH (bit 7) = file open\r
+lognam:        db      0               ;[pcc013] File to use for session logging\r
+       db      'KERMIT  '      ;[pcc013]\r
+       db      'LOG'           ;[pcc013]\r
+nexitf:        db      0               ; set to 1 for exit to CPM after command tail\r
+takflg:        db      0               ;[8] TAKE flag. \r
+                               ; Bit zero = 1 for take file in progress\r
+                               ; bit 4 = 1 if command line present/in progress\r
+                               ; Note: Take has priority over command line.\r
+initak:        db      0ffh            ;[MF]Cleared after initial TAKE (KERMIT.INI)\r
+taknam:        db      0               ;[8] use default drive\r
+       db      'KERMIT  '\r
+       db      'INI'           ;[8] Inital file to TAKE KERMIT.INI\r
+takptr:        ds      2               ;[8] Pointer to position in TAKE file input\r
+takfcb:        ds      12              ;[8] fcb space for take file\r
+       dw      0               ;[8] fill up extents etc with 00\r
+       dw      0\r
+       ds      16              ;[8] used by dos\r
+       dw      0\r
+       dw      0\r
+takdma:        ds      128             ;[8]space to read TAKE file...\r
+prnbuf:        ds      1               ; printer buffer. Output pointer\r
+       ds      1               ; input offset pointer\r
+       ds      256             ; give a large buffer\r
+       ds      10              ; and a little spare\r
+;\r
+;\r
+;\r
+; Transmit space\r
+;\r
+repcnt:        db      0               ; repeat counter\r
+starc: db      0               ; star count\r
+rexbfl:        db      0               ; retransmit flag (1=> retransmit)\r
+rexcnt:        db      0               ; retransmit character count\r
+rexbuf:        ds      128             ; max retransmit line length 128 characters\r
+xmtbuff:\r
+       ds      128             ; 128 byte sector buffer\r
+xmtptr:        db      0               ; offset pointer to xmtbuff above\r
+xmtfcb:        ds      36              ; fcb for transmit file.\r
+;\r
+;INPUT and STRING space\r
+strlen:        db      0               ; length of the string from INPUT and STRING\r
+\r
+; Assorted other space\r
+errorc:        db      0               ; error level set to xxx\r
+errorl:        db      0               ; error level to test against\r
+\r
+remtxt:        db      0               ; set <> 0 if D packets to screen\r
+\r
+hosths:        ds      1               ; have we told the host to xoff? (is this duplicated)\r
+stbuff:        ds      80h             ; some space or the string buffer\r
+waitp: ds      2               ; wait command timer\r
+waitp1:        ds      2               ; wait/input timer (copy of waitp)\r
+prntmp:        ds      1               ; temporary space to put the caracter to print\r
+prnfl: db      0               ; printer flag.  Used by TYPE/PRINT\r
+;[MF][17]Following line no longer needed as TYPE uses the big buffer\r
+;typptr:       ds      2               ; pointer used by TYPE/PRINT\r
+equflg:        db      0               ; set to non zero if copy files same\r
+nquiet:        db      0               ; If non zero print from NOUT to display\r
+\r
+escflg:        db      0               ;Escape flag (start off).\r
+fileio:        db      0               ;Line-by-line from file (default off).\r
+xofflg:        db      0               ;X-OFF (=^S) received from COMM-line\r
+                               ;X-ON (=^Q) received resets this\r
+clkbit:        dw      0               ; 32 bit pseudo clock\r
+       dw      0               ; MS bits of clock\r
+number:        ds      2               ; Number in binary form from user input\r
+initflg:db     0               ; set to non zero when system initialised\r
+maxbsc:        ds      1               ; save space to know how big system allows\r
+                               ; for multi-sector buffering. (Usually 8k?)\r
+;\r
+;       Multiple FCB storage space.  Used for the DIR command\r
+;               Later on, I want to shift this into space after the system\r
+;               dependent stuff, but then it becomes messy with pointers\r
+;               to pointers etc... [OBS]\r
+;\r
+xfcbptr:\r
+       ds      2               ; pointer to current fcb space\r
+fcbcnt:        ds      1               ; Number of valid fcbs in space\r
+;\r
+fcb0:  ds      12              ; 36 bytes requred for a single fcb\r
+fcblen EQU     $-fcb0          ; length of a single fcb\r
+       ds      maxfcb*fcblen   ; space for maximum fcbs + 1 \r
+;\r
+hidefs:        db      0ffh            ; flag <> 0 if we show file size in DIR\r
+\r
+; FCB sapce for COPY command\r
+cfcbs: ds      33              ; source fcb for copy file ops.\r
+                               ;[MF]and FRENAME ops.\r
+cfcbd: ds      33              ; destination fcb for copy ops.\r
+                               ;[MF]and FRENAME ops.\r
+\r
+colfcb:        ds      33              ;[MF]Rename fcb for SET COLLISION\r
+\r
+; Command tail data space etc\r
+cbptr: db      2               ; command tail pointer (0= length of tail)\r
+cbuff: ds      128             ; temp. space for potential command tail\r
+\r
+strcnt:        db      0               ; string count for string operations...\r
+\r
+vtyval:        ds      1               ; holds row number for VT52 cursor positioning\r
+chrcnt:        ds      1               ;Number of chars in the file buffer.\r
+\r
+; Various packet variables etc\r
+bytes: dw      0               ; 4 byte 'byte count' space\r
+       dw      0\r
+filcnt:        ds      1               ;Number of chars left to fill.\r
+outpnt:        ds      2               ;Position in packet.\r
+bufpnt:        ds      2               ;Position in file buffer.\r
+fcbptr:        ds      2               ;Position in FCB.\r
+datptr:        ds      2               ;Position in packet data buffer.\r
+cbfptr:        ds      2               ;Position in character buffer.\r
+pktptr:        ds      2               ;Position in receive packet.\r
+size:  ds      1               ;Size of data from gtchr.\r
+curchk:        ds      1               ;Current checksum type\r
+inichk:        ds      1               ;Agreed upon checksum type\r
+czseen:        ds      1               ;Flag that control-Z was typed\r
+dscflg:        ds      1               ;[MF]Discard file if nonzero\r
+pktnum:        ds      1               ;Packet number.\r
+numpkt:        ds      2               ;Total number of packets sent.\r
+numrtr:        ds      2               ;Total number of retries.\r
+numtry:        ds      1               ;Number of tries on this packet.\r
+oldtry:        ds      1               ;Number of tries on previous packet.\r
+state: ds      1               ;Present state of the automaton.\r
+;*** start of new flags.  Do not assume that just because these flags are\r
+;  present that the feature is available.  I simply put them in 'for future use'\r
+rcapas:\r
+rcap1: db      0               ; receive capabilties byte 0\r
+rcap2: db      0               ; receive cpabilities byte 1\r
+scapas:\r
+scap1: db      0               ; send capabilities byte 0\r
+scap2: db      0               ; send capabilities byte 1\r
+rtimeo:        db      0               ; receive timeout\r
+stimeo:        db      0               ; send timeout\r
+rpadc: db      0               ; receive pad character\r
+spadc: db      0               ; send pad character\r
+rrept: db      0               ; receive repeat prefix\r
+srept: db      0               ; send repeat prefix\r
+rwindo:        db      0               ; receive window size\r
+swindo:        db      0               ; send window size\r
+rdpkt:\r
+rlpkt: dw      0               ; receive long packet length\r
+sdpkt:\r
+slpkt: dw      0               ; send long packet length\r
+sdckt: db      0               ; send default checktype\r
+rdckt: db      0               ; receive checktype (should be same as sdckt)\r
+;*** end  of new flags\r
+sohchr:        db      1               ;Default Start-of-header chr is cntl-a\r
+; Kermit packet starts here\r
+;      Byte 0 = start of packe character\r
+;           1 = length of packet\r
+;           2 = packet number\r
+;           3 = packet type (S R I Z E B etc)\r
+packet:        ds      4               ;Packet (data is part of it).\r
+; Data part of packet (variable length - include checksum)\r
+data:  ds      5AH             ;Data and checksum field of packet.\r
+recpkt:        ds      65H             ;Receive packet storage (use the following).\r
+recpkx:        db      cr,'$'          ;=      =       = buffer limit\r
+filbuf:        ds      65H             ;Character buffer.\r
+fnbuf: ds      20h             ;[jd] file name buffer\r
+autorc:        db      0               ;[obs] set to ON for autoreceive\r
+\r
+; Temporary data space.  Sometimes accesses as 16 bits (eg temp1/2)\r
+;** Temp 1 & 2 must be in order\r
+lstchr:                                ;Last console input character.\r
+temp1: ds      1               ;Temporary storage.\r
+temp2: ds      1\r
+lincnt:                                ; used for counting lines in p20ln\r
+temp3: ds      1\r
+temp4: ds      1\r
+temp5: ds      1\r
+temp6: ds      1\r
+temp7: ds      1\r
+temp8: ds      1\r
+temp9: ds      1\r
+temp10:        ds      1\r
+temp11:        ds      1\r
+\r
+\r
+getrxflg:\r
+       ds      1               ;[obs 22]\r
+quietd:        db      0               ;loud display during file transfers\r
+argblk:        ds      20H             ;Used for subroutine arguments\r
+\r
+maxfil EQU     2               ; currently, only two names used.\r
+fcbblk:        ds      maxfil*10H      ;Used for a list of FCB's\r
+\r
+; [gnn] secondary filename storage (remote on send, local on get)\r
+remnam:        ds      60              ;[gnn]\r
+remlen:        ds      1               ;[gnn] length of name\r
+\r
+; Bookkeeping storage for multiple-sector buffering.  The actual buffer\r
+; is somewhere in the system-dependent overlay. (at the end, I hope).\r
+nxtbuf:        ds      2               ; Pointer to next sector\r
+seccnt:        ds      1               ; Number of sectors buffered\r
+endsts:        ds      1               ; Status for last read into buffer\r
+;\r
+;\r
+; [MF] Storage for Remote Command processing\r
+;\r
+;\r
+rdl:   ds      1               ;[MF]Holds accumulated length of remote data\r
+;\r
+rcl:   ds      1               ;[MF]Holds length of Remote command line arg\r
+;\r
+remdat:        ds      95              ;[MF]Packet data buffer (plenty big)\r
+;\r
+rcom:  ds      1               ;[MF] Remote Command type\r
+;\r
+rprmpt:        dw      0               ;[MF]Address of prompt strings\r
+;\r
+rptr:  dw      0               ;[MF]Remote command packet data pointer\r
+;\r
+rscode:        ds      3               ;[MF]Holds Remote Set command ASCII code\r
+;\r
+;\r
+       org     7000h           ; address for Kermit 4.11\r
+;               ORG     ($ + 0ffH) AND 0ff00H   ; move to start of next page\r
+\r
+;\r
+;       hooks for system-dependent routines:\r
+;       This area is overwritten by the system-dependent overlay.\r
+;\r
+lnkflg:        dw      0       ; linkage information for consistency check.\r
+lnkent:        dw      0       ; more of the same.\r
+ovlver:        dw      0       ; pointer to overlay's version string\r
+family:        dw      0       ;*NEW* [10] address of the family overlay (not CPSSYS)\r
+;\r
+; Input/output routines.  Note that outmdm and outcon may actually be the\r
+;       same routine if selmdm and selcon do anything.  (the same is true\r
+;       of inpmdm and inpcon).\r
+;\r
+selmdm:        jmp     $-$     ; select modem for I/O\r
+outmdm:        jmp     $-$     ; output character in E to modem\r
+inpmdm:        jmp     $-$     ; read character from modem. return character or 0 in A.\r
+flsmdm:        jmp     $-$     ; flush pending input from modem\r
+selcon:        jmp     $-$     ; select console for I/O\r
+outcon:        jmp     $-$     ; output character in E to console\r
+inpcon:        jmp     $-$     ; read char from console. return character or 0 in A\r
+outlpt:        jmp     $-$     ; output character in E to printer\r
+lptstat:jmp    $-$     ;*NEW*[10] see if printer ready to print a character\r
+                       ; If 0ffh then ok, if 0h then not ok.\r
+extern:        jmp     $-$     ;*NEW for 4.09* If $-$ is not zero, then its a jump to\r
+                       ; a routine to emulate any terminal type the user\r
+                       ; wants to implement.\r
+xbdos: jmp     0       ;*NEW* address of the bdos trap in this section\r
+                       ; of code.  It is filled in initialisation.\r
+;\r
+; screen formatting routines\r
+clrlin:        jmp     $-$     ; erase current line\r
+clrspc:        jmp     $-$     ; erase current position (after backspace)\r
+delchr:        jmp     $-$     ; make delete look like backspace\r
+clrtop:        jmp     $-$     ; erase screen and go home\r
+;\r
+; these routines are called to display a field on the screen.\r
+scrend:        jmp     $-$     ; move to prompt field\r
+screrr:        jmp     $-$     ; move to error message field\r
+scrfln:        jmp     $-$     ; move to filename field\r
+scrnp: jmp     $-$     ; move to packet count field\r
+scrnrt:        jmp     $-$     ; move to retry count field\r
+scrst: jmp     $-$     ; move to status field\r
+rppos: jmp     $-$     ; move to receive packet field (debug)\r
+sppos: jmp     $-$     ; move to send packet field (debug)\r
+;\r
+sysinit: jmp   $-$     ; program initialization\r
+sysexit: jmp   $-$     ; program termination\r
+syscon:        jmp     $-$     ; remote session initialization\r
+syscls:        jmp     $-$     ; return to local command level\r
+sysinh:        jmp     $-$     ; help text for interrupt (escape) extensions\r
+sysint:        jmp     $-$     ; interrupt (escape) extensions, including break\r
+sysflt:        jmp     $-$     ; filter for incoming characters.\r
+                       ;  called with character in E.\r
+sysbye:        jmp     $-$     ; terminate remote session\r
+sysspd:        jmp     $-$     ; baud rate change routine.\r
+                       ; called with value from table in DE\r
+sysprt:        jmp     $-$     ; port change routine.\r
+                       ; called with value from table in HL\r
+sysscr:        jmp     $-$     ; screen setup for file transfer\r
+                       ; called with Kermit's version string in DE\r
+csrpos:        jmp     $-$     ; move cursor to row B, column C\r
+sysspc:        jmp     $-$     ; calculate free space for current disk\r
+mover: jmp     $-$     ; block move\r
+prtstr:        jmp     $-$     ; *** NEW *** prtstr moved to overlay\r
+;\r
+; Data initialized by system-dependent overlay:\r
+;\r
+pttab: ds      2       ; points to local equivalents to VT52 escape sequences\r
+spdtab:        ds      2       ; address of baud rate command table, or zero\r
+spdhlp:        ds      2       ; address of baud rate help table, or zero\r
+prttab:        ds      2       ; address of port command table, or zero\r
+prthlp:        ds      2       ; address of port help table, or zero\r
+timout:        ds      2       ; Initial value for fuzzy timeout\r
+vtflg: ds      1       ; VT52 emulation flag\r
+escchr:        ds      1       ; Storage for the escape character.\r
+speed: ds      2       ; storage for the baud rate\r
+port:  ds      2       ; storage for port value\r
+prnflg:        ds      1       ;[hh] printer copy flag (overlay may need it)\r
+dbgflg:        ds      1       ; debugging flag\r
+ecoflg:        ds      1       ; Local echo flag (default off).\r
+flwflg:        ds      1       ; File warning flag (default on).\r
+ibmflg:        ds      1       ; IBM flag (default off).\r
+cpmflg:        ds      1       ; File mode flag (ascii/binary/default)\r
+incflg:        ds      1               ;[MF]Incomplete flag (keep/discard)\r
+                               ;[MF](default discard)\r
+parity:        ds      1       ; Current parity.\r
+spsiz: ds      1       ; Send packet size.\r
+rpsiz: ds      1       ; Receive packet size.\r
+stime: ds      1       ; Send time out.\r
+rtime: ds      1       ; Receive time out.\r
+spad:  ds      1       ; Send padding.\r
+rpad:  ds      1       ; Receive padding.\r
+spadch:        ds      1       ; Send padding char.\r
+rpadch:        ds      1       ; Receive padding char.\r
+seol:  ds      1       ; Send EOL char.\r
+reol:  ds      1       ; Receive EOL char.\r
+squote:        ds      1       ; Send quote char.\r
+rquote:        ds      1       ; Receive quote char.\r
+chktyp:        ds      1       ; Checksum type desired\r
+tacflg:        ds      1       ; TACTrap flag (zero=off, nonzero=on; when non-zero,\r
+                       ;  contains current TAC intercept character)\r
+tacchr:        ds      1       ; TAC intercept character\r
+bufadr:        ds      2       ; Pointer to big buffer for multiple-sector I/O\r
+bufsec:        ds      1       ; Number of sectors big buffer can hold (0 means 256)\r
+ffussy:        ds      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
+       END     START\r