aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/std_mem/test_memset.py
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-13 22:27:54 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-13 22:27:54 +0300
commita36e5e001a4f17505c40b7f7a8f9c1f514f40de1 (patch)
tree7511fff343ef5eb0329e18e5cb5584387c4f653a /test/e2e/std_mem/test_memset.py
parent46459fc1b753abc83c355440a014c696c0dacd3a (diff)
Fix bugs, add tests
Diffstat (limited to 'test/e2e/std_mem/test_memset.py')
-rw-r--r--test/e2e/std_mem/test_memset.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/e2e/std_mem/test_memset.py b/test/e2e/std_mem/test_memset.py
new file mode 100644
index 0000000..0052ffe
--- /dev/null
+++ b/test/e2e/std_mem/test_memset.py
@@ -0,0 +1,22 @@
+from atk16_asm import assemble
+from atk16_emu import Machine
+from test.utils import pad_bytearray
+
+def test_memset():
+ filename = "test/e2e/std_mem/run_memset.atk16"
+ with open(filename, "r") as f:
+ source = f.read()
+
+ obj = assemble(source, filename)
+ rom_image = pad_bytearray(obj.program)
+
+ machine = Machine()
+ machine.load_rom_image(rom_image)
+ machine.reset()
+ machine.run_until_halted()
+ machine.print_state_summary()
+
+ addr = 0x9000 - 0x8000
+ expected_n = 5
+ expected_value = 3
+ assert all(map(lambda x: x == expected_value, machine.ram.memory[addr:addr+expected_n]))