🔒 9 more in the full analysis
Searchable transcript of Hacking on the PDP1 Raspberry Pi Emulator - Computerphile — Computerphile (24:19). Search for a phrase, then click its timestamp to jump straight to that moment in the video.
Captions sourced from the original video on YouTube, published by Computerphile. The video, its captions and all related intellectual property remain the property of their respective owners; AINotes claims no ownership. Provided for research, accessibility and search — see the Transcript Notice and Copyright Policy.
00:00 First we will look a little bit into the history of these machines and we we use the PDP-1 here as sort of our central starting point. The PDP-1 designed in like the eight late 50s 59 sold starting in 1960 and about 50 were built and sold by Deck and I think it's a very good starting point to explore this whole history if you're interested because we then have a couple of PDP models branching out from this but there's also a history to the PDP-1 so So the Deck Deck is a Digital Electronics Corporation?
00:39 >> Digital Equipment Corporation. >> Equipment Corporation okay and they were a computer manufacturer in America. >> Yeah they didn't call it computers back then because that evoked notions of IBM style like payroll business machines very hard to access like you give your punch punch cards to someone and so on. And these are a different tradition very interactive and more personal.
01:03 And the PDP-1 was sort of the first one that you could buy in that lineage. The PDP-1 was an 18-bit machine you can see it here 18 bits and 4 kilowatts of memory originally so a word is again 18 bits didn't have any bytes yet that came in the mid-60s. So after the PDP-1 which was a little bit more experimental Deck was a startup essentially at that point.
01:28 When they had more customers they had different needs and the company was expanding so the first model after the PDP-1 was surprisingly not the two or three that was like an old business strategy that didn't pan out. But it was actually a PDP-4 which was also an 18-bit machine but not really not compatible with a PDP-1 like they had the same peripherals to some degree but not quite and they reused these architectures again.
01:57 They built new machines that were more or less compatible. So the seven was the next and that one is perhaps a bit famous for being the machine that Unix was developed on by Ken Thompson. 1969. They again built in a machine in that family the nine and the 15. We're not going to talk about that. So they're just kind of different capacities or Yeah, so essentially they they rededicated like they flipped one bit from being an address bit from being an instruction bit to being an address bit.
02:30 So you get 8 kilowords of memory on the PDP-4 in this family, but you get only half of the instruction space. And so in Unix you see that because the kernel has 4 kilowords of memory and the user has 4 kilowords of memory. And with a PDP-1 you would only have like 4 kilowords time sharing on a PDP-1 was done a bit differently. Um So yeah, kilowords is a new one to me.
02:56 Yeah, people are not used to kilowords anymore. >> words then? Yeah. Okay. Right. Um so that was sort of the first thing that uh uh that they built and afterwards uh came the PDP-5. What sort of things were these used for? Were they were they what were who were their customers? Um so the idea initial idea was to make a more a cheaper PDP-1 essentially and also use it for things like process control, lab equipment, that sort of stuff.
03:24 Um things where the computer is part of a system and not just the system itself crunching numbers like like a mainframe would do like doing scientific I don't know weather simulations or whatever and eventually you you'd have the result. But it was something that you know, talk to talk to the real world. And so there was a smaller family. Um which is kind of a stripped-down 18-bit family condensed into 12 bits.
03:57 That's the PDP-5, 8, and 12. Uh, so these are very minimal and really just to like more more of the lab equipment type and uh, process control. Even though people did time sharing and such on the PDP-8 as well. Um, and it's a very popular machine. There's a big PDP-8 fan community. Um, and the PDP-8 was the first that Oscar made. And on the other end, we have the PDP-6 and the PDP-10.
04:27 So, the PDP-6 and 10 uh, were 36-bit machines uh, meant for time sharing such that multiple users could use the machine at the same time. Also, sort of uh, designed to run Lisp well, which was a popular programming language uh, in AI circles and around MIT where these machines came to be. Um, and yeah, so so that is like the the on the wide end of the word size, 36 bits.
04:58 I'm just going to ask a question if that's all right cuz obviously you've mentioned the word AI, right? And we're now talking about the 1960s. I mean, this is you know, become massive nowadays, but it isn't the you know, the what we're going through now wasn't the start of AI. >> Right. Uh, AI at the ti- at that time and something like um, symbolic differentiation or chess programming um, stuff like this.
05:20 Um, so symbolic AI, good old-fashioned AI. Not the neural networks I mean, the neural networks uh, go back quite some time, but this was not really what people did because the computers weren't there yet. So, this is sort of the uh, the PDP family and there's one important piece missing which is the PDP-11 introduced in 1969 like around uh, 70 and this kind of uh, pulled everything or almost everything together a bit.
05:50 So, uh, it's a single architecture that is uh, that has small machines, PDP-11/05 for things like what a PDP-8 would do maybe. Um, but also bigger machines, um, maybe a PDP-11/40 which ran Unix. Or on the bigger on the higher end a PDP-11/70 which was quite uh, yeah, quite a capable machine. Um, it did not quite replace the the PDP-6 and 10 uh, style machines, um, but they later uh, built the VAX, the like a 32-bit reinterpretation of the PDP-11.
06:29 This was 16 bits. And so they had this these two uh, as their flagships uh, essentially and this became like ancient history which is why people don't know so much about them anymore. And these are very familiar. These have bytes like byte addressing which people take for granted these days, but these don't have bytes yet. These are all word addressed.
06:50 Um, So that those I mean they they were pioneering machines those ones but basically we're going to have a look at what came before. >> Yeah, I mean everyone was pioneering at the time. Had no choice, but uh, yeah, people had to figure out uh, what computers should be like. Um, for instance, Gordon Bell who was the architect on essentially all of them except for the PDP-1 uh, said this this 18-bit line was a mistake because it was not compatible with the with the 18-bit PDP-1 and they didn't appreciate the like
07:22 portable software yet. Being able to run >> write Right, they they thought oh, well, you just write the program for the new computer and then but yeah, uh, software quality like the the value of software was not uh, was not on people's minds apparently back then. And and I suppose I'm when I say pioneering I think I guess I mean they laid some of the foundations that we still use today, but yeah.
07:45 Yeah, like the PDP-11 and VAX are like very normal computers from today's points of view. You can you can read PDP-10 assembly or VAX assembly and it's it's not too foreign. Whereas when you go back to these older machines it becomes a bit less familiar. But on the other hand, they're also very simple. Like the PDP-1 is not a complicated machine for instance.
08:09 So you can still understand it. It just takes a little shift in the perspective perhaps. And so there's also prehistory which we're not going to cover, but the PDP-1 had uh was preceded by the TX-0 and these were one-off machines now that we're talking about. These were like production machines that were sold even if maybe not too many. Um but the earliest stuff only existed once.
08:33 So the TX-0 was also an 18-bit machine, but much simpler than the PDP-1. Um there's also a TX-2 which was a bigger 36-bit machine famous for being the machine that Sketchpad was written on by Ivan Sutherland. Uh first CAD system you might say. Um and this it goes back a little further to the memory test computer which was really part of Project Whirlwind.
09:08 So Whirlwind I was was there was that machine originally to do um cockpit simulation, but it didn't really pan out and they built a digital computer instead. I call it the first microcontroller except it took up a whole building. But essentially that was the idea to have a computer that interacts with a real world. So this is where it starts. What what era is that then, Whirlwind?
09:32 Uh Whirlwind I was operational more or less, or became operational during 1950. And So, it's kind of post-war kind of Right. They had difficulty with uh finances because the war stopped, and uh well, luckily for them, the Cold War started, so they got money again. And uh that is how the Whirlwind II, you might call it, but it's perhaps better known as the computer of the SAGE system, uh the AN/ FSQ-7.
10:05 Um that was like a a bigger version of the Whirlwind I, essentially, built all over the US for uh airspace monitoring. Um it was never it never really had a purpose because shortly after they had intercontinent- uh intercontinental uh missiles, and like they never got to use it, essentially. So, yeah. This is uh the the history that we're talking about.
10:31 And the Whirlwind I was where where the core memory was invented for. Here we got modems, and uh like displays uh all were already were on the Whirlwind, and this kind of uh goes down into the tree, so we have this whole uh history of interactive controller-type um personal, perhaps, uh computers. And so, again, the PDP-1 is uh sort of our central piece here, and uh we will now look a little bit into what the computer how it works, and what to do with it, how to use it, using the PDP-1.
11:09 Um we're first going to look a bit at the front panel, what it shows, and how to use it, and then we'll use it to uh draw the circle uh that uh uses the algorithm that Marvin Minsky of discovered. Um and also the Minskytron, which is based on that uh algorithm, which is a very uh nice-looking demo, and it's also you can play with the switches and uh it's very satisfying to play with.
11:34 So, what you see on the panel, all these lights are almost all of the state that the the PDP-1 has. All the internal flip-flops are visible as lights on the panel, which you need because if the machine isn't working and back in the day the machine was not working quite a bit. You have to make it work again and you have to see the machine state. This panel doesn't have all the lights.
11:59 There was an IO panel and peripherals would have more lights and so on, but this shows everything important really. So, we have two registers up here, the program counter and the memory address. Program counter is the same as you would expect today. It's the address at which to fetch the next instruction. Memory address is the register that holds the address for the memory word that is being addressed by the computer.
12:22 So, it's just an address and the memory buffer is the data that either came out of the memory or was written back into memory. So, at the end of a memory cycle the MB register would show what is in memory at that location shown at memory address. And the accumulator and in-out register are what the programmer uses and as you can as you can tell from the name in-out is also connected to the peripheral equipment IO stuff.
12:49 So, the accumulator is the arithmetic register that control with with your program more or less and IO was also used for uh like as an auxiliary register. Also, when we display a point it will be X and Y coordinates. One register is X, one is Y. And the address in the in the basic machine is 12 bits here, but we have a memory extension. We can use up to 64 kilowords.
13:14 12 only gives gives you 4 kilowords and 64 kilowords for the maximum what a PDP-1 could do. So, here we have like a run light and a cycle light and so on. These uh run as obviously when the machine is running. It's not running yet. And this is internal flip-flops that we're not going to go into in much detail. The power switch obviously turns off the power and on again.
13:41 The sense switches could be used by program just to read like general user interaction. You can read them and the program flags are kind of similar. They can be set and read by the program to its will. And they can also be connected to some peripheral equipment like when you use the light pen and it sees a spot, it might like set the program flag for the pen here.
14:07 And we have the instruction register. So, five bits that encodes the instruction. So, now let's put something into memory. We have the Minsky circle algorithm here. It's not a lot of words. And we have the symbolic assembly on the right here. And I just wrote down the binary code and octal that encodes these instructions. So, you have to know octal of course.
14:32 Oh, oh, and on the left we have the the address where this where we put this into memory. So, because I'm just to remind me that's base eight, isn't it? Octal. So, three bits are one octal digit. It's very easy to like it it's very quick to get into really. So, if you have the upper bit, that's a four. If you have the middle bit, that's a two. And if you have the lower bit, that's a one.
14:56 And so, if you have multiple, you just add them. So, that's five. And at some point you just don't think about it anymore. You just read octal and toggle in binary or you read binary. Um So, let's do a a couple of instructions manually with the front panel. We start at address 100. And the word that's supposed to go here is seven all up, six which is four and two, one, and the rest zeros.
15:26 Now, uh pressing deposit up uh puts this into memory. We see memory address 100 and memory buffer 761000. Oh, actually I made a mistake. That's the second instruction. That's no problem. We could just change the address and put it in location 101 instead. Easy. But now we have to do the first instruction, of course. So, that is 2 00 113. So, 200113.
16:01 Uh so, you can already tell it's easy to make mistakes. And that is why I don't really want to do this on the front panel so much. It's very tedious. Um but just to make sure uh that we also check the examine uh switch, let's look at our previous previous word and uh press examine, and then we see our six uh 761 again. So, now let's do the rest not on the front panel, but actually using the debugger, DDT.
16:30 DDT is the debugger, and it's uh it's an insecticide, so a debugger. So, I have DDT mounted as a paper tape in the reader. It will be above the front panel here. We have it on screen. Um and when you press read in, the machine knows the format of the tape and goes through it, and you can see the address being counted up here, where things is things are being put into memory, and eventually it's going to jump into DDT.
17:02 Okay. So, now we're interacting with the typewriter here. Would that be the sort of speed a paper tape to to run or is it >> Yes, it's the original speed. Like uh there are different numbers given, but uh 400 lines per a is is a is about right. Something like 300, 400. Um Okay, so now let's confirm that what we have put into memory is indeed correct.
17:25 So at address 100, we have exactly the instruction that I wanted to put there. And by pressing backspace, we can check the next one. And equals gives us the octal. And so now I just do the the rest. I can do some in octal directly. This will be the next instruction. And and the next one and the rest one the other ones I will just do symbolically because that's something DDT can also do.
18:00 So we are now at 104 and that is supposed to be DAC 114. Deposit accumulator. Okay, so now we finished putting this into memory using DDT and we see by examining successive locations that we have this code in memory now, which is the one that I want to execute. DDT was quite popular on other machines as well. There is a whole tradition of these interactive debuggers.
18:29 It doesn't start with DDT, but DDT is fairly well known. Okay, so we now finished putting the program into memory. We can examine the memory locations with DDT and we see the code, which is the one I wanted to put in there. And now we want to start this program. One way to do it is with the front panel. So we stop DDT because we're still running. So run is now off.
18:53 And we put in our start address, which is 100. Hit start. And there we see the circle. So what's happening there is is kind of the equivalent of find a point print a dot there, move a bit, print a dot there. >> Right. Right, it starts with a single point and essentially with a little bit of uh approximate trigonometry, you you would move the point uh with a small angle.
19:18 But, if you approximate it, it spirals out because it's just an approximation. So, Marvin Minsky's discovery was that uh you don't calculate the new point from the pre- previous point, but that the X and Y coordinates are sort of linked. And if you do the math, you uh find out that it actually uh remains stable. So, that was a very cool discovery. And there is a program called the Minskytron, obviously named after Marvin Minsky, which is three of these circles uh kind of linked together.
19:44 So, one oscillator uh is connected to the second one, the second to the third, and the third one again to the one to the first. And you have settings on the switches which control them, and you have a very cool demo. And this is exactly what we're going to do now. So, um we'll we'll put the So, this is where we use the magic of the emulator to load it back in, right?
20:11 >> Right. Uh oh, actually, no. Uh let's do one one thing first. We want to perhaps punch this onto paper tape because we like this program and want to run it again without toggling it in again. So, we go back into DDT, which is at 6000. So, stop the machine, start there. We're back in DDT. And now we uh punch a tape. Uh we start with a title, capital L, and we might call it circle.
20:38 And we see it punched on the paper tape as As as just so you can read it. Uh So, you know what that tape is. >> Right. With tab, we go into punching words now, and our words start at 100, and it goes up to 114. And now we see the words being punched. And we just have to give it our starting location now, which is 100 or 100. There it is. And now we can like rip off the tape, uh which we do with the emulator here.
21:09 Uh So, you're basically saving that Right. Um exactly. So, we now storing that the file already existed, it's fine. So, uh we now have our paper tape which came out of the machine and now we want to put it back into the reader. So, here we go. There it is. And obviously we still have it in memory, but it doesn't really matter. So, just read in. The tape goes in and it jumps into the circle program.
21:35 Ah, so that last instruction on the tape is basically run. Right. It just executes the instruction from from paper tape really. >> And then and on the tape, I think we've done a video on paper tape in but each line is basically some code, is it? Yeah, one word is three lines and there is different formats. Like read in has a special hardware format, but it's not the most space efficient and so there's more efficient loaders, but yeah.
22:02 But that's how it works and that's how you would perhaps program the machine and punch a program onto tape and yeah, very interactive and nice to use. You could of course use an assembler, but that's a bit more involved. Okay, so now let's go into the Minskytron. So, we load this demo tape here and read it in. Takes a while. Oh, that's a snowflake, but don't want that.
22:30 We want Minskytron. It starts at 500 and it needs some initial switches. If we if we start like this, it's just very noisy because all these shifts that are done in the Minsky algorithm, which is a very easy division by a by a number power of two number, um we can set these shifts now. So, let's just try something. So, you just randomly, well, More or less random.
22:54 I have some intuition, but not too much. Um but you can see how we have this feedback between these three oscillators now and if you observe it for a while it will go crazy or if you change the switches you can just change them and it start and you get a different pattern and you can you can really have fun exploring all these possible patterns here and sometimes like this is the typical display after after some time it was we just go crazy.
23:23 It's like PDP one you're drunk go home. Yeah, exactly. But it's very very fun to explore for sure and I can really recommend doing that. There's a very good website where you can do it as well maswerk Minskitron. If you Google Minskitron you will find it easily. So kind of in a chaotic mode right now. Let's see. But yeah, this is this is what you can do with a with this very simple circle.
24:02 Like just goes character by character. So we get that compare against the end of the string marker and until that is the case we just print the character on screen. So to see that in action let's call the B command and give it