1
0

emualtor working

This commit is contained in:
Aiden
2026-05-25 21:00:25 +10:00
parent 3ab79648ff
commit 752148c585
22 changed files with 588 additions and 22 deletions

View File

@@ -47,6 +47,17 @@ class EmulatorAddressingTest(unittest.TestCase):
self.assertEqual(emulator.cpu.regs[0], 0x00C7)
self.assertEqual(emulator.cpu.pc, 0x1006)
def test_byte_immediate_to_word_destination_writes_zero_extended_word(self):
rom = rom_with_reset()
rom[0x1000:0x1005] = b"\x1D\xF8\x70\x06\xAB" # MOV:G.W #H'AB, @H'F870
emulator = H8536Emulator(bytes(rom))
emulator.memory.write16(0xF870, 0xFFFF)
emulator.step()
self.assertEqual(emulator.memory.read16(0xF870), 0x00AB)
self.assertEqual(emulator.cpu.pc, 0x1005)
def test_signed_byte_displacement_addresses_below_base(self):
rom = rom_with_reset()
rom[0x1000:0x1003] = b"\xE1\xFE\x81" # MOV:G.B @(H'-02,R1), R1