Beautiful Code: PDP-11 Bootstrap Loaders

PC Paper Tape or Teletype

The paper tape bootstrap is a two stage process. First the bootstrap loader must be toggled in at the appropriate location (set table for xx). A special bootstrap tape (Absolute Loader) must be in the reader with the leader (punch 351) in the read frame. The program is then started at location xx7744. The program is self-modifying, so if you read the wrong tape, or position it incorrectly, it will corrupt itself. The program will halt when the last frame of the loader is read. Put in the tape you want loaded (on blank leader) and press continue or start at xx7500

Loc.	Cont.	Label	Instruction	Comment
	================================================
	xx7744	016701		mov device,r1	get csr address
	xx7746	000026
	xx7750	012702	loop:	mov #offset,r2	get offset
	xx7752	000352  offset:
	xx7754	005211		inc (r1)	read frame
	xx7756	105711	wait:	tstb (r1)	wait for ready
	xx7760	100376		bpl wait
	xx7762	116162		movb (r1),bnk(r2) store data
	xx7764	000002
	xx7766	xx7400
	xx7770	005267		inc offset	bump address
	xx7772	177756
	xx7774	000765		br loop
	xx7776	177550	device:			HSR csr, or 177560 for teletype

Where

	xx		Memory Size
	===========================
	017744		4k
	037744		8K
	057744		12K
	077744		16k
	117744		20k
	137744  	24k
	157744		28k

 

All these bootstraps (except paper tape) are designed to read in 512 bytes into locations 0-776, and then start program execution at 0. If you are having system problems, then it pays to have the bootstrap halt, so that you can check for error conditions in device registers.

The first serious program I studied in 1973, a bootstrap loader for a PDP-11 Clone called TDC-16. I am showing this because I could not locate the TDC16 version.

For a long time we were trying hard to shave off one instruction. I think some one did it but it was a hack.

PDP-11 had a CSR – Command Status Register and a data register. You set the command bits in the CSR and checked the status bit (in CSR) and read the data from the data register.

In the case of DMA devices, you just set the address for data transfer and initiate your command (you need not move the data manually since the direct memory access controller would transfer it to the set of locations).

Why is this beautiful? Because I fell in love with programming when I read this little program that did so much and the simple elegance of PDP-11 instruction set.

I remained an assembly language programmer from 1972-1984 even though around 79 we started doing Basic-Plus, Cobol and an open source C in 1983-84.

From PDP-11 Bootstrap Loaders

Advertisements

Please Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s