PiDP-8/I Software

Changes To PDP-8 Memory Addressing
Log In

Changes to "PDP-8 Memory Addressing" between 2017-04-01 15:41:03 and 2017-04-01 15:48:39

1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
1
2
3
4

5
6
7
8
9
10
11
12
13
14
15

16


17
18
19
20
21
22
23




-
+










-
+
-
-







# Notation

We must first settle on a bit of notation.

PDP-8 addresses are traditionally written as [octal](https://en.wikipedia.org/wiki/Octal) numbers. That means when we write 123 in this context, we aren't saying "one hundred and twenty-three," we're talking about the quantity 1 × 8² + 2 × 8¹ + 3 × 8⁰ = 83 in ordinary decimal notation. When I write an octal number below, I will write it as 123₈ to make this clear, meaning "base 8," also called "octal." If you see a multi-digit number without the base-8 subscript, it's a decimal number.
PDP-8 addresses are traditionally written as [octal](https://en.wikipedia.org/wiki/Octal) numbers. That means when we write 123 in this context, we aren't saying "one hundred and twenty-three," we're talking about the quantity (1 × 8²) + (2 × 8¹) + (3 × 8⁰) = 83 in ordinary decimal notation. When I write an octal number below, I will write it as 123₈ to make this clear, meaning "base 8," also called "octal." If you see a multi-digit number without the base-8 subscript, it's a decimal number.

We use octal when talking about PDP-8 addresses and memory values because the [PDP-8's major registers](http://homepage.cs.uiowa.edu/~jones/pdp8/man/registers.html) are all multiples of 3 bits in size. (Well, there is also one program-accessible single-bit register, but we won't be talking more about that here.) Since an octal digit encodes as 3 [bits](https://en.wikipedia.org/wiki/Bit), that makes octal the most convenient way to write PDP-8 addresses. The other more common ways to write computer numbers are inconvenient: [binary](https://en.wikipedia.org/wiki/Binary_number) takes too many digits even with the tiny PDP-8 memories, and [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) numbers don't divide evenly by 3-bit chunks until you get to 24-bit addresses, which is beyond the PDP-8's limits.

Another bit of notation we need to establish here is that when we use **k** as a unit modifier, it is the old-style 1024 multiplier, not the more correct [SI](https://en.wikipedia.org/wiki/International_System_of_Units) 1000 multiplier. Thus, 6 kB is six [kibibytes](https://en.wikipedia.org/wiki/Kibibyte): 6144 bytes, not 6000 bytes.

On that note, when I use the unit kW here, I mean 1024 words of PDP-8 memory, not "killowatts." Although a fairly small PDP-8/I setup dissipates about one killowatt of power, this article is purely concerned with PDP-8 memory, so I think we can safely repurpose this unit notation here. Original PDP-8 documentation would often just use "k" alone, and you were expected to understand that it meant kWords, not kBytes.


# Bytes

The base PDP-8 memory configuration is 4 kWords of core. We speak of PDP-8 memory in terms of words, rather than bytes, because the PDP-8 predates the modern notion of an 8-bit byte.¹
The base PDP-8 memory configuration is 4 kWords of core. We speak of PDP-8 memory in terms of words, rather than bytes, because the PDP-8 predates the modern notion of an 8-bit byte. Back in the PDP-8's day, a "byte" was a more slippery concept. You could speak of 6-bit bytes, 7-bit bytes, 9-bit bytes... It all depended on what your particular task needed
Back in the PDP-8's day, a "byte" was a more slippery concept. You could speak of 6-bit bytes, 7-bit bytes, 9-bit bytes... It all depended on what your particular task needed.

Since the PDP-8 uses a 12-bit native word size, 6-bit "bytes" are quite common in the PDP-8 world, often used for some kind of "packed [ASCII](https://en.wikipedia.org/wiki/ASCII)" representation. One common scheme gets rid of most of the 32 control characters defined in 7-bit ASCII, plus all of the lowercase letters, and a whole bunch of the punctuation in order to pack text two characters to a word. There are actually a few different 6-bit packed ASCII representations for the PDP-8, so you have to know which scheme you're looking at before you can turn the data back into 7-bit ASCII.

The PDP-8 was being designed at about the same time as the first versions of ASCII,² as well as around the same time as the first really popular ASCII terminal, the Teletype Model 33.³ Thus, the PDP-8 was one of the first popular ASCII-aware machines in the world.

When dealing with such terminals and the included paper tape reader, PDP-8s generally deal in either 7-bit or 8-bit bytes. When we're talking about 8-bit bytes, we aren't talking about the "[high-ASCII](https://en.wikipedia.org/wiki/Extended_ASCII)" stuff that infested the PC world in the late 1970s and 1980s before [Unicode](https://en.wikipedia.org/wiki/Unicode) was invented. When a PDP-8 reads in plain ASCII text from a terminal as 8-bit bytes, the eighth bit is a [parity bit](https://en.wikipedia.org/wiki/Parity_bit), meant to detect read errors only.

76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
108
109







-
+



















-
+








The `I` modifies the `JMP` instruction, telling the PDP-8 to load the value at the memory location referred to by the `OS8ENT` label, load up the value it finds there (7600₈) and jump to *that* address.

Barf bags are in the seat pocket ahead of you.

Once you've relieved yourself, please read on, because we're not done yet.


# Level 3: Instruction and Data Fields
# Level 3: The Instruction and Data Field Registers

By this point, you'll be wondering how a PDP-8 can be expanded beyond its stock 4 kW of core to its maximum of 32 kW, 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 kW = 32 kW.

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, 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. 

This is also why your PDP-8/I has two sets of 3 switches on the front and a set of indicator lights labeled "Data Field" and "Instruction 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.


# Conclusion

I hope you've found that interesting an 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.


---------------------

**Footnotes and Digressions**

1. You sometimes see the term [octet](https://en.wikipedia.org/wiki/Octet_(computing)) to unambiguously refer to a group of 8 bits as a result.
1. Thus the term [octet](https://en.wikipedia.org/wiki/Octet_(computing\)), which unambiguously refers to a group of 8 bits.

2. Yes, "versions," plural. There were actually 3 major [versions of ASCII](https://en.wikipedia.org/wiki/ASCII#History), the 1963, 1964, and 1967 versions. Note that 1967 postdates the first few versions of the PDP-8, though not the PDP-8/I, which we're focused on here on this site. Thus, the PDP-8/I is one of the first machines aware of 7-bit ASCII as we now understand it.

3. The most common terminal used with PDP-8s and other machines of its era was the [Teletype Model 33](https://en.wikipedia.org/wiki/Teletype_Model_33) ASR, the latter referring to the Asynchronous Send and Receive version. Although you will commonly see this referred to as an ASR-33, that is not its [proper](https://en.wikipedia.org/wiki/Teletype_Model_33#Model_33_ASR_vis-.C3.A0-vis_ASR-33) name.

4. Remember the notation: 4096 12-bit words is 6144 bytes, but we always speak of core memory in terms of words, not bytes. It's "4k" or "4 kW", not "6 kB".

5. Pro tip: every time the third digit of an octal address goes up by 2, it is referring to a different PDP-8 page: page 1 begins at address 200₈, page 2 begins at address 400₈, etc.