1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-05-28 22:41:34 +00:00

Add CpuType to differentiate between models/variants

This commit is contained in:
Ariejan de Vroom 2014-08-20 07:22:34 +02:00
parent a174259751
commit d0c10cd4af

9
cpu.go
View File

@ -22,8 +22,15 @@ type Cpu struct {
SP byte // Stack Pointer SP byte // Stack Pointer
Bus *AddressBus // The address bus Bus *AddressBus // The address bus
CpuType int // Which type of CPU is begin emulated
} }
const (
Cpu6502 = iota // The original MOS 6502, no bugs
Cpu65C02 // The WDC 65C02 version
)
const ( const (
ZeropageBase = 0x0000 // 0x0000-00FF Reserved for zeropage instructions ZeropageBase = 0x0000 // 0x0000-00FF Reserved for zeropage instructions
StackBase = 0x0100 // 0x0100-01FF Reserved for stack StackBase = 0x0100 // 0x0100-01FF Reserved for stack
@ -35,7 +42,7 @@ const (
// Create an new Cpu, using the AddressBus for accessing memory. // Create an new Cpu, using the AddressBus for accessing memory.
func NewCpu(bus *AddressBus) (*Cpu, error) { func NewCpu(bus *AddressBus) (*Cpu, error) {
return &Cpu{Bus: bus}, nil return &Cpu{Bus: bus, CpuType: Cpu6502}, nil
} }
// Returns a string containing the current state of the CPU. // Returns a string containing the current state of the CPU.