Google
 

Trailing-Edge - PDP-10 Archives - bb-k345a-sb - boot.pal
There are 6 other files named boot.pal in the archive. Click here to see a list.
/	BOOT 0.5 -- DOWN-LINE BOOTSTRAP FOR DC72NP  01 MAR 77
/	KALMAN RETI

/***	COPYRIGHT 1977 DIGITAL EQUIPMENT CORP., MAYNARD, MASS. ***

	MAJOR=0
	MINOR=5

IFNDEF PDP8 <PDP8=2>		/FOR PDP8I USE 1
				/FOR PDP8E USE 2
	PDP8I=PDP8-1
	PDP8E=PDP8-2

IFNDEF FTDP01 <
	IFZERO PDP8I <FTDP01=-1>/DEFAULT IS DP01 HDW
	IFZERO PDP8E <FTDP01=0>	/DEFAULT FOR 8E IS DP8E
>/END OF IFNDEF	FTDP01
IFNZRO FTDP01 <FTDP8E=0>
IFZERO FTDP01 <FTDP8E=-1>


IFNDEF	KG8E	<
KG8E=0
IFZERO	FTDP01	<
/KG8E=1
>/END OF IFZERO	FTDP01
>/END OF IFNDEF	KG8E

IFNDEF	FTMIM	<FTMIM=0>	/MIMIC SWITCH OFF BY DEFAULT

IFNDEF	EFIELD	<EFIELD=1>	/FIELD WHERE LOADED

IFNDEF	FTBIGL	<FTBIGL=0>

IFNDEF	MAXLEN	<MAXLEN=177+12>

	IFNDEF	FTDEBUG	<FTDEBUG=0>

	IFNDEF	START	<START=0>

IFNDEF	NAME	<
	NAMXXX=1			/SWITCH TO TELL NAME MACRO UNDEFINED
	DEFINE NAME	<>	/NULL NAME TO SEND IN REQUEST LOAD MESSAGE
>/END OF IFNDEF	NAME

IFNDEF	SERIAL	<SERIAL=0>	/SERIAL NUMBER OF MACHINE
IFNDEF	NODE	<NODE=0>	/NODE TO SEND REQUEST LOAD TO

/	USEFUL OPCODES
	NEGATE=CML CMA IAC	/NEGATE AC & LINK
	ZZ=EFIELD^10
	CDFINS=CDF+ZZ		/FIELD WE ARE EXECUTING IN
	NL0=CLA CLL
	NL1=CLA CLL IAC
	NL2=CLA CLL IAC RAL
	NLM1=CLA CLL CMA CML
	NLM2=CLL CLA CMA RAL
	BSW=7002
	CAF=6007

	IFZERO	FTBIGL	<DEFINE XL	<XLIST>>
	IFNZRO	FTBIGL	<DEFINE XL <>>



/	EQUATES
ACCPT=11
EXDATA=12
RJCT=13
AUTO1=10
AUTO2=11

IFNZRO	FTDEBUG	<
/LINE PRINTER IOT'S - LS8E & LE8=LP08
	LPTSTF=6660		/SET THE FLAG			(LS8E ONLY)
	LPTSKF=6661		/SKIP ON FLAG
	LPTCLF=6662		/CLEAR FLAG
	LPTSKE=6663		/SKIP ON NOT READY
/	LPT=6664		/LOAD PRINT BUFFER
	LPTSIE=6665		/SET PI ENABLE			(LE8 ONLY)
			/ IF AC11=1 SET PI ENABLE	(LS8E ONLY)
			/ IF AC11=0 CLEAR PI ENABLE	(LS8E ONLY)
	LPTSTB=6666		/LOAD DATA & CLEAR FLAG
	LPTCIE=6667		/CLEAR PI ENABLE		(LE8 ONLY)
	LPTWID=204
IFNZRO	FTMIM	<
	LPTSTB=6046
	LPTSTF=6040
	LPTSKF=6041
	LPTWID=110
>/END OF IFNZRO	FTMIM
>/END OF IFNZRO	FTDEBUG
/MACROS

	DEFINE	HGHADR	<
	CLL RTR
	RTR
	RAR>
/IFZERO	PDP8E	<
/	DEFINE	HGHADR	<
/E	BSW
/	CLL RTL>
/>/END OF IFZERO	PDP8E
	XL
IFNZRO FTDP01 <
	XL
/IOTS FOR DP01
	DPTAC=6301		/TRANSMIT A CHARACTER
	DPCTF=6302		/CLEAR TRANSMIT FLAG & SKIP IF TRANSMIT ACTIVE FLAG SET
	DPCIM=6304		/CLEAR IDLE MODE
	DPSTF=6311		/SKIP ON TRANSMIT FLAG NOT SET
	DPSIM=6314		/SET IDLE MODE
	DPSRF=6351		/SKIP ON RECEIVE FLAG NOT SET
	DPRRB=6312		/READ RECEIVE BUFFER(AND CLEAR FLAG)
	DPSEF=6321		/SKIP ON RECEIVE END FLAG
	DPCEF=6322		/CLEAR END FLAG
	DPSRE=6324		/SET RING ENABLE
	DPCRE=6344		/CLEAR RING ENABLE
	DPSRI=6331		/SKIP ON RING INDICATOR
	DPCRF=6332		/CLEAR RING FLAG
	DPSTR=6334		/SET TERMINAL READY
	DPCTR=6342		/CLEAR TERMINAL READY
	DPSSR=6341		/SKIP ON DATASET READY
	DPCRA=6352		/CLEAR RECEIVER ACTIVE
	XL
>/END OF IFNZRO FTDP01
	XL
/
	XL
IFZERO FTDP01 <
	XL
/IOTS FOR DP8E SYNCHRONOUS LINE INTERFACE
	DPSGTT=6405		/TRANSMIT GO
	DPSGRR=6404		/RECEIVE GO
	DPSSCD=6400		/SKIP IF CHAR DETECTED
	DPSCSD=6406		/CLEAR SYNC DETECT
	DPSSRO=6402		/SKIP IF RECEIVE WORD COUNT OVERFLOW
	DPSSTO=6403		/SKIP IF TRANSMIT WORD COUNT OVERFLOWS
	DPSCSI=6401		/CLEAR SYNCHRONOUS INTERFACE
	DPSRTA=6407		/READ TRANSFER ADDRESS REGISTER
	DPSLCC=6412		/LOAD CONTROL
	DPSSRG=6410		/SKIP IF RING FLAG
	DPSSCA=6411		/SKIP IF CARRIER/AGC FLAG
	DPSRS2=6414		/READ STATUS 2
			/ AC00 CARRIER/AGC
			/ AC01 REQUEST TO SEND
			/ AC02 TERMINAL READY
			/ AC03 CLEAR TO SEND
			/ AC04 TEMA 0(TRANSMIT EXTENDED MEMORY ADDRESS)
			/ AC05 TEMA 1
			/ AC06 TEMA 2
			/ AC07 RECEIVE DATA(INV)
	DPSRS1=6415		/READ STATUS 1
			/ AC00 R-RQST	RECEIVE AND TRANSMIT
			/ AC01 T-RQST	BREAK REQUESTS
			/ AC02 SYNC 2	RECEIVED SYNC
			/ AC03 SYNC 1	CHARS
			/ AC04 REMA 0
			/ AC05 REMA 1
			/ AC06 REMA 2
			/ AC07 MODEM READY
	DPSLFL=6413		/LOAD FIELD
	DPSSBE=6416		/SKIP ON BUS ERROR
	DPSRCD=6417		/READ CHAR DETECTED(IF AC0=0)

/FOLLOWING ARE IOTS FOR DP8-EP(KG8-EA) REDUNDANCY CHECK OPTION
/	6110		/TEST VRC AND SKIP
	BCCRDH=6111		/READ HIGH ORDER PORTION OF BCC INTO AC
	BCCRDL=6112		/READ LOW ORDER PORTION OF BCC INTO AC
/	BCCVRC=6113		/COMPUTE VRC CHARACTER
	BCCGEN=6114		/GENERATE BCC
	BCCLCL=6115		/LOAD CONTROL REGISTER FROM AC
			/ AC05=1: CRC; AC05=0: LRC
			/ AC6-8=0: 16BIT BCC
			/ AC6-8=1: 12BIT BCC
			/ AC6-8=2:  8BIT BCC
			/ AC6-8=3:  7BIT BCC
			/ AC6-8=4:  6BIT BCC
			/ AC9=0: PARITY TO AC4; AC9=1:PARITY TO AC11
			/ AC10=1: 6114 ALSO CAUSES 6113
			/ AC11=1: 6114 ALSO CAUSES 6110
	BCCCLR=6116		/CLEAR ACCUMULATION
/	6117		/MAINTENANCE TEST CLOCK
	XL
>/END OF IFZERO FTDP01
	XL

/BOOT:	DLE	CC1	CC2	0	0	A0	BCC1	BCC2
/	CODE	DATA	BCC3	BCC4
/
/CODE:
/
/BOOT:		SNA	<000>	BOOTSTRAP-DATA
/EXAMINE	SNA	<001>	ADDR1	ADDR2
/DEPOSIT	SNA	<002>	ADDR1	DEPOSIT-DATA
/GOTO		SNA	<003>	ADDR1
/CLEAR		SNA	<004>	ADDR1	ADDR2
/DEBUG		SNA	<005>
/RESERVED	<006>-<010>
/ACCEPT		DNA	<011>	(ADDR1	DATA)
/EXAM DATA	DNA	<012>	ADDR1	DATA
/REJECT		DNA	<013>
/REQUEST BOOT	DNA	<014>	MACH	SERIAL	PROG
/REQUEST LOAD	DNA	<015>	MACH	SERIAL	PROG
/
/
/ADDR1	=	FIRST ADDRESS IN A RANGE, OR ONLY ADDRESS
/		FIRST LOW ORDER EIGHT BITS, THEN HIGH 4 + FIELD
/DATA	=	DATA FOR EXAMINE OR DEPOSIT, SIX BITS PER BYTE,
/		LOW ORDER BYTE FIRST
/DNA	=	DESTINATION NODE ADDRESS
/MACH	=	EXTENSIBLE BINARY FIELD GIVING A CODE FOR WHICH
/		MACHINE
/		1=71
/		2=72
/		3=82,WITH DU11
/		4=82,WITH DQ11
/NODE	=	EXTENSIBLE BINARY NODE NUMBER
/PROG	=	EXTENSIBLE ASCII PROGRAM NAME
/SERIAL	=	SERIAL NUMBER OF MACHINE, EXTENSIBLE BINARY
/SNA	=	SOURCE NODE ADDRESS
/
/
/	THE BOOT MESSAGE IS INTENDED TO CONTAIN A SHORT
/ BOOTSTRAP PROGRAM WHICH WILL BE USED TO LOAD A
/ MORE SOPHISTICATED ONE -- THE DATA FIELD IS THE
/ PROGRAM ITSELF, AND THE START ADDRESS IS THE FIRST
/ WORD.
/ A BOOT MESSAGE IS SENT IN RESPONSE TO A REQUEST BOOT.
/
/	THE REQUEST LOAD MESSAGE SAYS THAT THE NODE
/ WANTS TO BE EITHER DUMPED OR LOADED OR BOTH.
/ SPECIFICALLY, IT CAN HANDLE EXAMINE, DEPOSIT AND
/ GOTO MESSAGES.
/
/	THE EXAMINE MESSAGE GIVES THE ADDRESS RANGE
/ FOR WHICH THE SENDER WOULD LIKE AN EXAMINE-DATA MESSAGE
/ WITH THE CONTENTS.
/
/	THE RESPONSE TO A DEPOSIT MESSAGE IS AN ACCEPT
/ WITH THE DATA THAT WAS DEPOSITED.
/
/	A REJECT IS SENT WHENEVER AN ADDRESS
/ IS OUTSIDE THE RANGE OF THE MACHINE.
/
/	THE CLEAR MESSAGE IS USED TO ZERO OUT A RANGE
/ OF CORE.  IT IS CURRENTLY UNIMPLEMENTED.
	FIELD	EFIELD
*START
TEMP1,	0
TEMP2,	0
TEMP3,	0
FLD1,	0
ADR1,	0
FLD2,	0
ADR2,	0
POINT,	0
	0;0;0;0;0;0;0;0		/AUTOINCREMENT REGISTERS
ENDMSG,	0
BOOT,				/START OF BOOTSTRAP
	JMP	INIT		/INITIALIZE THINGS
XMIT,				/TRANSMIT MESSAGE IN BUFF
IFNZRO	FTDEBUG	<JMS	LPTRAC>
	JMS	SNDMSG		/SEND IT
RCV,				/GET A MESSAGE
	JMS	GETMSG		/READ MESSAGE INTO BUFF
IFNZRO	FTDEBUG	<JMS	LPTRAC>
	JMS	CHKCRC		/CHECK CRC'S
	  JMP	BOOT		/START OVER IF BAD
	TAD	(BUFF+11	/POINT TO MESSAGE TYPE CODE
	DCA	POINT		/STORE ADDRESS OF CODE
	JMS	RNGCHK		/CHECK GOODNESS OF CODE
	TAD	(JMP I DSP	/MAKE DISPATCH INSTRUCTION
	DCA	.+1		/STORE
	0			/SET TO JMP I DSP+CODE
DSP,	BOOT			/0=BOOT, WE DON'T HANDLE IT
	EXAM			/1=EXAMINE
	DEP			/2=DEPOSIT
	GOTO			/3=GOTO

/	STORAGE

GETWD,	0			/GET NEXT WORD FROM MESSAGE
/	CALL IS:
/
/	JMS	GETWD
/	  ERROR RETURN (NONE LEFT)
/	NORMAL RETURN (AC HAS WORD)
/
/	POINT HOLDS CURRENT CHARACTER ADDRESS
/	ENDMSG HOLDS NEGATIVE OF LAST ADDRESS+1
/	WORD IS RETURNED IN AC (WHICH SHOULD BE ZERO AT ENTRY)
	TAD	POINT		/GET CURRENT ADDRESS
	TAD	ENDMSG		/SEE IF FINISHED
	SNA CLA			/NO, SKIP
	  JMP I	GETWD		/YES, RETURN
	ISZ	GETWD		/MAKE SKIP RETURN
	TAD I	POINT		/GET WORD FROM MESSAGE
	ISZ	POINT		/POINT TO NEXT WORD
	JMP I	GETWD		/RETURN WITH WORD

PUTCHR,	0			/SUBROUTINE TO PUT A WORD
/	POINT POINTS TO NEXT AVAILABLE ADDRESS
/	ENDMSG HOLDS NEGATIVE OF LAST ADDRESS+1
/	IF SPACE RUNS OUT, THE MESSAGE WILL BE SENT
/ AS IS.
	AND	(377		/ONLY 8 BITS
	DCA I	POINT		/STORE CHARACTER IN MESSAGE
	ISZ	POINT		/INCREMENT POINTER
	TAD	POINT		/GET ADDRESS
	TAD	ENDMSG		/IS IT END?
	SZA CLA			/SKIP IF YES
	  JMP I	PUTCHR		/NO, RETURN
	JMP	EXDONE		/YES, FINISH MESSAGE AND RETURN

GETADR,	0			/GET ADDRESS FROM MESSAGE
/	USES GETWD TO GET INDIVIDUAL WORDS
/	FORMAT OF ADDRESS IS:
/	FIRST WORD, BITS 4-11: EIGHT LOW ORDER BITS OF ADDRESS
/	SECOND WORD, BITS 8-11 HIGH ORDER 4 BITS OF ADDRESS
/		     BITS 5-7: FIELD
/	CALL IS
/	TAD	ADDR WHERE FIELD INSTRUCTION IS TO GO
/	JMS	GETADR
/	  ERROR RETURN
/	NORMAL RETURN (FIELD CHANGE INSTRUCTION STORED WHERE
/			AC POINTED AT ENTRY, AC HAS ADDRESS
/			WITHIN FIELD)
	DCA	TEMP3		/SAVE ADDRESS TO PUT FIELD INSTRUCTION
	JMS	GETWD		/GET FIRST WORD OF ADDRESS
	  JMP I	GETADR		/ERROR IF NOT THERE
	DCA	TEMP1		/SAVE LOW ORDER 8 ADDRESS BITS
	JMS	GETWD		/GET 2ND ADDRESS WORD
	  JMP I	GETADR		/ERROR IF NOT THERE
	DCA	TEMP2		/SAVE FIELD AND HIGH ORDER ADDRESS BITS
	TAD	TEMP2		/GET THEM BACK
	RAR			/PUT INTO CORRECT POSITION
	AND	(0070		/CLEAR OTHER BITS
	TAD	(CDF		/TURN INTO CHANGE FIELD INSTRUCTION
	DCA I	TEMP3		/STORE
	TAD	TEMP2		/GET HIGH ORDER BITS AGAIN
	HGHADR			/SHIFT TO HIGH ORDER BITS
	AND	(7400		/TURN OFF OTHERS
	TAD	TEMP1		/ADD IN LOW ORDER 8
	ISZ	GETADR		/SET TO SKIP RETURN
	JMP I	GETADR		/RETURN

PUTADR,	0			/PUT AN ADDRESS
/	THE ADDRESS IS IN ADR1 AND FLD1
	TAD	ADR1		/GET LOW ORDER
	JMS	PUTCHR		/WILL ONLY PUT 8 BITS
	TAD	ADR1		/GET REST
IFZERO	PDP8I	<
	CLL RTL
	RTL
	RAL			/PUT IN RIGHT PLACE
>/END OF IFZERO	PDP8I
IFZERO	PDP8E	<
	BSW
	RTR
>/END OF IFZERO	PDP8E
	AND	(0017		/CLEAR EXTRA BITS
	DCA	TEMP1		/STORE
	TAD	FLD1		/GET FIELD
	AND	(0070		/CLEAR EXTRA BITS
	CLL RAL
	TAD	TEMP1		/ADD TO REST
	JMS	PUTCHR		/PUT INTO MESSAGE
	JMP I	PUTADR		/RETURN

INCADR,	0			/INCREMENT ADDRESS
/	THIS SUBROUTINE INCREMENTS ADDRESS CONTAINED IN ADR1 AND
/ FLD1.
	ISZ	ADR1		/INCREMENT ADDRESS PART
	  JMP I	INCADR		/IF NOT ZERO, WE ARE DONE
	TAD	FLD1		/GET FIELD INSTRUCTION
	TAD	(10		/INCREMENT FIELD
	AND	(0070		/IN CASE OF OVERFLOW
	TAD	(CDF		/DITTO
	DCA	FLD1		/STORE BACK
	JMP I	INCADR

READ,	0			/GET WORD POINTED AT BY ADR1 AND FLD1
	TAD	FLD1		/GET FIELD INSTRUCTION
	DCA	.+1		/STORE IT
	0
	TAD I	ADR1		/GET WORD
	CDFINS			/GET BACK TO INSTRUCTION FIELD
	JMP I	READ		/RETURN
WRITE,	0			/STORES A WORD AT ADR1 + FLD1
	DCA	WRITE1		/STORE WORD
	TAD	FLD1
	DCA	.+1
	0
	TAD	WRITE1		/GET WORD AGAIN
	DCA I	ADR1		/STORE IT
	CDFINS			/GO TO NORMAL FIELD
	JMP I	WRITE
WRITE1=READ			/SAVE WORD TO BE STORED

	PAGE
ALTSTR,	JMP	BOOT		/ALTERNATE START (TO CONFORM TO PDP8 CONVENTION)
	ZZ=MAJOR^100+MINOR
	ZZ			/VERSION
EXAM,				/EXAMINE ROUTINE
	TAD	(FLD1		/WHERE FIELD SHOULD GO
	JMS	GETADR		/GET START ADDRESS
	  JMP	REJCT		/IF BAD, REJECT
	DCA	ADR1		/SAVE ADDRESS
	TAD	(FLD2		/WHERE FIELD SHOULD GO
	JMS	GETADR		/GET STOP ADDRESS+1
	  JMP	REJCT		/REJECT IF BAD
	NEGATE			/GET INTO PROPER FORM
	DCA	ADR2		/STORE
	TAD	FLD2		/GET FIELD
	NEGATE			/NEGATE IT AS WELL
	DCA	FLD2		/STORE BACK
	JMS	MSGBEG		/START MESSAGE
	TAD	(EXDATA		/EXAMINE DATA CODE
	JMS	PUTCHR		/STORE IN MESSAGE
EXADR,
	JMS	PUTADR		/STORE ADDRESS IN MESSAGE
EXLOOP,	TAD	ADR1		/GET ADDRESS
	TAD	ADR2		/COMPARE WITH STOP
	SZA CLA			/SKIP IF SEEMS TO BE END
	  JMP	EXGET		/GO GET THIS WORD
	TAD	FLD1		/GET FIELD
	TAD	FLD2		/COMPARE WITH STOP
	SNA CLA			/IF NON-ZERO, WASN'T REALLY END
	  JMP	EXDONE		/FINISHED
EXGET,				/GET VALUE AND PUT INTO MESSAGE
	JMS	READ		/GET VALUE OF WORD
	DCA	TEMP1		/SAVE
	TAD	TEMP1		/GET BACK AGAIN
	AND	(0077		/ONLY LOW ORDER BYT
	JMS	PUTCHR		/SEND IT
	TAD	TEMP1		/GET BACK
IFZERO	PDP8I	<
	RTR
	RTR
	RTR
>/END OF IFZERO	PDP8I
IFZERO	PDP8E	<
	BSW
>/END OF IFZERO	PDP8E
	AND	(0077
	JMS	PUTCHR
	JMS	INCADR		/INCREMENT ADDRESS
	JMP	EXLOOP
EXDONE,				/FINISHED WITH MESSAGE
	JMS	MSGEND		/CALC BCC, SET UP WC
	JMP	XMIT		/SEND IT
DEP,				/DEPOSIT
	TAD	(FLD2		/POINT TO WHERE FIELD SHOULD GO
	JMS	GETADR		/GET ADDRESS
	  JMP	REJCT
	DCA	ADR2		/SAVE ADDRESS
	TAD	ADR2		/GET IT AGAIN
	DCA	ADR1		/INTO RIGHT PLACE
	TAD	FLD2		/AND FIELD
	DCA	FLD1
DPLOOP,				/DEPOSIT LOOP
	JMS	GETWD		/TRY TO GET A DATA WORD
	  JMP	DPEND		/END OF DEPOSIT WHEN NONE LEFT
	DCA	TEMP3	/LOW ORDER BYTE
	JMS	GETWD		/GET HIGH ORDER
	  JMP	BOOT		/SOMETHING'S WRONG
IFZERO	PDP8I	<
	RTL
	RTL
	RTL
>/END OF IFZERO PDP8I
IFZERO 	PDP8E	<
	BSW
>/END OF IFZERO	PDP8E
	AND	(7700
	TAD	TEMP3		/NOW HAVE WHOLE WORD
	JMS	WRITE		/STORE THIS WORD
	JMS	INCADR		/INCREMENT ADDRESS
	JMP	DPLOOP		/CONTINUE
DPEND,				/NOW SEND ACCEPT WITH THE DATA
	TAD	ADR1		/ADR1 IS LAST ADDRESS + 1
	NEGATE
	DCA	TEMP1		/SAVE
	TAD	ADR2
	DCA	ADR1
	TAD	TEMP1
	DCA	ADR2
	TAD	FLD1		/NOW SWITCH FIELDS ALSO
	NEGATE
	DCA	TEMP1		/SAVE
	TAD	FLD2
	DCA	FLD1
	TAD	TEMP1
	DCA	FLD2
	JMS	MSGBEG		/START MESSAGE
	TAD	(ACCPT		/ACCEPT CODE
	JMS	PUTCHR
	JMP	EXADR		/PUT EXAMINE DATA IN REST

GOTO,				/GOTO MESSAGE
	TAD	(FLD1		/POINT TO FIELD
	JMS	GETADR		/GET ADDRESS
	  JMP	REJCT
	DCA	ADR1
ACCEPT,	JMS	MSGBEG
	TAD	(ACCPT
	JMS	PUTCHR
	JMS	PUTADR		/PUT ADDR1 AND FLD1 ADDRESS
	JMS	MSGEND
IFNZRO	FTDEBUG	<	JMS	LPTRAC>
	JMS	SNDMSG
DOGOTO,	TAD	FLD1		/GET FIELD
	DCA	.+5
	TAD	FLD1
	IAC			/CHANGE TO CIF
	DCA	.+1
	0
	0
	JMP I	ADR1		/GOTO
REJCT,	JMS	MSGBEG
	TAD	(RJCT
	JMS	PUTCHR
	JMP	EXDONE

	PAGE
CHKCRC,	0			/SUBROUTINE TO CHECK CRC
	JMS	CRCCLR		/CLEAR CRC
	TAD	(-10		/GET LENGTH
	DCA	TMP1		/STORE
	TAD	(BUFF		/GET ADDRESS
	DCA	TMP2		/STORE
	JMS	CRC		/CALCULATE CRC
	JMS	CRCUNL		/GET CRC
	  JMP I	CHKCRC		/ERROR RETURN IF NOT GOOD
	TAD	LEN		/GET LENGTH OF DATA PART
	TAD	(2		/ADD CRC
	NEGATE
	DCA	TMP1		/STORE
	TAD	(BUFF+10	/POINT TO START
	DCA	TMP2		/STORE
	JMS	CRC
	JMS	CRCUNL		/GET CRC
	  JMP I	CHKCRC		/ERROR RETURN IF BAD
	ISZ	CHKCRC		/SKIP RETURN
	JMP I	CHKCRC
IFZERO	KG8E	<
	DEFINE	CRCALG	<
	DCA	CRCTMP
	TAD	(-7
	DCA	CRCCNT
	TAD	CRCTMP
	AND	CRC2
	CIA
	CLL RAL
	TAD	CRCTMP
	TAD	CRC2
	CLL RTR
LPCRC,
	SPA
	CML
	RAR
	ISZ	CRCCNT
	  JMP	LPCRC
	DCA	CRCT2
	TAD	CRCT2
	CLL RTL
	AND	(301
	DCA	CRC2
	TAD	CRC1
	AND	CRC2
	CIA
	CLL RAL
	TAD	CRC1
	TAD	CRC2
	DCA	CRC2
	TAD	CRCT2
	CLL RTR
	DCA	CRC1
	TAD	CRC1
	AND	CRCT2
	CIA
	CLL RAL
	TAD	CRC1
	TAD	CRCT2
	CLL RTR
	CLL RAR
	CLL RAR
	DCA	CRC1
/	TAD	CRCTMP		/PUT BACK IF CHARACTER TO REMAIN IN AC
>/END OF DEFINE CRCALG
CRCINI,	0			/NULL INITIALIZATION SUBROUTINE
CRCCLR,	0			/CLEAR CRC
	CLA
	DCA	CRC1
	DCA	CRC2
	JMP I	CRCCLR
CRCUNL,	0			/UNLOAD CRC
	TAD	CRC1		/GET SECOND HALF
	 SZA  CLA
	  JMP I	CRCUNL		/ERROR RETURN
	TAD	CRC2
	SZA CLA
	  JMP I	CRCUNL		/ERROR RETURN
	ISZ	CRCUNL
	JMP I	CRCUNL		/GOOD RETURN
CRCACC,	0			/ACCUMULATE CRC
	CRCALG
	JMP I	CRCACC		/LEAVE AC 0
CRC1,	0
CRC2,	0
CRCTMP,	0
CRCT2,	0
CRCCNT,	0
GCR1,	0			/GET FIRST CRC CHAR
	TAD	CRC2
	JMP I	GCR1
GCR2,	0
	TAD	CRC1
	JMP I	GCR2
>/END OF IFZERO	KG8E

IFNZRO	KG8E	<
CRCINI,	0			/INITIALIZE CRC
	TAD	(100		/SET TO CRC-16
	BCCLCL			/LOAD CONTROL REG
	CLA			/CLEAR AC
	JMP I	CRCINI		/RETURN

CRCCLR,	0			/ROUTINE TO INITIALIZE THE CRC
	BCCCLR			/CLEAR BCC ACCUMULATION
	NL0			/RETURN GOOD AC
	JMP I	CRCCLR		/RETURN

CRCUNL,	0			/UNLOAD CRC
	BCCRDH			/READ HIGH PART
	SZA CLA			/SKIP IF OK
	  JMP I	CRCUNL		/GIVE ERROR RETURN
	BCCRDL			/READ LOW PART
	SZA CLA			/SKIP IF OK
	  JMP I	CRCUNL		/ERROR
	IFZERO	PDP8E	<
	CAF
>/END OF IFZERO	PDP8E
	ISZ	CRCUNL		/SKIP RETURN
	JMP I	CRCUNL

CRCACC,	0			/ACCUMULATE CRC CHARACTERS
	BCCGEN			/ADD TO CRC
	NL0

	JMP I	CRCACC		/RETURN
GCR1,	0			/GET LOW CRC BYTE
	BCCRDL			/READ IT
	JMP I	GCR1
GCR2,	0			/GET HIGH BYTE
	BCCRDH
	JMP I	GCR2

>/END OF IFNZRO	KG8E

CRC,	0			/CALCULATE A CRC
	TAD I	TMP2		/GET CHARACTER
	JMS	CRCACC		/ADD TO CRC
	ISZ	TMP2		/ADVANCE POINTER
	ISZ	TMP1		/ADVANCE COUNT
	  JMP	CRC+1		/LOOP TILL DONE
	JMP I	CRC		/RETURN
TMP1=GCR1			/TEMPORARIES FOR CRC
TMP2=GCR2
/	SYNCHRONOUS LINE SUBROUTINES
IFNZRO	FTDP01	<
F10CA=10			/USE AUTOINDEX REG FOR WC

DEFINE	WCR	<	JMS	WCRSUB>/END OF DEFINE WCR
INISYN,	0			/INITIALIZE
/	DPSIM			/SET IDLE MODE
	DPSTR			/TERMINAL READY
	DPSSR			/SKIP OF MODEM READY
	  JMP	.-1		/WAIT FOR IT
	JMP I	INISYN		/RETURN
SNDMSG,	0			/SUBROUTINE TO SEND A MESSAGE
	DPSTR
	DPSSR
	  JMP	.-1
	TAD	(226		/GET SYN
	JMP	SNDLP1
SNDLP,	TAD I	T10CA		/GET CHARACTER
	DPSTF			/SKIP ON NOT TRANSMIT
SNDLP1,	DPTAC DPCTF		/SEND IT AND CLEAR FLAG
	JMP	.-2
	CLA
	ISZ	T10CA
	ISZ	T10WC
	  JMP	SNDLP
	JMP I	SNDMSG
T10WC,	0
T10CA,	0
	PAGE
GETMSG,	0			/SUBROUTINE TO READ MESSAGE
	DPSTR
	DPCRA
	DPSSR
	  JMP	.-1
	TAD	(7400		/HALF OF SECOND ISZ
	DCA	COUNT2
	DCA	COUNT1
GETMS1,	CLA			/FOR BAD MESSAGES
	TAD	(BUFF-1
	DCA	F10CA
	DPCRA			/CLEAR RECEIVE ACTIVE
STMSG,	DPSRF			/SKIP ON NOT RECEIVE FLAG
	JMP	STMSG1		/GOT ONE
	ISZ	COUNT1
	  JMP	STMSG
	ISZ	COUNT2
	  JMP	STMSG
	JMP	BOOT		/START AGAIN, IF TAKES TOO LONG
STMSG1,	DPRRB			/READ CHARACTER
	TAD	(-226		/SEE IF SYN
	SNA			/SKIP ONLY IF NOT
	  JMP	STMSG		/STILL NOT START OF MESSAGE
	TAD	(6		/IF FIRST CHAR WAS 220, WILL
	SZA CLA			/WILL NOW BE ZERO
	  JMP	GETMS1		/NO, SORRY
	TAD	(220		/1ST CHARACTER
	DCA I	F10CA		/STORE
	WCR
	DCA	LOWCNT		/LOW BYTE OF COUNT
	TAD	LOWCNT		/GET BACK
	DCA I	F10CA		/STORE
	WCR			/THIRD CHARACTER
	DCA	HGHCNT
	TAD	HGHCNT
	DCA I	F10CA
	WCR
	DCA I	F10CA		/STORE FOURTH CHARACTER
	TAD	HGHCNT
	RTR
	DCA	HGHCNT
	WCR			/5TH
	DCA I	F10CA
	TAD	HGHCNT
	RTR
	DCA	HGHCNT
	WCR			/6TH
	DCA I	F10CA
	TAD	HGHCNT
	RAR
	DCA	HGHCNT
	WCR			/7TH
	DCA I	F10CA
	TAD	HGHCNT
	AND	(7400		/CLEAR USELESS BITS
	DCA	HGHCNT
	WCR			/8TH
	DCA I	F10CA
	TAD	HGHCNT
	TAD	LOWCNT		/NOW HAVE REAL COUNT
	DCA	COUNT
	WCR			/9TH
	DCA I	F10CA
	TAD	COUNT
	DCA	LEN		/SAVE FOR LATER
	WCR			/10TH
	DCA I	F10CA
	TAD	COUNT
	NEGATE
	DCA	COUNT
MSGLP,	WCR
	DCA I	F10CA
	TAD	F10CA		/GET ADDRESS
	TAD	(-BUFFRE	/COMPARE WITH END
	SNA CLA			/SKIP IF STILL OK
	 JMP	MSGFOR		/BETTER FORCE END
	ISZ	COUNT
	  JMP	MSGLP
MSGFOR,	DPCTR
	CLA CMA			/GET MINUS 1
	TAD	F10CA		/GET CURRENT ADDRESS (ACTUALLY AFTER LAST CHAR)
	NEGATE			/CONVERT TO NEGATIVE
	DCA	ENDMSG		/REMEMBER END OF MESSAGE
	JMP I	GETMSG

WCRSUB,	0			/SUBROUTINE TO WAIT FOR CHARACTER
	DPSRF			/SKIP ON NOT RECEIVE FLAG
	  SKP			/GOT CHARACTER
	JMP	.-2		/LOOP
	DPRRB			/READ CHARACTER
	JMP I	WCRSUB		/RETURN

HGHCNT,	0			/HIGH ORDER COUNT FROM MESSAGE
LOWCNT,	0			/LOWER ORDER COUNT FROM MESSAGE
COUNT=LOWCNT
LEN=HGHCNT
COUNT1,	0			/INNER ISZ LOOP COUNTER
COUNT2,	0			/OUTER ISZ LOOP COUNTER
>/END OF IFNZRO DP01
INIT,				/INITIALIZE
	CLA			/START WITH GOOD AC
	CDFINS			/SET DATA FIELD TO INSTRUCTION FIELD
	XL
IFNZRO	KG8E	<
	XL
	JMS	CRCINI		/INITIALIZE KG
	XL
>/END OF IFNZRO	KG8E
	XL
	JMS	INISYN		/INITIALIZE SYNCHRONOUS LINE
/	MOVE REQUEST LOAD MESSAGE INTO BUFF
	TAD	(RQL-1		/POINT TO MESSAGE
	DCA	AUTO1		/STORE IN AUTOINCREMENT LOCATION
	TAD	(BUFF-1		/POINT TO DESTINATION
	DCA	AUTO2		/STORE IN AUTOINCREMENT LOCATION
	TAD	(RQL-RQLE	/LENGTH FOR ISZ LOOP
	DCA	TEMP1		/STORE
MOVLP,	TAD I	AUTO1		/GET WORD
	DCA I	AUTO2		/STORE IT
	ISZ	TEMP1		/COUNT
	  JMP	MOVLP		/CONTINUE TILL DONE
	TAD	AUTO2		/END OF MESSAGE
	IAC			/MSGEND EXPECTS IT TO POINT PAST
	DCA	POINT		/STORE
	JMP	EXDONE		/PUT ON CRC'S AND GO TO XMIT
IFZERO	FTDP01	<
	PAGE
F10CA=7725
F10WC=7724
T10CA=7730
T10WC=7727
INISYN,	0			/INITIALIZE DP8E
	DPSCSI			/CLEAR SYNCHRONOUS LINE
	TAD	(5400		/TRANSMIT RQ,TERMINAL READY,IDLE
	DPSLCC
	ZZ=EFIELD^1100
	TAD	(ZZ-5400	/FIELDS
	DPSLFL
	TAD	(7720-ZZ-1
	DCA	AUTO1
	CDF
	DCA I	AUTO1
	DCA I	AUTO1
	DCA I	AUTO1
	DCA I	AUTO1
	CDFINS
	JMP I	INISYN
SNDMSG,	0			/SEND A MESSAGE
	DPSGTT
	DPSSTO			/SEE IF FLAG UP
	  JMP	.-1
	JMP I	SNDMSG		/RETURN
GETMSG,	0			/RECEIVE A MESSAGE
	TAD	(7400		/TIMER
	DCA	COUNT2
	DCA	COUNT1
GETMS0,	CLA			/JUNK HERE SOMETIMES   
	DPSCSD			/CLEAR SYNCH DETECT
GETMS1,	CDF			/WE ARE MODIFYING FIELD 0
	NLM1			/LENGTH OF FIRST PIECE
	DCA	F10WC
	TAD	(BUFF-1		/START ADDRESS
	DCA	F10CA		/ADDRESS
	CDFINS			/BACK TO OUR FIELD
	DPSGRR			/START RECEIVER
GETM1,				/LOOK FOR DONE
	DPSSRO			/SKIP IF DONE
	  JMP	GETL1		/ELSE DECREMENT TIMER, THINK
	TAD	BUFF		/GET CHARACTER GOTTEN
	TAD	(-226		/CHECK IF SYN
	SNA			/SKIP IF NOT
	  JMP	GETMS1		/GO TRY AGAIN
	TAD	(6		/WAS IT DLE (220)?
	SZA CLA			/SKIP IF YES
	  JMP	GETMS0		/NO, JUNK MEANS CLEAR SYNCH DETECT
	TAD	(-7		/LENGTH OF REST OF HEADER
	CDF			/HAS TO GO INTO FIELD 0
	DCA	F10WC		/STORE
	CDFINS
	DPSGRR			/START RECEIVER
GETM2,				/WAIT FOR SECOND PART TO COMPLETE
	DPSSRO			/SKIP ON DONE
	  JMP	GETL2		/IF NOT, DECREMENT COUNTER
	NL2			/TWO FOR CRC
	TAD	LEN		/+LENGTH
	NEGATE
	CDF
	DCA	F10WC
	CDFINS
	DPSGRR			/GET DATA PART
GETM3,	DPSSRO			/SKIP IF ALL DONE
	  JMP	GETL3
	CDF
	NLM1			/SUBTRACT CRC
	TAD	F10CA		/LAST ADDRESS + 1
	NEGATE
	CDFINS
	DCA	ENDMSG
	JMP I	GETMSG
GETL1,	TAD	(GETM1		/POINT TO DPSSRO
	JMP	ISZ1
GETL3,	TAD	(GETM3
	JMP	ISZ1
GETL2,	TAD	BUFF+2		/GET HIGH ORDER OF LENGTH
	HGHADR
	AND	(7400
	TAD	BUFF+1		/ADD LOW ORDER
	DCA	LEN		/SAVE
	TAD	LEN		/GET IT AGAIN
	SPA			/IF NEGATIVE, WAY TOO BIG
	  JMP	REPL		/MAKE A MORE REASONABLE LENGTH
	NEGATE
	TAD	(MAXLEN-12
	SPA CLA			/STILL TOO BIG IF NOT POSITIVE
	  JMP	REPL
ISZ2,	TAD	(GETM2		/POINT TO DPSSRO
ISZ1,	DCA	PVT		/WHERE TO GO
	ISZ	COUNT1		/INNER COUNTER
	  JMP I	PVT
	ISZ	COUNT2		/OUTER COUNTER
	  JMP I	PVT
	JMP	BOOT		/TOOK TOO LONG, START OVER
REPL,	NL0			/BECAUSE AC MIGHT HAVE JUNK
	TAD	(MAXLEN-12	/BETTER LENGTH
	DCA	LEN
	JMP	ISZ2

COUNT1=INISYN			/INNER ISZ LOOP
COUNT2=CRC			/OUTER ISZ LOOP
LEN=CRCINI			/LENGTH STORED HERE
PVT=SNDMSG			/POINTER TO RETURN FROM ISZ'ING
>/END OF IFZERO	FTDP01
	PAGE
RNGCHK,	0			/SUBROUTINE TO VALIDATE CODE
	JMS	GETWD		/GET NEXT WORD
	  JMP	BOOT		/IF NONE LEFT
	SPA			/BETTER BE POSITIVE
	  JMP	BOOT		/ELSE START OVER
	TAD	(-4		/NEGATIVE OF FIRST ILLEGAL CODE
	SMA			/BETTER BE NEGATIVE
	  JMP	BOOT		/ELSE START OVER
	TAD	(4		/GET ORIGINAL CODE BACK
	JMP I	RNGCHK		/RETURN
MSGBEG,	0			/SUBROUTINE TO START MESSAGE

	TAD	(BUFF-1		/ADDRESS FOR AUTO POINTER
	DCA	AUTO1		/STORE
	TAD	(220		/DLE
	DCA I	AUTO1		/STORE DLE
	DCA I	AUTO1		/COUNT (LOW ORDER)
	DCA I	AUTO1		/COUNT (HIGH ORDER)
	DCA I	AUTO1		/FILL
	DCA I	AUTO1		/FILL
	IAC			/STATION 1
	DCA I	AUTO1		/A0
	DCA I	AUTO1		/BCC1
	DCA I	AUTO1		/BCC2
	DCA I	AUTO1		/DNA
	IAC			/GET A 1
	TAD	AUTO1		/TO ADD TO CURRENT POSITION
	DCA	POINT		/STORE FOR PUTCHR
	TAD	(-BUFFE		/END OF DATA PART OF MESSAGE
	DCA	ENDMSG		/STORE FOR PUTCHR
	JMP I	MSGBEG		/RETURN
MSGEND,	0			/SUBROUTINE TO END A MESSAGE
	TAD	POINT		/GET POINTER TO NEXT SLOT
	TAD	(-BUFF-10	/GET MESSAGE LENGTH
	DCA	LEN		/STORE
	TAD	LEN		/GET BACK
	AND	(7400		/SEE IF WILL FIT IN ONE WORD
	SNA			/SKIP IF NOT
	  JMP	MSGE1		/YEAH, HAVE TO DO LOW PART ONLY
	RTL			/SHIFT TO RIGHT PLACE
	RTL
	RAL
	DCA I	(BUFF+2		/STORE IN SECOND COUNT WORD
MSGE1,	TAD	LEN		/GET LOW ORDER
	DCA I	(BUFF+1		/STORE IT
	JMS	CRCCLR		/CLEAR CRC
	TAD	(-6		/COUNT
	DCA	TMP1
	TAD	(BUFF		/STARTING ADDRESS
	DCA	TMP2
	JMS	CRC		/CALC CRC
	JMS	GCR1		/GET LOW ORDER
	DCA I	(BUFF+6		/STASH
	JMS	GCR2		/GET HIGH ORDER
	DCA I	(BUFF+7		/STASH
	TAD	LEN		/GET LENGTH
	NEGATE			/FOR ISZ LOOPING
	DCA	TMP1		/STORE AS COUNT
	TAD	(BUFF+10	/START OF DATA PORTION
	DCA	TMP2		/STORE
	JMS	CRCCLR		/CLEAR CRC
	JMS	CRC		/CALC DATA CRC
	TAD	TMP2		/GET POINTER
	DCA	MTMP		/STORE IN THIS PAGE
	JMS	GCR1		/GET LOW ORDER CRC CHAR
	DCA I	MTMP		/PUT INTO MESSAGE
	ISZ	MTMP		/BUMP POINTER
	JMS	GCR2		/GET HIGH ORDER CRC
	DCA I	MTMP		/PUT INTO MESSAGE
	TAD	LEN		/GET LENGTH OF DATA
	TAD	(2+10+4		/ADD BCC,HEADER,AND SYNCHS
	NEGATE			/INTO PROPER FORM
IFZERO	FTDP01	<CDF		/CHANGE TO RIGHT FIELD>
	DCA	T10WC		/FOR WORD COUNT
	TAD	(SYNBUF		/POINT TO START
	DCA	T10CA		/STORE
IFZERO	FTDP01	<CDFINS		/GO BACK>
	JMP I	MSGEND
MTMP,	0			/TEMP LOCATION
IFNZRO	FTDEBUG	<
	PAGE
LPTRAC,	0			/SUBROUTINE TO TRACE MESSAGES
	TAD	(15
	LPTSTB			/START
	JMS	TADR		/PUT OUT ADDRESS
	TAD	(40
	JMS	LPTC		/PUT OUT CHARACTER
	TAD	(BUFF-1		/POINT TO MESSAGE
	DCA	LPTAUT		/STORE IN AUTO
	TAD	BUFF+2
	HGHADR			/SHIFT TO HIGH ADDRESS
	TAD	BUFF+1		/ADD LOW
	TAD	(12		/HEADER+CRC
	NEGATE
	DCA	TCNT		/TRACE COUNTER
	JMP	LPTLP1		/START OUTPUTTING
LPTLP,	TAD	(",		/COMMA
	JMS	LPTC		/PRINT IT
	TAD	LPTCOL		/GET COLUMN
	TAD	(6		/WHERE AFTER NEXT OCTAL CHAR
	TAD	(-LPTWID	/END OF LINE
	SMA CLA			/SKIP IF OK
	  JMS	LCRLF		/OTHERWISE END THIS LINE
LPTLP1,	TAD I	LPTAUT		/GET MESSAGE CHARACTER
	JMS	TOCT		/PUT OUT OCTAL
	ISZ	TCNT
	  JMP	LPTLP
	JMP I	LPTRAC		/RETURN
TADR,	0			/PUT OUT ADDRESS
	CLA
	TAD	(15
	JMS	LPTC
	TAD	(12
	JMS	LPTC
	DCA	LPTCOL		/NOW AT BEGINNING
	TAD	(60+EFIELD
	JMS	LPTC
	TAD	LPTRAC		/GET RETURN ADDRESS
	TAD	(-1		/GET ADDRESS OF CALL
	DCA	LPTWK		/SAVE
	TAD	(-4
	DCA	LPTCNT
ADRL,	TAD	LPTWK		/GET CURRENT VERSION
	AND	(7000
	RTL
	RTL
	AND	(7
	TAD	(60
	JMS	LPTC
	TAD	LPTWK
	CLL RTL
	RAL
	DCA	LPTWK
	ISZ	LPTCNT
	  JMP	ADRL
	JMP I	TADR
TOCT,	0			/PUT OUT OCTAL BYTE
	AND	(377		/ONLY 8 BITS
	DCA	LPTWK		/SAVE WORD
	TAD	("<
	JMS	LPTC
	TAD	(TOCT1
	DCA	TADR
	TAD	LPTWK
	CLL RTL
	CLL RAL
	DCA	LPTWK
	TAD	(-3
	DCA	LPTCNT
	JMP	ADRL
TOCT1,	TAD	(">
	JMS	LPTC
	JMP I	TOCT
LPTC,	0
	LPTSKF
	  JMP	.-1
	LPTSTB
	CLA
	ISZ	LPTCOL
	JMP I	LPTC
LCRLF,	0
	TAD	(15
	JMS	LPTC
	TAD	(12
	JMS	LPTC
	DCA	LPTCOL
	TAD	(-6
	DCA	LCRCNT
LCRLFL,	TAD	(40
	JMS	LPTC
	ISZ	LCRCNT
	  JMP	LCRLFL
	JMP I	LCRLF
LPTCOL,	0
LPTCNT,	0
LCRCNT,	0
LPTWK,	0
TCNT,	0
LPTAUT=12
>/END OF IFNZRO	FTDEBUG
RQL,	220;RQLE-RQL-10;0;0;0;1;0;0;NODE;15;PDP8;SERIAL
	NAME
IFDEF	NAMXXX	<XLIST>
RQLE,
	PAGE
SYNBUF,	226;226;226;226	/FOUR SYNCHS
BUFF=.
BUFFE=.+MAXLEN			/END OF BUFFER
BUFFRE=BUFFE+2			/REAL END (ROOM FOR CORC)
	FIELD	EFIELD
*INIT				/FOR LOADER

$