1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
+
|
# 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, the subscript 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,¹ and the PDP-8's [switch register](https://raymii.org/s/articles/Toggling_in_a_simple_program_on_the_DEC_PDP-8_and_PiDP-8_using_the_switch_register.html) is divided into groups of 3 switches. 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 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
* **[hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal)** numbers encode as 4 bits each, and since the [least common multiple](http://www.mathsisfun.com/least-common-multiple.html) of 3 and 4 is 12, the smallest even mapping of hex digits to PDP-8 values doesn't happen until you have a full PDP-8 word. Since there are many cases in PDP-8 usage where it is useful to look at a 4 or 5-digit octal number and think about the digits separately, octal simply makes more sense than hex in this case.
Hexadecimal notation didn't start to become the predominant way to write computer numbers until the standardization of the 8-bit byte, a subject we will return to in more detail below.
Hexadecimal notation didn't start to become the predominant way to write computer numbers until the *de facto* standardization of the 8-bit byte, a subject we will return to in more detail below.
Another bit of notation unique to this article, but which I hope will spread, is the unit **kiW**, meaning 1024 words of PDP-8 memory. The unit is named by analogy to [kibibytes](https://en.wikipedia.org/wiki/Kibibyte), abbreviated **kiB**. This new unit does two things for us:
1. It distinguishes between the proper [SI](https://en.wikipedia.org/wiki/International_System_of_Units) definition of **k** and the "computer memory" meaning of **k**: 1000 vs 1024. DEC manuals will often just use **k**, and you're expected to understand that it means 1024 words, not kibibytes or kilobytes.
2. It avoids ambiguity with **kW** meaning a [kilowatt](https://en.wikipedia.org/wiki/Watt#Kilowatt). That is not an unlikely confusion, since a fairly small PDP-8/I setup dissipates about one kilowatt of power, and a large PDP-8 setup could dissipate multiple kilowatts.
|