aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_emu/test/test_opcode_hlt.py
blob: 5cae8881954d42c1ebd32ea1854df9206ddc2c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from atk16_emu.emu import Machine
from atk16_emu.test.utils import make_rom

def test_hlt():
  machine = Machine()

  rom_image = make_rom([0b1111_0000_0000_0000]) # HLT
  machine.load_rom_image(rom_image)
  machine.reset()
  machine.run()

  assert machine.pc.value == 0
  assert machine.running == True

  machine.step()

  assert machine.pc.value == 1
  assert machine.running == False