Skip to content
Browse files

Remove the old "debug" mode

  • Loading branch information...
1 parent 456a345 commit 9831529f4b8af4fa0f3d91e0e5ff15ee66ebe225 @mnaberez committed
Showing with 101 additions and 109 deletions.
  1. +1 −4 src/py65/devices/mpu6502.py
  2. +0 −5 src/py65/tests/devices/test_mpu6502.py
  3. +100 −100 src/py65/tests/devices/test_mpu65c02.py
View
5 src/py65/devices/mpu6502.py
@@ -22,9 +22,8 @@ class MPU:
ADDR_WIDTH = 16
ADDR_FORMAT = "%04x"
- def __init__(self, memory=None, pc=0x0000, debug=False):
+ def __init__(self, memory=None, pc=0x0000):
# config
- self.debug = debug
self.name = '6502'
self.byteMask = ((1<<self.BYTE_WIDTH)-1)
self.addrMask = ((1<<self.ADDR_WIDTH)-1)
@@ -494,8 +493,6 @@ def opLDX(self, y):
# instructions
def inst_not_implemented(self):
- if self.debug:
- raise NotImplementedError
self.pc += 1
instruct = [inst_not_implemented] * 256
View
5 src/py65/tests/devices/test_mpu6502.py
@@ -5215,11 +5215,6 @@ def test_repr(self):
mpu = self._make_mpu()
self.assert_("6502" in repr(mpu))
- def test_stz_not_supported(self):
- mpu = self._make_mpu(debug=True)
- mpu.memory[0x0000] = 0x64 #=> stz (on 65c02)
- self.assertRaises(NotImplementedError, mpu.step)
-
def _get_target_class(self):
return py65.devices.mpu6502.MPU
View
200 src/py65/tests/devices/test_mpu65c02.py
@@ -12,7 +12,7 @@ def test_repr(self):
self.assert_('65C02' in repr(mpu))
# ADC Zero Page, Indirect
-
+
def test_adc_bcd_off_zp_indirect_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
@@ -26,7 +26,7 @@ def test_adc_bcd_off_zp_indirect_carry_clear_in_accumulator_zeroes(self):
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
-
+
def test_adc_bcd_off_zp_indirect_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
@@ -41,7 +41,7 @@ def test_adc_bcd_off_zp_indirect_carry_set_in_accumulator_zero(self):
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEquals(mpu.CARRY, mpu.p & mpu.CARRY)
-
+
def test_adc_bcd_off_zp_indirect_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
@@ -53,20 +53,20 @@ def test_adc_bcd_off_zp_indirect_carry_clear_in_no_carry_clear_out(self):
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0xFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
- self.assertEqual(0, mpu.p & mpu.CARRY)
+ self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
-
+
def test_adc_bcd_off_zp_indirect_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
self._write(mpu.memory, 0x0000, (0x72, 0x10)) #=> $0000 ADC ($0010)
self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) #=> Vector to $ABCD
mpu.memory[0xABCD] = 0xFF
- mpu.step()
+ mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x01, mpu.a)
- self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
+ self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
@@ -127,12 +127,12 @@ def test_adc_bcd_off_zp_indirect_overflow_set_on_40_plus_40(self):
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x80, mpu.a)
- self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
- self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
- self.assertEqual(0, mpu.p & mpu.ZERO)
-
+ self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
+ self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
+ self.assertEqual(0, mpu.p & mpu.ZERO)
+
# AND Zero Page, Indirect
-
+
def test_and_zp_indirect_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFF
@@ -145,12 +145,12 @@ def test_and_zp_indirect_all_zeros_setting_zero_flag(self):
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
-
+
def test_and_zp_indirect_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFF
self._write(mpu.memory, 0x0000, (0x32, 0x10)) #=> AND ($0010)
- self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) #=> Vector to $ABCD
+ self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) #=> Vector to $ABCD
mpu.memory[0xABCD] = 0xAA
mpu.step()
self.assertEqual(0x0002, mpu.pc)
@@ -158,13 +158,13 @@ def test_and_zp_indirect_zeros_and_ones_setting_negative_flag(self):
self.assertEqual(0xAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
-
+
# BIT (Absolute, X-Indexed)
-
+
def test_bit_abs_x_copies_bit_7_of_memory_to_n_flag_when_0(self):
mpu = self._make_mpu()
- mpu.p &= ~(mpu.NEGATIVE)
- mpu.x = 0x02
+ mpu.p &= ~(mpu.NEGATIVE)
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0xFF
mpu.a = 0xFF
@@ -172,11 +172,11 @@ def test_bit_abs_x_copies_bit_7_of_memory_to_n_flag_when_0(self):
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
def test_bit_abs_x_copies_bit_7_of_memory_to_n_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE
- mpu.x = 0x02
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0x00
mpu.a = 0xFF
@@ -184,11 +184,11 @@ def test_bit_abs_x_copies_bit_7_of_memory_to_n_flag_when_1(self):
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
def test_bit_abs_x_copies_bit_6_of_memory_to_v_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
- mpu.x = 0x02
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0xFF
mpu.a = 0xFF
@@ -196,11 +196,11 @@ def test_bit_abs_x_copies_bit_6_of_memory_to_v_flag_when_0(self):
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
def test_bit_abs_x_copies_bit_6_of_memory_to_v_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.OVERFLOW
- mpu.x = 0x02
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0x00
mpu.a = 0xFF
@@ -208,11 +208,11 @@ def test_bit_abs_x_copies_bit_6_of_memory_to_v_flag_when_1(self):
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
def test_bit_abs_x_stores_result_of_and_in_z_while_preserving_a_when_1(self):
- mpu = self._make_mpu()
+ mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
- mpu.x = 0x02
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0x00
mpu.a = 0x01
@@ -222,11 +222,11 @@ def test_bit_abs_x_stores_result_of_and_in_z_while_preserving_a_when_1(self):
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
def test_bit_abs_x_stores_result_of_and_when_nonzero_in_z_while_preserving_a(self):
- mpu = self._make_mpu()
+ mpu = self._make_mpu()
mpu.p |= mpu.ZERO
- mpu.x = 0x02
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0x01
mpu.a = 0x01
@@ -236,11 +236,11 @@ def test_bit_abs_x_stores_result_of_and_when_nonzero_in_z_while_preserving_a(sel
self.assertEqual(0x01, mpu.memory[0xFEED])
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
def test_bit_abs_x_stores_result_of_and_when_zero_in_z_while_preserving_a(self):
- mpu = self._make_mpu()
+ mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
- mpu.x = 0x02
+ mpu.x = 0x02
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE)) #=> BIT $FEEB,X
mpu.memory[0xFEED] = 0x00
mpu.a = 0x01
@@ -250,9 +250,9 @@ def test_bit_abs_x_stores_result_of_and_when_zero_in_z_while_preserving_a(self):
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
-
+
# BIT (Zero Page, X-Indexed)
-
+
def test_bit_zp_x_copies_bit_7_of_memory_to_n_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
@@ -264,7 +264,7 @@ def test_bit_zp_x_copies_bit_7_of_memory_to_n_flag_when_0(self):
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
-
+
def test_bit_zp_x_copies_bit_7_of_memory_to_n_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE
@@ -276,7 +276,7 @@ def test_bit_zp_x_copies_bit_7_of_memory_to_n_flag_when_1(self):
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
-
+
def test_bit_zp_x_copies_bit_6_of_memory_to_v_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
@@ -288,7 +288,7 @@ def test_bit_zp_x_copies_bit_6_of_memory_to_v_flag_when_0(self):
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
-
+
def test_bit_zp_x_copies_bit_6_of_memory_to_v_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.OVERFLOW
@@ -300,9 +300,9 @@ def test_bit_zp_x_copies_bit_6_of_memory_to_v_flag_when_1(self):
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
-
+
def test_bit_zp_x_stores_result_of_and_in_z_while_preserving_a_when_1(self):
- mpu = self._make_mpu()
+ mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
self._write(mpu.memory, 0x0000, (0x34, 0x10)) #=> BIT $0010,X
mpu.memory[0x0013] = 0x00
@@ -311,12 +311,12 @@ def test_bit_zp_x_stores_result_of_and_in_z_while_preserving_a_when_1(self):
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0002, mpu.pc)
- self.assertEqual(4, mpu.processorCycles)
- self.assertEqual(0x01, mpu.a)
+ self.assertEqual(4, mpu.processorCycles)
+ self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
-
+
def test_bit_zp_x_stores_result_of_and_when_nonzero_in_z_while_preserving_a(self):
- mpu = self._make_mpu()
+ mpu = self._make_mpu()
mpu.p |= mpu.ZERO
self._write(mpu.memory, 0x0000, (0x34, 0x10)) #=> BIT $0010,X
mpu.memory[0x0013] = 0x01
@@ -328,9 +328,9 @@ def test_bit_zp_x_stores_result_of_and_when_nonzero_in_z_while_preserving_a(self
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x01, mpu.memory[0x0010 + mpu.x])
-
+
def test_bit_zp_x_stores_result_of_and_when_zero_in_z_while_preserving_a(self):
- mpu = self._make_mpu()
+ mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
self._write(mpu.memory, 0x0000, (0x34, 0x10)) #=> BIT $0010,X
mpu.memory[0x0013] = 0x00
@@ -342,9 +342,9 @@ def test_bit_zp_x_stores_result_of_and_when_zero_in_z_while_preserving_a(self):
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO) # result of AND is zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
-
+
# EOR Zero Page, Indirect
-
+
def test_eor_zp_indirect_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFF
@@ -353,11 +353,11 @@ def test_eor_zp_indirect_flips_bits_over_setting_z_flag(self):
mpu.memory[0xABCD] = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
- self.assertEqual(5, mpu.processorCycles)
+ self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
-
+
def test_eor_zp_indirect_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
@@ -366,11 +366,11 @@ def test_eor_zp_indirect_flips_bits_over_setting_n_flag(self):
mpu.memory[0xABCD] = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
- self.assertEqual(5, mpu.processorCycles)
+ self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0xFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
- self.assertEqual(0, mpu.p & mpu.ZERO)
+ self.assertEqual(0, mpu.p & mpu.ZERO)
# LDA Zero Page, Indirect
@@ -401,7 +401,7 @@ def test_lda_zp_indirect_loads_a_sets_z_flag(self):
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# ORA Zero Page, Indirect
-
+
def test_ora_zp_indirect_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
@@ -416,7 +416,7 @@ def test_ora_zp_indirect_zeroes_or_zeros_sets_z_flag(self):
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
-
+
def test_ora_zp_indirect_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
@@ -432,7 +432,7 @@ def test_ora_zp_indirect_turns_bits_on_sets_n_flag(self):
self.assertEqual(0, mpu.p & mpu.ZERO)
# PHX
-
+
def test_phx_pushes_x_and_updates_sp(self):
mpu = self._make_mpu()
mpu.x = 0xAB
@@ -442,10 +442,10 @@ def test_phx_pushes_x_and_updates_sp(self):
self.assertEqual(0xAB, mpu.x)
self.assertEqual(0xAB, mpu.memory[0x01FF])
self.assertEqual(0xFE, mpu.sp)
- self.assertEqual(3, mpu.processorCycles)
-
+ self.assertEqual(3, mpu.processorCycles)
+
# PHY
-
+
def test_phy_pushes_y_and_updates_sp(self):
mpu = self._make_mpu()
mpu.y = 0xAB
@@ -458,7 +458,7 @@ def test_phy_pushes_y_and_updates_sp(self):
self.assertEqual(3, mpu.processorCycles)
# PLX
-
+
def test_plx_pulls_top_byte_from_stack_into_x_and_updates_sp(self):
mpu = self._make_mpu()
mpu.memory[0x0000] = 0xFA #=> PLX
@@ -469,9 +469,9 @@ def test_plx_pulls_top_byte_from_stack_into_x_and_updates_sp(self):
self.assertEqual(0xAB, mpu.x)
self.assertEqual(0xFF, mpu.sp)
self.assertEqual(4, mpu.processorCycles)
-
+
# PLY
-
+
def test_ply_pulls_top_byte_from_stack_into_y_and_updates_sp(self):
mpu = self._make_mpu()
mpu.memory[0x0000] = 0x7A #=> PLY
@@ -481,10 +481,10 @@ def test_ply_pulls_top_byte_from_stack_into_y_and_updates_sp(self):
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xAB, mpu.y)
self.assertEqual(0xFF, mpu.sp)
- self.assertEqual(4, mpu.processorCycles)
+ self.assertEqual(4, mpu.processorCycles)
# RMB0
-
+
def test_rmb0_clears_bit_0_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -505,7 +505,7 @@ def test_rmb0_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB1
-
+
def test_rmb1_clears_bit_1_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -526,7 +526,7 @@ def test_rmb1_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB2
-
+
def test_rmb2_clears_bit_2_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -547,7 +547,7 @@ def test_rmb2_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB3
-
+
def test_rmb3_clears_bit_3_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -568,7 +568,7 @@ def test_rmb3_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB4
-
+
def test_rmb4_clears_bit_4_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -589,7 +589,7 @@ def test_rmb4_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB5
-
+
def test_rmb5_clears_bit_5_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -610,7 +610,7 @@ def test_rmb5_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB6
-
+
def test_rmb6_clears_bit_6_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -631,7 +631,7 @@ def test_rmb6_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# RMB7
-
+
def test_rmb7_clears_bit_7_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('11111111',2)
@@ -652,7 +652,7 @@ def test_rmb7_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# STA Zero Page, Indirect
-
+
def test_sta_zp_indirect_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xFF & ~(mpu.NEGATIVE)
@@ -666,7 +666,7 @@ def test_sta_zp_indirect_stores_a_leaves_a_and_n_flag_unchanged(self):
self.assertEqual(0xFF, mpu.memory[0xFEED])
self.assertEqual(0xFF, mpu.a)
self.assertEqual(flags, mpu.p)
-
+
def test_sta_zp_indirect_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xFF & ~(mpu.ZERO)
@@ -682,7 +682,7 @@ def test_sta_zp_indirect_stores_a_leaves_a_and_z_flag_unchanged(self):
self.assertEqual(flags, mpu.p)
# SMB0
-
+
def test_smb0_sets_bit_0_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('00000000',2)
@@ -703,7 +703,7 @@ def test_smb0_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# SMB1
-
+
def test_smb1_sets_bit_1_without_affecting_other_bits(self):
mpu = self._make_mpu()
mpu.memory[0x0043] = int('00000000',2)
@@ -827,7 +827,7 @@ def test_smb6_does_not_affect_status_register(self):
mpu.p = expected
mpu.step()
self.assertEqual(expected, mpu.p)
-
+
# SMB7
def test_smb7_sets_bit_7_without_affecting_other_bits(self):
@@ -850,7 +850,7 @@ def test_smb7_does_not_affect_status_register(self):
self.assertEqual(expected, mpu.p)
# SBC Zero Page, Indirect
-
+
def test_sbc_zp_indirect_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
@@ -866,7 +866,7 @@ def test_sbc_zp_indirect_all_zeros_and_no_borrow_is_zero(self):
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
-
+
def test_sbc_zp_indirect_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
@@ -882,7 +882,7 @@ def test_sbc_zp_indirect_downto_zero_no_borrow_sets_z_clears_n(self):
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
-
+
def test_sbc_zp_indirect_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
@@ -897,8 +897,8 @@ def test_sbc_zp_indirect_downto_zero_with_borrow_sets_z_clears_n(self):
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
- self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
-
+ self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
+
def test_sbc_zp_indirect_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
@@ -912,13 +912,13 @@ def test_sbc_zp_indirect_downto_four_with_borrow_clears_z_n(self):
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
- self.assertEqual(0, mpu.p & mpu.ZERO)
+ self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
-
+
# STZ Zero Page
def test_stz_zp_stores_zero(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0x0032] = 0x88
mpu.memory[0x0000:0x0000+2] = [0x64, 0x32] #=> STZ $32
self.assertEqual(0x88, mpu.memory[0x0032])
@@ -930,7 +930,7 @@ def test_stz_zp_stores_zero(self):
# STZ Zero Page, X-Indexed
def test_stz_zp_x_stores_zero(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0x0032] = 0x88
mpu.memory[0x0000:0x0000+2] = [0x74, 0x32] #=> STZ $32,X
self.assertEqual(0x88, mpu.memory[0x0032])
@@ -942,7 +942,7 @@ def test_stz_zp_x_stores_zero(self):
# STZ Absolute
def test_stz_abs_stores_zero(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0xFEED] = 0x88
mpu.memory[0x0000:0x0000+3] = [0x9C, 0xED, 0xFE] #=> STZ $FEED
self.assertEqual(0x88, mpu.memory[0xFEED])
@@ -954,7 +954,7 @@ def test_stz_abs_stores_zero(self):
# STZ Absolute, X-Indexed
def test_stz_abs_stores_zero(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0xFEED] = 0x88
mpu.x = 0x0D
mpu.memory[0x0000:0x0000+3] = [0x9E, 0xE0, 0xFE] #=> STZ $FEE0,X
@@ -964,11 +964,11 @@ def test_stz_abs_stores_zero(self):
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
-
+
# TSB Zero Page
def test_tsb_sp_ones(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0x00BB] = 0xE0
self._write(mpu.memory, 0x0000, [0x04, 0xBB]) #=> TSB $BD
mpu.a = 0x70
@@ -980,7 +980,7 @@ def test_tsb_sp_ones(self):
self.assertEqual(5, mpu.processorCycles)
def test_tsb_sp_zeros(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0x00BB] = 0x80
self._write(mpu.memory, 0x0000, [0x04, 0xBB]) #=> TSB $BD
mpu.a = 0x60
@@ -995,7 +995,7 @@ def test_tsb_sp_zeros(self):
# TSB Absolute
def test_tsb_abs_ones(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0xFEED] = 0xE0
self._write(mpu.memory, 0x0000, [0x0C, 0xED, 0xFE]) #=> TSB $FEED
mpu.a = 0x70
@@ -1007,7 +1007,7 @@ def test_tsb_abs_ones(self):
self.assertEqual(6, mpu.processorCycles)
def test_tsb_abs_zeros(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0xFEED] = 0x80
self._write(mpu.memory, 0x0000, [0x0C, 0xED, 0xFE]) #=> TSB $FEED
mpu.a = 0x60
@@ -1021,7 +1021,7 @@ def test_tsb_abs_zeros(self):
# TRB Zero Page
def test_trb_sp_ones(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0x00BB] = 0xE0
self._write(mpu.memory, 0x0000, [0x14, 0xBB]) #=> TRB $BD
mpu.a = 0x70
@@ -1033,7 +1033,7 @@ def test_trb_sp_ones(self):
self.assertEqual(5, mpu.processorCycles)
def test_trb_sp_zeros(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0x00BB] = 0x80
self._write(mpu.memory, 0x0000, [0x14, 0xBB]) #=> TRB $BD
mpu.a = 0x60
@@ -1048,7 +1048,7 @@ def test_trb_sp_zeros(self):
# TRB Absolute
def test_trb_abs_ones(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0xFEED] = 0xE0
self._write(mpu.memory, 0x0000, [0x1C, 0xED, 0xFE]) #=> TRB $FEED
mpu.a = 0x70
@@ -1060,7 +1060,7 @@ def test_trb_abs_ones(self):
self.assertEqual(6, mpu.processorCycles)
def test_trb_abs_zeros(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
mpu.memory[0xFEED] = 0x80
self._write(mpu.memory, 0x0000, [0x1C, 0xED, 0xFE]) #=> TRB $FEED
mpu.a = 0x60
@@ -1072,7 +1072,7 @@ def test_trb_abs_zeros(self):
self.assertEqual(6, mpu.processorCycles)
def test_dec_a_decreases_a(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, [0x3A]) #=> DEC A
mpu.a = 0x48
mpu.step()
@@ -1081,7 +1081,7 @@ def test_dec_a_decreases_a(self):
self.assertEqual(0x47, mpu.a)
def test_dec_a_sets_zero_flag(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, [0x3A]) #=> DEC A
mpu.a = 0x01
mpu.step()
@@ -1090,7 +1090,7 @@ def test_dec_a_sets_zero_flag(self):
self.assertEqual(0x00, mpu.a)
def test_dec_a_wraps_at_zero(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, [0x3A]) #=> DEC A
mpu.a = 0x00
mpu.step()
@@ -1099,14 +1099,14 @@ def test_dec_a_wraps_at_zero(self):
self.assertEqual(0xFF, mpu.a)
def test_bra_forward(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, [0x80, 0x10]) #=> BRA $10
mpu.step()
self.assertEqual(0x12, mpu.pc)
self.assertEqual(2, mpu.processorCycles)
def test_bra_backward(self):
- mpu = self._make_mpu(debug=True)
+ mpu = self._make_mpu()
self._write(mpu.memory, 0x0204, [0x80, 0xF0]) #=> BRA $F0
mpu.pc = 0x0204
mpu.step()

0 comments on commit 9831529

Please sign in to comment.
Something went wrong with that request. Please try again.