Google
 

Trailing-Edge - PDP-10 Archives - dec-10-omona-u-mc9 - dxld.mac
There are 6 other files named dxld.mac in the archive. Click here to see a list.
TITLE	DXLD - DX10 MICRO-CODE BOOTSTRAP LOADER
SUBTTL T.HESS/TAH	14-AUG-75

;ASSIGNMENTS

P=17	;PDL PNTR
IOCLR==1B19		;APR, I/O CLR
PICLR==10400		;PI SYSTEM CLEAR
DTE==200		;DEVICE CODE

;DX10 VALUES

PDC==220		;DEVICE CODE
RUNIND==1		;RUN FLAG
INHLD==1B25	;INHIBIT LOAD ICPC
MPERR=1B26	;MICRO-PROCESSOR ERROR
MEMPAR==1B27	;MEM PAR ERROR
NXM==1B28	;NXM
STAVL==1B29	;STATUS AVAIL
CONT==1B32	;CONTINUE DX10

DXCLR==2	;CLEAR DX10
UNITNM==7713	;ADDRESS OF UNIT IN 8-MEM
ENEXM==1B22	;ENABLE EXAMINE
ENDEP==1B23		;ENABLE DEPOSIT
RSEL==1
MPADR==5
MPCTL==4

;VERSION NUMBER

VDXLD==2		;VERSION #
EDXLD==4		;EDIT #
PDXLD==0		;PATCH LEVEL
WDXLD==0		;LAST EDITED BY DEC

	LOC	137
	BYTE	(3)WDXLD(9)VDXLD(6)PDXLD(18)EDXLD
	LOC	200

PLIST:	BLOCK	20

;THIS CODE WILL BE READ-IN BY THE TU70 MAGTAPE SYSTEM
;BY THE READ-IN HARDWARE STARTING AT LOCATION 0
;AND THEN WILL BE STARTED AT LOCATION 100.

	LOC	220		;CODE WILL EVENTUALLY BE TRANSFERRED TO HERE

CONIX:	CONI PDC,0		;CONI INSTRUCTION
CONOX:	CONO PDC,CONT		;CONO TO SET CONTINUE
DATAIX:	DATAI	PDC,0		;DATAI INSTRUCTION
DATAOX:	DATAO PDC,0		;DATAO INSTRUCTION

CONOP:	POINT 7,CONOX,9		;POINTER TO CONO DEVICE CODE
DATAIP:	POINT 7,DATAIX,9	;POINTER TO DATAI DEVICE CODE
DATAOP:	POINT 7,DATAOX,9	;POINTER TO DATAO DEVICE CODE

MEM8P:	POINT 12,MEM8		;POINTER TO PDP-8A CORE IMAGE
RECDS:	BLOCK	1		;RECORDS TO READ FROM TAPE
STRTAD:	BOOTM##			;BOOTM START ADDRESS
LOCATE:	MEM8			;START LOADING HERE


	PHASE 77		;CODE EXECUTED AT 100 STARTS HERE

POINTR:	XWD	<READIN-<LOCATE-CONIX+2>>,CONIX;BLT POINTER
READIN:	MOVE	POINTR		;GET POINTER
	BLT	ENDIN		;TRANSFER PROGRAM
	JRST	WHICH		;GO TO PROGRAM

	DEPHASE
;DETERMINE WHICH DX10 PERFORMED THE READ-IN

WHICH:	MOVE	1,CONIX		;GET CONI INSTRUCTION
	XCT	1		;EXECUTE CONI
	TLNE	RUNIND		;SKIP IF NOT RUNNING
	JRST	SETCOD		;FOUND DX10
	TLC	1,(1B9)		;CHANGE CODE TO 224
	JRST	WHICH+1		;CHECK THIS CODE

;STORE TABLE OF I/O INSTRUCTION WITH SELECTED DEVICE CODE

SETCOD:	MOVEM	1,CONIX		;STORE CONI
	LSH	1,-^D26		;POSITION DEVICE CODE
	DPB	1,CONOP		;PUT IT IN CONO INSTRUCTION
	DPB	1,DATAIP	;PUT IT IN DATAI INSTRUCTION
	DPB	1,DATAOP	;PUT IT IN DATAO INSTRUCTION

;READ THE OTHER RECORED INTO CORE AND TRANSFER THEM
;TO MEMORY. THESE RECORDS ARE BOOTM.

READRC:	XCT	CONOX		;CONTINUE THE READ
	XCT	CONIX		;EXECUTE CONI
	JUMPG	.-1		;WAIT TILL DX10 LOAD I/O BUS
	XCT	DATAIX		;CLEAR I/O BUS
	XCT	DATAIX		;BOTH WORDS
	HRLZI	1,20		;SET UP BLT POINTER
	HRR	1,LOCATE	;START AT ADR IN LOCATE
	MOVEI	2,200-20	;TRANSFER FULL RECORD LESS THE AC'S
	ADDB	2,LOCATE	;UPDATE LOCATE FOR NEXT RECORD
	BLT	1,-1(2)		;TRANSFER THE DATA
	SOSLE	RECDS		;REPEAT UNTIL ALL RECORDS READ
	JRST	READRC
;GET UNIT NUMBER OF DEVICE FROM WHICH FILE WAS READ

	MOVE	[RSEL,,MPADR]	;SELECT 8A'S CPMA ON IBUS
	TLO	DXCLR		;RESET THE DX10 ALSO
	XCT	DATAOX
	MOVEI	UNITNM		;GET ADR OF UNIT #
	XCT	DATAOX		;LOAD ADDRESS
	MOVE	[RSEL,,MPCTL]	;SELECT 8A CONTROL REGISTER
	XCT	DATAOX
	MOVEI	ENEXM		;CAUSE A MEMORY READ
	XCT	DATAOX
	XCT	DATAIX		;GET THE DATA
	ANDI	17		;CLEAR OTHER BITS
	HRLI	3		;CTL TYPE OF DX10
	MOVEM	UNIT##		;SAVE UNIT #

;LOAD THE MICRO-CODE INTO THE 8A MEMORY

LOADMC:	MOVE	[RSEL,,MPADR]	;SELECT CPMA ON IBUS
	XCT	DATAOX
	MOVEI	0		;LOAD ADR 0
	XCT	DATAOX
	MOVE	[RSEL,,MPCTL]	;SELECT 8A CONTROL REGISTER
	XCT	DATAOX
	MOVE	1,MEM8P		;BYTE POINTER TO 8 MEMORY IMAGE
	MOVEI	2,10000		;COUNT OF DATA WORDS
LOAD8A:	ILDB	1		;GET A DATA WORD
	TRO	ENDEP		;SET ENABLE DEPOSIT BIT
	XCT	DATAOX		;WRITE WORD INTO MEMORY
	SOJG	2,LOAD8A	;WRITE ALL WORDS
	JRST	@STRTAD		;START BOOTM

NXMW:	0			;NXM BIT FOR CONI INSTR

;1080 STARTING POINT

START:	CONO	APR,IOCLR	;IO RESET
	CONO	PI,PICLR
	CONO	PAG,0
	CONO	DTE,20
	MOVSI	DXCLR		;RESET DX10
	XCT	DATAOX
	SETZM	UNIT##		;DONT KNOW
	JRST	LOADMC		;NOW LOAD DX AND START BOOTM

ENDIN:	0			;END OF READIN RECORD
	LOC	440
;THIS CODE WILL BE EXECUTED ONLY IN USER MODE TO
;CREATE THE READ-IN FILE FOR TU70 READ-IN.

;READ THE MICRO-CODE FILE DXMPA.BIN AND TRANSLATE INTO
;PDP-8A CORE IMAGE

BEGIN:	RESET			;INITIALIZE I/O
	MOVE	P,[-20,,PLIST]	;SET UP PUSH LIST
	MOVEI	BOOTM##		;START ADDRS OF BOOTM
	CAIG	MEM8E		;CHECK OVERLAP
	JRST	BADLOD		;INFORM USER
	MOVE	FILL		;GET WORD OF HALT INSTRUCTIONS
	MOVEM	MEM8		;PUT IN 8 MEMORY IMAGE
	MOVSI	MEM8		;BUILD BLT POINTER
	HRRI	MEM8+1		;TO FILL ALL OF 8 MEMORY IMAGE
	BLT	MEM8E		;WITH HALT INSTRUCTIONS
	SETOM	A8FLG		;INIT FLAG
	MOVSI	'A8 '
	HLLZM	FNAME+1	;AND EXTENSION
	INIT	10		;INITIALIZE DISK FOR IMAGE MODE
	SIXBIT	/SYS/		;CALL DEVICE SYS
	EXP	BUF		;SPECIFY INPUT BUFFER
	JRST	INTERI		;INIT ERROR
RELOOK:	LOOKUP	FNAME		;LOOKUP MICRO-CODE BINARY FILE
	JRST	[HLRZ FNAME+1
		CAIE 'A8 '
		JRST NOMICR
		SETZM A8FLG
		MOVSI 'BIN'
		HLLZM FNAME+1
		JRST RELOOK]
	INBUF			;SET UP BUFFER
	SKIPE	A8FLG
	JRST	MCA8		;LOAD .A8 FILE
	PUSHJ	P,CHRIN		;READ A CHARACTER FROM PAPER TAPE
	JUMPE	.-1		;IGNORE IT IF ZERO
	CAIE	200		;FIND LEADER
	JRST	NOLEAD		;NO LEADER?
	PUSHJ	P,WRDIN		;GET ALL LEADER CHARACTERS
	CAIN	1,20000		;STILL LEADER?
	JRST	.-2		;YES, KEEP IT COMING
	TRZN	1,10000		;FIRST WORD, BETTER BE ADDRESS
	JRST	BADCHR
	SETZM	CHECK		;CLEAR CHECKSUM
MCADR:	ADDM	4,CHECK		;UPDATE CHECKSUM
	IDIVI	1,3		;GET ADDRESS OF STORAGE WORD
	ADDI	1,MEM8
	MOVEM	1,PNTR		;STORE AS POINTER ADR
	IMULI	2,^D12		;COMPUTE BYTE POSITION
	MOVEI	1,^D36		;FROM REMAINDER
	SUB	1,2		;IN FIRST
	LSH	1,^D12		;POSITION NUMBER
	ORI	1,^D12_6	;BYTE SIZE
	HRLM	1,PNTR		;COMPLETE POINTER
	PUSHJ	P,WRDIN		;GET DATA WORD
MCDATA:	TRCE	1,10000		;DATA OR ADDRESS?
	JRST	MCADR		;ADDRESS - GO LOAD IT
	MOVEM	1,NUMSAV	;SAVE THIS DATA ENTRY
	MOVEM	4,DCSAV		;SAVE ASSOCIATED CHECKSUM ENTRY
	PUSHJ	P,WRDIN		;READ NEXT WORD FROM TAPE
	TRNE	1,20000		;SKIP IF NEXT ENTRY IS NOT TRAILER
	JRST	MCSUM		;LAST ENTRY WAS CHECKSUM
MCCONT:	MOVE	2,DCSAV		;GET SAVED CHECKSUM ENTRY
	ADDM	2,CHECK		;UPDATE CHECKSUM
	MOVE	2,NUMSAV	;GET DATA ENTRY
	IDPB	2,PNTR		;STORE DATA IN TABLE
	JRST	MCDATA		;GET NEXT WORD FROM TAPE
;NUMSAV CONTAINS CHECKSUM FROM TAPE
;CHECK CONTAINS COMPUTED CHECKSUM

MCSUM:	MOVE	4,CHECK		;GET COMPUTED CHECKSUM
	ANDI	4,7777		;STRIP TO 12 BITS
	MOVE	1,NUMSAV 	;GET CHECKSUM FROM TAPE
	ANDI	1,7777		;STRIP TO 12 BITS
	CAME	4,1		;CHECK IF CHECKSUMS MATCH
	JRST	BADCHK		;CHECKSUM ERROR
WRTIT:	RESET			;INITIALIZE I/O
	MOVEI	4756		;MAJIK BITS
	DPB	[POINT 12,MEM8+<17/3>,11]
	JRST	OTBUF		;GO TO WRITE OUTPUT FILE

;READ FROM THE FILE
;READ A CHARACTER, CHECK FOR ERROR

CHRIN:	SOSGE	BUFC		;DECREMENT THE COUNT
	JRST	GETBF		;GET ANOTHER BUFFER
	ILDB	BUFP		;GET DATA
	ADDM	4		;COMPUTE CHECKSUM FOR THIS ENTRY
	POPJ	P,		;RETURN

GETBF:	IN			;GET A BUFFER
	JRST	CHRIN		;NO ERROR, JUMP BACK
	OUTSTR	.+2
	EXIT
	ASCIZ	/
INPUT ERROR FROM DXMPA.BIN/

;READ A PAIR OR CHARACTERS THAT FORM AN ADDRESS OR DATA WORD

WRDIN:	SETZ	4,		;CLEAR CHECKSUM ENTRY STORAGE
	PUSHJ	P,CHRIN		;GET A CHARACTER
	LSH	6		;SHIFT DATA
	MOVEM	1
	TRNE	20000		;SKIP IF CHANNEL 8 IS ZERO
	JRST	CH8
	PUSHJ	P,CHRIN		;GET SECOND CHARACTER
	TRNE	300		;SKIP IF CHANNELS 7 & 8 ARE ZERO
	JRST	BADCHR		;BAD CHARACTER
	ORM	1		;MERGE THE TWO CHARACTERS
	POPJ	P,

CH8:	TRNE	7700		;SKIP IF CHANNELS 1 TO 6 ARE ZERO
	JRST	BADCHR		;BAD CHARACTER
	TRNN	10000		;SKIP IF CHANNEL 7 IS NOT ZERO
	POPJ	P,		;LEADER OR TRAILER
	JRST	WRDIN		;FIELD SET 0, IGNORE IT

	DEFINE ERROR (MSG)<
	 JRST	[OUTSTR [ASCIZ \MSG\]
		 EXIT]
>

;AC DEFS

T1=1
T2=2
P1=5
P2=6
WC=10

;ROUTINE TO LOAD A8 FILES

MCA8:	SETZM	CHECK		;CLEAR THIS
	SETSTS	0		;CHANGE TO MODE 0
	MOVSI	(POINT 7,,)
	HLLM	BUFP
LDA8WC:	PUSHJ	P,WCREAD	;GET WORD COUNT IN WC
	JUMPE	P1,WRTIT	;DONE IF ZERO
	MOVE	WC,P1
	PUSHJ	P,WDREAD	;GET DATA WORD
	PUSH	P,P2
	IDIVI	P1,3
	ADDI	P1,MEM8
	MOVEM	P1,PNTR
	IMULI	P2,^D12
	MOVEI	P1,^D36
	SUB	P1,P2
	LSH	P1,^D12
	IORI	P1,^D12_6
	HRLM	P1,PNTR		;FORM BYTE PNTR
	POP	P,P2		;RESTORE
LDA8D:	PUSHJ	P,WDREAD	;GET WORD
	IDPB	P1,PNTR		;STASH WORD
	SOJG	WC,LDA8D	;LOOP THROUGH ALL WORDS
	PUSHJ	P,CHREAD	;READ AND VERIFY CHECKSUM
	JRST	LDA8WC		;GET NEXT RECORD

;ROUTINE TO READ THE CHECKSUM FROM FILE AND THE CRLF
;CHECK THAT CHECKSUM IS CORRECT

CHREAD:	PUSHJ	P,GET2W		;GET A WORD
	CAIE	P2,15		;TERMINATOR BETTER BE CR
	ERROR	<End-of-line missing>
	ADD	P1,CHECK	;ADD COMPUTED CHECKSUM
	ANDI	P1,7777		;CHECKIT
	JUMPN	P1,[ERROR <Checksums do not agree>]
	PUSHJ	P,GETC		;GET LF
	CAIE	P1,12		;DOUBLE CHECK CRLF
	ERROR	<End-of-line missing>
	POPJ	P,		;RETURN
;PDP-8 A8 UTILITIES

GET2W:	PUSH	P,[0]		;INIT ANSWER
	PUSHJ	P,GETA8		;GET FIRST CHAR
	 JRST	GET2X		;EXIT IF NOT DIGIT
	MOVEM	P1,0(P)		;STASH ON PDL
	PUSHJ	P,GETA8		;GET NEXT
	 JRST	GET2X		;MUST BE SINGLE DIGIT
	EXCH	P1,0(P)		;NEW LOW ORDER BYTE
	LSH	P1,6		;MAKE HIGH ORDER BYTE
	IORM	P1,0(P)		;COMBINE
	PUSHJ	P,GETC		;GET NEXT FILE CHAR
GET2X:	MOVE	P2,P1		;RETURN BREAK CHAR IN P2
	POP	P,P1		;RESTORE WORD TO P1
	POPJ	P,		;EXIT

;GET NEXT FILE CHAR AND RETURN LOW 6 BITS

GETA8:	PUSHJ	P,GETC		;GET CHAR FROM FILE
	CAIE	P1,","		;CHECK TERMINATOR
	CAIN	P1,15
	POPJ	P,		;NON SKIP RETURN
	ANDI	P1,77		;TRIM TO LOW ORDER 6-BIT
	AOS	0(P)
	POPJ	P,

;GET WORD COUNT FFROM FILE

WCREAD:	PUSHJ	P,GETC		;GET CHARACTER
	CAIE	P1,"8"		;CHECK VALIDITY
	JRST	[PUSHJ P,SKPCOM	;SKIP COMMENT
		 JRST WCREAD]
	PUSHJ	P,GETC		;GET NEXT CHARACERR
	CAIE	P1," "		;BETTER BE A SPACE
	ERROR	<File not in correct A8 format>
	SETZM	CHECK		;INIT CHECKSUM
				;NOW GET DATA WORD
WDREAD:	PUSHJ	P,GET2W		;GET 12 BIT NUMBER
	ADDM	P1,CHECK	;ADD TO CHECKSUM
	CAIE	P2,","		;GRNTEE COMMA TERMINATOR
	ERROR	<File not in correct A8 format>
	POPJ	P,		;RETURN (ANSWER IN P1)
;ROUTINE TO SKIP COMMENTS

SKPCOM:	CAIE	P1,";"		;VALID COMMENT CHAR?
	ERROR	<File not in A8 format>
SKPCM1:	PUSHJ	P,GETC		;GET CHAR TILL  EOL
	CAIE	P1,12		;LINE FEED?
	JRST	SKPCM1		;NO - LOOP
	POPJ	P,		;YES - RETURN

;ROUTINE TO GET NEXT CHAR FROM FILE

GETC:	SOSG	BUFC
	PUSHJ	P,GETBYI
	ILDB	P1,BUFP
	POPJ	P,

GETBYI:	IN
	 POPJ P,
	STATZ	740000
	 ERROR	<INPUT FILE READ ERROR>
	STATZ	20000
	 ERROR <UNEXPECTED EOF>
	POPJ P,
NOLEAD:	OUTSTR	.+2
	EXIT
	ASCIZ /
?FIRST NON-ZERO CHARACTER READ FROM PAPER TAPE WAS NOT THE
EXPECTED LEADER CODE.
/

BADCHR:	OUTSTR	.+2
	EXIT
	ASCIZ /
?UNEXPECTED CHARACTER READ FROM PAPER TAPE.
/

BADCHK:	OUTSTR	.+2
	EXIT
	ASCIZ /
?CHECKSUMS DO NOT AGREE.
/


BADLOD:	OUTSTR	.+2
	EXIT
	ASCIZ	/
?BOOTM OVERLAPS MEM8 - SEE BOOTM LISTING.
/
;WRITE THE OUTPUT FILE BOOTM.RDI

OTBUF:	INIT	10		;INIT DISK FOR IMAGE MODE
	SIXBIT	/OUT/		;CALL DEVICE OUT
	XWD	BUF,0		;SPECIFY OUTPUT BUFFER
	  JRST	[OUTSTR INTERO
		 EXIT 1,
		 JRST OTBUF]
	ENTER	ONAME		;ENTER READ-IN FILE
	  JRST	ENTRER		;ENTER ERROR
	OUTPUT			;SET UP OUTPUT BUFFER
	MOVNI	1,READIN-<LOCATE-CONIX+2>;ZERO WORDS
	MOVEI	2,CONIX		;ADR OF FIRST WORD
	MOVEI	3,EBTM##	;END OF BOOTM
	SUBI	3,MEM8		;LENGTH OF STUFF
	IDIVI	3,<200-20>
	AOS	3		;PLUS ONE
	MOVEM	3,RECDS		;SAVE IN CORE IMAGE
	ADDI	3,1		;PLUS INITIAL RECORD
OUTREC:	ADDM	1,BUFC		;DECREMENT COUNTER BY C(AC1)
	CAMN	3,RECDS		;CHECK IF FIRST RECORD
	MOVEI	2,MEM8		;AFTER INITIAL, SET IN START ADDRESS
	SETZ			;CLEAR AC0
	IDPB	BUFP		;STORE ZERO WORD
	AOJL	1,.-1		;COUNT THE WORDS
OUTW1:	MOVE	(2)		;GET WORD
	IDPB	BUFP		;STORE WORD IN BUFFER
	ADDI	2,1		;INCREMENT ADDRESS
	SOSLE	BUFC		;DECREMENT COUNTER
	JRST	OUTW1		;WRITE ALL WORDS
	OUT			;WRITE THE BUFFER
	  JRST	OUTW2		;NO ERRORS
	OUTSTR	OUTERR
	EXIT

OUTW2:	MOVNI	1,20		;20 ZERO WORDS IN EACH BUFFER
	SOJG	3,OUTREC	;COUNT RECORDS
	CLOSE
	MOVEI	START		;SET UP NEW START ADDRS
	HRRM	.JBSA##
	RESET			;RESET .JBFF
	OUTSTR	[ASCIZ \TYPE ".OSAVE BOOTM" FOR 1080/TU70 BOOTSTRAP.
\]
	EXIT
FILL:	BYTE (12) 7402, 7402, 7402	;HALT INSTRUCTIONS
BUF:	0
BUFP:	0				;BUFFER BYTE POINTER
BUFC:	0				;BUFFER COUNTER
FNAME:	SIXBIT	/DXMPA/			;MICRO-CODE FILE NAME
	SIXBIT	/A8/			;A8ARY FILE
	0
	0
PNTR:	0				;POINTER TO 8A CORE IMAGE
NUMSAV:	0
A8FLG:	0
DCSAV:	0
CHECK:	0				;CHECK SUM
ONAME:	SIXBIT	/BOOTM/			;OUTPUT FILE NAME
	SIXBIT	/RDI/			;RDI EXTENSION
	0
	0

INTERI:	OUTSTR	.+2
	EXIT
	ASCIZ	/
?INIT ERROR FOR INPUT FROM DXMPA/

NOMICR:	OUTSTR	.+2
	EXIT
	ASCIZ	/
?LOOKUP ERROR FOR INPUT FILE DXMPA/

INTERO:	ASCIZ	/
%ASSIGN LOGICAL DEVICE "OUT" AND TYPE CONTINUE.
/
ENTRER:	OUTSTR	.+2
	EXIT
	ASCIZ	/
?ENTER ERROR FOR BOOTM.RDI/

OUTERR:	ASCIZ	/
?OUTPUT ERROR FOR BOOTM.RDI/

	LIT
	VAR

MEM8:	BLOCK	10000/3			;PDP-8A MEMORY CORE IMAGE
MEM8E:	0

	END	BEGIN