



		    PNOTICE_hasp.alm                11/14/89  1114.3r w 11/14/89  1114.3        2853



	dec	1			"version 1 structure
	dec	1			"no. of pnotices
	dec	3			"no. of STIs
	dec	100			"lgth of all pnotices + no. of pnotices
          acc       "Copyright (c) 1989 by Massachusetts Institute of
Technology and Honeywell Information Systems, Inc."

	aci	"C1HSPM0D0000"
	aci	"C2HSPM0D0000"
	aci	"C3HSPM0D0000"
	end
   



		    hasp_tables.map355              04/18/84  1000.8r w 04/18/84  0938.7      219249



***********************************************************
*                                                         *
*                                                         *
* Copyright, (C) Honeywell Information Systems Inc., 1981 *
*                                                         *
*                                                         *
***********************************************************
	rem
	lbl	,hasp_tables
	ttl	hasp_tables -- control tables for hasp protocol
	editp	on
	pcc	off
	pmc	off
	detail	off
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*	hasp_tables
*
*	These tables provide the special processing for a BISYNC
*	  line utilizing the HASP multi-leaving protocol
*
*	Created: September 1979 by Larry Johnson
*	Modified: November-December 1980 by G. Palter to implement
*	  infinite initial connection timeout, properly report NAK
*	  limit overflows to Multics, and fix many minor bugs
*	Modified: 30 March 1981 by G. Palter to fix bug in slave
*	  idle loop handling of NAKs
*	Modified: 9 April 1981 by G. Palter to fix bug in slave
*	  idle loop reporting of NAK limit overflow
*	Modified: July 1981 by G. Palter to add metering and
*	  support for SIGNON/runout processing and to remove the
*	  limitation in slave (CPU) initialization
*	Modified: 24 August 1981 by G. Palter to make wraparounds
*	  nest by counting foreign devices going not ready and
*	  the corresponding sync-blocks from the CS
*	Modified: 28 December 1981 by G. Palter to fix another
*	  case where the slave idle loop wasn't detecting 
*	  too many sequential NAKs
*	Modified: June 1982 by Robert Coren for extended memory
*	Modified: February 1984 by G. Palter to properly implement
*	  the system wait-a-bit and to insure that the "Too Many
*	  NAKs" line status get through to the CS
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
	rem
	symdef	sthasp	start of hasp tables
	rem
	symref	bsctst	bisync test state handler
	symref	bscwt	bisync write routine
	symref	bscwtr	bisync write/read routine
	symref	bscrd	bisync read routine
	symref	bsccki	bisync check input routine
	symref	bsccko	bisync check output routine
	symref	bshang	bisync hangup routine
	symref	bscbad	bisync report bad block routine
	rem
	symref	setbpt
	symref	adbyte	interpreter byte addressing rtn
	symref	cvaddr	interpreter word addressing rtn
	rem
hasp	null
	rem
	start	hasp,,c3hspm0b0000
	pmc	save,on
	tib
	meters
	csbits
	tconst
	buffer
	bscdat
	pmc	restore
	ttls	HASP symbol definitions
	rem
	rem	/* input scan control strings */
	rem
inack	chstr	(rescan,match,dle,ignore,match,tiback)
innak	chstr	(rescan,match,tibnak)
ininit	chstr	(rescan,match,soh,ignore,match,enq)
	rem
	rem	/* output bldmsg control strings */
	rem
otack	chstr	(dle,tiback,seteom)
otnak	chstr	(tibnak,seteom)
otinit	chstr	(soh,enq,seteom)
	rem
	rem	/* Local system not-ready idle message */
	rem
libcb	bool	220	/* BCB: ignore block count */
lifcs1	bool	300	/* FCS 1: system wait-a-bit */
lifcs2	bool	200	/* FCS 2: all devices not ready */
otsidl	chstr	(dle,stx,libcb,lifcs1,lifcs2,000,dle,etb,seteom)
	rem
	rem	/* definitions of fcs bits */
	rem
fcs1sb	bool	100	/* system wait-a-bit */
fcs1nr	bool	040	/* 1 = some device went not-ready */
fcs1rt	bool	020	/* 1 = this is output being returned */
fcs1pr	bool	017	/* printer wait-a-bits */
	rem
fcs2ty	bool	100	/* tty wait-a-bit */
fcs2pn	bool	017	/* punch wait-a-bits */
	rem
fcs2bt	bool	060	/* contains block type set by CS */
fcs2ra	bool	020	/* 01 = tell CS when block is sent */
fcs2sy	bool	060	/* 11 = this is resync msg */
	rem
allon	equ	512*fcs1pr+fcs2ty+fcs2pn  /* "1" for all device wait-a-bits */
	rem		/* includes fcs1 and fcs2 */
	ttls	HASP initialization
**********************************************************************
*
*	Wait for Multics to perform proper initialization
*	 by watching for the 'allow bid' line control order
*
**********************************************************************
	rem
sthasp	setflg	tfmrcv	/* we are msg-receive device */
	clrlcf	exflg1,naksw+nakksw+wacksw+datrcv+cfgok+rflag
	clrlcf	exflg1,ttdsw+ntrsw+rvisw+needrv+ctlmsg
	clrlcf	exflg2,lookot+gotot+timout+polpnd+pollok+selop
	clrlcf	exflg2,pollsw+autopl+outarv+dialos+csreqa
	clrlcf	exflg2,lswabs+fswabs+fnrcba
	setlcl	testrt,testst	/* establish our test-state handler */
	setchr	tiback,ack0
	setlcl	wabmsk,0	/* init all wait-a-bits off */
	setlcl	wrpcnt,0	/* don't need any sync-blocks to get started */
	rem
	tstlcf	exflg1,alwbid,ini020 /* initialization already done? */
	setlcl	naklmt,10	/* set default values */
	setlcl	hcontm,30
	setlcl	hrcvtm,3
	setlcl	hxmttm,2
	wait	0,0,ini010	/* watch for line status */
	status	0,dsr,bshang	/* don't miss hangups */
	rem
ini010	tstflg	tfhang,bshang	/* forced hangup */
	linctl	ctlop,bsctst	/* see if line status */
	tstlcl	ctlop,lctabd,ini020 /* if so, see if allow bid */
	goto	bsctst	/* no, let bsc test state handler do it */
	rem
ini020	setlcf	exflg1,alwbid	/* setup complete */
	tstlcf	exflg2,master,ini050 /* master */
	eject
**********************************************************************
*
*	slave device initialization (cpu)
*
**********************************************************************
	rem
	tstlcl	hcontm,0,ini030 /* no connect timeout requested */
	setlcv	temp1,hcontm	/* connect time limit */
	setlcv	temp2,hrcvtm	/* receive time limit for waiting for connect */
	calasm	calcbl	/* divide to calculate retry count */
	setlcv	bidcnt,temp1
	rem
ini030	setimv	hrcvtm	/* wait for initialization message */
	contrl	srec
	calsub	bscrd
	tstlcf	exflg2,timout,ini040 /* no message in time... */
	rem
	inscan	ininit,ini040	/* initialization message? */
	dumpin
	bldmsg	otack,punt	/* yes: acknowledge */
	holdot
	calsub	bscwtr
	dmpout
	setlcl	ctlop,lsthin	/* report HASP initialized */
	setlcl	ctlvl1,0	/* as a slave */
	linsta	ctlop
	goto	slv000
	rem
ini040	dumpin		/* discard any garbage */
	tstlcl	hcontm,0,ini030	/* no connect timeout: retry */
	addlcl	bidcnt,1
	tstlcl	bidcnt,0,bshang	/* too many tries: punt */
	goto	ini030
	eject
**********************************************************************
*
*	master device initialization (terminal)
*
**********************************************************************
	rem
ini050	tstlcl	hcontm,0,ini060 /* no connect timeout requested */
	setlcv	temp1,hcontm	/* connect time limit */
	setlcv	temp2,hrcvtm	/* receive time limit for waiting for replies */
	calasm	calcbl	/* divide to calculate retry count */
	setlcv	bidcnt,temp1
	rem
ini060	bldmsg	otinit,punt	/* initialization msg */
	holdot
	calsub	bscwtr	/* write it */
	dmpout
	rem
	setimv	hrcvtm
	calsub	bscrd	/* wait for reply */
	tstlcf	exflg2,timout,ini070 /* no response */
	rem
	inscan	inack,ini070	/* good response? */
	dumpin
	setlcl	ctlop,lsthin	/* report HASP initialized */
	setlcl	ctlvl1,1	/* as a master */
	linsta	ctlop
	goto	mstidl
	rem
ini070	dumpin		/* throw away and try again */
	tstlcl	hcontm,0,ini060 /* no connect timeout so retry */
	addlcl	bidcnt,1
	tstlcl	bidcnt,0,bshang /* too many tries */
	goto	ini060
	ttls	HASP idle state handlers
**********************************************************************
*
*	master channel idle state handler
*
**********************************************************************
	rem
mstidl	calsub	chkout	/* see if output ready */
	tstlcl	result,resack,haspwr /* yes */
	setimv	hxmttm	/* we ack every two seconds */
	rem
	wait	mst020,mst010,bsctst
	status	0,dsr,bshang
	rem
mst010	dumpin		/* just in case */
	setlcf	exflg2,outarv	/* output arrived */
	calsub	chkout	/* examine it */
	tstlcl	result,resack,haspwr /* ready to go */
	waitm
	rem
mst020	dumpin		/* nothing to write: send idle block */
	setlcl	nakcnt,0
mst025	tstlcf	exflg2,lswabs,mst026
	bldmsg	otack,punt /* ... either an ACK */
	goto	mst030
mst026	bldmsg	otsidl,punt /* ... or local not-ready */
	rem
mst030	holdot
	calsub	bscwtr	/* write the idle message */
	dmpout
	rem
	setimv	hrcvtm	/* wait for reply */
	calsub	bscrd
	tstlcf	exflg2,timout,mst035 /* timeout */
	tstlcf	exflg1,naksw,mst055 /* CRC error */
	inscan	inack,mst040	/* is it an ACK? */
	rem	/* foreign side sent an ACK ... */
	tstlcf	exflg2,fswabs,mst031 /* ... was foreign not ready? */
	goto	mst032	/* ... ... no */
mst031	clrlcf	exflg2,fswabs	/* ... ... yes: ACK resets not ready */
	setlcl	ctlop,lsthfr	/* ... ... and we must inform CS */
	linsta	ctlop
mst032	dumpin		/* ... discard the ACK ... */
	meter2	m.cnt5,1	/* ... and count a trip through idle loop */
	goto	mstidl
	rem
mst035	meter2	m.cnt4,1	/* count timeout waiting for reply */
	goto	mst070
	rem
mst040	inscan	innak,mst050	/* was it a nak? */
	meter2	m.cnt2,1	/* yes: count NAK to our output ... */
	dumpin
	addlcl	nakcnt,1
	tstlcv	nakcnt,naklmt,mst045 /* report nak limit to mcs? */
	goto	mst025	/* no: retry the ack */
mst045	signal	quit	/* yes */
	setlcl	ctlop,lstnak
	linsta	ctlop
	goto	mst025	/* retry the ack */
	rem
mst050	calasm	bsccki	/* detailed scan */
	tstlcl	result,resack,mst060 /* good */
	tstlcl	result,resntr,mst060
mst055	meter2	m.cnt1,1	/* bad input: count NAK we send */
	goto	mst070
	rem
mst060	calsub	chkdia	/* be sure dia caught up */
	tstlcf	exflg2,dialos,mst065 /* no, must nak for breather */
	calsub	inproc	/* ship good data */
	calsub	chkout	/* anything more to write */
	tstlcl	result,resack,haspwr /* yes */
	goto	mst020	/* no, just ack */
	rem
mst065	meter2	m.cnt6,1	/* count inability to take input */
	rem
mst070	dumpin		/* timeout or garbage */
	addlcl	nakcnt,1
	tstlcv	nakcnt,naklmt,mst075 /* report nak limit to mcs? */
	goto	mst080	/* no: just send nak */
mst075	signal	quit	/* yes */
	setlcl	ctlop,lstnak
	linsta	ctlop
	rem
mst080	bldmsg	otnak,punt	/* send nak */
	goto	mst030
	eject
**********************************************************************
*
*	slave channel idle state handler
*
**********************************************************************
	rem
slv000	contrl	srec
slv005	setlcl	nakcnt,0
slv010	setimv	hrcvtm
	calsub	bscrd
	tstlcf	exflg2,timout,slv040 /* timeout */
	tstlcf	exflg1,naksw,slv035 /* CRC error */
	inscan	inack,slv020	/* ack? */
	goto	slv050	/* yes */
	rem
slv020	inscan	innak,slv030	/* nak? */
	dumpin		/* yes: flush it ... */
	meter2	m.cnt2,1	/* ... count NAK to our output ... */
	addlcl	nakcnt,1
	tstlcv	nakcnt,naklmt,slv025 /* ... report NAK limit to MCS? ... */
	goto	slv026	/* ... ... no */
slv025	signal	quit	/* ... ... yes */
	setlcl	ctlop,lstnak
	linsta	ctlop
slv026	tstlcf	exflg2,lswabs,slv027 /* ... resend the idle block */
	bldmsg	otack,punt	/* ... ... which is an ACK */
	goto	slv028
slv027	bldmsg	otsidl,punt	/* ... ... or local not-ready */
slv028	holdot
	calsub	bscwtr
	dmpout
	goto	slv010	/* ... and not a completed cycle */
	rem
slv030	calasm	bsccki	/* detailed scan */
	tstlcl	result,resack,slv080 /* good data */
	tstlcl	result,resntr,slv080
slv035	meter2	m.cnt1,1	/* bad input: count NAK we send */
	goto	slv041
	rem
slv040	meter2	m.cnt3,1	/* count timeout waiting for input */
slv041	dumpin		/* discard garbage */
	addlcl	nakcnt,1
	tstlcv	nakcnt,naklmt,slv045 /* report nak limit to mcs? */
	goto	slv046	/* no: just send nak */
slv045	signal	quit	/* yes */
	setlcl	ctlop,lstnak
	linsta	ctlop
	rem
slv046	bldmsg	otnak,punt	/* send nak */
	holdot
	calsub	bscwtr
	dmpout
	goto	slv010
	rem
	rem	/* foreign side sent an ACK ... */
slv050	tstlcf	exflg2,fswabs,slv051 /* ... was foreign not ready? */
	goto	slv052	/* ... ... no */
slv051	clrlcf	exflg2,fswabs	/* ... ... yes: ACK resets not ready */
	setlcl	ctlop,lsthfr	/* ... ... and we must inform CS */
	linsta	ctlop
slv052	dumpin		/* ... discard the ACK ... */
	meter2	m.cnt5,1	/* ... and count a trip through idle loop */
	rem
	tstlcf	exflg2,lswabs,slv053 /* are we not ready? */
	goto	slvidl	/* ... no */
slv053	setimv	hxmttm	/* ... yes: give CS time to become ready */
	wait	slvidl,slv055,bsctst
	status	0,dsr,bshang
slv055	setlcf	exflg2,outarv	/* ... ... output has arrived */
	calsub	chkout	/* ... ... see if it is complete */
	tstlcl	result,resack,haspwr /* ... ... yes: send it */
	waitm
	rem
	rem	/* Control arrives here after processing input */
slvidl	calsub	chkout	/* see if something to send */
	tstlcl	result,resack,haspwr
	rem
	tstlcf	exflg2,lswabs,slv061 /* no: send an idle block */
	bldmsg	otack,punt	/* ... which is an ACK */
	goto	slv062
slv061	bldmsg	otsidl,punt	/* ... or local not-ready */
slv062	holdot
	calsub	bscwtr
	dmpout
	goto	slv005
	rem
slv080	calsub	chkdia	/* be sure dia caught up */
	tstlcf	exflg2,dialos,slv081 /* no: NAK to buy some time */
	calsub	inproc	/* ship good data */
	goto	slvidl
	rem
slv081	meter2	m.cnt6,1	/* count inability to accept input */
	goto	slv041
	ttls	HASP output processing
**********************************************************************
*
*	HASP output processing: write the message and analyze the
*	  response; retransmit when necessary if NAKed
*
**********************************************************************
	rem
haspwr	meterm	1	/* count the output message */
	holdot		/* to keep msg */
	signal	sndout	/* start next */
	rem
**********************************************************************
*
*	Check the output block type: if the CS requests
*	 acknowledgement of transmission of this block, record its
*	 BCB for the line status sent when block is transmitted
*
**********************************************************************
	rem
	clrlcf	exflg2,csreqa	/* assume CS doesn't care */
	outscn	outcra,wrt010	/* check for block type = 1 */
	rem		/* block type 1: CS requests ack */
	setlcf	exflg2,csreqa
	outscn	outgbn,punt	/* pickup the BCB */
	calasm	setbno	/* copy wrkch1 to hblkno */
	rem
wrt010	outscn	outcbt,punt	/* clear block type field */
	rem
**********************************************************************
*
*	Transmit the block
*
**********************************************************************
	rem
	setlcl	nakcnt,0	/* count transmission failures */
wrt020	dumpin
	calsub	bscwtr	/* write the message */
	rem
	setimv	hrcvtm	/* wait for rcv time limit */
	calsub	bscrd	/* wait for input */
	rem
**********************************************************************
*
*	analyze the response (if any)
*
**********************************************************************
	rem
	tstlcf	exflg2,timout,wrt080 /* no response */
	tstlcf	exflg1,naksw,wrt045 /* CRC error */
	rem
	inscan	inack,wrt030	/* ack? */
	goto	wrt050	/* yes */
	rem
wrt030	inscan	innak,wrt040	/* nak? */
	dumpin		/* yes: flush it ... */
	meter2	m.cnt2,1	/* ... and count the NAK to our msg */
	addlcl	nakcnt,1
	tstlcv	nakcnt,naklmt,wrt035 /* report nak limit to mcs? */
	goto	wrt020	/* no: retry transmission */
wrt035	signal	quit	/* yes */
	setlcl	ctlop,lstnak
	linsta	ctlop
	goto	wrt020	/* now retry transmission */
	rem
wrt040	calasm	bsccki	/* subject to further analysis */
	tstlcl	result,resack,wrt070 /* good message */
	tstlcl	result,resntr,wrt070 /* non-transparent ok too */
wrt045	meter2	m.cnt1,1	/* bad input: count NAK we must send */
	goto	wrt081
	rem
**********************************************************************
*
*	Response is an ACK: message has been transmitted; inform
*	 the CS if needed and return to the idle loop
*
**********************************************************************
	rem
wrt050	dumpin		/* discard ack */
wrt060	dmpout		/* discard data */
	tstlcf	exflg2,csreqa,wrt061 /* does CS want to know? */
	goto	wrt065	/* no: return to idle loop */
wrt061	setlcl	ctlop,lstwrc	/* yes: report write completed */
	setlcv	ctlvl1,hblkno	/*... and which block was written */
	linsta	ctlop
wrt065	tstlcf	exflg2,master,mstidl /* if master mode */
	goto	slvidl
	rem
**********************************************************************
*
*	response is a valid message: send it to Multics
*
**********************************************************************
	rem
wrt070	calsub	chkdia	/* be sure to check dia first */
	tstlcf	exflg2,dialos,wrt071
	calsub	inproc	/* ship the input */
	goto	wrt060
	rem
wrt071	meter2	m.cnt6,1	/* can't accept input now: NAK it */
	goto	wrt081
	rem
**********************************************************************
*
*	response garbled or timeout: request restransmission
*
**********************************************************************
	rem
wrt080	meter2	m.cnt4,1	/* count timeout waiting for reply */
wrt081	dumpin		/* discard bad input, if any */
	addlcl	nakcnt,1
	tstlcv	nakcnt,naklmt,wrt085 /* report nak limit to mcs? */
	goto	wrt086	/* no */
wrt085	signal	quit	/* yes */
	setlcl	ctlop,lstnak
	linsta	ctlop
	rem
wrt086	bldmsg	otnak,punt	/* prepare to write nak */
	holdot
	calsub	bscwtr
	dmpout
	setimv	hrcvtm	/* time limit for response */
	calsub	bscrd
	rem
	tstlcf	exflg2,timout,wrt080 /* timeout: try again */
	tstlcf	exflg1,naksw,wrt105 /* CRC error */
	inscan	inack,wrt090	/* ack? */
	goto	wrt020	/* yes */
wrt090	inscan	innak,wrt100	/* nak? */
	meter2	m.cnt2,1	/* yes: count original NAK to our msg */
	goto	wrt020
	rem
wrt100	calasm	bsccki	/* examine input */
	tstlcl	result,resack,wrt070 /* response now ok */
	tstlcl	result,resntr,wrt070
wrt105	meter2	m.cnt1,1	/* bad input: count our NAK */
	goto	wrt081
	rem
outcra	chstr	(rescan,search,stx,ignore,ignore,ignore,cmask,fcs2ra,fcs2
	etc	bt)
outgbn	chstr	(rescan,search,stx,ignore,movchr,wrkch1)
outcbt	chstr	(rescan,search,stx,ignore,ignore,ignore,offbit,fcs2bt)
	ttls	HASP input processing
**********************************************************************
*
*	scan input and update state of wait-a-bit bits
*
**********************************************************************
	rem
inproc	inscan	getfcs,inp020	/* extract fcs chars */
	setlcv	temp1,wabmsk	/* make copy of current mask */
	rem
	calasm	wabchk	/* analyze wait-a-bit stuff */
	rem
	clrlcf	exflg2,fswabs	/* clear foreign system wait-a-bit */
	tstlcl	temp3,0,inp010	/* foreign system wait-a-bit on? */
	setlcf	exflg2,fswabs	/* yes: don't check individual devices */
	goto	inp020
	rem
inp010	setlcv	wabmsk,temp1	/* save new state of device wabs */
	tstlcl	temp2,0,inp020	/* any bits go off? */
	inscan	setnr,punt	/* yes: flag msg as important ... */
	addlcl	wrpcnt,1	/* ... and expect another sync-block */
	rem
inp020	meterm	0	/* count the input ... */
	sendin		/* ... and hand it off to CS */
	retsub
	rem
getfcs	chstr	(rescan,search,stx,ignore,ignore,offbit,fcs1rt+fcs1nr,mov
	etc	chr,wrkch1,ignore,movchr,wrkch2)
setnr	chstr	(rescan,search,stx,ignore,ignore,setbit,fcs1nr)
	ttls	subroutines
**********************************************************************
*
*	examine output to see if it is ready to write
*
**********************************************************************
	rem
chkout	tstlcf	exflg2,outarv,chk010 /* any arrivals since last time? */
	tstlcf	exflg2,fnrcba,chk030 /* ... while foreign not ready? */
	goto	chk050	/* no, nothing is ready to write */
	rem
chk010	clrlcf	exflg2,outarv
	calasm	bsccko	/* perform output scan */
	tstlcl	result,resack,chk030
	tstlcl	result,resntr,chk030
	tstlcl	result,resinc,chk020
	tstlcl	result,resnul,chk020
	calsub	bscbad	/* report bad block */
	dmpout
	goto	chk050
	rem
chk020	signal	sndout	/* ask message be completed */
	goto	chk050
	rem
chk030	clrlcf	exflg2,fnrcba
	tstlcl	wrpcnt,0,chk035	/* returning output to CS? */
	goto	chk060	/* yes: check for sync-blocks */
	rem
chk035	tstlcf	exflg2,fswabs,chk040 /* ignore while foreign not ready */
	clrlcf	exflg2,lswabs /* copy local system wait-a-bit */
	outscn	getlsw,chk036
	setlcf	exflg2,lswabs
chk036	setlcl	result,resack	/* good message */	
	retsub
	rem
chk040	setlcf	exflg2,fnrcba	/* remember there's data */
chk050	setlcl	result,resinc	/* incomplete message */
	retsub
	rem
chk060	calasm	wrpchn	/* turn output into input */
	inscan	setrt,chk070	/* turn on returned msg bit */
chk070	inscan	chksnc,chk080	/* check for sync-block */
	addlcl	wrpcnt,-1	/* yes: need one less to start sending again */
chk080	signal	sndout	/* ask for more */
	sendin
	goto	chk050
	rem
getlsw	chstr	(rescan,search,stx,ignore,ignore,cmask,fcs1sb,fcs1sb)
setrt	chstr	(rescan,search,stx,ignore,ignore,setbit,fcs1rt)
chksnc	chstr	(rescan,search,stx,ignore,ignore,ignore,cmask,fcs2sy,fcs2
	etc	bt)
	eject
**********************************************************************
*
*	divide connect time by transmit repeat time to get
*	initialization try count
*
**********************************************************************
	rem
calcbl	subr	clc
	lda	temp1-*
	lrs	17
	dvf	temp2-*
	iera	-1	/* complement */
	iaa	1
	sta	temp1-*
	return	calcbl
	rem
	rem
**********************************************************************
*
*	turn current output chain back into input
*
**********************************************************************
	rem
wrpchn	subr	wrp,(x2)
	szn	t.icp,1	/* input chain is programming error */
	tze	2
	oct	0	/* crash */
	lda	t.ocp,1	/* get output chain start */
	sta	t.icp,1
	stz	t.ocp,1
	stz	t.icpl,1	/* prepare to count length of chain */
	lda	t.icp,1
wrp010	sta	wrplst-*
	tsy	a.a001-*,*	setbpt
	cax2
	lda	bf.siz,2	/* get word with size */
	ana	wrp030-*
	arl	15	/* convert to buffers */
	iaa	1
	asa	t.icpl,1
	szn	bf.nxt,2
	tze	wrp020-*
	lda	bf.nxt,2
	tra	wrp010-*
wrp020	lda	wrp040-*	/* flag last buffer */
	orsa	bf.flg,2
	lda	wrp050-*
	ansa	bf.flg,2
	lda	wrplst-*
	sta	t.ilst,1
	return	wrpchn
	rem
wrp030	vfd	o18/bufsmk
wrp040	vfd	o18/bffbrk
wrp050	vfd	o18//bfflst
wrplst	bss	1
	rem
a.a001	ind	setbpt
	eject
**********************************************************************
*
*	analyze fcs chars to build new mask
*
*	sets temp2 to 1 if some bits went off
*	sets temp3 to 1 if system wait-a-bit on
*
**********************************************************************
	rem
wabchk	subr	wab
	stz	temp2-*
	stz	temp3-*
	lda	wab020-*	/* get address of first work char */
	tsy	wab030-*,*	/* =adbyte */
	oct	0	/* impossible */
	lda	0,3,b.0	/* get first fcs */
	icana	fcs1sb	/* check for system bit */
	tze	2	/* off */
	aos	temp3-*
	als	9	/* align in left half */
	ora	0,3,b.1	/* get second fcs */
	ana	wab010-*	/* isolate wait-a-bits */
	caq		/* save copy of new mask */
	iera	-1
	ana	temp1-*	/* 1's here means wait-a-bits went off */
	tze	2	/* no change */
	aos	temp2-*
	stq	temp1-*	/* new mask */
	return	wabchk
	rem
wab010	vfd	o18/allon
wab020	vfd	o18/wrkch1
wab030	ind	adbyte
	eject
**********************************************************************
*
*	Copy the character in wrkch1 into the TIB variable
*	 hblkno right justified
*
**********************************************************************
	rem
setbno	subr	sbn
	lda	sbn005-*	/* byte address of interest */
	tsy	sbn010-*,*	/* =adbyte */
	oct	0
	ldq	0,3,b.0	/* get the character we want */
	lda	sbn015-*	/* TIB extension addr */
	cax3		/* cvaddr needs addr in X3 */
	tsy	sbn020-*,*	/* =cvaddr */
	stq	0,3	/* store the character */
	return	setbno
	rem
sbn005	vfd	o18/wrkch1
sbn010	ind	adbyte
sbn015	vfd	o18/hblkno
sbn020	ind	cvaddr
	eject
**********************************************************************
*
*	routine to check dia for pending input not yet sent to
*	mainframe.  the assumption here is that if the dia is
*	falling behind, maybe multics is slow, or is having a
*	problem, and we better not send too much more input.
*	since it is too hard to attempt HASP flow control from
*	this level, input will be nakked until the dia can
*	catch up.
*
**********************************************************************
	rem
chkdia	clrlcf	exflg2,dialos	/* assume OK to send */
	tstfld	t.dcp,0,ckd030	/* all ok, return */
	setime	-100	/* first, wait .1 seconds */
	wait	ckd010,ckd040,bsctst
	status	0,dsr,bshang
	rem
ckd010	tstfld	t.dcp,0,ckd030	/* .1 wait worked */
	setime	-500	/* wait a little longer */
	wait	ckd020,ckd040,bsctst
	status	0,dsr,bshang
	rem
ckd020	tstfld	t.dcp,0,ckd030	/* .5 wait worked */
	setlcf	exflg2,dialos	/* can't wait forever: NAK it */
	rem
ckd030	retsub
	rem
ckd040	setlcf	exflg2,outarv	/* dont fail to notice output */
	waitm
	eject
**********************************************************************
*
*	test state handler
*
**********************************************************************
	rem
testst	tstlcl	ctlop,lcthtm,tst010 /* only HASP timers handled here */
	waitm
tst010	setlcv	hcontm,ctlvl1
	setlcv	hrcvtm,ctlvl2
	setlcv	hxmttm,ctlvl3
	waitm
	rem
	rem
	rem
	rem
punt	punt	0	/* fnp crash on wierd errors */
	rem
	rem
	rem
temp1	bss	1
temp2	bss	1
temp3	bss	1
	rem
	end	hasp






		    bull_copyright_notice.txt       08/30/05  1008.4r   08/30/05  1007.3    00020025

                                          -----------------------------------------------------------


Historical Background

This edition of the Multics software materials and documentation is provided and donated
to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. 
as a contribution to computer science knowledge.  
This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology,
Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull
and Bull HN Information Systems Inc. to the development of this operating system. 
Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970),
renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership
of Professor Fernando Jose Corbato.Users consider that Multics provided the best software architecture for 
managing computer hardware properly and for executing programs. Many subsequent operating systems
incorporated Multics principles.
Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., 
as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. .

                                          -----------------------------------------------------------

Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without
fee is hereby granted,provided that the below copyright notice and historical background appear in all copies
and that both the copyright notice and historical background and this permission notice appear in supporting
documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining
to distribution of the programs without specific prior written permission.
    Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc.
    Copyright 2006 by Bull HN Information Systems Inc.
    Copyright 2006 by Bull SAS
    All Rights Reserved
