blob: c03fb8d9c5a807d50eb27080f2a84e3e84d62178 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
from atk16_emu import Machine
from test.utils import make_rom
def test_ldr():
machine = Machine()
rom_image = make_rom([0b0010_010_000_000_000]) # ALR target=RC reg=RA
machine.load_rom_image(rom_image)
machine.reset()
machine.mem_write(0x8000, 0x1234)
machine.ra.value = 0x8000 # mem address
machine.rc.value = 0x2345
machine.run()
machine.step()
assert machine.rc.value == 0x1234
def test_ldi():
machine = Machine()
rom_image = make_rom([0b0100_010_111111111]) # LDI target=RC imm=511
machine.load_rom_image(rom_image)
machine.reset()
machine.rc.value = 0x123
machine.run()
machine.step()
assert machine.rc.value == 511
|