pdp8

package module
v0.0.0-...-6b5edbd Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 6 Imported by: 0

README

gopdp8

A PDP-8 emulator written in Go.

The emulator implements as much as possible only portable instructions used by the family of 8. Therefore, there are a number of limitations:

  • No Group 3 instructions
  • No instructions to turn on/off individual device interrupts

This keeps the code simpler and means that a program that runs on it is likely to run on any PDP-8, assuming it has enough memory and connected devices.

Comment Conventions

Throughout the source code the bits are labeled differently to the DEC documentation. We define bit 0 as the Least Significant Bit.

Testing

In order to test the emulator you will need to supply digital images of a number of paper tapes. Please see fixtures/README.md for how to obtain them.

Documentation

For documentation about the paper tapes used please see docs/README.md for how to obtain them.

Licence

Copyright (C) 2023, Lawrence Woodman lwoodman@vlifesystems.com

This software is licensed under an MIT Licence. Please see the file, LICENCE.md, for details.

Documentation

Overview

TODO: Put in separate package?

TODO: Put in separate package? - rawterm - then change struct to RawTerm? and include writer so that can be used for in and out? TODO: Use via an interface as this isn't relevant for many uses

TODO: Put in separate package?

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PDP8

type PDP8 struct {
	// contains filtered or unexported fields
}

func New

func New() *PDP8

func (*PDP8) AddDevice

func (p *PDP8) AddDevice(d device) error

func (*PDP8) Cleanup

func (p *PDP8) Cleanup()

TODO: rename this

func (*PDP8) Load

func (p *PDP8) Load(filename string) error

TODO: Remove this and implement a BIN loader

func (*PDP8) LoadRIMTape

func (p *PDP8) LoadRIMTape(tty *TTY, filename string) error

Load paper tape in RIM format

func (*PDP8) Run

func (p *PDP8) Run(cycles int) (bool, int, error)

Returns (hlt, cyclesLeft, error) TODO: Improve cycle accuracy and return number left/over? TODO: Test cyclesLeft

func (*PDP8) SetPC

func (p *PDP8) SetPC(pc uint)

Set Program Counter

func (*PDP8) SetSR

func (p *PDP8) SetSR(sr uint)

Set Switch Register

func (*PDP8) Step

func (p *PDP8) Step() (bool, error)

Step Executes one instruction and moves to the next

type RawTerm

type RawTerm struct {
	// contains filtered or unexported fields
}

func NewRawTerm

func NewRawTerm() (*RawTerm, error)

func (*RawTerm) Close

func (r *RawTerm) Close() error

This reports if it couldn't restore the terminal so it's pretty important to handle this error rather than ignore errors from Close()

func (*RawTerm) Read

func (r *RawTerm) Read(p []byte) (n int, err error)

type TTY

type TTY struct {
	// contains filtered or unexported fields
}

func NewTTY

func NewTTY(conin io.Reader, conout io.Writer) *TTY

func (*TTY) Close

func (t *TTY) Close() error

Closes device but doesn't close any readers/writers passed to it

func (*TTY) PunchAttachTape

func (t *TTY) PunchAttachTape(tapeout io.Writer)

Attach a punched tape to the punch

func (*TTY) PunchStart

func (t *TTY) PunchStart()

Tell the paper tape punch to start punching the tape

func (*TTY) PunchStop

func (t *TTY) PunchStop()

Tell the paper tape pucnh to stop punching the tape

func (*TTY) ReaderAttachTape

func (t *TTY) ReaderAttachTape(tapein io.Reader)

Attach a punched tape to the reader

func (*TTY) ReaderIsEOF

func (t *TTY) ReaderIsEOF() bool

Returns whether the paper tape reader is finishing reading a tape

func (*TTY) ReaderPos

func (t *TTY) ReaderPos() int

ReaderPos returns the position on the paper tape, starting at 0

func (*TTY) ReaderStart

func (t *TTY) ReaderStart()

Tell the paper tape reader to start reading the tape

func (*TTY) ReaderStop

func (t *TTY) ReaderStop()

Tell the paper tape reader to stop reading the tape

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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