Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50224/lod11.p11
There are no other files named lod11.p11 in the archive.
; LOD11.P11
	LOADER= 157500	; STARTING ADDRESS OF DEC ABSOLUTE LOADER
	START = 74000	; STARTING ADDRESS OF THIS PROGRAM
;
	;	PDP-10  ---    PDP-11    LOADER PROGRAM
;	VER 2   OCTOBER 7, 1971     RICHARD B. FLEISHER
;
; THE PURPOSE OF THIS PROGRAM IS TO ALLOW A USER AT THE PDP-11
; TELETYPE TO HAVE TWO WAY COMMUNICATION WITH THE PDP-10.
; FURTHERMORE IT ALLOWS A PROGRAM ASSEMBLED ON THE PDP-10 TO BE 
; LOADED INTO CORE ON THE PDP-11.
;
; INTERRUPTS ARE SERVICED FOR THE TELETYPE KEYBOARD AND PRINTER
; AS WELL AS THE DC-11 RECEIVE MODE. DC-11 TRANSMIT IS HANDLED BY
; CHECKING THE READY FLAG.
;
; DATA COMING FROM THE PDP-10 AT 1200 BAUD IS BUFFERED AND TELETYPE
; PRINTER OVERLAPPED WITH IT.  WHEN A BUFFER LOAD IS
; RECEIVED A STOP IS SENT TO THE PDP-10 MONITOR (CODE 200/8)
; ANY CHARACTERS IN THE LINE WHEN THE STOP IS SENT ARE BUFFERED ALSO.
; WHEN THE PRINTER IS DONE PUTTING OUT THE BUFFER, A START IS SENT TO
; THE PDP-10 MONITOR (CODE-0).  NOTE: A PATCH HAD TO BE PUT INTO THE
; PDP-10 MONITOR BY DEC TO ACCEPT AND RECOGNIZE THESE CODES.
;
; THE CORE LOAD BEGINS WITH A SPECIAL CHARACTER 243/8 COMING FROM
; THE PDP-10.  SIX BITS OF DATA ARE USED  - BIT 6 ALWAYS
; SET FOR BINARY DATA.
;
; THE PDP-11 LOADER IS USED WITH ALL ITS FEATURES TO LOAD CORE.
; FIVE WORDS ARE OVERLAID TO ACCOMPLISH THIS.  THESE ARE 
; REPLACED IF A TAPE IS TO BE LOADED LOCALLY BY STARTING THE MACHINE
; AT (ABSOLUTE LOADER ADDRESS - 100/8)
; AT END OF DEC LOADER THIS PROGRAM PUT A LINK BACK DONT OVER LAY
;
; A CHECKSUM ERROR CAUSES A 243/8 TO BE SENT TO THE PDP-10 AND 
; AN IMMEDIATE CHANGE TO CONVERSATION MODE.  A GOOD LOAD IS FOLLOWED
; BY A 15/8 SENT TO THE PDP-10.
; EACH TIME A GOOD PDP11 BLOCK IS SENT A "CR" IS SENT, MEANS OK
;
; THE PDP-10 WILL TRY A MAXIMUM OF 8 TIMES TO LOAD CORE 
; EACH PRECEEDED WITH A 243/8.
;
; THIS PROGRAM MAY BE ASSEMBLED ANYWHERE IN CORE BY CHANGING THE
; VALUE OF (START). (LOADER) SHOULD BE SET EQUAL TO THE STARTING
; ADDRESS OF THE DEC ABSOLUTE LOADER (V005A).
;
; THE PROGRAM IS NOW SET TO BE USED WITH A DC-11 AB  AT 1200 BAUD.
; THE CONTROL BITS FOR THE DC-11 STATUS REGISTERS ARE SET BY THE
; FOLLOWING TWO EQUALITIES.
	CONT1= 21	; FOR TRANSMIT: REQUEST TO SEND, 1200 BAUD
	CONT2= 121	; FOR RECEIVE: INTERRUPT ENABLE,1200 BAUD
;
;
;	START OF MAIN PROGRAM
;
	.=START
;	DEFINE REGISTERS
	R0= %0
	R1= %1
	R2= %2
	R3= %3
	R4= %4
	R5= %5
	SP= %6
	PC= %7
;	INITIALIZE FLAGS AND VARIABLES
;
BEGIN:	MOV	#340,	PS	; INHIBIT INTERRUPTS
	MOV	#.-8.,	SP	; INITIALIZE STACK POINTER
	MOV	#60,	R0	; READY TO SET VECTORS
	MOV	#TTYK,	(R0)+
	MOV	#200,	(R0)+	; KEYBOARD VECTOR
	MOV	#TTYP,	(R0)+
	MOV	#200,	(R0)+	; PRINTER VECTOR
	MOV	#PD10S,	@#300
	MOV	#300,	@#302
	MOV   #1,	INTOF ; SET FLAG  PRINTER HAS NOT BEEN STARTED
	CLR   R1
	MOV   R1,	FLOUT	; DOWN FLAG WHICH TELLS PRINTER
				; ROUTINE CHARACTER TO BE ECHOED
	MOV   R1,	FLG2	; DOWN FLAG - BYTE READY FOR LOADER
	MOV   R1,	BDF	; DOWN BINARY DATA FLAG
;      OVER-LAY LOADER TO MAKE LINKAGE BACK TO THIS PROGRAM
;
	L.BAD=LOADER+112	;FORM ADDRESS IN LOADER
	MOV   JUMP,	L.BAD	; PUT INSTRUCTION IN LOADER
	MOV   JUMP+2,	L.BAD+2	
	MOV   JUMP3,	L.BAD-2	
	MOV   JUMP4,	LOADER+224
	MOV   JUMP4+2,	LOADER+226
	BR   ON
;
;
JUMP:	JMP	@#CHERR		; A JUMP TO ERROR IN MAINLINE
JUMP2:	JMP	@#FINE		; OK LOADER FINISHED  --  JUMP BACK
JUMP3:	1445			; = BEQ OKBLK LINKS TO IT
JUMP4:	JMP	@#OKBLK		; THIS IS PUT AT END OF LOADER
	LPJMP= LOADER+206	; FORM ADDRESS IN LOADER
ON:	MOV   JUMP2,	LPJMP	; PUT INSTRUCTION IN LOADER
	MOV   JUMP2+2,	LPJMP+2
;  INITIALIZE   POUT, PIN   AS ADDRESS POINTERS TO BUFFER
;
	MOV   #BUFR,	POUT
	MOV   #BUFR,	PIN
;
;
	MOV	#20.,	COUTR	; INITIALIZE COUNTER
	MOV	#2,	SEQ	; INITIALIZE SEQUENCE COUNTER
;
;
;  INITIALIZE TELETYPE AND PDP-10 CONTROL REGISTERS
;
	TKS= 177560		; TYP KEYBOARD STATUS
	TKB= 177562		; TYP KEYBOARD BUFFER
	TPS= 177564		; TYP PRINTER STATUS
	TPB= 177566		; TYP PRINTER BUFFER
	MOVB	TKB,	SAVT	; CLEAR DONE FLAG IF SET ON KEYBOARD
	MOVB	#0,	TPB	; OUTPUT DUMMY CHARACTER TO INSURE THAT
				; READY FLAG WILL BE UP WHEN INT ENABLED
	MOV   #100,	TKS	; ENABLE INTERRUPT
	PD10= 174004		; TRANSMITTER STATUS REGISTER
	PDBUF= 174006		; TRANSMITTER BUFFER REGISTER
	P10RS= 174000		; RECEIVER STATUS REGISTER
	P10RD= 174002		; RECEIVER BUFFER REGISTER
	MOV	P10RD,	SAVT	; CLEAR DONE FLAG IF UP -- RECIEVER
	CLR	PDBUF		; SET TRANSMITT READY
	MOV	#CONT1,	PD10	; SET SPEED TRANS 1200
	MOV	#CONT2,	P10RS	; SET INT AND SPEED RECEV
;
	MOVB	#0,	PDBUF
	PS= 177776		; STATUS REGISTER
	CLR	PS		; SET PRIORITY TO 0
	BR      RETURN
SAVT:	.WORD	0	; TEMPORARY STORAGE
;
;	VARIABLES
;
INTOF:.WORD	0		;FLAG- INTERRUPT SEQUENCE IN PROGRESS
FLOUT:	.WORD	0		;FLAG- INDICATES WHERE TO ECHO CH.
FLG2:	.WORD	0		;FLAG- INDICATES MUST CALL LOADER
BDF:	.WORD	0		;FLAG- BINARY DATA COMING
POUT:   .WORD   0		; DATA OUT -- POINTER TO BUFFER
PIN:	.WORD	0		;DATA IN POINTER TO BUFFER
COUTR:	.WORD	0		;COUNTER -- TELLS WHEN TO SHUT OFF PDP-10
SEQ:	.WORD	0		; SEQUENCE COUNTER FOR PDP-10 SERVICE
;
;
BUFR:	.WORD	0		; ROTATING BUFFER
	.=.+44.
; 20 WORDS + 2 WORDS FOR CHARACTERS CAUGHT IN LINE AFTER STOP 
;	MAIN LINE ROUTINE
;
;  CHECK BUFFER TO SEE IF PRINTER NEEDS TO BE STARTED.  OUTPUT FIRST
;  CHARACTER ONLY.
;
;
;
;
;
;
;
RETURN:	TST 	INTOF		; IS INTOF SET
	BEQ	NO		; BRANCH IF  NO
	CMP	POUT,	PIN
	BEQ	NO		; POINTERS EQU -- NO INFO. TO GO OUT
;	OUTPUT CHARACTER TO PRINTER
;
;
BAC:	TSTB	TPS		; CHECK READY FLAG
	BPL	BAC
	MOVB	@POUT,	TPB	; MOVE TO BUFFER
	ADD	#2,	POUT	; INCREMENT OUTPUT POINTER BY 2
;  CHECK IF POINTER IS PAST BOTTOM OF BUFFER AND
;  NEEDS TO BE REPOSITIONED
;
	CMP	POUT,	#BUFR+44.
	BEQ	OK		;IF = OK
	BMI	OK		; IF LESS THAN  OK
	MOV	#BUFR,	POUT	;IF GREATER
OK:	MOV	#0,	INTOF	;DOWN INTOF SINCE FURTHER OUTPUTS
	MOV	#100,	TPS	; ENB INT  ON TTY PRINTER
				; WILL BE HANDLED BY INTERRUPT HANDLER
NO:	TST	FLG2		; CHECK FLG2  TO SEE IF BYTE READY
				; FOR LOADER
	BEQ	RETURN		; LOOP
	MOV	#IO,	R5	; YES -- SO INITIALIZE R5 FOR USE
				; BY THE LOADER IN CALLING FOR I/O
	L.LDIB= LOADER+14	; ENTRY TO LOADER
	CMP	#1,	SR	; CLEAR R1 IF ABSOLUTE , OR RELOCATED
	BEQ	X2		; LOAD SPECIFIED BY SWITCHES
	CLR	R1		; DO NO CLEAR IF CONTINUING
;
X2:	JMP	L.LDIB		; GO TO DEC LOADER PROGRAM
;
;
;
;  ROUTINE WHICH REPLACES I/O SECTION IN LOADER
;  CALLED L.READ
;
;
;
;
;
IO:	TST	FLG2		; TEST BYTE READY FLAG
	BEQ	IO		; LOOP HERE UNTIL 8 BIT BYTE READY
	CLR	FLG2		; CLEAR FLAG
	MOVB	SAVE,	R3	; MOVE DATA TO LOADER
	JMP	LOAD		; GO BACK TO LOADER
	LOAD= LOADER+140	; ADDRESS OF RETURN
SAVE:   .WORD   0
; ROUTINE SENDS A "CR" TO THE PDP10 TO TELL
; IT RECEIVED THE PDP11 BLOCK OK.


OKBLK:	TSTB	PD10		; TEST READY
	BPL	.-4
	MOVB	#215,PDBUF	; SIGNAL BLOCK OK
	JMP	LOADER+40	; LOOK FOR BEGINNING OF BLOCK
;  RETURN HERE IN CASE OF CHECKSUM ERROR IN INPUTTED PROGRAM
;  BEING PROCESSED BY THE LOADER  ( MIDDLE BLOCKS OR END)
;
;
;
;
CHERR:	MOV	#340,	PS
	TSTB	PD10		; TEST IF 10 READY
	BPL	.-4
	MOVB	#17,	PDBUF	; SEND 17/8 TO PDP-10
	TSTB	PD10
	BPL	.-4
	MOVB	#243,	PDBUF	; SEND 243/8 TO PDP-10
	TSTB	PD10
	BPL	.-4
	MOVB	#215,	PDBUF	; SEND 215/8 TO PDP-10
	BR	ON1
;
;
;	RETURN HERE IF A SATISFACTORY CORE LOAD WAS MADE
;
;
;
FINE:	MOV	#340,	PS
	TSTB	PD10		; TEST READY
	BPL	.-4
	MOVB	#215,	PDBUF	; SEND CARRIAGE RETURN
;  INITIALIZE THE PACK ROUTINE IN PDP-10 INTERRUPT HANDLER
;
ON1:	CLR	R0
	MOV	R0,	FLG2
	MOV	R0,	BDF	; DOWN BYTE READY AND BINARY DATA FL
	MOV	#2,	SEQ	; INITIALIZE
	MOV	P10RS,	R0	; CLEAR ERROR BIT IF UP
	CLR	PS
	JMP	RETURN		; RETURN TO MAIN LOOP
;
;   TELETYPE KEYBOARD   INTERRUPT SERVICE
;
;
;
TTYK:	TSTB	TKS		; ACCEPT CHARACTER
	BPL	END1		; EXIT
	MOVB	TKB,	CHRET	; SAVE CHARACTER
	TST	INTOF
	BEQ	T1
;
T2:	TSTB	TPS		; WAS SET -  SO ECHO
	BPL	T2		; TO PRINTER
	MOVB	CHRET,	TPB
	BR	T3
T1:	INC	FLOUT		; SET FLOUT IN PRINTER INTERR. HANDLER
;
;
;
T3:	TSTB	PD10
	BPL	T3
	MOVB	CHRET,	PDBUF	; SEND CHARACTER TO PDP-10
END1:	RTI			; INTERRUPT RETURN
CHRET:	.WORD	0
;
;  TELETYPE PRINTER INTERRUPT HANDLER
;
;
;
;
;
TTYP:	TST	FLOUT
	BNE	TT1		;BRANCH IF SET
	CMP	POUT,	PIN	; NOT SET-- CHECK BUFFER
	BEQ	TT2	
;
TT3:	TSTB	TPS		; YES-  TEST PRINTER
	BPL	TT3
	MOVB	@POUT,	TPB	; OUTPUT NOW
	ADD	#2,	POUT	; INCREMENT BUFFER ADDRESS POINTER.
;  CHECK TO SEE IF PAST BOTTOM OF BUFFER AND NEEDS TO BE RE-POSITIONED
;
	CMP	POUT,	#BUFR+44.
	BEQ	TT4
	BMI	TT4
	MOV	#BUFR,	POUT	; MOVE TO TOP OF BUFFER
;
TT4:	RTI			; RETURN
TT2:	BIS	#1,	INTOF	; SET TABLE EMPTY FLAG
	CLR	TPS		; TURN OFF INTERRUPT FOR PRINTER
;
TT5:	TSTB	PD10		; TELL PDP-10 TO GO IF NOT ALREADY GOING
	BPL	TT5
	MOVB	#0,	PDBUF
	BR	TT4
;  ECHO CHARACTER TYPED FROM KEYBOARD
;
;
;
TT1:	TSTB	TPS		; CHECK IF READY
	BPL	TT1
	MOVB	CHRET,	TPB	; OUTPUT
	CLR	FLOUT		; CLEAR FLOUT
	BR	TT4
;
;
;
;
;
;
;	INTERRUPT FROM PDP-10 RECEIVE DATA SERVICE ROUTINE
;
;
; ONLY 6 BITS OF DATA ARE SENT AT A TIME. THE DISK FILE
; IS UNPACKED AT THE 10 END AND PACKED HERE. WHEN 8 BITS ARE BUILT, THEY
; ARE SENT TO THE DEC ABSOLUTE LOADER.
;
;
PD10S:	BIT	#100000,P10RS	; ANY ERRORS NOT PARITY
	BMI	RCVERR		; HAVE ERROR
PD10S1:	MOV	R0,	EXT1+2	; SAVE CONTENTS OF REGISTER
	MOV	R1,	EXT2+2	; SAVE CONTENTS OF REGISTER
;
PD6:	TSTB	P10RS		; ACCEPT DATA IF RECEIVER READY
	BPL	PD5
	MOVB	P10RD,	PHOLD
	TST	BDF		; CHECK BINARY DATA FLAG
	BNE	PD1		; WAS SET
;
;  CHECK FOR 243/8
	CMPB	#243,	PHOLD
	BEQ	PD2		; BRANCH IF WAS 243/8
;  WAS VALID ASCII CH. -- PUT IN BUFFER
PD8:	MOV	PIN,	R0
	MOVB	PHOLD,	(R0)+
	INC	R0
; CHECK TO SEE IF PAST BOTTOM OF BUFFER AND NEEDS TO BE REPOSITIONED
	CMP	R0,	#BUFR+44.
	BEQ	PD3
	BMI	PD3
	MOV	#BUFR,	R0	; POSITION TO TOP OF BUFFER
;
PD3:	MOV	R0,	PIN	; REPLACE
;  SEE IF STOP OF PDP-10 SHOULD BE ORDERED NOW
	DEC	COUTR		; DECREMENT COUNTER
	BEQ	PD4		; YES-- STOP PDP-10
PD5:	JMP	EXT2		; END
;
PXERR:	MOV	#CHERR,	(SP)	;ERROR EXIT
PXERR1:	RTI
RCVERR:	TST	BDF	; BINARY DATA ?
	BEQ	PXERR1	; NO,ASC DATA 
	BR	PXERR		; YES, RESEND DATA
PD4:	TSTB	PD10		; STOP PDP-10 IF READY
	BPL	PD4
	MOVB	#200,	PDBUF
	MOV	#20.,	COUTR	; RESET COUNTER
	BR	PD5		; END
;
PD2:	TST 	SR
	BNE	PD11
;
PD12:	INC	BDF
	BR	PD5
;
PD11:	BIT	#1,	SR
	BNE	PD12
	BR	PD8
;  ENTRY POINT FOR BINARY DATA FOLLOWING 243
;  EACH IS A SIX BIT GROUP OF DATA Z--  NEEDS TO BE PACKED
;
;
	SR = 177570
PD1:	BIT	#100,	PHOLD	; IS BIT 6 SET
	BEQ	PD5		; WAS NOT BINARY
	BR	PD9
PD7:	CLR	BDF
	BR	PD8
PD9:	BICB	#300,	PHOLD
	BIT	#40,	P10RS	; CHECK EVEN PARITY
	BNE	PXERR		; NOT EVEN PARITY ERROR
	MOV	SEQ,	R0	; PACK - PICK UP SEQUENCE
	JMP	@PDSX(R0)	; NUMBER
;
;
PDSX:	.WORD	0,S1,S2,S3,S4
;
; ACTUAL PACK IS DONE HERE
;
S1:	ASL	SEQ		; INCREMENT POINTER TO 4
	ASL	PHOLD		; SHIFT LEFT
	ASL	PHOLD
	MOVB	PHOLD,	HOD1   ; STORE
	BR	PD5
;
S2:	MOV	#6,	SEQ
	MOVB	PHOLD,	R1
	ASR	R1		; SHIFT RIGHT 4
	ASR	R1
	ASR	R1
	ASR	R1
	BISB	R1,	HOD1	; COMBINE WITH FIRST
	MOVB	HOD1,	SAVE	; 6 BITS
	BIS	#1,	FLG2	; SET FLG2
;  CONDITION OTHER PART OF WORD
	BICB	#360,	PHOLD	; MASK OFF
	MOVB	PHOLD,	R1
	ASL	R1		;@SHIFT LEFT 4
	ASL	R1
	ASL	R1
	ASL	R1
	MOVB	R1,	HOD1
	BR	EXT2
;
;
S3:	MOV	#10,	SEQ
	MOV	PHOLD,	R1
	ASR	R1		; SHIFT RIGHT 2
	ASR	R1
	BISB	R1,	HOD1	; COMBINE
	MOVB	HOD1,	SAVE	; 2ND BYTE COMPLETE
	BIS	#1,	FLG2	; SET FLAG
	BICB	#374,	PHOLD	; LEAVE 2 BITS
	MOVB	PHOLD,	R1
	SWAB	R1		; SWAP BYTES 
	ASR	R1		; POSITION
	ASR	R1
	MOVB	R1,	HOD1	;SAVE 2 BITS
	BR	EXT2
;
S4:	MOV	#2,	SEQ	; RESET SEQUENCE
	BISB	PHOLD,	HOD1	; COMBINE
	MOVB	HOD1,	SAVE
	BIS	#1,	FLG2	; RESET FLAG
;
EXT2:	MOV	#0,	R1
;
;
EXT1:	MOV	#0,	R0
	RTI			; REPLACE REGISTER AND EXIT
;
PHOLD:	.WORD	0
HOD1:	.WORD   0
;
;
;
; ************************************************************
;
;  START HERE TO RE- INITIALIZE LOADER FOR LOCAL USE
;
	.=LOADER-100		; CONSTANT MAY BE CHANGED
; BUT CAREFULL DO NOT OVERLAY LOADER OR ITS STACK
	MOV	#1753,  L.BAD-2	; BEQ   L.LD2
	MOV	#0,	L.BAD
	MOV	#751,	L.BAD+2
	MOV	#6204,	LPJMP
	MOV	#103002,LPJMP+2
	JMP	LOADER
	.END	BEGIN