cpu6502

package
v0.0.0-...-fa24f98 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagCarry            byte = 0x01 // C
	FlagZero             byte = 0x02 // Z
	FlagInterruptDisable byte = 0x04 // I
	FlagDecimal          byte = 0x08 // D
	FlagBreak            byte = 0x10 // B
	FlagIgnored          byte = 0x20
	FlagOverflow         byte = 0x40 // V
	FlagNegative         byte = 0x80 // N
)

Flags set in cpu.P

View Source
const (
	InterruptNone = iota // 0
	InterruptIRQ
	InterruptNMI
)
View Source
const (
	NMIVector   = 0xfffa
	ResetVector = 0xfffc
	IRQVector   = 0xfffe
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressMode

type AddressMode byte

func (AddressMode) Addr

func (am AddressMode) Addr(cpu *CPU) uint16

func (AddressMode) AddrFast

func (am AddressMode) AddrFast(cpu *CPU) uint16

func (AddressMode) Debug

func (am AddressMode) Debug(cpu *CPU) string

func (AddressMode) Implied

func (am AddressMode) Implied(cpu *CPU)

func (AddressMode) Length

func (am AddressMode) Length() int

func (AddressMode) Read

func (am AddressMode) Read(cpu *CPU) byte

func (AddressMode) Write

func (am AddressMode) Write(cpu *CPU, v byte)

func (AddressMode) WriteFast

func (am AddressMode) WriteFast(cpu *CPU, v byte)

WriteFast writes without losing cycles

type CPU

type CPU struct {
	A    byte   // accumulator
	X, Y byte   // registers
	PC   uint16 // program counter
	S    byte   // stack pointer
	P    byte   // status register

	Memory memory.Master

	Trace io.Writer
	// contains filtered or unexported fields
}

func New

func New() *CPU

func (*CPU) Clock

func (cpu *CPU) Clock(uint64) uint64

func (*CPU) IRQ

func (cpu *CPU) IRQ()

func (*CPU) NMI

func (cpu *CPU) NMI()

func (*CPU) PeekPC

func (cpu *CPU) PeekPC() uint8

func (*CPU) PeekPC16

func (cpu *CPU) PeekPC16() uint16

func (*CPU) Pull

func (cpu *CPU) Pull() byte

func (*CPU) Pull16

func (cpu *CPU) Pull16() uint16

func (*CPU) Push

func (cpu *CPU) Push(v byte)

func (*CPU) Push16

func (cpu *CPU) Push16(v uint16)

func (*CPU) Read16

func (cpu *CPU) Read16(offt uint16) uint16

func (*CPU) Read16W

func (cpu *CPU) Read16W(offt uint16) uint16

func (*CPU) ReadPC

func (cpu *CPU) ReadPC() uint8

func (*CPU) ReadPC16

func (cpu *CPU) ReadPC16() uint16

func (*CPU) Reset

func (cpu *CPU) Reset()

func (*CPU) SetNMI

func (cpu *CPU) SetNMI(v byte)

func (*CPU) String

func (cpu *CPU) String() string

func (*CPU) TimeFreeze

func (cpu *CPU) TimeFreeze(v uint64) uint64

TimeFreeze is used to "freeze" the CPU by a number of cycles, delaying the next operation

Jump to

Keyboard shortcuts

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