61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
-
+
|
# Level 2: Fields
To get beyond the page level, you have to use indirect memory accesses. That is, instead of using the 7-bit address to directly refer to the core memory address you're interested in, you store a 12-bit address in one of the core memory locations within the current page and refer indirectly through that location.
For example, let's say you're currently executing in page 0 and need to jump to code that resides at address 234₈, which is in page 1.⁵ You could store the 12-bit value 0234₈ at address 0177₈, then do an indirect jump through page address 177₈.
PDP-8 programmers normally don't have to think too much about such things, even at the assembly language level, because the assembler automatically generates "links" when needed to cross field boundaries like this. Thus, the assembly code for what we just described is written as a single assembly language instruction:
PDP-8 programmers may opt to ignore such things, even at the assembly language level, because the assembler automatically generates "links" when needed to cross field boundaries like this. Thus, the assembly code for what we just described is written as a single assembly language instruction:
JMP 0234
The thing is, this instruction takes two words of core memory: one for the indirect `JMP` instruction, and one for the link.
Since all those links chew into the 4 to 32 kiW core limit of any given PDP-8 machine, one of the common games PDP-8 masters play is reusing *instruction and data* words for target address values and operands to save a word or two.
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
+
+
|
By this point, you'll be wondering how a PDP-8 can be expanded beyond its stock 4 kiW of core to its maximum of 32 kiW, and why is that the limit anyway?
The answer to both questions is that the PDP-8 has a pair of 3-bit registers for setting the instruction field and the data field. 2³ = 8, and 8 fields × 4 kiW = 32 kiW.
Thus, when a program is currently executing code in field 0 but wants to address data in field 1, it sets the data field (DF) register to 1 with a `CDF` instruction, and now all data fetches pull data from field 1. Likewise, to jump to an address in field 1 from field 0, it sets the instruction field (IF) register to 1 with a `CIF` instruction and jumps to an address in that field.⁶
This is also why your PDP-8/I has two sets of 3 switches and associated indicator lights on its front panel labeled "Data Field" and "Inst Field." Together, this gives you a combined 15-bit extended address. A jump or fetch between fields thus takes two instructions, rather than the indirect addressing for in-field operations or the direct addressing of in-page operations. This gives a hierarchy of expense: a diligent PDP-8 programmer tries to keep data and instructions close together and logically bunched to avoid needless page and field transitions.
Keep in mind that this is all a simplified overview, meant more for explaining how addressing works to a PDP-8 newbie than as a guide to memory management for a PDP-8 programmer. There are still further complications here, such as how indirect addressing interacts with links and the IF and DF registers.
# Conclusion
I hope you've found this overview interesting and enlightening. If you would like more on this topic, the various versions of DEC's Small Computer Handbook for the PDP-8 cover this in more detail and take you beyond it, into actual programming of a PDP-8:
* The [1967-1968 edition](http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/pdp8/handbooks/SmallComputerHandbook_67-68.pdf) was first published before the PDP-8/I was formally released, so its first drafts must have been written with reference to a pre-production unit. (PDF, 21 MB.)
|