     .XLIST
; [18]	Add SHORT/LONG option to SET BELL (long is what proc beep
;	used to do).  Correct error message spelling.  Add FORHOME
;	assembly switch to default to 1200 baud.  Add source
;	segmenting comments for easier editing/assembly on PC.
;	James R. Celoni, S.J. (Celoni@SU-SCORE.ARPA), 7-13-83
;******************** Version 1.3A ********************************** 
; [17] (a) Make command to SET BELL ON/OFF when transfer is complete.
;          Changed variable name to be consistent with other flags. (DT)
;      (b) DK2 Make it more like a Zenith (I/D L/C,inverse,24x80),
;      (c) Fix Telflg to be in CS so Telnet works.
;      Dave King (CMU), 7/1/83
;******************** Version 1.3 ********************************** 
; [16] Make adjustments to XT changes so that things that used to work
;      still do: pass along characters with the eighth bit on, and in
;      OUTCHR, don't overwrite character after setting the appropriate 
;      parity.
;      Daphne, 6/17/83
; [15] Add tabs stop and clear screen support.  Don't give checksum 
;      warnings.  Give keyboard input higher scheduling priority than 
;      port input.  This allows users to ^S, ^O, ^C, etc. the output 
;      when the port is full of characters.  Add a CMU conditional
;      to swap control-backspace (delete) with backspace since TOPS-20
;      and VMS are more delete than backspace oriented.
;      Glenn Marcy, 6/8/83
; [14] Add CMU changes that allow Kermit to work on the XT.  Plus add
;      a statement omitted previously when comparing packet numbers.   
;      Daphne, 5/26/83  (changes by Dave King, CMU)
;******************** Version 1.2 ********************************** 
; [13] When closing received file, handle case where number of bytes is
;      divisible by 128.
;      Daphne, 5/2/83
;******************** Version 1.1 ********************************** 
; [12] If "SET IBM", set local echo, XON/XOFF, and default (mark) parity.
;      Daphne, 4/15/83
; [11] In RPACK, don't push packet type, but store in temp variable.
;      If push and get an error, you pick up packet type as return addr.
;      Daphne, 4/15/83 
; [10] Add Set Parity Command.
;      Daphne, 4/12/83
; [9]  Allow single-character wildcard in filenames, use "=".
;      Daphne, 4/4/83
; [8]  Add Kermit server support.
;      Daphne, 3/17/83
; [7]  Allow wildcards in filename.
;      Daphne, 3/15/83
; [6]  Make format of "Set Escape" look like the other commands.
;      Daphne, 3/14/83
; [5]  Add Set "End-of-Line" (to the char used to terminate packets I send).
;      Daphne, 3/7/83
; [4]  Ring bell when done (when succeed and when fail).
;      Daphne, 2/10/83
; [3]  Match keyword if "?" is the terminator.
;      Daphne, 2/9/83
; [2]  Change "Inpkt" so ignores bare CR from any system. 
;      Daphne, 2/9/83
; [1]  Add "cmer04" - print error message if run off list of commands allowed.
;      Daphne, 2/9/83     

;******************** Version 1.0 ********************************** 
; KERMIT - KL10 Error-free Reciprocal Micro Interconnect over TTY-lines
; 
;       Program Version 1.3A, Kermit Protocol Version 2
;	June 13, 1983
; 
;       Based on the KERMIT Protocol.
; 
;       Copyright (C) 1982,1983 Trustees of Columbia University
;
;       Daphne Tzoar
;       Columbia University Computer Center
;       612 W. 115th St.
;       New York City, NY  10025
; 
;  Special thanks to Frank da Cruz, Bill Catchings, Steve Jensen,
;  Vace Kundakci, and Bernie Eiben for their help and contributions.
 

;  This file is the global data area for all the Kermit modules.
 
 
CMU	EQU	1		; CMU conditional assembly. [15]
IBMPC   EQU     1               ; For IBM PC conditional assembly.
FORHOME	EQU	1		; For home use, default to 1200 baud. [18]
Z100	EQU	0		; For Heath/Zenith Z-100. 
STEVE   EQU     0               ; For Steve's homebrew assembly.
 
BELL    EQU     07Q
TAB     EQU     11Q
LF      EQU     12Q
FF      EQU     14Q
CR      EQU     15Q
XON     EQU     21Q
XOFF    EQU     23Q
ESC     EQU     33Q
DEL     EQU     177Q
BS	EQU	08H

DOS     EQU     21H
 
CONIN   EQU     01H
CONOUT  EQU     02H
RDRIN   EQU     03H
PUNOUT  EQU     04H
LSTOUT  EQU     05H
DCONIO  EQU     06H
GTIOB   EQU     07H
PRSTR   EQU     09H
CONSTAT EQU     0BH
OPENF   EQU     0FH
CLOSF   EQU     10H
SFIRST  EQU     11H
SNEXT   EQU     12H
DELF    EQU     13H
READF   EQU     14H             ; Read from the file.
WRITEF  EQU     15H
MAKEF   EQU     16H
SETDMA	EQU	1AH
CFLSZ   EQU     23H
 
MAXPKT  EQU     '~'-' '+2Q      ; Maximum size of a packet.
MAXTRY  EQU     05Q             ; Default number of retries on a packet.
IMXTRY  EQU     20Q             ; Default number of retries send initiate.
DRPSIZ  EQU     5EH             ; Default receive packet size.
DSPSIZ  EQU     20H             ; Default send packet size.
DSTIME  EQU     08H             ; Default send time out interval.
DRTIME  EQU     05H             ; Default receive time out interval.
DSPAD   EQU     00H             ; Default send padding.
DRPAD   EQU     00H             ; Default receive padding.
DSPADC  EQU     00H             ; Default send padding char.
DRPADC  EQU     00H             ; Default receive padding char.
DSEOL   EQU     CR              ; Default send EOL char.
DREOL   EQU     CR              ; Default receive EOL char.
DSQUOT  EQU     '#'             ; Default send quote char.
DRQUOT  EQU     '#'             ; Default receive quote char.

PAREVN	EQU	00H		; Even parity.			[10 start]
PARMRK	EQU	01H		; Mark parity.
PARNON	EQU	02H		; No parity.	
PARODD	EQU	03H		; Odd parity.
PARSPC	EQU	04H		; Space parity.
DEFPAR	EQU	PARNON		; Default parity (none.) 
IBMPAR  EQU	PARMRK		; IBM's parity (mark.)		[10 end]
FREQ	EQU	0A98H		; 440 Hz (1193180. / 0A98H) bell [18]
BELLONG	EQU	0FFFFH		; Long (500 ms) bell [18]
BELSHOR	EQU	1311		; Short (10 ms) bell [18]

 
SOH     EQU     01H             ; Start of header char.
BUFSIZ  EQU     80H             ; Size of DMA.
DIASW   EQU     01H             ; Default is diagnostics on.
 
CMKEY   EQU     01H             ; Parse a keyword.
CMIFI   EQU     02H             ; Parse an input file spec (can be wild).
CMOFI   EQU     03H             ; Parse an output file spec.
CMCFM   EQU     04H             ; Parse a confirm.
CMTXT	EQU	05H		; Parse arbitrary text up to CR.   [8]

IF ibmpc
BIOS    EQU     10H
COMM	EQU	14H
KEYB	EQU	16H
DEFESC  EQU     ']'-100Q        ; The default escape character.
MDMDAT	EQU	03F8H		; Address of modem port (data).
MDMSTS	EQU	03FDH		; Address of modem port	status.
MDMCOM	EQU	03FBH		; Address of modem port command.
MDMINP	EQU	1		; Input ready bit.
MDMINTV	EQU	0030H		; Address of modem port interrupt vector.
MDMINTO	EQU	0EFH		; Mask to enable interrupt for modem port.
MDMINTC	EQU	010H		; Bit to set to disable interrupts for modem.
INTCONT	EQU	0021H		; Address of 8259 interrupt controller ICW2-3.
INTCON1	EQU	0020H		; Address of 8259 ICW1.
EOICOM	EQU	0064H		; End of interrupt.
TIMER	EQU	40H		; Use to issue short beep.
PORT_B	EQU	61H		; Port B address.

B0300	EQU    180H		; Variables for 300 baud, 1200, etc.
B1200	EQU	60H
B1800	EQU	40H
B2400	EQU	30H
B4800	EQU	18H
B9600	EQU	0CH
ENDIF

IF Z100
DEFESC  EQU     '\'-100Q        ; The default escape character.

; BIOS entry points

BIOS_SEG SEGMENT AT 40H		; Define segment where BIOS really is

	ORG	6*3
BIOS_AUXOUT LABEL FAR		; AUX output routine

	ORG	26*3
BIOS_AUXFUNC LABEL FAR		; AUX: function

BIOS_SEG ENDS			; End of BIOS segment defs

; Function codes for BIOS_AUXFUNC
CHR_READ	EQU	1	; Read character
CHR_STATUS	EQU	2	; Get status
  CHR_SFGS	EQU	0	; Get status subfunction
  CHR_SFGC	EQU	1	; Get config subfunction
CHR_CONTROL	EQU	3	; Control function
 CHR_CFSU	EQU	0	; Set new configuration parameters

B00455	EQU	0		; 45.5 baud
B0050	EQU	1		; 50 baud
B0075	EQU	2		; 75 baud
B0110	EQU	3		; 110 baud
B01345	EQU	4		; 134.5 baud
B0150	EQU	5		; 150 baud
B0300	EQU	6		; 300 baud
B0600	EQU	7		; 600 baud
B1200	EQU	8		; 1200 baud
B1800	EQU	9		; 1800 baud
B2000	EQU	10		; 2000 baud
B2400	EQU	11		; 2400 baud
B4800	EQU	12		; 4800 baud
B9600	EQU	13		; 9600 baud
B19200	EQU	14		; 19200 baud
B38400	EQU	15		; 38400 baud 
ENDIF

STACK   SEGMENT PARA STACK 'STACK'
        DW      100 DUP(0)      ; Initialize stack to all zeros.
STK	EQU	THIS WORD
STACK   ENDS
 
DATAS   SEGMENT PARA PUBLIC 'DATAS'
 
        ; Pure storage.
 
versio  db      'CUCCA'
IF ibmpc
	db	' IBM-PC' 
ENDIF
IF Z100
	db	'/Stevens Heath/Zenith Z-100'
ENDIF
	db	' Kermit-86 - ver 1.3A [18]',cr,lf,	; [18]
	db	'Field Test Version',cr,lf,'$'
kerm    db      'Kermit-86>$'
spmes   db	'Spack:  $'
rpmes 	db	'Rpack:  $'
hibit	db	'Warning - Non Ascii char$'
tmp	db	?
foo	db	'$'
crlf    db      cr,lf,'$'
ender	db	bell,bell,'$' 			;  [4]
tmsg1	db	cr,lf,'[Connecting to host, type $' 
tmsg3	db	' C to return to PC]',cr,lf,cr,lf,'$' ;DK2
tmsg2	db	cr,lf,'[Back at micro]',cr,lf,'$'
ermes1  db      cr,lf,'?Unrecognized command$'	; [18]
ermes2  db      cr,lf,'?Illegal character$'
ermes3  db      cr,lf,'?Not confirmed$'
ermes4  db      'Unable to rename file$'
ermes7  db      '?Unable to receive initiate$'
ermes8  db      '?Unable to receive file name$'
ermes9  db      '?Unable to receive end of file$'
erms10  db      '?Unable to receive data$'
erms11  db      '?Disk full$'
erms14  db      '?Unable to receive an acknowledgment from the host$' ; [18]
erms15  db      '?Unable to find file$'
erms17  db	'Record length exceeds size of buffer$'
erms18	db	cr,lf,'?Unable to tell host that session is finished$'
erms19	db	cr,lf,'?Unable to tell host to logout$'
infms0  db      'Waiting .....$'
infms1  db      'Receiving ...$'
infms2  db      'Sending .....$'
infms3  db      'Completed    $'
infms4  db      'Failed       $'
infms5  db      'Renaming file to $'
 
cfrmes  db      ' Confirm with carriage return $'
filhlp  db      ' Input file spec (possibly wild) $'
esctl	db	'Control-$'         ; [6]
spchar	db	24H,26H,23H,40H,21H,25H,27H,28H,29H,2DH
	db	3CH,3EH,7BH,7DH,5FH,5CH,5EH,7EH,7CH,60H
eschlp  db      cr,lf,'Enter literal value (ex: Cntrl ])  $'
tophlp  db	cr,lf,'BYE to host (LOGOUT) and exit to DOS'
	db      cr,lf,'CONNECT to host on selected port'
        db      cr,lf,'EXIT to DOS'
	db	cr,lf,'FINISH running Kermit on the host'
        db      cr,lf,'HELP by giving this message'
	db	cr,lf,'LOGOUT the host'
        db      cr,lf,'RECEIVE file from host'
        db      cr,lf,'SEND file to host'
        db      cr,lf,'SET a parameter'
;        db      cr,lf,'SHOW the parameters'
        db      cr,lf,'STATUS of Kermit$'
sethlp  db	cr,lf,'BAUD rate'
	db	cr,lf,'BELL'	; [17a]
	db	cr,lf,'DEBUG'
	db	cr,lf,'END-OF-LINE character'
	db      cr,lf,'ESCAPE character change'
        db      cr,lf,'FILE-WARNING'
	db	cr,lf,'IBM'
        db      cr,lf,'LOCAL-ECHO echoing (half-duplex)'
	db	cr,lf,'PARITY type'         		; [10]
;        db      cr,lf,'RECEIVE parameter'
;        db      cr,lf,'SEND parameter'
IF ibmpc
        db      cr,lf,'VT52-EMULATION$'
ENDIF
IF Z100
	db	'$'
ENDIF	
stshlp  db      cr,lf,'PAD-CHAR'
        db      cr,lf,'PADDING$'
onhlp   db      cr,lf,'OFF      ON$'
yeshlp  db      cr,lf,'NO       YES$'
belhlp	db	cr,lf,'OFF      ON       LONG     SHORT$'	; [18]
parhlp	db	cr,lf,'None   Mark   Odd   Even   Space$'   ; [10]
IF ibmpc
bdhlp	db	cr,lf,'300   1200   1800   2400   4800   9600$'
ENDIF
IF Z100
bdhlp	db	cr,lf,'45.5	50	75	110	134.5	150	300'
	db	'	600	1200	1800'
	db	cr,lf,'	2000	2400	4800	9600	19200	38400'
ENDIF
eolhlp	db	cr,lf,'Decimal digit between 0 and 31$'   ; [5]
eolerr	db	cr,lf,'Illegal end-of-line character$'  ; [5]
inthlp  db      cr,lf,'?  This message'
        db      cr,lf,'C  Close the connection'
        db      cr,lf,'S  Status of the connection'
        db      cr,lf,'Typing the escape character will send it to the host'
        db      cr,lf,cr,lf,'Command>$'
locst   db      cr,lf,'Local echo on$'
remst   db      cr,lf,'Local echo off$'
belon	db	cr,lf,'Ring bell at end of transfer$'     ; [17a - DT]
beloff	db	cr,lf,'No bell at end of transfer$'       ; [17a - DT]
bellg	db	cr,lf,'Long bell from host$'	; [18]
belsh	db	cr,lf,'Short bell from host$'	; [18]
IF ibmpc
vtemst  db      cr,lf,'VT52 emulation on$'
novtst  db      cr,lf,'VT52 emulation off$'
ENDIF
ibmst   db      cr,lf,'IBM on$'
noibm   db      cr,lf,'IBM off$'
pnonst	db	cr,lf,'No parity$'   			; [10]
poddst	db	cr,lf,'Odd parity$'    			; [10]
pevnst	db	cr,lf,'Even parity$'   			; [10]
pmrkst	db	cr,lf,'Mark parity$'   			; [10]
pspcst	db	cr,lf,'Space parity$'  			; [10]
IF Z100 
b04st	db	cr,lf,'Baud rate is 45.5$'
b05st	db	cr,lf,'Baud rate is 50$'
b07st	db	cr,lf,'Baud rate is 75$'
b11st	db	cr,lf,'Baud rate is 110$'
b13st	db	cr,lf,'Baud rate is 134.5$'
b15st	db	cr,lf,'Baud rate is 150$'
b06st	db	cr,lf,'Baud rate is 600$'
b20st	db	cr,lf,'Baud rate is 2000$'
b19st	db	cr,lf,'Baud rate is 19200$'
b38st	db	cr,lf,'Baud rate is 38400$'
ENDIF
b03st	db	cr,lf,'Baud rate is 300$'
b12st	db	cr,lf,'Baud rate is 1200$'
b18st	db	cr,lf,'Baud rate is 1800$'
b24st	db	cr,lf,'Baud rate is 2400$'
b48st	db	cr,lf,'Baud rate is 4800$'
b96st	db	cr,lf,'Baud rate is 9600$'
debon	db	cr,lf,'Debug mode on$'
deboff	db	cr,lf,'Debug mode off$'	
flwon	db	cr,lf,'File Warning on$'
flwoff	db	cr,lf,'File Warning off$'
eolst	db	cr,lf,'End-of-line character is ^$'     ; [5]
escmes  db      cr,lf,'Escape character is  $'          ; [6]
 
 
outlin  db      cr,lf,'                CUCCA'
IF ibmpc
	db	' IBM-PC'
ENDIF
IF Z100
	db	'/Stevens Heath/Zenith Z-100'
ENDIF
	db	' Kermit-86 - ver 1.3A [18]',	; [18]
	db	'  Field Test Version',cr,lf
        db      cr,lf,'Number of packets        (hex)'
        db      cr,lf,'Number of retries        (hex)'
        db      cr,lf,'File name $'
delstr  db      10O,' ',10O,10O,'$'     ; Delete string.
clrspc  db      ' ',10O,'$'             ; Clear space.
escspc	db	10O,' ',10O,'$'		; Clear escape.
IF ibmpc
clrlin  db      cr,'$'			; Clear line (just the cr part).
ENDIF
IF Z100
clrlin	db	cr,esc,'K$'		; Clear line on Z-100
clreol	db	esc,'K$'		; Clear to end of line
clrscr	db	esc,'H',esc,'J$'	; Home and clear screen
homcur	db	esc,'H$'		; Home cursor
ENDIF
prsp	db	' $'			; Print a space.

; Cursor addressing items.

IF ibmpc
scrhi	dw	0434H			; Err when 8th bit is on.
scrrpr	dw	0700H			; Prompt when Kermit ends.
screrr  dw      0600H		        ; Place for error msgs. 
scrfln  dw      050CH			; Place for file name.
scrnrt  dw      0415H		        ; Place for number of retries.
scrnp   dw      0315H 		        ; Place for number of packets.
scrfr	dw	0600H			; Rename file.
scrst	dw	0334H			; Place for status.
scrsp	dw	0800H			; Place for send packet.
scrrp	dw	0A00H			; Place for receive packet.

ttab	label	word			; Table for cursor movement.
ta	dw	curup			; Cursor up.
tb	dw	curdwn			; Cursor down.
tc	dw	currt  			; Cursor right.
td	dw	curlft			; Cursor left.
te	dw	curclr			; Clear display. [15]
tf	dw	curskp			; Enter graphics mode.
tg	dw	curskp			; Exit graphics mode.
th	dw	curhm			; Cursor home.
ti	dw	curup			; Reverse line feed.
tj	dw	curscr			; Clear to end of screen.
tk	dw	curln			; Clear to end of line.
tl	dw	inslin			; Insert line.
tm	dw	dellin			; Delete line.	
tn	dw	delchr			;DK2 Delete character
to	dw	insmox			;DK2 Cancel Insert Character
ENDIF

IF Z100
scrhi	db	esc,'Y',23H,54H,lf,'$'	; 8th bit on in character
scrrpr	db	esc,'Y',27H,20H,'$'	; Prompt when Kermit ends
screrr	db	esc,'Y',26H,20H,'$'	; Error messages
scrfln	db	esc,'Y',25H,2CH,'$'	; File name
scrnrt	db	esc,'Y',23H,35H,lf,'$'	; Number of retries
scrnp	db	esc,'Y',23H,35H,'$'	; Number of packets
scrfr	db	esc,'Y',26H,20H,'$'	; Rename file
scrst	db	esc,'Y',23H,54H,'$'	; Status
scrsp	db	esc,'Y',28H,20H,'$'	; send packet
scrrp	db	esc,'Y',2AH,20H,'$'	; Receive packet
ENDIF

        ; COMND tables

comtab  db      0AH             	; Ten entries.
	db	03H,'BYE$'
	dw	bye
        db      07H,'CONNECT$'
        dw      telnet
        db      04H,'EXIT$'
        dw      exit
	db	06H,'FINISH$'
	dw	finish
        db      04H,'HELP$'
        dw      help
	db	06H,'LOGOUT$'
	dw	logout
        db      07H,'RECEIVE$'
        dw      read
        db      04H,'SEND$'
        dw      send
        db      03H,'SET$'
        dw      setcom
        db      06H,'STATUS$'
        dw      status

IF ibmpc
settab  db      0AH             ; Ten entries. [17a]
ENDIF
IF Z100
settab  db      09H             ; Nine entries.   [10]  [17a -- DT]
ENDIF
	db	04H,'BAUD$'
	dw	baudst
	db	04H,'BELL$'	; [17a]
	dw	bellst		; [17a]
	db	05H,'DEBUG$'
	dw	debst
	db	0BH,'END-OF-LINE$'	         ;  [5]
	dw	eolset				 ;  [5]
        db      06H,'ESCAPE$'
        dw      escape
	db	0CH,'FILE-WARNING$'
	dw	filwar
        db      03H,'IBM$'
        dw      ibmset
        db      0AH,'LOCAL-ECHO$'
        dw      lcal
	db	06H,'PARITY$'				; [10]
	dw	setpar					; [10]
IF ibmpc
        db      0EH,'VT52-EMULATION$'
        dw      vt52em
ENDIF
 
ontab   db      02H             ; Two entries.
        db      03H,'OFF$'	; alphabetized [18 start]
        dw      00H
        db      02H,'ON$'
        dw      01H		; [18 end]
 
yestab  db      02H             ; Two entries.
        db      02H,'NO$'
        dw      00H
        db      03H,'YES$'
        dw      01H

beltab	db      04H		; Four entries. [18 start]
	db	04H,'LONG$'
	dw	BELLONG
        db      03H,'OFF$'
        dw      00H
	db	02H,'ON$'
        dw      01H
	db	05H,'SHORT$'
	dw	BELSHOR		; [18 end]

partab	db	05H		; Five entries.			[10 start]
	db	04H,'EVEN$'
	dw	PAREVN
	db	04H,'MARK$'
	dw	PARMRK
	db	04H,'NONE$'
	dw	PARNON
	db	03H,'ODD$'
	dw	PARODD
	db	05H,'SPACE$'
	dw	PARSPC						;[10 end]

IF ibmpc
bdtab	db	06H		; Six entries.
	db	04H,'1200$'
	dw	B1200
	db	04H,'1800$'
	dw	B1800
	db	04H,'2400$'
	dw	B2400
	db	03H,'300$'
	dw	B0300
	db	04H,'4800$'
	dw	B4800
	db	04H,'9600$'
	dw	B9600
ENDIF
IF Z100
bdtab	db	010H		; 16 entries
	db	03H,'110$'
	dw	b0110
	db	04H,'1200$'
	dw	b1200
	db	03H,'134$'
	dw	b01345
	db	03H,'150$'
	dw	b0150
	db	04H,'1800$'
	dw	b1800
	db	05H,'19200$'
	dw	b19200
	db	04H,'2000$'
	dw	b2000
	db	04H,'2400$'
	dw	b2400
	db	03H,'300$'
	dw	b0300
	db	05H,'38400$'
	db	b38400
	db	02H,'45$'
	dw	b00455
	db	04H,'4800$'
	dw	b4800
	db	02H,'50$'
	dw	b0050
	db	03H,'600$'
	dw	b0600
	db	02H,'75$'
	dw	b0075
	db	04H,'9600$'
	dw	b9600
ENDIF
 
; COMND storage
 
cmer00  db      cr,lf,'?Program error   Invalid COMND call$'
cmer01  db      cr,lf,'?Ambiguous$'
cmer02  db      cr,lf,'?Illegal input file spec$'
cmer03	db	cr,lf,'?Unrecognized instruction$'
cmer04	db	cr,lf,'?Invalid command or operand$'     ;  [1]
cmin00  db      ' Confirm with carriage return$'
cmcrlf  db      cr,lf,'$'
 
cmstat  db      ?               ; What is presently being parsed.
cmaflg  db      ?               ; Non-zero when an action char has been found.
cmccnt  db      ?               ; Non-zero if a significant char is found.
cmsflg  db      ?               ; Non-zero when the last char was a space.
cmostp  dw      ?               ; Old stack pointer for reparse.
cmrprs  dw      ?               ; Address to go to on reparse.
cmprmp  dw      ?               ; Address of prompt.
cmptab  dw      ?               ; Address of present keyword table.
cmhlp   dw      ?               ; Address of present help.
cmdbuf  db      80H DUP(?)      ; Buffer for command parsing.
cmfcb   dw      ?               ; Pointer to FCB.
cmfcb2  dw      ?               ; Pointer to position in FCB.
cmcptr  dw      ?               ; Pointer for next char input.
cmdptr  dw      ?               ; Pointer into the command buffer.
cmsiz	dw	?		; Size info of user input.
cmkptr  dw      ?               ; Pointer to keyword.
cmsptr  dw      ?               ; Place to save a pointer.
cmchr	db	?		; Save char when checking ambiguity.
 
; Program storage.
 
oldstk  dw      ?               ; Storage for system stack.
oldsts  dw      ?               ; System stack segment.
ssp	dw	0		; Save SP in Telnet.
bufhex	dw	80H
filsiz	dd	0		; Double word for filesize (in bytes.)
eoflag  db      ?               ; EOF flag; non-zero on EOF.
wldflg	db	0		; Assume no "*" in fn.         [7]
;telflg	db	0		; Are we acting as a terminal. [16] [17c]
belflg	db	1		; Use bell  [17a -- DT]
incmod	db	0		;DK2 Insert Character mode
debug	db	0		; Debugging mode (default off).
hierr	db	0		; Non-ascii char (non-zero if yes).
filflg  db      ?               ; Non-zero when nothing in DMA buffer.
ecoflg  db      0               ; Local echo flag (default off).
parflg  db	defpar		; Parity flag (default none.)  [10]
escflg  db      0               ; Escape flag (start off).
IF forhome			; [18 start]
bellen	dw	BELSHOR		; Bell length (default shorter)
ELSE
bellen	dw	BELLONG		; Bell length (default longer)
ENDIF				; [18 end]
IF ibmpc
vtflg   db      1               ; VT52 emulation flag (default on).
curatt	dw	0007H		;DK2 Video attributes
IF forhome			; [18]
baud	dw	B1200		; Default to 1200 baud. [18]
ELSE				; [18]
baud	dw	B4800		; Use default of 4800.
ENDIF				; [18]
ENDIF
IF Z100
auxcnf	db	4 dup(?)	; AUX port configuration info
baud	db	?		; Baud rate
auxcnf1	db	12 dup(?)	; Rest of configuration info
ENDIF

flwflg  db      0               ; File warning flag (default off).
ibmflg  db      0               ; IBM flag (default off).
extflg  db      0               ; Exit flag (default off).
escchr  db      defesc          ; Storage for the escape character.
incnt	dw	?		; Number of chars read in from port.
chrcnt  dw      ?               ; Number of chars in the file buffer.
filcnt  dw      ?               ; Number of chars left to fill.
outpnt  dw      ?               ; Position in packet.
bufpnt  dw      ?               ; Position in file buffer.
fcbptr  dw      ?               ; Position in FCB.
datptr  dw      ?               ; Position in packet data buffer.
cbfptr  dw      ?               ; Position in character buffer.
pktptr  dw      ?               ; Poistion in receive packet.
siz     dw      ?               ; Size of data from gtchr.
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.
pktnum  dw      ?               ; Packet number.
numpkt  dw      ?               ; Total number of packets sent.
numrtr  dw      ?               ; Total number of retries.
numtry  db      ?               ; Number of tries on this packet.
oldtry  db      ?               ; Number of tries on previous packet.
state   db      ?               ; Present state of the automaton.
savsci	dw	?		; Save for serial port interrupt vector. [14]
savscs	dw	?		; Ditto.  [14]  
packet  db      ?,?,?,?         ; Packet (data is part of it).
data    db      5AH DUP(?)      ; Data and checksum field of packet.
recpkt  db      60H DUP(?)      ; Receive packet storage (use the following).
filbuf  db      60H DUP(?)      ; Character buffer.
fcb	db	25H DUP(?)	; Use as our FCB.
cpfcb	db	25H DUP(?)	; Save FCB in case of "*".   [7]
buff	db	80H DUP(?)	; Use as our DAT.
rdbuf	db	80H DUP(?)
cnt	dw	0
temp	dw	0
temp1   dw      ?               ; Temporary storage.
temp2   dw      ?
temp3   dw      ?
temp4   dw      ?
argblk  dw      ?               ; For subroutine arguments.
argbk1  dw      ?
argbk2  dw      ?
argbk3  dw      ?
 
DATAS   ENDS                    ; End data segment
; end kermit1.asm [18]
owledge packet.
        call spack              ; Send the packet.
	 jmp abort
    