
>>>>> DB1:K11COM.MAC[2,2] <<<<<

loacmd::mov	#cmdlst	,r0
loarem::mov	#remlst	,r0
loaset::mov	#setcmd	,r0

>>>>> DB1:K11CON.MAC[2,2] <<<<<

doconn::tstb	ttname			; insure that a device name is set
dorsx::	return

>>>>> DB1:K11CPY.MAC[2,2] <<<<<

copy::	save	<r2,r3,r4>		; save r2-r4 please

>>>>> DB1:K11DER.MAC[2,2] <<<<<

direrr::
fcsdir::mov	r1	,-(sp)		; save R1

>>>>> DB1:K11DFH.MAC[2,2] <<<<<

defhlp::message

>>>>> DB1:K11ERR.MAC[2,2] <<<<<

rmserr::cmp	@2(r5)	,#-624.
rmserp::mov	r1	,-(sp)		;save fab addr
rmserx::mov	#77-5	,r1		; maxlength of 77 (8) bytes

>>>>> DB1:K11ER1.MAC[2,2] <<<<<

rmser1::save	<r0,r1,r2>		; be nice to our caller

>>>>> DB1:K11ER2.MAC[2,2] <<<<<

rmser2::save	<r0,r1,r2>		; be nice to our caller

>>>>> DB1:K11ER3.MAC[2,2] <<<<<

rmser3::save	<r0,r1,r2>		; be nice to our caller

>>>>> DB1:K11E80.MAC[2,2] <<<<<

xinit::	calls	l$fss	,<#200$>	; open terminal on LUN.AS
ttyini::call	getprv			; will need for binary open
ttyfin::calls	clrdlm	,<2(r5)>	; clear private delimiters
gttnam::save	<r0,r1,r2>		; may as well save it
setdlm::mov	#xrb	,r0		; setup to set a private delim
clrdlm::
ttrini::mov	#xrb	,r0		; setup to set a private delim
ttrfin::calls	clrdlm	,<#lun.tt>
noecho::save	<r1>			; save a temp register
echo::	save	<r1>			; save a temp register
write::	mov	#xrb	,r0		; address of xrb parameter block
read::	mov	#xrb	,r0		; address of xrb parameter block
kbread::calls	read	,<@r5,#80.,#0,#0> ; do the actual read now
xbinre::
binrea::mov	#xrb	,r0		; address of xrb parameter block
chkabo::calls	binrea	,<#5,#-1>	; simple read on console terminal
binwri::mov	#xrb	,r0		; address of xrb parameter block
l$fss::	clrfqb
l$fssx::mov	@r5	,r0		; get the filename address
l$ttyo::save	<r0,r1>			; save temps here please
sttyou::mov	r5	,-(sp)
l$pcrl::.print	#100$
$clrxr::save	<r0>
$clrfq::save	<r0>
exit::	clrxrb				; ensure xrb is clear first
logout::clrfqb				; ensure firqb is cleared out
quochk::clrfqb				; try to see if the logout will work
dskuse::save	<r0,r1>
cantyp::save	<r1,r2>			; use r0 to point into xrb
getuic::mov	#xrb	,r0		; clear xrb out first
drpprv::mov	#jfsys	,xrb+0		; drop temp privs
getprv::mov	#jfsys	,xrb+0		; get temp privs back please
suspen::mov	@r5	,xrb+0
fcserr::
fiperr::save	<r0,r1,r2>
syserp::save	<r0>
syserr::save	<r1>			; save a register
ttypar::call	ttpars			; get the terminal unit number
chkpar::clr	r0
ttyhan::call	ttpars			; the usual, parse the device name
ttydtr::call	ttpars			; the usual, parse the device name
ttspee::save	<r1>
setspd::save	<r1,r2>
ttysav::save	<r1,r2>			; save registers please
ttyrst::save	<r1,r2>			; save registers please
ttyset::save	<r1>
ttpars::save	<r1>
assdev::call	ttpars
namcvt::save	<r1,r2>
ascdat::save	<r0,r1>
asctim::save	<r0,r1>
dodir::	save	<r1,r2,r3,r4>
ttxon::	save	<r1>			; save a temp register
sp.dev::.word	0
sp.mod::.word	0			; use 4!40 for delete and noheader
qspool::save	<r1>
detach::clrfqb				; insure no defaults
setcc::	mov	#ttast	,@#24
setsla::clr	r0
fu$def::.word	177777			; do we need a defdir for RMS11v2

>>>>> DB1:K11HLP.MAC[2,2] <<<<<

c$help::call	hlpopn			; open the help file up?
hnames::.word	10$,20$,30$,40$,0

>>>>> DB1:K11LCL.MAC[2,2] <<<<<

okuser::mov	2(sp)	,r0
...uic::.word	0			; no checks on group number
..$bye::.ascii	<000>/BYE/		; BYE         
..$com::.ascii	<000>/COM/		; COMMENT     
..$con::.ascii	<000>/CON/		; CONNECT     
..$cop::.ascii	<000>/COP/		; COPY        
..$del::.ascii	<000>/DEL/		; DELETE      
..$dir::.ascii	<000>/DIR/		; DIRECT      
..$dis::.ascii	<000>/DIS/		; DISCONNECT  
..$era::.ascii	<000>/ERA/		; ERASE       
..$exi::.ascii	<000>/EXI/		; EXIT        
..$fin::.ascii	<000>/FIN/		; FINISH      
..$get::.ascii	<000>/GET/		; GET         
..$han::.ascii	<000>/HAN/		; HANGUP      
..$hel::.ascii	<000>/HEL/		; HELP        
..$loc::.ascii	<000>/LOC/		; LOCAL       
..$log::.ascii	<000>/LOG/		; LOGOUT      
..$not::.ascii	<000>/NOT/		; NOTE        
..$qui::.ascii	<000>/QUI/		; QUIT        
..$rec::.ascii	<000>/REC/		; RECEIVE     
..$rem::.ascii	<000>/REM/		; REMOTE      
..$ren::.ascii	<000>/REN/		; RENAME      
..$sen::.ascii	<000>/SEN/		; SEND        
..$ser::.ascii	<000>/SER/		; SERVER      
..$set::.ascii	<000>/SET/		; SET         
..$sho::.ascii	<000>/SHO/		; SHOW        
..$spa::.ascii	<000>/SPA/		; SPACE       
..$sys::.ascii	<000>/SYS/		; SYSTEM      
..$tak::.ascii	<000>/TAK/		; TAKE        
..$tra::.ascii	<000>/TRA/		; TRANSMIT    
..$typ::.ascii	<000>/TYP/		; TYPE        
..$who::.ascii	<000>/WHO/		; WHO         
slowgr::.word	2			; cutoff for group numbers
slowdo::.word	0			; if <> 0, then slow xfers down
slowbd::.word	1200.
throtl::save	<r0,r1>

>>>>> DB1:K11M41.MAC[2,2] <<<<<

fu$def::.word	0			; if rms needs the DNA filled in
xinit::	call	getsys					; rsx or m+
xk$dev::.asciz	/XK0:/
xk$spd::.word	9600.
setcc::	qiow$s	#io.det,#lun.tt,#ef.tt,,#kbiost
ttyini::save	<r1>
ttyfin::					; no more abort handling
ttrini::
ttrfin::
ttysav::
ttyset::
ttyrst::
noecho::
echo::
gttnam::save	<r1,r2,r3>		; save temps please
kbread::
binrea::tstb	handch			; doing ibm style xon handshaking  BDN
binwri::
xbinre::save	<r2,r3>			; save a register for a friend
chkabo::calls	xbinrea	,<#lun.tt,#-1>	; simple read on console terminal
l$ttyo::
sttyou::
l$pcrl::
logout::
exit::
quochk::
dskuse::
cantyp::
ttxon::	save	<r1>			; use r0 to point into xrb
getuic::
drpprv::
getprv::
suspen::
ttypar::
chkpar::clr	r0
ttyhan::save	<r1>
ttydtr::
ttspee::
setspd::save	<r1,r2,r3,r4>
setsla::save	<r1>			; save temps we may want
ttpars::				; NEEDS TO BE GLOBAL(RBD)
assdev::tst	proflg
namcvt::
ascdat::save
asctim::save
sercmd::
systat::
dodir::
runjob::
runmcr::
rsxsys::
qspool::movb	#1	,r0
;rsxspl::mov	r0	,-(sp)		; save temps
detach::qiow$s	#io.det,#5,#ef.tt,,#kbiost
syserp::
syserr::

>>>>> DB1:K11PK .MAC[2,2] <<<<<

runjob::mov	r5	,-(sp)		; convert f4/bp2 call format
$runjo::clr	-(sp)
$pklog::

>>>>> DB1:K11RMS.MAC[2,2] <<<<<

sydisk::.ascii	/SY:/
fablst::.word	0	,fab1	,fab2	,fab3	,fab4
namlst::.word	0	,nam1	,nam2	,nam3	,nam4
namlen::.word	0	,0	,0	,0	,0
rablst::.word	0	,rab1	,rab2	,rab3	,rab4
df$rat::.word	fb$cr
df$rfm::.word	fb$var
open::	calls	fopen	,<@r5,2(r5),4(r5),#0>
create::calls	fcreate	,<@r5,2(r5),4(r5),#0>
fopen::	save	<r1,r2,r3>		; save registers
fcreat::save	<r1,r2,r3>		; save registers
settyp::mov	fablst(r0),r1
close::	save	<r1,r2,r3>		; save registers we may have
rewind::mov	@r5	,r0
binfil::save	<r1,r2,r3,r4>		; save registers we may use
getsiz::mov	@r5	,r1		; return error in r0, size in r1
getatr::save	<r1,r2>			; save these please
putatr::save	<r1,r2>			; save these please
getrec::mov	2(r5)	,r0		; get the channel number
putrec::mov	r1	,-(sp)
getc::	mov	@r5	,r0
getcr0::save	<r2,r3>			; save temps
putc::	save	<r1>			; simply save r1 and call putcr0
putcr0::save	<r1,r2,r3,r4>		; save registers we use
fu$dir::.word	0			; style wildcarding on your non-standard
lookup::save	<r1,r2,r3,r4,r5>
RNFAB1::FAB$B				; Old file name
RNNAM1::NAM$B				; NAM definition
RNFAB2::FAB$B				; New file name
RNNAM2::NAM$B				; NAM definition
rename::save	<r2,r3,r4,r5>		; save temps please
delete::save	<r2,r3,r4>		; save registers we may overwrite
fparse::save	<r1,r2>			; save registers we may overwrite
tsksiz::sub	#40	,sp		; use the stack for a buffer
getsys::sub	#40	,sp		; use the stack for a buffer
GSABAS::			; GSA base address
GSAMIN::			; Minimum allocation
GSAREQ::			; Size of this request
GSA::
getmcr::save	<r1,r2>			; just for kicks, save these

>>>>> DB1:K11RTC.MAC[2,2] <<<<<

doconn::tstb	ttname			; insure that a device name is set
dorsx::	return

>>>>> DB1:K11SER.MAC[2,2] <<<<<

server::mov	remote	,-(sp)		; save the local/remote flag
remfin::clr	paknum			; packetnumber := 0
rembye::clr	paknum			; packetnumber := 0
remget::call	seropn			; get the link line intialzied
remhos::call	seropn			; get the link line intialzied
remspa::calls	doremo	,<#'U,#1,#null>
remdir::calls	doremo	,<#'D,#1,@r5>
remtyp::calls	doremo	,<#'T,#1,@r5>
remwho::calls	doremo	,<#'W,#1,#null>
remera::calls	doremo	,<#'E,#1,@r5>
remhlp::calls	doremo	,<#'H,#1,#null>
remren::calls	doremo	,<#'R,#2,@r5,2(r5)>
remcop::calls	doremo	,<#'K,#2,@r5,2(r5)>

>>>>> DB1:K11SHO.MAC[2,2] <<<<<

c$show::$name	<SHO>
sho$dy::calls	ascdat	,<#errtxt,#0>
sho$ve::message	<Kermit-11 >
sho$es::mov	conesc	,r1
c$copy::$name	<COP>
c$rena::$name	<REN>
c$del::	$name	<DEL>
c$type::$name	<TYP>
c$prin::calls	qspool	,<#argbuf,#lun.in>

>>>>> DB1:K1180S.MAC[2,2] <<<<<

systat::br	5$			; skip the error exit
sercmd::clr	pkbufs			; insure no data is left in buffer

>>>>> DB1:K11DEB.MAC[2,2] <<<<<

texadr::
c$disp::mov	#argbuf	,r0		; locate the symbol in directory

>>>>> DB1:K11INI.MAC[2,2] <<<<<

kerini::call	init0
spar::	save	<r0,r1,r2>		; save registers we may use
fixchk::tstb	setsen+p.chkt		; did the user ever set block-check?
sparin::save	<r1>			; save registers we may use
rpar::	save	<r0,r1,r2>		; save registers we may use
rparin::save	<r1>			; save registers we may use
fillog::save	<r0,r1>
dskdmp::save	<r0,r1,r2,r5>
senhdr::mov	#-1	,pcnt.n
rechdr::mov	#-1	,pcnt.n
reclog::save	<r1>
senlog::save	<r1>

>>>>> DB1:K11ATR.MAC[2,2] <<<<<

w$attr::save	<r2,r3,r4>		; save registers that we may use here
r$attr::save	<r1,r2,r3,r4,r5>	; just to be safe
ispdp::	clr	r0			; presume failure
clratr::clr	at$len	
atrfin::save	<r1,r2,r3>		; just in case please

>>>>> DB1:K11TRA.MAC[2,2] <<<<<

transf::clr	r2			; input_open := false

>>>>> DB1:K11ST0.MAC[2,2] <<<<<

set$li::copyz	#argbuf	,#ttname,#20	; copy the device name please
set$sp::calls	l$val	,<#argbuf>	; get the speed into decimal
set$de::calls	getcm0	,<#argbuf,#dbglst>; find out which option was given
sd$off::bic	#log$al	,trace		; clear all debug bits now
set$pa::calls	getcm0	,<#argbuf,#parlst>; find out which option was given
set$ha::call	ttchk			; insure a line is set
set$lc::mov	#lcelst	,r5
set$du::mov	#duplst	,r5
set$ib::calls	getcm0	,<#argbuf,#ibmlst>; find out which option was given

>>>>> DB1:K11RTD.MAC[2,2] <<<<<

lookup::save	<r1,r2,r3>		; save all the temps please
dodir::	save	<r1,r2,r3,r5>		; save these please

>>>>> DB1:K11RTU.MAC[2,2] <<<<<

rename::save	<r2,r3,r4>		; save these please
delete::save	<r2,r3,r4>		; save these please
copy::	save	<r2,r3>			; save temp registers please
ascdat::save	<r0,r1,r2,r3>		; save these please
asctim::save	<r0,r1,r2,r3>		; save all registers that we use
$ddiv::

>>>>> DB1:K11ST1.MAC[2,2] <<<<<

set$bl::calls	getcm0	,<#argbuf,#blklst>; find out which option was given
set$dt::call	ttchk			; must have already done a SET LINE
c$disc::
c$hang::$name	<HAN>
set$hu::call	ttchk			; must have already done a SET LINE
set$fi::calls	getcm0	,<#argbuf,#setfil>
set$df::copyz	#argbuf	,#defdir,#filsiz; setup a default directory
set$ho::clrb	defdir
set$lo::call	sd$off			; insure previous file is closed
set$eo::calls	octval	,<#argbuf>	; get the octal value now
set$pl::calls	l$val	,<#argbuf>	; set the arguement now
set$ps::calls	l$val	,<#argbuf>	; get the value
set$dl::calls	l$val	,<#argbuf>	; get the value
set$es::calls	octval	,<#argbuf>	; get the octal value now
set$re::calls	l$val	,<#argbuf>	; SET RETRY decimal number
set$ti::calls	l$val	,<#argbuf>	; SET TIMEOUT decimal number
set$rf::calls	getcm0	,<#argbuf,#rfmlst>; find out which option was given
set$at::calls	getcm0	,<#argbuf,#attlst>; find out which option was given
set$pr::copyz	#argbuf	,#prompt,#20.
set$se::calls	l$val	,<#argbuf>	; SET SEED decimal number
set$ra::calls	getcm0	,<#argbuf,#ranlst>; find out which option was given
set$cf::calls	getcm0	,<#argbuf,#cflst>; find out which option was given
set$tt::calls	getcm0	,<#argbuf,#ttlst>; find out which option was given

>>>>> DB1:K11DAT.MAC[2,2] <<<<<

prompt::.blkb	40
kbiost::.blkw	2			; for RSXM/M+ terminal io status
notatt::.blkw	1			; if <>, server is running detached
vttype::.blkw	1			; the vttypeal type
proflg::.blkw	1			; if a pro/350 (?)
logini::.blkw	1
consts::.blkw	2			; for the connect command for RSX
tists::	.blkw	2			; for the connect command for RSX
mcrcmd::.blkw	1			; if <>, then we got a mcr/ccl cmd line
binmod::.blkw	1			; for RSTS, something is open mode 1
sy.ini::.blkw	1			; for KERMIT.INI stuff
handch::.blkw	1			; for ibm systems ?
duplex::.blkw	1			; if eq, full (default), else half
sparsz::.blkw	1			; size of our sinit packet
chksiz::.blkw	1			; current checksum size in bytes
chktyp::.blkw	1			; the current checksum type
maxtry::.blkw	1			; maximum number of retries
conesc::.blkw	1			; escape character for connection
sertim::.blkw	1			; timeout waiting for server cmd
inserv::.blkw	1			; currently we are a server
ranerr::.blkw	1			; generate random checksum errors if ne
seed::
testc::	.blkw	1			; for debugging
skipfl::.blkw	1			; should we send a EOF DISCARD packet
parity::.blkw	1			; save parity setting for SHOW command
logfil::.blkb	40			; a log filename for the  SHOW command
cccnt::	.blkw	1			; number of control C's so far
doauto::.blkw	1			; if <>, then do auto binary (default)
sendat::.blkw	1			; if zero, NEVER send attribute packets
sendly::.blkw	1			; wait before sending SINIT
pauset::.blkw	1			; wait before sending a packet
oldpau::.blkw	1			; save the old time for pausing
defdir::.blkb	filsiz+2		; default directory for send and rec
ttcnpa::
ttparm::.blkb	50			; saved terminal settings
ttnapa::.blkb	50
outlun::.blkw	1			; zero for TI else lun.ou
cmdlun::.blkw	1			; current command file lun
cmdadr::.blkw	1			; saved address of command routine
cmdnum::.blkw	1			; index into the current command list
hlpbuf::
cmdbuf::.blkb	120			; 80 byte buffer for reading commands
argbuf::.blkb	120			; also for reading args for commands
hlptop::
srcnam::.blkb	filsiz+2		; original send filespec
filnam::.blkb	filsiz+2		; output from directory lookup routine
index::	.word	0			; index into directory
recpkt::.blkb	210			; 128 byte buffer receive packet buffer
packet::.blkb	210			; a general packet
ttname::.blkb	20			; our current terminal link name
ttdial::.blkb	20			; save the remote name here
ttcons::.blkb	20			; our console name for virtual tty
consav::.blkb	20
trace::	.blkw	1			; for file and packet logging
debug::	.blkw	1			; console debugging
sermod::.blkw	1			; if we are currently a server
reccnt::.blkw	1			; total received count
sencnt::.blkw	1			; total sent count
totp.r::.blkw	34			; total rec  by packet type
totp.s::.blkw	34			; total sent by packet type
pcnt.r::.blkw	34			; packet count by type for RPACK
pcnt.s::.blkw	34			; packet count by type for SPACK
pcnt.n::.blkw	1
atrctx::.blkw	1			; context for attribute packets
senpar::.blkb	20			; remotes connection parameters
conpar::
recpar::.blkb	20			; our connection parameters
setsen::.blkb	20			; we may override the default
setrec::.blkb	20			; save for receive parameters
image::	.blkw	1			; if in image mode
$image::.blkw	1			; save image flag for autobyte
numtry::.blkw	1			; number of retrys
oldtry::.blkw	1			; old value of numtry
paknum::.blkw	1			; current packet number mod 64
remote::.blkw	1			; if <> then we are remote
state::	.blkw	1			; current state
linkst::.blkw	1			; if <> then a link is active
outopn::.blkw	1			; did recsw ever create anything
inopn::	.blkw	1			; did sendsw ever open  anything
size::	.blkw	1			; size of last call to bufferfill
xgottn::.blkw	1			; got an xpacket in server
xmode::	.blkw	1			; if <> then doing text output to ti:
do8bit::.blkw	1			; if <> then doing 8 bit prefixing
snd8bi::.blkw	1
set8bi::.blkw	1			; if <> then set bit seven on character
ebquot::.blkw	1			; if doing 8 bit prefixing, this is it
errtxt::.blkb	102			; a buffer for SYSERR(errnum,buffer)
rtwork::.blkw	10			; for RT11 exec calls
conflo::.blkw	1			; for RT11 connect flow control
rtque::	.blkw	12*12			; allocate extra que elements for RT11
at$len::.blkw	1
at$typ::.blkw	1
at$cre::.blkw	1
at$id::	.blkw	1
at$bil::.blkw	1
at$are::.blkw	1
at$pas::.blkw	1
at$bsi::.blkw	1
at$acc::.blkw	1
at$enc::.blkw	1
at$dis::.blkw	1
at$pr0::.blkw	1
at$pr1::.blkw	1
at$sys::.blkw	2
at$for::.blkw	1
at$fab::.blkw	15
at$val::.blkw	1
stklim::.blkw	600
stack::

>>>>> DB1:K11CM1.MAC[2,2] <<<<<

c$set::	$name	<SET>
c$conn::$name	<CON>
c$dir::	$name	<DIR>
c$who::	calls	systat	,<#0>
c$tran::calls	transf	,<#argbuf,#0>
c$take::$name	<TAKE>
c$sys::	$name	<SYS>
c$spac::$name	<SPA>

>>>>> DB1:K11RTE.MAC[2,2] <<<<<

syserr::calls	rmserr	,<#2,r5,2(r5)>	; simple
rmserr::save	<r0,r1>			; the registers we will use

>>>>> DB1:K11SUB.MAC[2,2] <<<<<

edit$::
cvt$$::	save	<r1,r2,r3,r4,r5>	; the scratch registers to use.
l$len::	mov	r0	,-(sp)		; save it for later.
l$wrdec::
l$cvti::save	<r5>			; call common conversion sub.
l$cvtnum::
locmout::
mout::	save	<r0>
instr::
rdtoa::
l$val::	save	<r2,r3>
octval::save	<r2,r3>			; save temps please
l$otoa::save	<r0,r1,r2,r3>		; save the scratch regs.
l$wroc::save	<r0>
copyz$::save	<r0,r1>			; save registers we may use
dump$b::save	<r0,r1,r2>		; save all please

>>>>> DB1:K11PAK.MAC[2,2] <<<<<

spack$::save	<r1,r2,r3,r4>		; save registers that we may use
spakin::bit	#log$pa	,trace		; tracing today ?
rpack$::save	<r1,r2,r3,r4>
clrpar::tstb	parity			; handle nothing please (no parity)
checks::save	<r0,r1,r2,r3>		; save registers we may use
crcclc::save	<r1,r2,r3,r4,r5>	; save registers please
clrsta::save	<r0,r1,r2>		; save the registers we use
buffil::save	<r2,r3,r4>		; save all registers we may use
bufpak::save	<r2,r3,r4,r5>		; save all registers we may use
bufemp::save	<r1,r2,r3>		; save temps as usual
bufunp::save	<r2,r3,r4>		; save temps as usual
printm::save	<r0,r1,r5>		; save registers we will use
error::	save	<r1,r2,r3,r4,r5>
prerrp::.print	#200$
m$type::save	<r0>			; save temps that we will use
m$retr::save	<r0>			; save r0 please
m$sync::save	<r0>			; save r0 please
getnxt::save	<r1>
l$xor::	save	<r0>
scanch::save	<r2>			; save temps
irand::	tst	testc
dopari::save	<r0,r1,r2,r3>		; save things we will use

>>>>> DB1:K11RT4.MAC[2,2] <<<<<

df$rfm::.word	0
df$rat::.word	0
freept::.word	0			; for the next .fetch
cloerr::.word	er$sy1	,er$sy1	,er$sys	,er$prv
csierr::.word	er$fnm	,er$dev	,er$sy2
dsterr::.word	er$dev
enterr::.word	er$lby	,er$ful	,er$sy3	,er$prv	,er$sy3
feterr::.word	er$dev	,er$sy4
lokerr::.word	er$lby	,er$fnf	,er$sys
reaerr::.word	er$eof	,er$rer	,er$nop	,er$sys
wrierr::.word	er$eof	,er$wer	,er$nop	,er$sys
twaerr::.word	er$que
mrkerr::.word	er$que
renerr::.word	er$lby	,er$fnf	,er$iop	,er$prv
xcierr::.word	er$lby	,er$xco
xcspfu::.word	er$fun	,er$hrd	,er$nop	,er$sys
mterr::	.word	er$nin	,er$nat	,er$lun	,er$iop	,er$bsy	,er$buf	,er$sys
xinit::	.gval	#rtwork,#CONFIG		; check for what we are running on
nosj::	.asciz	/Kermit-11 may not run correctly on a SJ monitor./<cr><lf>
fopen::
open::	save	<r1,r2,r3>		; save all the temps please
en$siz::.word	0			; 1/2 largest free or 2nd largeset
fcreat::
create::save	<r1,r2,r3,r4>		; save all the temps please
getsiz::mov	@r5	,r1		; get opened filesize
close::	save	<r1>			; save registers we may have
rewind::mov	@r5	,r0		; get the channel number
getrec::save	<r2,r3,r4>		; save registers we may need
putrec::save	<r1,r2,r3>		; save registers we may need
getc::	mov	@r5	,r0
getcr0::save	<r3>			; use for saving the channel#
putc::	save	<r1>			; simply save r1 and call putcr0
putcr0::save	<r1,r2,r3,r4>		; save registers we use
fparse::save	<r1>
l$ttyo::save	<r0,r1,r2,r3>		; save registers we may need
sttyou::mov	r5	,-(sp)
l$pcrl::print	#100$
getsys::mov	#7	,r0		; this is rt11 folks
exit::	.exit				; should always work ok
suspen::save	<r1>			; save temps
setcc::
getuic::
logout::
quochk::
qspool::
noecho::
echo::
runjob::clr	r0
getprv::
drpprv::
throtl::return
getatr::mov	#er$iop	,r0
putatr::clr	r0
binfil::clr	r0
chkpar::clr	r0
systat::
sercmd::mov	#er$iop	,r0
okuser::mov	(sp)+	,@sp
dskuse::mov	@r5	,r0
getmcr::mov	@r5	,r0
detach::mov	#er$iop	,r0
fetch::	.dstat	#rtwork,r5
$mul::	mov	r0	,-(sp)
$div::	mov	r0	,-(sp)
$ash::	tst	2(sp)			; left shift or rigth shift?

>>>>> DB1:K11PRT.MAC[2,2] <<<<<

ttysav::
ttyrst::
deadev::
assdev::
ttyini::save	<r1,r2>			; always save temps please
ttyfin::save	<r1>			; save temps please
contrp::clr	ttctlc
conrst::.scca	#rtwork	,#0
xbinre::
binrea::save	<r2,r3,r4>		; we may want to use these here
binwri::save	<r1,r2,r3,r4>
cantyp::save	<r1,r2>			; save temps
ttxon::	call	clrxc			; get the driver to clear xoff status
ttpars::clr	r0			; always unit zero for PRO/RT
gttnam::mov	@r5	,r0		; for PRO/RT, always return TT:
setspd::mov	#377	,r0
chkabo::bis	#40000!10000!100,@#JSW	; enable special input modes
ttspee::
ttyset::
ttrfin::
ttrini::clr	r0
ttydtr::
ttyhan::mov	#er$iop	,r0
kbread::mov	r2	,-(sp)

>>>>> DB1:K11CVT.MAC[2,2] <<<<<

namcvt::save	<r1,r2,r3,r4>		; save these in case we use them
chkext::save	<r1,r2,r3,r4>		; save scratch registers we will use

>>>>> DB1:K11CMD.MAC[2,2] <<<<<

kermit::calls	setcc	,<#cctrap>	; enable control C trapping ?
c$rec::	$name	<REC>
c$send::$name	<SEN>
c$serv::$name	<SER>			; allow patching this out (why??)
opentt::tst	linksts			; already open ?
clostt::save	<r0>
c$exit::call	sd$off
c$nop::	return				; a NO-OP command ???
rm$bye::
c$bye::	$name	<BYE>
rm$fin::
c$fin::	$name	<FIN>
rm$get::
c$get::	$name	<GET>
rm$spa::$name	<SPA>
rm$hlp::$name	<HEL>
rm$hos::$name	<HOS>
rm$dir::$name	<DIR>
rm$typ::$name	<TYP>
rm$who::$name	<WHO>
rm$del::$name	<DEL>
rm$ren::$name	<REN>			; do a remote rename please
rm$cop::$name	<COP>			; do a remote Kopy please
tkecho::.word	-1			; if <> then echo the take file
c$loc::	$name	<LOC>
c$rem::	$name	<REM>
c$test::return
getcmd::clrb	argbuf
getcm0::save	<r2,r3,r4>
cctrap::cmp	cccnt	,#cc$max
direr$::mov	r0	,-(sp)		; direrr will select whether or not
gettwo::save	<r1,r2>			; save temps please

>>>>> DB1:K11SEN.MAC[2,2] <<<<<

sen.sw::
sendsw::movb	@r5	,state		; do a SINIT first thing please
sinfo::	save				; save ALL registers please
sinit::	movb	#'S&137	,-(sp)		; normal sinit operation for sending

>>>>> DB1:K11REC.MAC[2,2] <<<<<

recsw::	clr	paknum			; packet_number := 0
rec.sw::movb	@r5	,state		; assume RECEIVE-INIT for starters

>>>>> DB1:K11RTT.MAC[2,2] <<<<<

assdev::save	<r1>			; we may want to use these
ttyini::save	<r1,r2>			; we will need this one
contrp::.scca	#rtwork	,#ttctlc
conrst::.scca	#rtwork	,#0
ttysav::save	<r1>			; we will use this one
ttyrst::save	<r1,r2>			; we will use this one
xbinre::
binrea::save	<r2,r3,r4>		; we may want to use these here
binwri::save	<r1,r2,r3,r4,r5>	; save registers we may need
ttpars::mov	r1	,-(sp)		; save scratch register please
gttnam::save	<r1,r2,r3>		; save registers please
ttyfin::call	ttpars			; finish up mt service
setspd::save	<r1,r2,r3>		; save temps that we will use
ttspee::save	<r1,r2,r3>		; save these please
spdlst::.word	50.	,75.	,110.	,134.	,150.	,300.	,600.
spdmap::.word	0	,400	,1000	,1400	,2000	,2400	,3000
ttxon::
cantyp::
ttyset::
ttydtr::
ttrfin::
ttrini::clr	r0
ttyhan::mov	#er$iop	,r0
kbread::mov	r2	,-(sp)
chkabo::bis	#40000!10000!100,@#JSW	; enable special input modes
