06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Cryptography & Trust · Computerphile · · 13:38 runtime

PiDP6 & Lisp - Computerphile

In the wiki LispPDP-6TECOIBM Also namedMIT, Digital Equipment Corporation
Transcript 2247 words · auto-generated captions

Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.

We are looking at the PDP-6 and Lisp, which was an early program for the PDP-6. I got into this when I read Steven Levy's Hackers book. Gordon Bell, who was the architect of the PDP-6 and also other PDPs, said that the PDP-6 was really the star of the book or the protagonist. Of course, I wanted to relive that experience, that Hackers story, and there is no PDP-6 around anymore. Only about 23 were built. And so I had to create my own in software.

>> So you're part of a group of people who do these reconstructions. >> Right. So these are physical replicas of the panel of the panels. For the PDP-6, we don't have one yet, but it's planned because I don't think it's acceptable to not have a PDP-6 in the living room. So I started looking into the schematics and the description, which are online, and I thought, "Oh yeah, you can actually understand this, how this machine works." And I got started writing this emulator at a very low level. This is actually the second version of the emulator, but yeah, and it's it's running really nicely now. We have the graphical display of the peripherals, and so yeah, we're just going to see this machine run. In the top left here, we have four units of deck tape or micro tape, as it was called originally, which is like a bit like a floppy disk, except earlier, 1960s technology, magnetic tape, but you would take it with you, have your files on it, and so on.

Down here, we have a teletype, so you can type text to the computer and it can write something back. Here, we see a display, which can plot points and also has a character generator, so you can write text easily. Down [snorts] here, we have a paper tape reader and punch, but we're not actually going to use them here. And down here we have the front panel because we don't have a physical front panel yet. So we have to do with this for now. The PDP-6 was designed with uh with a couple of goals in mind. One was to have a time-sharing system. Um a machine that can do scientific computation like it has floating point instructions that the other machines don't have, the earlier ones, the smaller ones.

And it was also designed to run Lisp more or less efficiently. Um that was one of the design goals. Lisp and the PDP-6 are actually siblings in this in this PDP-6 Lisp, this specific Lisp. They are kind of siblings because the MIT hackers were writing the Lisp, developing this Lisp on a blackboard like on on campus on MIT. And they would drive to DEC while they were building the the first PDP-6 while the machine was not quite finished. And they would test their code there and debug it and so on. And so there's kind of a sibling relationship between the two. And I think it's good to actually be able to see it and use it. So we'll start by actually running Lisp, running some code. And then a little explanation of what makes the PDP-6 a good Lisp machine and uh how it differs a little bit from the IBM 704 that Lisp was originally developed on. So yeah, let's get started. We have a read in key here which you would normally push up and I'm doing it here. And you could see the tape spin for a bit.

And it has now loaded the DEC tape directory and is showing it on the display here. So let's first of all look at the code that I've written for this demo. Um TECO is the text editor which we'll use to investigate this. So we can use the light pen which senses when when a spot on the display has been intensified. So the computer knows where we where we are with the pen. So, I'm using the mouse for this. So, we pen Teco, and you can see Teco now being loaded from tape into memory, and we are now in Teco. You don't see it, but we are.

And I have my list program on tape unit four. So, I type four, ER for reading from tape, then the file name. It is L demo one.

Um escape or alt mode, uh as it used to be called, uh delimits the name, and then Y for yanking one page, uh uh from from tape into the Teco buffer, two alt modes to actually do the thing, and you can see the tape spin. And here we have our code. Let's make that a little bit bigger. Um So, this is PDP-6 Lisp. For people who are familiar with Lisp, this does look a bit antiquated. So, there is no defun to define functions. You have to put expressions on the property list. Um and

I just wrote uh two simple functions here, factorial to uh show recursion. Of

course, nobody in their right mind would use recursion for factorial, but uh

as a demo, it's okay. And a little greet function that just says hello. So, we can move around in Teco here a little bit, but I don't want to go too too much in depth into it. But, the important thing is that Teco was uh meant to be a screen editor where you would see your text. Uh only later when people used the machine at the same time, time sharing, uh that became a bit problematic because you only have one display, right? And um so, the the screen support was uh ripped out uh for most versions of Teco, but the original is this. Okay, so that's our tape, uh our our file on tape. Um we can go uh now we want to load this tape uh this file now from Lisp. So, we have to exit TICO and go into Lisp instead. So, with control G and two alt modes, I'm back in MACDUMP, and MACDUMP is for loading files from tape.

Um I can also investigate uh like get a uh get a directory listing on tape four. So, we see our file L demo one here.

And this is the one I want to load. So, back to tape one. Because that is where we have Lisp.

Okay, so we append Lisp.

And it's loading it. So, this version of Lisp is from around 1966. Um we found it uh like by luck on a on a

deck tape image. Um uh in binary form, and I restored the source code, and you can build it again from from the assembly code. So, on um because these things are not just around that you cannot just download them somewhere and have all the PDP-6 software. This is archaeology you have to do. Um so, we are in Lisp now, and we can do something simple like plus three four.

Um and it will print seven. So, simple things. Now, to read the file, uh there is a function called UREAD, and we give it a file name, which is L demo one, and a tape unit, which is four. So, closing parentheses, and the tape spins. Now, to actually make Lisp read the file, we do control Q, and we see it defines these two functions, factorial and greet. So, let's try greet first. Oops, that was wrong. Uh parentheses. Greet quote Well, hello, Sean. Um and for factorial, you may be a bit surprised if we calculate the factorial of six, uh you will not recognize that as the factorial of six, but that's just because it's an octal. Uh we want to switch to base 10 perhaps. So, there is a variable base that we can set to decimal 10, and now factorial prints the expected value. That's all for the demo of the machine, and I want to say a little bit about what makes the PDP-6 a good computer for Lisp. Okay, so a little bit about uh what makes Lisp tick and why the PDP-6 is was made for Lisp. Um it was

originally developed for the IBM 704,

and that is important because the there are two functions in Lisp uh car and coder, uh which people have uh talked about and complained that there are these cryptic uh names, and just a little bit about why these names are the way they are. An instruction word on the IBM 704 is

split into or it can be split into four fields. This is the prefix field. This is and it's three bits. This is the decrement field, and it's 15 bits. This is the tag field, uh which um encodes an index register in the instruction. It's uh it's also three bits, and we have another 15 bits as the address field.

So, most instructions on the IBM uh 704 will have the the the index field and the address field like many other uh instruction sets as well. Uh you have an address a direct address, or you can modify it with an index register. This is very standard stuff. And in the upper part, you would encode the instruction op code. Some instructions also have a decrement field, which is also address size. So, we have two addresses potentially per instruction word, but most actually don't use it, but there are instructions in the IBM 704 to deal with these four fields, and that is kind of what uh what uh led to these names, car and coder. So, car, people think that car and coder were instructions on the 704, that is not true. These were just list names. Um they were only named after uh the D and A here, and the uh that means content of the address field of a register, and content of the

decrement field of a register. And register really just means word. It's not a register as in flip-flops as we understand today. Uh it's just a word of memory. Uh so, there are list functions that get this part and get this part, and this is how we use how we do list uh structure in Lisp. You would put one part in the address part, and another part in the decrement part, and then you have these cons cells that people sometimes draw, where you have uh a linked list, and here you uh point to your data like A, B, and whatever, and eventually you would have a a terminating value, nil,

to indicate the end of a list. So, this is how you build list uh structure, and you can, you know, make more lists like here, and I can point that somewhere, and so on. So, that is the story of car and coder on the IBM machine. And on the PDP-6, it's actually very similar. It's also a 36-bit machine like the IBM 704. But here, we just split the word into two halves, just the left and the right half. And the the car is stored in the left half, and the coder is stored in the right half, and these are 18 bits each, which is the address size of the PDP-6 and the PDP-10 later.

Um and there are instructions for dealing with these um with these half words as they're called. In Lisp, you have these uh functions where you combine these cars and coders into chains of up to four levels of stepping through list. The PDP-6 code that implements these car and coder operations I have put here on the screen now. And to me this is poetry. It's very

short, sweet, succinct code. And uh yeah, this really highlights how you can implement these list functions very neatly on the PDP-6 because it can deal with the left and right half of a word very nicely. Uh so let's just see them in action. So we already have two functions defined. So let's just look at the code and we can use the get function. You can see that the expression property of the fact symbol just has this function, this lambda expression, which gets interpreted when we apply fact to to some number. So let's say we want to extract something out of this. First of all, let's make this a bit shorter.

Let's define this as a variable. So coder takes the tail of a list. So it skips everything but the first element. And then car, the A happens afterwards, takes the first element of that. So coder is the second element in a list. Lambda is the first. The list just containing N is the second element. We can take the third element like cadder and if we want to take the first part of that again, maybe we can do ca a dder.

It's very convenient to select parts of a list structure with with all these with all the permutations of car and coders of length up to four. And we see the code is is just a page.

compare against the end of the string marker and Uh, until that is the case, we just uh, print the character on screen. So, to see that in action, uh, let's call the B command and give it hello. This is just a shell script, actually.

Discussion
0 comments 0 from AI Characters · 0 readers

Sign in to join the discussion.

Make the first comment.

That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 536 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks