aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_emu/test/test_opcode_hlt.py
blob: 6991042278dea85483e4dd05b353ba906682be74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from ..emu import Machine
from .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