Learn PDP-11 Assembly For Fun But Probably No Profit

Learning a new skill is fun, especially one that could land you a new job. We don’t think you’ll find too much demand for PDP-11 assembly language programmers, but if it still interests you, check out [ChibiAkumas’s] video that starts a series on that subject for “absolute beginners.”

The PDP-11 is a venerable computer, but you can still find simulators ranging from SIMH to browser-based virtual devices with front panels. If you want real hardware, there is a PDP-11 on a chip that is still around (or you can score the real chips, sometimes) and there are some nice hardware simulations, too.

Like a lot of machines in its day, the PDP-11 was most comfortable with octal or base 8. That’s a bit odd these days, but it is easy enough to figure out to express for example 377 instead of FF.

The text part of the tutorial is a little — um — colorful. A “reading view” like the one you get from Mercury reader or in some browsers can help if it bothers you. You might also try PrintFriendly.

If you are into specs, a 1970-era PDP-11/20 ran with a cycle time of 1.5 µs and 56KB of magnetic core. All for the low, low price of $20,000 (although that probably didn’t include the TeleType machine  or any fancy I/O such as tape drives).

Given the limited amount of memory and the simple instructions, it is amazing how much these old computers can do. Even today there is at least one nuclear power plant that uses a PDP-11 to control some robotics. In Soviet Russia, several home computers used clones of the LSI-11 which was a PDP-11 on a chip. The Heathkit H11 used the same CPU.

We still occasionally see practical PDP-11 projects like this weather station. If you are really lucky, you can restore an actual machine.

43 thoughts on “Learn PDP-11 Assembly For Fun But Probably No Profit

  1. I can likely code under RSTS on a 11-70 or 11-40, or RSX using Teco maybe, or Basic+2. System utility calls too. Would I want to? Not really. But that’s what I cut my teeth on for the first couple years of coding in the late 70’s, that and the Darth Vader Bell and Howell Apple II+ with the black case. Did some assembly too, it was the only way to get around directory calls that were privileged as a student – they had put them in restricted mode with a system patch, which you could get around with Basic+2 linked with assembly.

    1. Use it a lot in 3 a.m. when the U computer has less use. Even print it using wheel printer for my resume to find job in those days. U of Waterloo compilers and RSTS/E (or sometime like that, just remember the /E part). Any fpga implementation I can get hold of it?

      1. That was the only time there was room on the computer 9pm to 7 am. I spent many nights and weekends doing just straight out programming, with by 2-liter mountain dews or 8-pack of coke – they didn’t allow games at that time, so we have to encrypt the code and hide it on a student accounts under .DAT files. We had one 8-inch Comstor unit connected in Engineering – but they only allowed it to run at 2400 baud to store files, and if they caught you with games on your disk by forcing a directory on it, they would erase it by forcing format commands to your keyboard. We had a somewhat contentious relationship with Computer Consulting there. I haven’t looked at a FPGA implementation of it, but it wouldn’t surprise me. We had 300 baud printers as terminals, or Microbee’s at 9600 baud, I think there we some Hazeltine terminals too.

  2. Did a lot of fairly complex stuff (semi-realtime) in MACRO-11 back when. You could code on a Heathkit and push to the minis using 8″ disks – RX02? A lifetime ago. It’s good to see there’s still some interest in it.

  3. I spent a decade or so using them for banking, mapping the Tees estuary, digital television, petrochemicals and everything in between. Lovely old machine. The point about octal is that with 8 registers the instructions were split into 3 bit fields.

    1. The use of octal is really a carryover from DEC’s previous machines. The PDP-11 was DEC’s first 16-bit machine. Prior to that, they had produced computers whose word size was a multiple of 6 bits (e.g., PDP-1, 4, 7, 9, 15: 18 bits; PDP-5, 8: 12 bits; PDP-6, 10: 36 bits) and octal naturally fits these word sizes better.

      1. No. Robert Billing got it right. It’s all about the layout of the op-codes and how things are coded in there.
        It would have been just amazingly bad to have the PDP-11 use anything else than octal. Word size don’t enter into it.

  4. There are plenty of old CS text books that use it. They might be books on “Macro programming” or machine code, or something like that. It is pretty basic as instruction sets go. It is kinda fun to know some of these old systems, like PDP-11 and 65C02 and ask yourself what you would do to make it better. Then compare that to –86, ARM, PA-RISC. SGI, etc.

  5. I learned PDP-11 assembly at DEC’s Westfield, MA plant when I was a summer replacement tech on the production line. We had some downtime and my boss let me sign up for the course. I used to have a certificate, but I think it got lost. Fast forward 10 years, and I’m working with the Motorola 68000…the register set and instructions look darn PDP-11-like. Apparently, someone at Motorola liked the 11 as much as I did.

  6. The more I learn about Spectre, Meltdown and speculative execution, the more I like simple and predictable processors of the old.

    I’m not an expert, but it does seem to me that simplicity and predictability would be a great help from security standpoint.

    1. Hum, it can be said that the prevalence of serious software bugs has everything to do with lack of memory safety on the PDP-11 which was the original target and thus reference implementation for C, resulting in promulgation of a programming language that had no inherent expectation of and cooperation with memory protection. In other words the deficiencies in the PDP-11 have been enshrined in C for decades and continue to cause security problems.


      1. The “insecure” characteristics of C have nothing to do with the PDP-11 architecture or hardware.
        A PDP-11 with an MMU have memory protection just the same as any “modern” computer have. Other programming languages, even at the time, had checks and protection against going outside of bounds of objects.
        The “problem” is all down to making C small and efficient, at the expense of not having any safety. There is no reason to try and blame this on the PDP-11.

  7. I programmed a game on a PDP-11 in assembler at the University of Wisconsin, Madison for a computer science course. I remember a couple of bearded computer science grad students walking around with a disc pack that contained a mysterious operating system called “Unix”. This was around 1975 or 1976.
    I later worked a company that also employed Harold D (Mack) McFarland. One of the principle designers that worked on the PDP-11. It had a pretty cool architecture, but it never graduated to a decent virtual memory or big memory implementation.

    1. > … but it never graduated to a decent virtual memory or big memory implementation.

      And thus was born the VAX (virtual address extension) 11/780. Fond memories.

      1. Good one but the point went over your head. People often post here about “I’ve got something but I can’t find it.”

        No one needs an incremental inventory of things someone else can’t find.

        1. But there’s a difference.

          There is lots of material about the PDP-11. So “I remember something vague” really has no relevance.

          But if someone is asking something specific, and I reply “I remember something like that, it was in Byte around 1978” , it is a vague pointer and someone who really cares can make rhe effort to find it. I do have a good memory, so it’s reliable even if I can’t remember specific title or date.

          Sometimes I lost a reply and then decide I can find it, so I.make tge effort, and add a more specific reply.

          But I can certainly know whether the information sought is rare or common, and thus not bother for the common unless to say “that’s really easy to find”.

  8. The reason that a lot of these old machines used octal instead of hex was that programmers calculators didn’t exist. When programming them in assembler you had to do a fair amount of arithmetic and conversion to/from decimal’ using pencil and paper. This could be done by mere mortals in octal. In hex, not so much.

    There was also quite an excellent mapping between C and MACRO-11 assembler. I’ve seen assembler code commented by the C code that would have generated it. One of my co-workers developed a set of assembler macros that allowed you to code assembler using a C-like pseudo-language.

    Also, the PDP-11 could be overclocked. You unsoldered the 16 MHz crystal from the processor board, and replaced it with a 19 MHz crystal. The machine would run hot, but it would run.

    As a final option, there was a way to program and install an additional ROM chip which would allow you to extend the instruction set with your own custom machine instructions. Never saw it done, but it was possible.

    They don’t build them like that any more…

    1. I disagree. The IBM 360, dating to 1964, was a hexadecimal machine. I think it relates much more to the fact that the PDP-1 (1959) was an 18-bit machine, and octal maps better to 18-bit words. So DEC was octal-brained from 1959 and had no reason to change that when they built their first 16-bit (and first multiple-of-8-bit instead of 6-bit word size) machine.

      1. Yeah I remember that. When your Fortran program went down in a ball of fire, your primary debugging aid was a hex dump of the memory containing your variables, and a load map. I spent many a happy hour doing pencil and paper math to find everything, and then figuring out what happened this time.

        Although oddly enough, the 32-bit DEC VAX used octal too. The old CDC Cyber series used 60-bit words, and I cannot even remember which convention they used. This might have been some sort of corporate culture thing.

        The good old days. They were terrible. And don’t even get me started on OS360 commas in your JCL deck.

      2. The reason the PDP-11 uses octal have everything to do with the fact that the op-codes are all divided into groups of 3 bits. It makes total sense to talk octal for the PDP-11, even though it has a 16-bit word. Using hex for a PDP-11 just makes it almost impossible to read the op-codes.

        People should really just take a quick look, and then this discussion can be wrapped up.

    2. You appear to be referring to a specific PDP-11 model. There were a number of models, each with their own technologies, unique features and characteristics. One had a writable control store that allowed users to create their own microprogrammmed instructions.

      1. The TI Programmer came out about 1977, I remember a review in Byte. I couldn’t afford it, but I got my second good calculator in the eighties because it couid do conversions between decimal, binary, hex and octal. (It could add, subtract and divide, but no logic operations.) By the time I got it, it wasn’t a new thing since the TI had long been out.

        My KIM1 came with a programming card, which had the ASCII code on it too. I photocopied some things from magazines and glued them to cardboard, to have easy access to things like offset for branch instructions, and I can’t remember what else.

        We made do without fancy calculators or much intermediate paper and pencil.

        And I never had an assembler for the 6502, it was easy to remember commenting n opcodes. When I moved to the 6809 in 1984, the instruction set was way more complicated, so I did get an assembler.

      1. In the early 70’s, I debugged a COBOL program by physically examining the bits on a 7-track magnetic tape created by the program. I had to determine whether the end of the data on the tape did or did not contain a magic bit pattern called a “tape mark”. Back then the bit density was so low that you could actually see the magnetized areas on the tape.

        To do this. you used something resembling an 8 inch plastic ruler. The top of the ruler had a shallow wide groove that was filled with some kind of ferrite in oil. The groove was then covered by a thin sheet of plastic,

        To use it, you laid it down over the tape and tapped it. A pattern of bits appeared consisting of row after row of little squares. The ‘1’ bits were dark brown, and the ‘0’ bits were light brown. I examined about 30 feet of tape for the tape mark pattern this way, six inches at a time. And yes, the terminating tape mark was missing.

        This kind of bare metal I/O must have been a fairly common thing to do. There had to be some sort of vendor making and selling tape readers.

      2. You do not know that time each run of the program take one night! Better debug using your pen and pencil than the computer! Actually running Cobol is faster but the management decided to use 4GL.

  9. At Graboplast (Győr, Hungary, EU) the enterprise system (developed and maintaned by the IT dept., where I was a programmer) was running on a TPA 11/40 (Hungarian clone of PDP 11/40). We were using DEC MUMPS, which is the best database system I’ve ever seen. Simple, pretty fast, a masterpiece of system design.

    Around 1992, one day, the machine stopped working. We have had a service contract with Albacomp (Székesfehérvár), so servicemen come, and replaced the 3-board, which was the CPU emulation, with an original CPU board (with shiny CPU on the middle). It ran 2.5-3x faster than the emulated one.

    Later we’ve bought a HP-UX 9000 system, and moved our enterprise software to Intersystems Standard Mumps (ISM), which was pretty compatible with DSM, as far as I remember, we haven’t modified any code.

  10. 1972. The college I was in bought a PDP-11 for the math department. It was installed over summer break. The lab assistant in charge of it was my buddy. The paper tape with the assembler was locked in a faculty office, so we assembled by hand on a blackboard. We tuned the CR bell on each of the 4 teletypes to a different pitch and wrote “Jingle Bells” in machine language. It was the most fun I have ever had with my clothes on.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.