Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

impl

std › pdp10 › impl

The PDP-10: 36-bit words, 16 accumulators, and a representative subset of its instructions, all in the one word format.

from std.pdp10.impl import *

movei ac1, 0, Index(0), 42
04 08 80 00 2a

Each instruction takes its operands as the manual’s fields: accumulator ac, indirect bit i, index register x, and address y. The machine is word-addressed, so a word has no byte order; bitter packs its 36 bits into 5 bytes with 4 zero bits above them.

Opcodes are from the DEC PDP-10 System Reference Manual (DEC-10-HGAA-D), Appendix A.

Macros

instr

An instruction with any opcode, for one this module doesn’t name, such as an operating system’s monitor call.

SyntaxParametersResultDescription
instr opcode, ac, i, x, yopcode: int, ac: int, i: int, x: int, y: intemits Instr

halt

Stops the processor. It’s JRST 4,.

SyntaxParametersResultDescription
haltemits Instr

jrst

Jumps to the effective address.

SyntaxParametersResultDescription
jrst i, x, yi: int, x: Index, y: intemits Instr

jumpa

Jumps to the effective address. JUMPA is JUMP with the “always” condition.

SyntaxParametersResultDescription
jumpa i, x, yi: int, x: Index, y: intemits Instr

movei

Loads the effective address itself, not what’s there, into ac: an immediate load.

SyntaxParametersResultDescription
movei ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

move

Loads the word at the effective address into ac.

SyntaxParametersResultDescription
move ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

movem

Stores ac at the effective address.

SyntaxParametersResultDescription
movem ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

add

Adds the word at the effective address into ac. Addresses 0 to 15 are the accumulators, so add(ac1, 0, Index(0), 2) adds ac2 into ac1.

SyntaxParametersResultDescription
add ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

addi

Adds the effective address itself into ac.

SyntaxParametersResultDescription
addi ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

sub

Subtracts the word at the effective address from ac.

SyntaxParametersResultDescription
sub ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

and

ANDs the word at the effective address into ac.

SyntaxParametersResultDescription
and ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

cain

Compares ac with the effective address itself, and skips the next instruction if they’re not equal.

SyntaxParametersResultDescription
cain ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

exch

Swaps ac with the word at the effective address.

SyntaxParametersResultDescription
exch ac, i, x, yac: AC, i: int, x: Index, y: intemits Instr

asciz

A string packed the way MACRO-10’s ASCIZ packs it: five 7-bit characters to a word, first character in the high bits, low bit unused, and at least one NUL at the end. Each word is its own emitted value, so a label after it still counts words.

SyntaxParametersResultDescription
asciz source<S>, source: S

Types

AC

type AC = bits<4>

An accumulator number, 0 to 15.

Opcode

type Opcode = bits<9>

The 9-bit opcode.

Indirect

type Indirect = bits<1>

The indirect bit: 1 means y holds the address of the operand’s address.

Index

type Index = bits<4>

An index register number. Any accumulator but 0 can be one; 0 means none.

Addr

type Addr = bits<18>

An 18-bit address.

Instr

struct Instr

The PDP-10 instruction word: opcode (9 bits), ac (4), i (1), x (4) and y (18), most significant first.

Word

type Word = bits<36>

A 36-bit data word.

Constants

ConstantTypeValueDescription
ac0AC(0)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac1AC(1)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac2AC(2)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac3AC(3)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac4AC(4)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac5AC(5)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac6AC(6)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac7AC(7)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac8AC(8)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac9AC(9)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac10AC(10)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac11AC(11)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac12AC(12)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac13AC(13)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac14AC(14)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.
ac15AC(15)An accumulator. None is wired to zero, and there are no ABI names: each PDP-10 operating system had its own conventions.