mirror of https://github.com/mnaberez/py65.git
parent
1b279ef851
commit
94a22330cf
|
@ -15,6 +15,9 @@
|
|||
- Added ``irq()`` and ``nmi()`` methods to the ``MPU`` class, so that
|
||||
interrupts can be simulated. Patch by Irmen de Jong.
|
||||
|
||||
- The ``MPU`` class constructor now accepts ``None`` for the initial PC, which
|
||||
will cause it to read the address from the reset vector on ``reset()``.
|
||||
|
||||
1.1.0 (2018-07-01)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class MPU:
|
|||
if memory is None:
|
||||
memory = 0x10000 * [0x00]
|
||||
self.memory = memory
|
||||
self.start_pc = pc
|
||||
self.start_pc = pc # if None, reset vector is used
|
||||
|
||||
# init
|
||||
self.reset()
|
||||
|
@ -67,6 +67,8 @@ class MPU:
|
|||
|
||||
def reset(self):
|
||||
self.pc = self.start_pc
|
||||
if self.pc is None:
|
||||
self.pc = self.WordAt(self.RESET)
|
||||
self.sp = self.byteMask
|
||||
self.a = 0
|
||||
self.x = 0
|
||||
|
|
|
@ -18,6 +18,24 @@ class Common6502Tests:
|
|||
self.assertEqual(0, mpu.y)
|
||||
self.assertEqual(mpu.BREAK | mpu.UNUSED, mpu.p)
|
||||
|
||||
def test_reset_sets_pc_to_0_by_default(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.reset()
|
||||
self.assertEqual(mpu.pc, 0)
|
||||
|
||||
def test_reset_sets_pc_to_start_pc_if_not_None(self):
|
||||
mpu = self._make_mpu(pc=0x1234)
|
||||
mpu.reset()
|
||||
self.assertEqual(mpu.pc, 0x1234)
|
||||
|
||||
def test_reset_reads_reset_vector_if_start_pc_is_None(self):
|
||||
mpu = self._make_mpu(pc=None)
|
||||
target = 0xABCD
|
||||
mpu.memory[mpu.RESET+0] = target & 0xff
|
||||
mpu.memory[mpu.RESET+1] = target >> 8
|
||||
mpu.reset()
|
||||
self.assertEqual(mpu.pc, 0xABCD)
|
||||
|
||||
# ADC Absolute
|
||||
|
||||
def test_adc_bcd_off_absolute_carry_clear_in_accumulator_zeroes(self):
|
||||
|
|
Loading…
Reference in New Issue