cpu

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

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag byte

Flag is the possible different status flags for the CPU.

const (
	C Flag = 1 << iota // C is the Carry Bit flag.
	Z                  // Z is the Zero flag.
	I                  // I is the Disable Interrupts flag.
	D                  // D is the Decimal Mode flag.
	B                  // B is the Break flag.
	U                  // U is the Unused flag.
	V                  // V is the Overflow flag.
	N                  // N is the Negative flag.
)

Mos6502 Status Flags

type Mos6502

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

Mos6502 represents a Mos 6502 CPU.

func NewMos6502

func NewMos6502() *Mos6502

NewMos6502 constructs and returns a pointer to an instance of Mos6502.

func (*Mos6502) Clock

func (cpu *Mos6502) Clock()

Clock is the clock signal.

func (*Mos6502) ConnectBus

func (cpu *Mos6502) ConnectBus(b *bus.Bus)

ConnectBus connects the CPU to a Bus.

func (*Mos6502) Disassemble

func (cpu *Mos6502) Disassemble(addressStart uint16, addressStop uint16) map[uint16]string

Disassemble builds a map of assembly strings for a given range of addresses.

func (*Mos6502) GetAccumulator

func (cpu *Mos6502) GetAccumulator() byte

GetAccumulator returns the current value of the Accumulator Register.

func (*Mos6502) GetProgramCounter

func (cpu *Mos6502) GetProgramCounter() uint16

GetProgramCounter returns the current value of the Program Counter.

func (*Mos6502) GetStackPointer

func (cpu *Mos6502) GetStackPointer() byte

GetStackPointer returns the current value of the Stack Pointer.

func (*Mos6502) GetStatusFlag

func (cpu *Mos6502) GetStatusFlag(f Flag) byte

GetStatusFlag returns the current value of specific bit on CPU status register.

func (*Mos6502) GetX

func (cpu *Mos6502) GetX() byte

GetX returns the current value of the X Register.

func (*Mos6502) GetY

func (cpu *Mos6502) GetY() byte

GetY returns the current value of the Y Register.

func (*Mos6502) InterruptRequest

func (cpu *Mos6502) InterruptRequest()

InterruptRequest is the interrupt request signal. Requires the Interrupt Disable (I) flag to be set to 0 or else nothing happens. The currently running instruction is allowed to complete before the Interrupt Request does its thing.

func (*Mos6502) NonMaskableInterrupt

func (cpu *Mos6502) NonMaskableInterrupt()

NonMaskableInterrupt is the non-maskable interrupt request signal, which cannot be ignored. It has the same behavior as the normal Interrupt Request but reads 0xfffa to set the program counter.

func (*Mos6502) Reset

func (cpu *Mos6502) Reset()

Reset signals the cpu to reset to a known state.

Jump to

Keyboard shortcuts

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