emulator

package
v0.0.0-...-68e8ff9 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CAPP_TICK_COST = 1    // Cost of a single CAPP tick.
	ALU_TICK_COST  = 4    // Cost of an ALU tick.
	CAPP_SIZE      = 8192 // 4K for program text, 1K for compiled, 3K for work
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Emulator

type Emulator struct {
	Verbose  bool         // If set, enables verbose logging.
	*cpu.Cpu              // Reference to the CPU simulation.
	Program  *cpu.Program // Reference to the currently running program listing.

	Temporary sio.Temporary // Temporary buffer IO channel.
	Tape      sio.Tape      // Tape IO channel.
	Depot     sio.Depot     // Depot (Drum and Ring) IO channel.
	Rom       sio.Rom       // ROM IO channel.

	TrapRequest chan uint32
}

Emulator state. CPU + CAPP + IO channels.

func NewEmulator

func NewEmulator() (emu *Emulator)

NewEmulator creates a new emulator.

func (*Emulator) Close

func (emu *Emulator) Close() (err error)

Close the emulator

func (*Emulator) Code

func (emu *Emulator) Code() cpu.Code

Code returns the current instruction code.

func (*Emulator) Defines

func (emu *Emulator) Defines() iter.Seq2[string, string]

Defines returns an iterator over all of the defines

func (*Emulator) Ip

func (emu *Emulator) Ip() int

Ip returns current instruction pointer.

func (*Emulator) LineNo

func (emu *Emulator) LineNo() int

LineNo returns the current line number for the executing opcode.

func (*Emulator) Power

func (emu *Emulator) Power() int

Power returns the total power consumed.

func (*Emulator) Reset

func (emu *Emulator) Reset(boot cpu.CodeChannel) (err error)

Reset the assembler state

func (*Emulator) Tick

func (emu *Emulator) Tick() (done bool, err error)

Tick performs a single tick of the emulator.

func (*Emulator) Ticks

func (emu *Emulator) Ticks() int

Ticks returns the total ticks since a reset.

type ErrRuntime

type ErrRuntime struct {
	LineNo int
	Err    error
}

ErrRuntime indicates the location of a runtime error.

func (*ErrRuntime) Error

func (err *ErrRuntime) Error() string

func (*ErrRuntime) Unwrap

func (err *ErrRuntime) Unwrap() error

Jump to

Keyboard shortcuts

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