From fac1c257b3ea9e02c9b3a35dee229fb5d767a7ac Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Sat, 4 Apr 2009 20:20:49 -0700 Subject: [PATCH] Fix default memory size and add UNUSED constant. (offe) --- src/py65/mpu6502.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/py65/mpu6502.py b/src/py65/mpu6502.py index 3ffdd17..e0559a0 100644 --- a/src/py65/mpu6502.py +++ b/src/py65/mpu6502.py @@ -9,6 +9,7 @@ class MPU: # processor flags NEGATIVE = 128 OVERFLOW = 64 + UNUSED = 32 BREAK = 16 DECIMAL = 8 INTERRUPT = 4 @@ -27,7 +28,7 @@ class MPU: self.internalCycleDelay = 0 if memory is None: - memory = 0xFFFF * [0x00] + memory = 0x10000 * [0x00] self.memory = memory self.start_pc = pc @@ -57,15 +58,19 @@ class MPU: self.a = 0 self.x = 0 self.y = 0 - self.flags = 32 + self.flags = self.UNUSED self.breakFlag = False self.processorCycles = 0 + # Helpers for addressing modes + def ByteAt(self, addr): return self.memory[addr] def WordAt(self, addr): return self.ByteAt(addr) + (self.ByteAt(addr + 1) << 8) + + # Addressing modes def ImmediateByte(self): return self.ByteAt(self.pc)