Versions in this module Expand all Collapse all v0 v0.0.4 Nov 12, 2025 Changes in this version type CPU + func (c *CPU) ROR_RevA() uint8 type CPUVariant + const VariantNMOS6502RevA + func (v CPUVariant) HasRORQuirk() bool v0.0.3 Nov 12, 2025 Changes in this version + func FormatFlags(p Flags) string + type AddrModeType uint8 + const AddrModeABS + const AddrModeABX + const AddrModeABY + const AddrModeIMM + const AddrModeIMP + const AddrModeIND + const AddrModeIZX + const AddrModeIZY + const AddrModeREL + const AddrModeZP0 + const AddrModeZPX + const AddrModeZPY + func (a AddrModeType) String() string + type Bus interface + Read func(addr uint16) uint8 + Write func(addr uint16, data uint8) + type CPU struct + A uint8 + P Flags + PC uint16 + SP uint8 + X uint8 + Y uint8 + func NewCPU(bus Bus) *CPU + func NewCPUWithConfig(bus Bus, config CPUConfig) *CPU + func NewCPUWithErrorHandler(bus Bus, handler ErrorHandler) *CPU + func NewCPUWithVariant(bus Bus, variant CPUVariant) *CPU + func NewCPUWithVariantAndErrorHandler(bus Bus, variant CPUVariant, handler ErrorHandler) *CPU + func (c *CPU) ABS() uint8 + func (c *CPU) ABX() uint8 + func (c *CPU) ABY() uint8 + func (c *CPU) ADC() uint8 + func (c *CPU) AND() uint8 + func (c *CPU) ASL() uint8 + func (c *CPU) BCC() uint8 + func (c *CPU) BCS() uint8 + func (c *CPU) BEQ() uint8 + func (c *CPU) BIT() uint8 + func (c *CPU) BMI() uint8 + func (c *CPU) BNE() uint8 + func (c *CPU) BPL() uint8 + func (c *CPU) BRK() uint8 + func (c *CPU) BVC() uint8 + func (c *CPU) BVS() uint8 + func (c *CPU) CLC() uint8 + func (c *CPU) CLD() uint8 + func (c *CPU) CLI() uint8 + func (c *CPU) CLV() uint8 + func (c *CPU) CMP() uint8 + func (c *CPU) CPX() uint8 + func (c *CPU) CPY() uint8 + func (c *CPU) ClearNMI() + func (c *CPU) Clock() error + func (c *CPU) CurrentOpcode() uint8 + func (c *CPU) DEC() uint8 + func (c *CPU) DEX() uint8 + func (c *CPU) DEY() uint8 + func (c *CPU) DisableInstructionCache() + func (c *CPU) Disassemble(startAddr, endAddr uint16) map[uint16]string + func (c *CPU) EOR() uint8 + func (c *CPU) EnableInstructionCache() + func (c *CPU) GetCurrentInstruction() *Instruction + func (c *CPU) GetState() string + func (c *CPU) GetStateSnapshot() State + func (c *CPU) HasPendingInterrupt() bool + func (c *CPU) IMM() uint8 + func (c *CPU) IMP() uint8 + func (c *CPU) INC() uint8 + func (c *CPU) IND() uint8 + func (c *CPU) INX() uint8 + func (c *CPU) INY() uint8 + func (c *CPU) IZX() uint8 + func (c *CPU) IZY() uint8 + func (c *CPU) InstructionCacheStats() (hits, misses uint64, hitRate float64) + func (c *CPU) InterruptRequest() + func (c *CPU) InvalidateInstructionCache() + func (c *CPU) IsIllegalOpcode(opcode uint8) bool + func (c *CPU) JMP() uint8 + func (c *CPU) JSR() uint8 + func (c *CPU) LDA() uint8 + func (c *CPU) LDX() uint8 + func (c *CPU) LDY() uint8 + func (c *CPU) LSR() uint8 + func (c *CPU) LastError() *CPUError + func (c *CPU) LookupInstruction(opcode uint8) Instruction + func (c *CPU) LookupTable() [256]Instruction + func (c *CPU) NOP() uint8 + func (c *CPU) NonMaskableInterrupt() + func (c *CPU) ORA() uint8 + func (c *CPU) Opcode() uint8 + func (c *CPU) PHA() uint8 + func (c *CPU) PHP() uint8 + func (c *CPU) PLA() uint8 + func (c *CPU) PLP() uint8 + func (c *CPU) REL() uint8 + func (c *CPU) ROL() uint8 + func (c *CPU) ROR() uint8 + func (c *CPU) RTI() uint8 + func (c *CPU) RTS() uint8 + func (c *CPU) RemainingCycles() uint8 + func (c *CPU) Reset() + func (c *CPU) SBC() uint8 + func (c *CPU) SEC() uint8 + func (c *CPU) SED() uint8 + func (c *CPU) SEI() uint8 + func (c *CPU) STA() uint8 + func (c *CPU) STX() uint8 + func (c *CPU) STY() uint8 + func (c *CPU) SetCycles(cycles uint8) + func (c *CPU) SetIRQ(asserted bool) + func (c *CPU) SetNMI(asserted bool) + func (c *CPU) TAX() uint8 + func (c *CPU) TAY() uint8 + func (c *CPU) TSX() uint8 + func (c *CPU) TXA() uint8 + func (c *CPU) TXS() uint8 + func (c *CPU) TYA() uint8 + func (c *CPU) TotalCycles() uint64 + func (c *CPU) Variant() CPUVariant + func (c *CPU) XXX() uint8 + func (c *CPU) ZP0() uint8 + func (c *CPU) ZPX() uint8 + func (c *CPU) ZPY() uint8 + type CPUBuilder struct + func NewBuilder(bus Bus) *CPUBuilder + func (b *CPUBuilder) Build() *CPU + func (b *CPUBuilder) DisableDecimalMode() *CPUBuilder + func (b *CPUBuilder) DisableInstructionCache() *CPUBuilder + func (b *CPUBuilder) WithErrorHandler(handler ErrorHandler) *CPUBuilder + func (b *CPUBuilder) WithInstructionCacheSize(size int) *CPUBuilder + func (b *CPUBuilder) WithStrictMode() *CPUBuilder + func (b *CPUBuilder) WithVariant(variant CPUVariant) *CPUBuilder + type CPUConfig struct + EnableDecimalMode bool + EnableInstructionCache bool + ErrorHandler ErrorHandler + InstructionCacheSize int + StrictMode bool + Variant CPUVariant + func DefaultConfig() CPUConfig + type CPUError struct + Message string + Opcode uint8 + PC uint16 + Type ErrorType + func (e *CPUError) Error() string + type CPUVariant int + const VariantCMOS65C02 + const VariantNMOS6502 + const VariantRicoh2A03 + const VariantRicoh2A07 + func (v CPUVariant) HasIndirectJMPBug() bool + func (v CPUVariant) String() string + func (v CPUVariant) SupportsDecimalMode() bool + type ErrorHandler interface + HandleError func(err *CPUError) error + type ErrorType uint8 + const ErrorBusError + const ErrorIllegalOpcode + const ErrorInvalidState + type Flags uint8 + const B + const C + const D + const I + const N + const U + const V + const Z + type Instruction struct + AddrMode func(*CPU) uint8 + AddrModeType AddrModeType + Cycles uint8 + Illegal bool + Length uint8 + Name string + Operate func(*CPU) uint8 + PageCrossPenalty bool + type InstructionCache struct + func NewInstructionCache() *InstructionCache + func (ic *InstructionCache) Invalidate() + func (ic *InstructionCache) Lookup(pc uint16, opcode uint8) (*Instruction, bool) + func (ic *InstructionCache) Stats() (hits, misses uint64, hitRate float64) + func (ic *InstructionCache) Store(pc uint16, opcode uint8, instruction *Instruction) + type InstructionCacheEntry struct + type LoggingErrorHandler struct + Logger *log.Logger + func (h *LoggingErrorHandler) HandleError(err *CPUError) error + type State struct + A uint8 + Cycles uint8 + InInterrupt bool + Instruction string + InterruptVector uint16 + Opcode uint8 + P Flags + PC uint16 + SP uint8 + TotalCycles uint64 + X uint8 + Y uint8 + func (s State) String() string + type StrictErrorHandler struct + func (h *StrictErrorHandler) HandleError(err *CPUError) error