From d0c10cd4af4dccef58183af925c431b1f520c5c7 Mon Sep 17 00:00:00 2001 From: Ariejan de Vroom Date: Wed, 20 Aug 2014 07:22:34 +0200 Subject: [PATCH] Add CpuType to differentiate between models/variants --- cpu.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cpu.go b/cpu.go index d197e54..6091404 100644 --- a/cpu.go +++ b/cpu.go @@ -22,8 +22,15 @@ type Cpu struct { SP byte // Stack Pointer 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 ( ZeropageBase = 0x0000 // 0x0000-00FF Reserved for zeropage instructions StackBase = 0x0100 // 0x0100-01FF Reserved for stack @@ -35,7 +42,7 @@ const ( // Create an new Cpu, using the AddressBus for accessing memory. 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.