Difference between revisions of "PDP-11 Bootstrap Loader"
(Mention LSI-11 ODT) |
(→Program: add actual code) |
||
Line 5: | Line 5: | ||
The original bootstrap loader is [[self-modifying code]], since this allows a very short program. The program is not directly self-modifying; rather, the nature of its input is such that it modifies the bootstrap loader as it is read in. (Most bootstrap loader input files eventually restore the bootstrap loader to its original condition, allowing it to be re-used.) | The original bootstrap loader is [[self-modifying code]], since this allows a very short program. The program is not directly self-modifying; rather, the nature of its input is such that it modifies the bootstrap loader as it is read in. (Most bootstrap loader input files eventually restore the bootstrap loader to its original condition, allowing it to be re-used.) | ||
− | == | + | ==Program== |
The bootstrap loader contains two locations which are modified by reading the input: the first is a [[pointer]] to the [[buffer]] in which to place data being read in; the second is a [[branch]] back to the beginning of the data input [[loop]]. | The bootstrap loader contains two locations which are modified by reading the input: the first is a [[pointer]] to the [[buffer]] in which to place data being read in; the second is a [[branch]] back to the beginning of the data input [[loop]]. | ||
Line 12: | Line 12: | ||
The buffer pointer is then modified to point it immediately before the bootrap loader in memory, so at the end of the load the newly loaded code then progressively overlays the first several [[instruction]]s of the bootstrap loader itself, finally patching the buffer pointer to point at the branch instruction, which is then modified to jump to the newly loaded code. | The buffer pointer is then modified to point it immediately before the bootrap loader in memory, so at the end of the load the newly loaded code then progressively overlays the first several [[instruction]]s of the bootstrap loader itself, finally patching the buffer pointer to point at the branch instruction, which is then modified to jump to the newly loaded code. | ||
+ | |||
+ | ===Code=== | ||
+ | |||
+ | This is the actual bootstrap program: | ||
+ | LOAD = 0x400 ; Buffer address | ||
+ | 0x744 016701 BEGIN: MOV DEVICE, R1 ; Get Device CSR | ||
+ | 0x746 000026 | ||
+ | 0x750 012702 LOOP: MOV (PC)+, R2 ; Get buffer offset | ||
+ | 0x752 000352 OFFSET: 0352 | ||
+ | 0x754 005211 INC @R1 ; Turn on reader | ||
+ | 0x756 105711 READY: TSTB @R1 ; Done? | ||
+ | 0x760 100376 BPL READY | ||
+ | 0x762 116162 MOVB 2(R1), LOAD(R2) ; Transfer | ||
+ | 0x764 000002 | ||
+ | 0x766 0x4000 | ||
+ | 0x770 005267 INC OFFSET ; Bump buffer offset | ||
+ | 0x772 177756 | ||
+ | 0x774 000765 BR LOOP | ||
+ | 0x776 yyyyyy DEVICE: yyyyyy ; Input device CSR address | ||
==Bootstrap Loader format== | ==Bootstrap Loader format== |
Revision as of 02:12, 20 August 2019
The PDP-11 Bootstrap Loader is a short program designed to be loaded into the main memory on a PDP-11 via the front panel; it is then run to load an initial program into the machine. I.e it is a way of bootstrapping a totally empty machine, one with no ROM.
It is designed to be absolutely as short as possible (since it is manually toggled in via the switch register), and therefore has limitations, including how long a program can be loaded using it, and where in memory that program can be placed. The usual program to load with it is the PDP-11 Absolute Loader, which relaxes both of those limitations.
The original bootstrap loader is self-modifying code, since this allows a very short program. The program is not directly self-modifying; rather, the nature of its input is such that it modifies the bootstrap loader as it is read in. (Most bootstrap loader input files eventually restore the bootstrap loader to its original condition, allowing it to be re-used.)
Program
The bootstrap loader contains two locations which are modified by reading the input: the first is a pointer to the buffer in which to place data being read in; the second is a branch back to the beginning of the data input loop.
The program starts with the pointer set to itself, so the blank leader at the start of the data for the bootstrap loader (originally contained on paper tapes) starts with a special leader code which causes this to be left un-changed.
The buffer pointer is then modified to point it immediately before the bootrap loader in memory, so at the end of the load the newly loaded code then progressively overlays the first several instructions of the bootstrap loader itself, finally patching the buffer pointer to point at the branch instruction, which is then modified to jump to the newly loaded code.
Code
This is the actual bootstrap program:
LOAD = 0x400 ; Buffer address 0x744 016701 BEGIN: MOV DEVICE, R1 ; Get Device CSR 0x746 000026 0x750 012702 LOOP: MOV (PC)+, R2 ; Get buffer offset 0x752 000352 OFFSET: 0352 0x754 005211 INC @R1 ; Turn on reader 0x756 105711 READY: TSTB @R1 ; Done? 0x760 100376 BPL READY 0x762 116162 MOVB 2(R1), LOAD(R2) ; Transfer 0x764 000002 0x766 0x4000 0x770 005267 INC OFFSET ; Bump buffer offset 0x772 177756 0x774 000765 BR LOOP 0x776 yyyyyy DEVICE: yyyyyy ; Input device CSR address
Bootstrap Loader format
The format of boostrap loader input is as follows:
- Leader (all bytes 0351)
- Load offset (1 byte)
- Program to be loaded (up to 0344 bytes)
- Copy of boostrap loader (first 7 bytes)
- Branch offset (1 byte)
Others
Several PDP-11 bootstrap ROMs, e.g. the BM792-YA, BM792-YK and BM873 ROM are prepared to read programs in bootstrap loader format. The code in them is obviously not self-modifying, but reacts to the bootstrap loader input format to produce the same effects.
ODT in the LSI-11 CPUs also has a command to load programs in bootstrap loader format.
Further reading
The Bootstrap Loader is documented in some detail in the "paper tape software programming handbook" (DEC-11-GGPB-D), pp. 6-1 to 6-8.
v • d • e PDP-11 Computers and Peripherals |
---|
UNIBUS PDP-11s - PDP-11/20 • PDP-11/15 • PDP-11/35 • PDP-11/40 • PDP-11/45 • PDP-11/50 • PDP-11/55 • PDP-11/70 PDP-11/05 • PDP-11/10 • PDP-11/04 • PDP-11/34 • PDP-11/60 • PDP-11/44 • PDP-11/24 • PDP-11/84 • PDP-11/94 QBUS PDP-11s - PDP-11/03 • PDP-11/23 • PDP-11/23+ • MicroPDP-11/73 • MicroPDP-11/53 • MicroPDP-11/83 • MicroPDP-11/93 QBUS CPUs: LSI-11 • LSI-11/2 • KDF11-A • KDF11-B • KDJ11-A • KDJ11-B • KDJ11-D • KDJ11-E Buses: UNIBUS • UNIBUS map • SPC • MUD • EUB • QBUS • CD interconnect • PMI Also: PDP-11 architecture • PDP-11 Extended Instruction Set • FP11 floating point • PDP-11 Memory Management |
UNIBUS CPUs: KA11 • KC11 • KB11-A • KB11-B • KB11-C • KB11-D • KD11-A • KD11-B • KD11-D • KD11-E • KD11-EA • KD11-K • KD11-Z • KDF11-U
Co-processors: FP11-A • FP11-B • FP11-C • FP11-E • FP11-F • KE44-A • FPF11 Chips: LSI-11 • KEV11-A • KEV11-B • KEV11-C • F-11 • KEF11-A • KTF11-A • T-11 • J-11 • FPJ11 CPU options: KE11-E • KE11-F • KJ11-A • KT11-C • KT11-D • KK11-A • KK11-B • KT24 • KTJ11-B Rare CPU options: KS11 Memory Protection and Relocation option • KT11-B Paging Option • KUV11 Writeable Control Store Front panels: KY11-A • KY11-D • KY11-J • KY11-LA • KY11-LB • KY11-P More on buses: UNIBUS and QBUS termination • Bus Arbitration on the Unibus and QBUS • CTI BUS PDT-11s - PDT-11/110 • PDT-11/130 • PDT-11/150 CTI PDP-11s - PRO-325 • PRO-350 • PRO-380 Other: FIS floating point • PDP-11 Commercial Instruction Set • PDP-11 stacks • PDP-11 family differences |