|
13 | 13 | from mock import patch, call
|
14 | 14 |
|
15 | 15 | from chip8.cpu import Chip8CPU, UnknownOpCodeException, MODE_EXTENDED
|
16 |
| -from chip8.screen import Chip8Screen, DEFAULT_HEIGHT, DEFAULT_WIDTH |
| 16 | +from chip8.screen import Chip8Screen |
17 | 17 |
|
18 | 18 | # C O N S T A N T S ###########################################################
|
19 | 19 |
|
@@ -281,6 +281,7 @@ def test_right_shift_reg(self):
|
281 | 281 | for value in range(0, 0xFF, 0x10):
|
282 | 282 | self.cpu.registers['v'][register] = value
|
283 | 283 | self.cpu.operand = register << 8
|
| 284 | + self.cpu.operand = self.cpu.operand + (register << 4) |
284 | 285 | for index in range(1, 8):
|
285 | 286 | shifted_val = value >> index
|
286 | 287 | self.cpu.registers['v'][0xF] = 0
|
@@ -319,6 +320,7 @@ def test_left_shift_reg(self):
|
319 | 320 | for value in range(256):
|
320 | 321 | self.cpu.registers['v'][register] = value
|
321 | 322 | self.cpu.operand = register << 8
|
| 323 | + self.cpu.operand = self.cpu.operand + (register << 4) |
322 | 324 | for index in range(1, 8):
|
323 | 325 | shifted_val = value << index
|
324 | 326 | bit_seven = (shifted_val & 0x100) >> 9
|
@@ -530,7 +532,7 @@ def test_operation_9E_pc_skips_if_key_pressed(self):
|
530 | 532 | self.cpu.registers['v'][0] = 1
|
531 | 533 | self.cpu.registers['pc'] = 0
|
532 | 534 | result_table = [False] * 512
|
533 |
| - result_table[pygame.K_KP0 + 1] = True |
| 535 | + result_table[pygame.K_4] = True |
534 | 536 | with mock.patch("pygame.key.get_pressed", return_value=result_table) as key_mock:
|
535 | 537 | self.cpu.keyboard_routines()
|
536 | 538 | self.assertTrue(key_mock.asssert_called)
|
@@ -561,7 +563,7 @@ def test_operation_A1_pc_does_not_skip_if_key_pressed(self):
|
561 | 563 | self.cpu.registers['v'][0] = 1
|
562 | 564 | self.cpu.registers['pc'] = 0
|
563 | 565 | result_table = [False] * 512
|
564 |
| - result_table[pygame.K_KP0 + 1] = True |
| 566 | + result_table[pygame.K_4] = True |
565 | 567 | with mock.patch("pygame.key.get_pressed", return_value=result_table) as key_mock:
|
566 | 568 | self.cpu.keyboard_routines()
|
567 | 569 | self.assertTrue(key_mock.asssert_called)
|
|
0 commit comments