	.title	KRTDAT	Global read/write data
	.ident	"V03.63"

; /63/	27-Sep-97  Billy Youdelman  V03.63
;
;	add rem.ack
;	dpmumber conformed to its current 16-bit max value
;	add spare0 buffer, for small stuff..

; /62/	27-Jul-93  Billy Youdelman  V03.62
;
;	use erbfsiz to size errtxt buffer
;	add pkrate buffer

; /BBS/	 1-Dec-91  Billy Youdelman  V03.61
;
;	added a general use buffer, some flags and variables
;	SL editor insert mode default is set on here in edists

	.include "IN:KRTMAC.MAC"
	.iif ndf  KRTINC  .error	<; .include for IN:KRTMAC.MAC failed>


	.sbttl	Global read/write data
	.psect	$rwdata	,rw,d,lcl,rel,con

RWDATA	== .			; top of this list
$image:: .blkw	1		; for temp mods to image flag
albuff:: .blkw	1		; /51/ malloc start of free memory pointter
answer:: .blkw	1		; /62/ for SET PHONE [NO]ANSWER
argbuf:: .blkw	1		; /53/ pointer to argument bufferin hi memory
argpnt:: .blkw	1		; pointer used with argument buffer
at$len:: .blkw	1		; current file length in blocks
at$sys:: .blkw	1		; machine and os type from rec'd attributes
b4speed::.blkw	1		; /BBS/ speed before fallback
blind::	 .blkw	1		; /54/ SET PHONE BLIND
blip::	 .blkw	1		; display stats every "blip" number of packets
break::	 .blkw	2		; /BBS/ break duration (for .mrkt)
cc$max:: .blkw	1		; /BBS/ number of ^Cs needed to abort
cccnt::	 .blkw	1		; number of ^Cs typed so far
charin:: .blkw	2		; /43/ total data bytes in
charou:: .blkw	2		; /43/ total data bytes out
chksiz:: .blkw	1		; current checksum size (length in bytes)
chktyp:: .blkw	1		; current checksum type
cl.pri:: .blkw	1		; /BBS/ run TSX handler at this priority
clkflg:: .blkw	1		; /BBS/ store the clock rate here
cmdadr:: .blkw	1		; saved address of command routine
cmdbuf:: .blkw	1		; /53/ pointer to command line input buffer
cmdlun:: .blkw	1		; current command file lun
cmdnum:: .blkw	1		; index into the current command list
con8bi:: .blkw	1		; if <> we pass eight bits to console
conesc:: .blkw	1		; escape character for CONNECT
conmsg:: .blkw	1		; /BBS/ flag to hold CONNECT sign-on
conpar:: .blkb	20		; other Kermit's sinit parameters
csi.fak::.blkw	1		; /62/ if <> use fake CSI comma parser
ctlflgs::.blkb	<1.+32.+1.+32.>	; /63/ DEL&200 ,NUL..US ,DEL ,<NUL..US>&200
datauk:: .blkw	1		; /62/ data unknown loop counter
defpri:: .blkw	1		; /BBS/ TSX priority when Kermit was started
diatmo:: .blkw	1		; /46/ SET DIAL TIME-OUT
do8bit:: .blkw	1		; if <> doing 8-bit prefixing
doattr:: .blkw	1		; if 0 don't send attribute packets
doauto:: .blkw	1		; if <> check list for binary file type match
dolong:: .blkw	1		; /42/ if <> do long packets
dorpt::	 .blkw	1		; if <> do repeat counts
;doslid::.blkw	1		; /42/ if <> do sliding windows
dowild:: .blkw	1		; /63/ if 0 wildcarding must be explicit
dpnumb:: .blkw	1		; /63/ serial number of data packet
duplex:: .blkw	1		; if 0, full (default), else half
ebquot:: .blkw	1		; 8-bit prefixing quote char
edilen:: .blkw	1		; SL current command line length
edipos:: .blkw	1		; SL current cursor position
errtxt:: .blkb	erbfsiz+2	; /62/ buffer for syserr(errnum,errtxt)
exieof:: .blkw	1		; /45/ SET EOF [NO]EXIT
exstal:: .blkw	1		; /41/ take file current line number pointer
filein:: .blkw	2		; /43/ file data bytes in
fileou:: .blkw	2		; /43/ file data bytes out
filpro:: .blkw	1		; if <> don't overwrite files
getcro:: .blkw	1		; alternate address for get char routine
handch:: .blkw	1		; handshake char (for IBM systems)
image::	 .blkw	1		; if <> in image mode
incfile::.blkw	1		; /BBS/ set <> to keep incomplete file
incpar:: .blkw	1		; /56/ parity was found in rec'd SOH char
index::	 .blkw	1		; index into directory, for wildcarded lookups
infoms:: .blkw	1		; /41/ if <> display information messages
initry:: .blkw	1		; /BBS/ number of retries for init packet only
inopn::	 .blkw	1		; did sensw ever open anything?
inprog:: .blkw	1		; /BBS/ packets in progress flag
inserv:: .blkw	1		; currently we are a server
jobtyp:: .blkw	1		; /45/ 0 for interactive, <> for batch
lastcmd::.blkw	1		; /BBS/ last command's dispatch address
lastli:: .blkw	ln$cnt+1	; /BBS/ SL previous commands pointers
linkst:: .blkw	1		; if <> the link device is active
locase:: .blkw	1		; /BBS/ if <> pass lower case file name
logini:: .blkw	1		; if <> cursor is not on a newline at column 1
maxtry:: .blkw	1		; maximum number of retries for data packets
mcrcmd:: .blkw	1		; if <> it's a MCR/CCL command line
milnet:: .blkw	1		; /BBS/ if <> send XONs when first CONNECTing
modem::	 .blkb	40		; /37/ ascii modem name
modtype::.blkw	1		; /BBS/ address of modem data structure
mready:: .blkw	1		; /BBS/ if <> modem is initialized to dial out
msgtim:: .blkw	1		; /43/ warning message already done flag
nakrec:: .blkw	1		; /BBS/ anti-resonating NAK shift register
nextone::.blkw	1		; /62/ pointer to the next filespec in argbuf
numtry:: .blkw	1		; number of retries currently attempted
outlun:: .blkw	1		; zero for TT, else lun.ou
outopn:: .blkw	1		; did recsw ever create anything?
paknum:: .blkw	1		; current packet serial number mod 64
parity:: .blkw	1		; save parity setting here
pauset:: .blkw	1		; wait before sending each packet
pcnt.n:: .blkw	2		; /43/ NAKs received count
pcnt.r:: .blkw	2*34		; rpack packet counts by type
pcnt.s:: .blkw	2*34		; spack packet counts by type
pcnt.t:: .blkw	2		; /44/ time-out count
pf2$ok:: .blkw	1		; /BBS/ if <> off PF2 can't overlay HELP
phnum::	 .blkw	1		; /40/ last phone number dialed
pkrate:: .blkw	4		; /62/ last packet start & duration
pnhead:: .blkw	1		; /45/ listhead for SET PHONE numbers
ports::	 .blkb	ln$max		; /BBS/ store TSX ports to try here
prexon:: .blkw	1		; /53/ if <> prefix packets with an XON
pulse::	 .blkw	1		; /54/ SET PHONE PULSE/TONE
qedtst:: .blkw	1		; /63/ # .gtim loops to find clock ticking
qu.ini:: .blkw	1		; /BBS/ store SET TT [NO]QUIET here
ranerr:: .blkw	1		; if <> generate random checksum errors
rawfil:: .blkw	1		; /54/ SET FILE NAMING
rdrate:: .blkw	3		; /56/ exec I/O stats /62/ 3 words
recbit:: .blkw	1		; /43/ find out if parity was on
reclng:: .blkw	1		; /42/ max size I can read
recsop:: .blkw	1		; SET RECEIVE START-OF-PACKET
rectim:: .blkw	1		; /62/ SET RECEIVE TIME-OUT
rem.ack::.blkw	1		; /63/ if <> ACK rec'd for REMOTE command
remote:: .blkw	1		; if <> we are remote
restof:: .blkw	1		; /BBS/ pointer to rest of args in argbuf
rptcou:: .blkw	1		; number of repeated chars in a string
rptini:: .blkw	1		; repeat init, meaning first time through proc
rptlas:: .blkw	1		; the last char when checking repeats
rptquo:: .blkw	1		; prefix char for repeat quoting
rptsav:: .blkw	1		; save failed char in repeat encoding
rtvol::	 .blkw	1		; if <> do dir disk volume id test
seed::	 .blkw	1		; to generate random errors for debugging
senlen:: .blkw	1		; /62/ save SET SEND p.spsiz
senlng:: .blkw	1		; /42/ max size I am allowed to send
sendly:: .blkw	1		; wait before sending sinit
senpar:: .blkb	20		; our sinit parameters vector
sensop:: .blkw	1		; SET SEND START-OF-PACKET
sentim:: .blkw	1		; /62/ SET SEND TIME-OUT
senwin:: .blkw	1		; /42/ sliding windows not yet here..
sertim:: .blkw	1		; time-out waiting for server command
serwai:: .blkw	1		; SET SERVER TIME-OUT
set8bi:: .blkw	1		; if <> set bit seven on char
setchk:: .blkw	1		; /62/ save SET BLO here
setrpt:: .blkw	1		; used to set repeat encoding on/off
settle:: .blkw	1		; /BBS/ modem settle ticks on reset
signon:: .blkw	1		; /BBS/ if <> sign-on text has been displayed
size::	 .blkw	1		; size of last call to buffer_fill
skipfil::.blkw	1		; /BBS/ copy of inc-file-disp to file closer
skipfl:: .blkw	1		; should we send a eof$discard packet?
sl.ked:: .blkw	1		; /BBS/ make <> for SL's KED mode
sl.on::	 .blkw	1		; /BBS/ make <> to turn on SL
snd8bi:: .blkw	1		; local do 8-bit prefixing flag
spare0:: .blkb	32.		; /63/ temp buffer, for small stuff..
 SP0SIZ	 ==	<.-spare0>	; /63/ size of above spare0 buffer
spare1:: .blkb	256.		; /BBS/ temp buffer, max SVID filespec
 SP1SIZ	 ==	<.-spare1>	; /63/ size of above spare1 buffer
sparsz:: .blkw	1		; size of our sinit packet
state::	 .blkw	1		; current recsw or sensw state
summary::.blkw	1		; /BBS/ if <> do dir summary only
sy.ini:: .blkw	1		; init file is executing flag
tgetad:: .blkw	1		; get text address for textsrc macro
times::	 .blkw	10		; /43/ time stamp stats
tk.err:: .blkw	1		; /BBS/ format init file error message display
trace::	 .blkw	1		; file and packet logging status word
tsxcl::	 .blkw	1		; if <> it's TSX and CL
tt$io::	 .blkw	1		; /62/ if <> do I/O through TT
ttname:: .blkb	16		; our current link device ascii name
ttpar2:: .blkw	1		; /BBS/ $tcfig saved here
ttparm:: .blkw	1		; /BBS/ jsw stored here
undchr:: .blkb	2		; /BBS/ SL undel char buffer
undlin:: .blkb	ln$max+2	; /BBS/ SL undel word/line buffer
units::	 .blkb	16.		; /BBS/ store CL unit numbers to try here
vttype:: .blkw	1		; the terminal type
warn8d:: .blkw	1		; /BBS/ 8-bit quote warning has been done flag
wasmore::.blkw	1		; /62/ flag for multiple arguments display
wasnul:: .blkw	1		; /45/ for "?" processing in the command line
xgottn:: .blkw	1		; server got an "X" packet
xmode::	 .blkw	1		; if <> doing text output to TT
xredial::.blkw	1		; /BBS/ if <> redial (retry) a failed call
xresult::.blkb	4		; /BBS/ SET PHONE XMODE
RWSIZE	 == <.-rwdata>		; end of r/w data zero'd by start-up init


	.sbttl	Data to be preserved at start-up

edicmd::.word	-1		; SL hasn't saved anything yet
edists::.word	1		; /BBS/ SL insert mode is init'd on here
xprint::.word	0		; /62/ if <> dump TT to LP, here for safety..
prompt::.asciz	"KRT> "		; /63/ say this is a special version
	.even			; /62/ prompt buffer = 32. bytes total
	.blkb	26.		; /62/ if stack overflows, make it obvious!
stklim::.blkw	400+<$allsiz/2>	; /62/ the stack, allowing for max long packet
stack::	.word	0		; stack starts here..
STKSIZ	== <.-stklim>		; /62/ for debugger display

	.end
