1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-14 13:29:28 +00:00

Flags are now set to 0 on reset.

This commit is contained in:
Mike Naberezny 2009-08-16 19:17:38 -07:00
parent a5482c1e1b
commit 00e247ecb7
3 changed files with 16 additions and 2 deletions

View File

@ -13,6 +13,9 @@ Next Release
- MPU objects now return a two-line string as their __repr__ with
the processor status register displayed as binary for readability.
- The processor status register is now initialized to 0 on reset.
Previously, its unused bit (bit 5) was set to 1 on reset.
0.6 (2009-08-11)
- Added monitor shortcut "a" for "assemble".

View File

@ -44,7 +44,7 @@ class MPU:
"%s: %04x %02x %02x %02x %02x %s"
return out % (indent, self.name,
self.pc, self.a, self.x, self.y, self.pc, flags)
self.pc, self.a, self.x, self.y, self.sp, flags)
def step(self):
instructCode = self.ImmediateByte()
@ -63,7 +63,7 @@ class MPU:
self.a = 0
self.x = 0
self.y = 0
self.flags = self.UNUSED
self.flags = 0
self.processorCycles = 0
# Helpers for addressing modes

View File

@ -6,6 +6,17 @@ import py65.devices.mpu6502
class Common6502Tests:
"""Tests common to 6502-based microprocessors"""
# Reset
def test_reset_sets_registers_to_initial_states(self):
mpu = self._make_mpu()
mpu.reset()
self.assertEquals(0xFF, mpu.sp)
self.assertEquals(0, mpu.a)
self.assertEquals(0, mpu.x)
self.assertEquals(0, mpu.y)
self.assertEquals(0, mpu.flags)
# ADC Absolute
def test_adc_bcd_off_absolute_carry_clear_in_accumulator_zeroes(self):