interpreter

package
v0.0.0-...-4e5b205 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DEBUGGER_OPCODE_DUMP_REGS uint8 = 0xA
View Source
const DEBUGGER_OPCODE_DUMP_ROM uint8 = 0xE
View Source
const DEBUGGER_OPCODE_GET uint8 = 0x1

OP-Codes

View Source
const DEBUGGER_OPCODE_HI uint8 = 0x4
View Source
const DEBUGGER_OPCODE_LO uint8 = 0x8
View Source
const DEBUGGER_OPCODE_SET uint8 = 0x2
View Source
const DEBUGGER_OPCODE_STEP uint8 = 0xC
View Source
const MaxSRAMValue uint16 = 0x7FFF

MaxSRAMValue is the maximum address the SRAM can be accessed at

View Source
const SRAMPageBits uint = 4

SRAMPageBits is the bit count needed to represent SRAMPageCount

View Source
const SRAMPageCount uint = 16

SRAMPageCount determines how many memory pages are available

View Source
const SRAMPageMask uint16 = 0x000F

SRAMPageMask is a mask that can be applied to a 16 bit unsigned integer to make it safe to use as an SRAM page address

Variables

This section is empty.

Functions

func Interpret

func Interpret(file string, attach bool, maxSteps int, symbolOverride string)

Interpret runs the MCPC debugger

func VMRun

func VMRun(file, traceFile string)

VMRun executes the given file in a virtual MCPC

Types

type Device

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

Device represents a physical MCPC device attached via a serial port

type Register

type Register struct {
	Address   byte
	Value     uint16
	Writeable bool
}

Register represents a single register of an MCPC instance

func GetReg

func GetReg(vm *VM, ins uint16, reg uint16) *Register

GetReg extracts details about a register from an instruction in the context of a VM

type Registers

type Registers struct {
	A, B, C, D, E, F, G, H, SCR1, SCR2, SP, PC, Zero, One, NegOne, BUS *Register
}

Registers includes all registers of an MCPC instance

type VM

type VM struct {
	RegDef      *Registers
	RegIrq      *Registers
	SRAM        []uint16
	EEPROM      []uint16
	Halted      bool
	SRAMPageDef uint16
	SRAMPageIrq uint16
	VgaWidth    uint16
	VgaHeight   uint16
	VgaBuffer   []uint16

	IrqEn      bool
	InIrq      bool
	IrqHandler uint16
	IrqQueue   chan uint32

	// addr relative to VgaBuffer (0 is x=y=0)
	VgaChangeCallback func(addr, x, y, old, new uint16)

	TraceCallback func(msg string, step int64)
	StepCounter   int64
	// contains filtered or unexported fields
}

VM represents an MCPC virtual machine state

func NewVM

func NewVM(program []uint16, vgaWidth, vgaHeight uint16) *VM

NewVM creates a new MCPC virtual machine instance

func (*VM) InjectIRQ

func (vm *VM) InjectIRQ(irqData uint32)

InjectIRQ writes the given IRQ payload into the VM's IRQ FIFO

func (*VM) Registers

func (vm *VM) Registers() *Registers

Register arbitration (DEF/IRQ)

func (*VM) SRAMPage

func (vm *VM) SRAMPage() uint16

SRAMPage arbitration (DEF/IRQ)

func (*VM) Step

func (vm *VM) Step() (bool, error)

Step executes a single instruction step of this MCPC virtual machine instance; Returns true if a debug break instruction has been hit

Jump to

Keyboard shortcuts

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