1
0

EMualtor adjustments

This commit is contained in:
Aiden
2026-05-25 20:42:45 +10:00
parent d2e7609bbf
commit 3ab79648ff
17 changed files with 3047 additions and 83 deletions

View File

@@ -117,6 +117,16 @@ def planned_semantics_payload() -> dict:
instruction(0x3FF9, "CLR.B", "@H'F9B0", [0xF9B0]),
instruction(0x3FFD, "BCLR.B", "#7, @H'FAA5", [0xFAA5]),
instruction(0x4007, "BSET.B", "#7, @H'FAA5", [0xFAA5]),
instruction(0x4046, "TST.B", "@H'F9C4", [0xF9C4]),
instruction(0x404C, "BTST.B", "#7, @H'FAA5", [0xFAA5]),
instruction(0x4050, "BEQ", "loc_4059", targets=[0x4059]),
instruction(0x4052, "TST.B", "@H'F9C3", [0xF9C3]),
instruction(0x405F, "CMP:G.B", "@H'F9B5, R2", [0xF9B5]),
instruction(0x4067, "MOV:G.W", "#H'00, @(-H'0790,R2)"),
instruction(0x406C, "ADD:Q.B", "#1, @H'F9B0", [0xF9B0]),
instruction(0x4070, "BCLR.B", "#7, @H'F9B0", [0xF9B0]),
instruction(0x40E0, "MOV:G.B", "#H'14, @H'F9C4", [0xF9C4]),
instruction(0xBA31, "MOV:G.B", "#H'07, @H'F9C4", [0xF9C4]),
instruction(0xC000, "MOV:G.B", "@H'F861, R1", [0xF861]),
instruction(0xC004, "MOV:G.B", "@H'F862, R2", [0xF862]),
instruction(0xC008, "BSR", "loc_622B", targets=[0x622B]),
@@ -319,6 +329,8 @@ class SerialSemanticsTest(unittest.TestCase):
self.assertIn("faa2", state_text)
self.assertIn("f9b5", state_text)
self.assertIn("f9c0", state_text)
self.assertIn("f9c4", state_text)
self.assertIn("idle_heartbeat_gate_countdown", state_text)
def test_planned_retry_error_model_identifies_retransmit_and_checksum_error(self):
semantics = only_semantics(self, planned_semantics_payload())
@@ -368,6 +380,8 @@ class SerialSemanticsTest(unittest.TestCase):
self.assertIn("baf2", gate_text)
self.assertIn("faa2 == 0", gate_text)
self.assertIn("f9c0 == 0", gate_text)
self.assertIn("f9c4 == 0", gate_text)
self.assertIn("h'00ff", gate_text)
self.assertIn("f9b5 != f9b0", gate_text)
self.assertIn("bb43", gate_text)
self.assertIn("be9e", gate_text)
@@ -377,6 +391,28 @@ class SerialSemanticsTest(unittest.TestCase):
self.assertIn("0x06", gate_text)
self.assertIn("not rom constants", gate_text)
def test_timer_interrupt_model_surfaces_frt2_idle_heartbeat_counter(self):
semantics = only_semantics(
self,
base_payload(
[
instruction(0xBF23, "BCLR.B", "#5, @FRT2_TCSR"),
instruction(0xBF27, "TST.B", "@H'F9C4", [0xF9C4]),
instruction(0xBF2D, "ADD:Q.B", "#-1, @H'F9C4", [0xF9C4]),
instruction(0xBF31, "TST.B", "@H'F9C5", [0xF9C5]),
instruction(0xBF37, "ADD:Q.B", "#-1, @H'F9C5", [0xF9C5]),
]
),
)
timer = semantics["timer_interrupt_model"]
timer_text = semantic_text(timer)
self.assertIn("frt2 ocia", timer_text)
self.assertIn("f9c4", timer_text)
self.assertIn("idle_heartbeat_gate_countdown", timer_text)
self.assertIn("phi/32", timer_text)
def test_missing_serial_reconstruction_candidates_emit_no_protocol_semantics(self):
payload = {
"serial_reconstruction": {"candidates": []},