Version: v0.0.4 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 3 Imported by: 1



This package and spacewar.go implement a simple PDP-1 emulator complete enough to run the original PDP-1 video game Spacewar!

They are a translation of the Java emulator pdp1.java in http://spacewar.oversigma.com/sources/sources.zip.

See also the PDP-1 handbook at http://www.dbit.com/~greeng3/pdp1/pdp1.html

http://spacewar.oversigma.com/readme.html reads:

Spacewar! was conceived in 1961 by Martin Graetz, Stephen Russell,
and Wayne Wiitanen. It was first realized on the PDP-1 in 1962 by
Stephen Russell, Peter Samson, Dan Edwards, and Martin Graetz,
together with Alan Kotok, Steve Piner, and Robert A Saunders.
Spacewar! is in the public domain, but this credit paragraph must
accompany all distributed versions of the program.

This is the original version! Martin Graetz provided us with a
printed version of the source. We typed in in again - it was about
40 pages long - and re-assembled it with a PDP-1 assembler written
in PERL. The resulting binary runs on a PDP-1 emulator written as
a Java applet. The code is extremely faithful to the original. There
are only two changes. 1)The spaceships have been made bigger and
2) The overall timing has been special cased to deal with varying
machine speeds.

The "a", "s", "d", "f" keys control one of the spaceships. The "k",
"l", ";", "'" keys control the other. The controls are spin one
way, spin the other, thrust, and fire.

Barry Silverman
Brian Silverman
Vadim Gerasimov



This section is empty.


This section is empty.


This section is empty.


type HaltError

type HaltError Word

func (HaltError) Error

func (e HaltError) Error() string

type LoopError

type LoopError Word

func (LoopError) Error

func (e LoopError) Error() string

type M

type M struct {
	AC, IO, PC, OV Word
	Mem            [010000]Word
	Flag           [7]bool
	Sense          [7]bool
	Halt           bool

An M represents the machine state of a PDP-1. Clients can set Display to install an output device.

func (*M) Load

func (m *M) Load(r io.Reader) error

Load loads the machine's memory from a text input file listing octal address-value pairs, one per line, matching the regular expression ^[ +]([0-7]+)\t([0-7]+).

func (*M) Step

func (m *M) Step(t Trapper) error

Step runs a single machine instruction.

type Trapper

type Trapper interface {
	Trap(y Word)

A Trapper represents an object with a Trap method. The machine calls the Trap method to implement the PDP-1 IOT instruction.

type UnknownInstrError

type UnknownInstrError struct {
	Inst Word
	PC   Word

func (UnknownInstrError) Error

func (e UnknownInstrError) Error() string

type Word

type Word uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL