Diode Matrix
94 points
2 months ago
| 10 comments
| cca.org
| HN
t-3
2 months ago
[-]
If you, like myself, were wondering why the opcodes are written in octal, apparently modern hex notation was new at the time: PDP-11 was introduced in 1970, 0-F hex in 1966: https://en.wikipedia.org/wiki/Hexadecimal
reply
fweimer
2 months ago
[-]
The 6-bit byte was still common at the time. Previous DEC machines had word sizes like 12 bits, 18 bits, or 36 bits. Apparently, the PDP-11 instruction encoding mostly had field widths that are multiples of three bits (although the opcode field mostly used 4 or 7 bits), and the usable address space for the machine was 15 bits when measured in words.
reply
zh3
2 months ago
[-]
Once you know the pattern, it's super-easy to 'assemble' PDP-11 programs in your head. For example, for a double-operand instruction like 'MOV', the lower 12 bits are 4 groups of 3 bits specifying addressing modes and registers. Thus. MOV R2,R3 is 010203 (01=MOV, 0=direct source, 2=R2, 0=direct destination, 3=R3). More advanced example, this gets used to load data by utilising the PC (R7) which autoincrements each time, so a common MOV like MOV '#12345,@100' is 012737 12345 100 (MOV what the PC points too - #12345 - into the memory location the PC now points to @100 - noting the PC will be advanced 3 times in total so it ends up pointing to the next instruction).

On PDP-11's with ODT (a minimal memory/register inspection/modification tool) this made it easy to enter short programs (like bootstraps) from memory - it was less a case of remembering the octal than it was remembering the code and doing mental translation to octal on the fly (systems without ODT, same process but you got to use the front panel rather than a terminal).

reply
fasa99
2 months ago
[-]
I didn't understand any of that.

But what I got out of it was, this hardcore mf doesn't code in assembly, he codes in binary.

reply
msla
2 months ago
[-]
Yep: The machine code is in octal (three bits per digit), the low-order bit is on the reader's left in this image, and the words run top to bottom. Pretty easy to read, once you get oriented.
reply
ghayes
2 months ago
[-]
I sat confused how each 16-bit row was being shown as 8 hex digits (32-bits). Thanks for explaining it was in octal.
reply
Aaron2222
2 months ago
[-]
I count 7 octal digits per row. Any reason it's 7 instead of 6 (7×3 = 21 whereas 6×3 = 18 which is still greater than 16)?
reply
lpribis
2 months ago
[-]
Maybe the zero digit prefix is retained to signify octal base (C style)?
reply
Aaron2222
2 months ago
[-]
That would make sense.
reply
morninglight
2 months ago
[-]
Until now I've never heard of anyone else doing this. I purchased a 6502 in Nov '75 without any way to program it. Out of desperation, I wired up a diode matrix using the 6502 machine codes and was delighted that it actually ran! Even though I had a bucket full of signal diodes from a nearby surplus store, this programming effort was more than sufficient motivation for purchasing some ram chips.
reply
zeroq
2 months ago
[-]
Just two days ago I was reading a discussion, here on HN, about early days of programming and someone in the comments mentioned that games like PONG were easily moddable, and you could change a lot of variables because they used diode matrix.

Lo and behold, today 'diode matrix' is on the first page. :)

reply
01HNNWZ0MV43FF
2 months ago
[-]
Cool. I suppose the reason they're diodes and not just wires is the same reason n-rollover keyboards need diodes, so that current doesn't jump across rows you're not trying to read?
reply
kazinator
2 months ago
[-]
Yes; it has to be one way. Current goes from the row wire to the columns that are connected to it via diodes. Some of those columns have other diodes connecting them to other rows. Current must not flow in that reverse direction, otherwise columns would be randomly shorted together via rows that are not currently (no pun intended) being probed.
reply
pvillano
2 months ago
[-]
The circuit is a n-rollover keyboard with the appropriate keys held down
reply
Taniwha
2 months ago
[-]
Luxury! (Monty Python voice) In my day we had to enter the bootstrap from the front panel switches.

Seriously though, we did, if you had money you bought this board - it wasn't as bad as you might think, the old PDPs had core which didn't lose it's contents when you powered them off, usually the bootstrap was still there

reply
zh3
2 months ago
[-]
My first boss was a demon at loading the bootstrap, fingers sweeping back and forth across the panel to bring the system up every morning.

Later I got to write a boot ROM which supported 5 different drive types (4 types of floppy from 3.5" to 8" and Winchester hard drives), complete with terminal prompt, multi-unit support and interupt handler. I got it to fit into 256 words (2 256x8 PROMS) with some trickery (I still recall being out of space by one word and needing 204 for a sector read command - finally, remembering I had 102 in a register from loading the BEV vector, shifting that up one saved a load and so got it to fit).

reply
cesaref
2 months ago
[-]
I had an 11-23, and that had a monitor in the CPU (proper CISC!), writing to a serial port. That meant that I typed the boot loader into a terminal, and hence had a pre-recorded sequence I replayed to the port to boot the machine.
reply
btbuildem
2 months ago
[-]
> ROM is easily user-writable using a soldering iron and pair of wire cutters

Even a ROM is a RAM if you're determined enough!

reply
aruametello
2 months ago
[-]
in a philosophical question, would it be ram if your hands/tools need to move around like a HDD head? it could be argued there is seek time involved.
reply
0_____0
2 months ago
[-]
The lack of variability between reads at arbitrary addresses is a defining characteristic of RAM
reply
InfamousRece
2 months ago
[-]
It is RAM as long as you access it randomly.
reply
kazinator
2 months ago
[-]
For obfuscation, the unused diode footprints could be populated with decoys that look like diodes but are open. You wouldn't want the competition easily understanding your 30 byte diode program.
reply
zh3
2 months ago
[-]
We used to fit all the diodes then use a pair of contacts connected to a high current supply to blow the unwanted ones. The diodes make (and still do) a nice little flash as the internal point contact blows. IIRC you could tell which ones were blown by close inspection (we weren't doing it for obfuscation though).
reply
hggigg
2 months ago
[-]
Plug in the debugger and give it 5 minutes to warm up!
reply
sim7c00
2 months ago
[-]
love this, never saw one. writing a lot of boot code this looks amazing to me :D definitely another hole to happily tumble into, thanks
reply
grigy
2 months ago
[-]
I was curios what does the code do and asked ChatGPT.

  Summary of Functionality:

  • This code seems to perform a sequence of loading data from memory into registers, performing bit tests, comparisons, and conditional branching based on the results of these tests.
  • It appears to be part of a loop or some repeated operation, as there are multiple backward branches that seem to control a flow of tests and memory manipulations.
reply
mmastrac
2 months ago
[-]
Do yourself a favour -- develop an intuition for this sort of code rather than reaching for GPT. It basically gave you what you should be able to read in a first pass, and a you can probably reduce the algorithm to some C-like code with a few manual passes in notepad or textedit.

I'm on mobile but my guess would be an init function waiting for hardware to be ready based on the looping and bit testing, and the context of the page itself.

reply
kjs3
2 months ago
[-]
It basically gave you what you should be able to read in a first pass

Don't give it that much credit. It basically gave you an answer to "what does a generic program do".

reply
kjs3
2 months ago
[-]
So you saw something, asked your AI to 'think' for you, and blindly accepted a useless answer as worthy of posting. And you call that 'curiosity'?
reply
hggigg
2 months ago
[-]
So useless then.
reply