1
0
mirror of https://github.com/mnaberez/py65.git synced 2025-01-07 20:31:47 +00:00

Fix default memory size and add UNUSED constant. (offe)

This commit is contained in:
Mike Naberezny 2009-04-04 20:20:49 -07:00
parent 1ed2582247
commit fac1c257b3

View File

@ -9,6 +9,7 @@ class MPU:
# processor flags # processor flags
NEGATIVE = 128 NEGATIVE = 128
OVERFLOW = 64 OVERFLOW = 64
UNUSED = 32
BREAK = 16 BREAK = 16
DECIMAL = 8 DECIMAL = 8
INTERRUPT = 4 INTERRUPT = 4
@ -27,7 +28,7 @@ class MPU:
self.internalCycleDelay = 0 self.internalCycleDelay = 0
if memory is None: if memory is None:
memory = 0xFFFF * [0x00] memory = 0x10000 * [0x00]
self.memory = memory self.memory = memory
self.start_pc = pc self.start_pc = pc
@ -57,16 +58,20 @@ class MPU:
self.a = 0 self.a = 0
self.x = 0 self.x = 0
self.y = 0 self.y = 0
self.flags = 32 self.flags = self.UNUSED
self.breakFlag = False self.breakFlag = False
self.processorCycles = 0 self.processorCycles = 0
# Helpers for addressing modes
def ByteAt(self, addr): def ByteAt(self, addr):
return self.memory[addr] return self.memory[addr]
def WordAt(self, addr): def WordAt(self, addr):
return self.ByteAt(addr) + (self.ByteAt(addr + 1) << 8) return self.ByteAt(addr) + (self.ByteAt(addr + 1) << 8)
# Addressing modes
def ImmediateByte(self): def ImmediateByte(self):
return self.ByteAt(self.pc) return self.ByteAt(self.pc)