Learn Multi platform PDP11 Assembly Programming... With Octal!
This is work in progress... This tutorial is planned to start in 2020

Don't like to read? you can learn while you watch and listen instead!

Every Lesson in this series has a matching YOUTUBE video... with commentary and practical examples

Visit the authors Youtube channel, or Click the icons to the right when you see them to watch the Lessons video!

Before the ZX Spectrum, the CPC and Nintendo, computing was literally a 'bigger' thing... the PDP-11 by DEC was an early computer...

Impressively advanced for it's time, it's programming language resembles the 68000, and some of it's other design ideas can be seen in other processors today.

The front of the PDP unit is lit up with LED's and covered in switches... these aren't just a sci-fi prop though, the PDP panel can be used as a hardware monitor and debugger, allowing any address in the CPU's memory to be read and altered.... in fact booting the PDP-11 may require setting many of these switches to program a 'boot sequence' into ram.

A PDP/40

The PDP-11 front panel.

If you want to learn PDP-11 get the Cheatsheet! it has all the 6502 commands, it also covers the extra commands used by the 65c02 and PC-Engine HuC6280

What is the PDP and what the heck is 'Octal'?
The PDP-11 is an 16-Bit processor - in the 1970s it was classed as a 'MiniComputer'... the CPU unit was around the size of a microwave, and when connected to disk drives and other hardware, the whole computer was the size of a single 'rack'
Octal is a numbering system known as 'Base-8' - it uses digits 0-7, effectively grouping digits from sets of 3 bits.

Octal allows binary to converted to digits, without using any extra 'letters', allowing for easier display and usage on conventional hardware like calculators.

If we're going to use the PDP-11 we need to get used to octal, as that's how all the documentation is written... fortunately, because it only uses 'digits' it won't be too strange, and we can mostly not worry about it!

While Octal is the 'norm' in PDP, Our Assembler can use other formats with the following syntax.

Binary 0b
Octal (default) - or 0o
Decimal .
Hexadecimal 0x
Ascii ''
- `1234` -- octal (decimal in case you use `decimalnumbers` directive)
- `1234.` -- decimal
- `0b101010` -- binary
- `0o1234` -- octal
- `0x1234` -- hexadimical

the PDP 11 is a Little Endian system... Low bytes are stored at even numbered addressses, and High bytes are stored at odd addresses
Oct Dec Hex Binary
1 1 1 1
2 2 2 10
3 3 3 11
4 4 4 100
5 5 5 101
6 6 6 110
7 7 7 111
10 8 8 1000
11 9 9 1001
12 10 A 1010
13 11 B 1011
14 12 C 1100
15 13 D 1101
16 14 E 1110
17 15 F 1111
20 16 10 10000
100 64 40 1000000

The PDP-11 and UKNC content on this site wouldn't have been possible without the help of 'aberrant'... who's also working on a UKNC port of Chibiakumas!... not only is it an impressive feat, but the code is incredibly well commented, and worth looking at for UKNC insights

You can check out aberrant's work here!

Using The PDP-11 Front panel
The PDP 11 has an advanced front panel, which effectively can operate as a debugger, and is also able to program words of data into memory... The

There are 18-22 SWITCHes numbered 0-17/21 - these are used to set a value to be used as an address or as a value to store. the ADDRESS leds show the address being set or probed, the DATA leds show the value at an address/register

You can try out the PDP interface online... Here!

The other switches and leds have the following functions:

The PDP-11 Registers

The PDP-11's registers are ALL 16 bit.






LK Often Used to remember the return address during calls
SP (R6)
SP Stack pointer
PC (R7)
PC Used to remember running address

If an Even register number (R0,R2,R4) is used for certain commands (for example MUL)- the register and it's following will be used as a 32 bit pair when the result is returned
    Flags: -------- PPPTNZVC

Name Meaning
- unused
P Priority
T Trap
N Negative 1=Negative
Z Zero 1=Result Zero
V Overflow
C Carry 1=Carry

The PDP-11 Addressing Modes
The PDP-11 has 8 different addressing modes... many are similar to much later systems... in addition it has 4 'effective modes' which are defined by using Reg 7 as a parameter
'Deferred' addressing is known as indirect addressing on other systems
Octal Representation Mode Description
Sample Command 68000 Equivalent effective result
0 R
Register Value is taken from Registers itself Rn

1 R
Register Deferred Value is taken from address in register (Rn) or @Rn
2 R
Auto Increment Value is taken from address in register.... register increased by bytes read (Rn)+

3 R
Auto Increment Deferred Value is taken from address at address in register.... register increased by 2 @(Rn)+

4 R
Auto Decrement Value is taken from address in register.... register decreased by bytes read -(Rn)

5 R
Auto Decrement Deferred Value is taken from address at address in register.... register decreased by 2 @-(Rn)

6 R
Indexed Value is taken from address in register + a fixed number n(Rn)
(2,R2) (Rn+n)
7 R
Indexed Deferred Value is taken from address at address in register + a fixed number @n(Rn)

2 7
Immediate Fixed numeric value #n
3 7
Absolute Value from fixed address @#A
6 7
Relative Value from relative address A

7 7
Relative deferred Value from address in address @A


Macro-11 is the Assembler that is used by RT-11... Macro-11 is case insensitive, it also only uses the first 6 characters of labels and symbols... this limit extends to file names -which must be 6 characters or less... eg 123456.MAC or ABCDEF.asm

We can complement (flip the bits) of a constant with ^C eg #^C123

Missing commands
AND We don't have an AND command, but we can fake one, we flip all the bits of our register, and use BIS (OR)
Here is the equivalent of AND #7
bis #177770,r0    ;effecitive AND #7
or bis #^C7
We need to specify a register to use with calls
JSR PC,\addr
PUSH reg
POP reg
We need to specify a stack poiinter with our calls
MOV  \reg,-(SP)
MOV  (SP)+,\reg


View Options
Default Dark
Simple (Hide this menu)
Print Mode (white background)

Top Menu
Youtube channel
ASM Programming Forums
Dec/Bin/Hex/Oct/Ascii Table

Z80 Content
Learn Z80 Assembly
Hello World
Advanced Series
Multiplatform Series
Platform Specific Series
ChibiAkumas Series
Grime Z80
Z80 Downloads
Z80 Cheatsheet
DevTools kit
Z80 Platforms
Amstrad CPC
Elan Enterprise
Gameboy & Gameboy Color
Master System & GameGear
Sam Coupe
ZX Spectrum
Spectrum NEXT
Camputers Lynx

6502 Content
Learn 6502 Assembly
Advanced Series
Platform Specific Series
Grime 6502
6502 Cheatsheet
DevTools kit
6502 Platforms
Apple IIe
Atari 800 and 5200
Atari Lynx
BBC Micro
Commodore 64
Commander x16
Super Nintendo (SNES)
Nintendo NES / Famicom
PC Engine (Turbografx-16)
Vic 20

68000 Content
Learn 68000 Assembly
Platform Specific Series
Grime 68000
68000 Cheatsheet
DevTools kit
68000 Platforms
Amiga 500
Atari ST
Neo Geo
Sega Genesis / Mega Drive
Sinclair QL (Quantum Leap)
X68000 (Sharp x68k)

My Game projects
Chibi Aliens
Chibi Akumas

Work in Progress
Learn 6809 Assembly
Learn 65816 Assembly
Learn 6809 Assembly
Learn PDP11 Assembly
Learn TMS9900 Assembly
Learn 8086 Assembly (x86)
Learn Risc-V Assembly
Learn ARM Assembly
Dragon 32/Tandy Coco
Ti 99
Gameboy Advance
Risc Os

Misc bits
Ruby programming

Chibi Akumas V1.666 has taken over 350 hours of development, if you want to support my work, and learn all the secrets of the game's development, please back me on patreon!

Thanks to Homebrew Legends for help promoting my game!
Buy Chibi Akuma(s) from PolyPlay
Buy ChibiAkuma(s) games now!