Version: v0.0.0-...-faf97dc Latest Latest

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

Go to latest
Published: Jul 25, 2021 License: GPL-3.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type FlatMemory

type FlatMemory struct {
	// contains filtered or unexported fields

FlatMemory puts RAM on the 64Kb addressable by the processor

func (*FlatMemory) Peek

func (m *FlatMemory) Peek(address uint16) uint8

Peek returns the data on the given address

func (*FlatMemory) PeekCode

func (m *FlatMemory) PeekCode(address uint16) uint8

PeekCode returns the data on the given address

func (*FlatMemory) Poke

func (m *FlatMemory) Poke(address uint16, value uint8)

Poke sets the data at the given address

type Memory

type Memory interface {
	Peek(address uint16) uint8
	Poke(address uint16, value uint8)

	// PeekCode can bu used to optimize the memory manager to requests with more
	// locality. It must return the same as a call to Peek()
	PeekCode(address uint16) uint8

Memory represents the addressable space of the processor

type State

type State struct {
	// contains filtered or unexported fields

State represents the state of the simulated device

func NewCMOS65c02

func NewCMOS65c02(m Memory) *State

NewCMOS65c02 returns an initialized 65c02

func NewNMOS6502

func NewNMOS6502(m Memory) *State

NewNMOS6502 returns an initialized NMOS6502

func (*State) ExecuteInstruction

func (s *State) ExecuteInstruction()

ExecuteInstruction transforms the state given after a single instruction is executed.

func (*State) GetAXYP

func (s *State) GetAXYP() (uint8, uint8, uint8, uint8)

GetAXYP returns the value of the A, X, Y and P registers

func (*State) GetCarryAndAcc

func (s *State) GetCarryAndAcc() (bool, uint8)

GetCarryAndAcc returns the value of the carry flag and the accumulator. Used to trace MLI calls

func (*State) GetCycles

func (s *State) GetCycles() uint64

GetCycles returns the count of CPU cycles since last reset.

func (*State) GetPCAndSP

func (s *State) GetPCAndSP() (uint16, uint8)

GetPCAndSP returns the current program counter and stack pointer. Used to trace MLI calls

func (*State) GetTrace

func (s *State) GetTrace() bool

GetTrace gets trhe tracing state of the cpu execution

func (*State) Load

func (s *State) Load(r io.Reader) error

Load loads the CPU state (registers and cycle counter)

func (*State) Reset

func (s *State) Reset()

Reset resets the processor. Moves the program counter to the vector in 0cfffc.

func (*State) Save

func (s *State) Save(w io.Writer) error

Save saves the CPU state (registers and cycle counter)

func (*State) SetAXYP

func (s *State) SetAXYP(regA uint8, regX uint8, regY uint8, regP uint8)

SetAXYP changes the value of the A, X, Y and P registers

func (*State) SetMemory

func (s *State) SetMemory(mem Memory)

SetMemory changes the memory provider

func (*State) SetPC

func (s *State) SetPC(pc uint16)

SetPC changes the program counter, as a JMP instruction

func (*State) SetTrace

func (s *State) SetTrace(trace bool)

SetTrace activates tracing of the cpu execution

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL