1
0

More decompiling work

This commit is contained in:
Aiden
2026-05-25 17:32:00 +10:00
parent 56829b6e0b
commit 07f48c76e0
22 changed files with 9837 additions and 5 deletions

View File

@@ -103,8 +103,20 @@ def planned_semantics_payload() -> dict:
instruction(0xBF14, "BEQ", "loc_C100", targets=[0xC100]),
instruction(0xBF18, "CMP:E.B", "#H'06, R0"),
instruction(0xBF1C, "BEQ", "loc_C600", targets=[0xC600]),
instruction(0xBF1E, "CMP:E.B", "#H'05, R0"),
instruction(0xBF1F, "BEQ", "loc_C500", targets=[0xC500]),
instruction(0xBF20, "CMP:E.B", "#H'07, R0"),
instruction(0xBF24, "BEQ", "loc_C700", targets=[0xC700]),
instruction(0x3FD3, "TST.B", "@H'FAA2", [0xFAA2]),
instruction(0x3FD9, "BTST.B", "#7, @H'FAA5", [0xFAA5]),
instruction(0x3FDF, "TST.B", "@H'F9C3", [0xF9C3]),
instruction(0x3FE5, "TST.B", "@H'F9C0", [0xF9C0]),
instruction(0x3FEB, "BSR", "loc_BAF2", targets=[0xBAF2]),
instruction(0x3FEF, "TST.B", "@H'F9C5", [0xF9C5]),
instruction(0x3FF5, "CLR.B", "@H'F9B5", [0xF9B5]),
instruction(0x3FF9, "CLR.B", "@H'F9B0", [0xF9B0]),
instruction(0x3FFD, "BCLR.B", "#7, @H'FAA5", [0xFAA5]),
instruction(0x4007, "BSET.B", "#7, @H'FAA5", [0xFAA5]),
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]),
@@ -130,6 +142,9 @@ def planned_semantics_payload() -> dict:
instruction(0xC124, "MOV:G.W", "R3, @H'F853", [0xF853]),
instruction(0xC128, "MOV:G.B", "@H'F9B5, R6", [0xF9B5]),
instruction(0xC12C, "BSR", "loc_BA26", targets=[0xBA26]),
instruction(0xC500, "ADD:Q.B", "#1, @H'F9B5", [0xF9B5]),
instruction(0xC504, "BCLR.B", "#7, @H'F9B5", [0xF9B5]),
instruction(0xC508, "BCLR.B", "#7, @H'FAA3", [0xFAA3]),
instruction(0xC600, "MOV:G.B", "@H'F861, R1", [0xF861]),
instruction(0xC604, "MOV:G.B", "@H'F862, R2", [0xF862]),
instruction(0xC608, "BSR", "loc_622B", targets=[0x622B]),
@@ -143,6 +158,25 @@ def planned_semantics_payload() -> dict:
instruction(0xC70C, "BSR", "loc_BA26", targets=[0xBA26]),
instruction(0xC800, "CMP:E.B", "@H'F865, R7", [0xF865]),
instruction(0xC804, "BNE", "loc_C700", targets=[0xC700]),
instruction(0xBB20, "MOV:G.B", "#H'00, @H'F850", [0xF850]),
instruction(0xBB24, "MOV:G.B", "#H'00, @H'F851", [0xF851]),
instruction(0xBB28, "MOV:G.B", "#H'15, @H'F852", [0xF852]),
instruction(0xBB2C, "MOV:G.W", "@(-H'1800,R4), R0"),
instruction(0xBB30, "MOV:G.W", "R0, @H'F853", [0xF853]),
instruction(0xBB43, "BSR", "loc_BA26", targets=[0xBA26]),
instruction(0xBE90, "MOV:G.W", "#H'01F4, @H'F9C6", [0xF9C6]),
instruction(0xBE94, "MOV:G.B", "#H'14, @H'F9C8", [0xF9C8]),
instruction(0xBE98, "MOV:G.B", "#H'80, @H'FAA3", [0xFAA3]),
instruction(0xBE9C, "MOV:G.B", "#H'01, @H'FAA2", [0xFAA2]),
instruction(0xBEA0, "MOV:G.B", "@H'F9B5, R1", [0xF9B5]),
instruction(0xBEA4, "MOV:G.B", "#H'01, @H'F9C0", [0xF9C0]),
instruction(0xBE9E, "MOV:G.B", "@H'FAA5, R0", [0xFAA5]),
instruction(0xBEA5, "AND.B", "@H'FAA3, R0", [0xFAA3]),
instruction(0xBEB5, "TST.W", "@H'F9C6", [0xF9C6]),
instruction(0xBEBB, "TST.B", "@H'F9C8", [0xF9C8]),
instruction(0xBED5, "MOV:G.B", "@H'F858, R0", [0xF858]),
instruction(0xBED9, "MOV:G.B", "R0, @H'F850", [0xF850]),
instruction(0xBEE0, "BSR", "loc_BA26", targets=[0xBA26]),
]
)
@@ -296,6 +330,53 @@ class SerialSemanticsTest(unittest.TestCase):
self.assertIn("0x07", retry_text)
self.assertIn("checksum_error_response", retry_text)
def test_tx_report_model_separates_autonomous_reports_from_rx_commands(self):
semantics = only_semantics(self, planned_semantics_payload())
report = semantics["tx_report_model"]
report_text = semantic_text(report)
self.assertEqual(report["direction"], "device_to_host_autonomous_report_candidate")
self.assertIn("bb43", report_text)
self.assertIn("ba26", report_text)
self.assertIn("bytes 0..2", report_text)
self.assertIn("current_value_table", report_text)
self.assertIn("00 00 15 80 00 cf", report_text)
self.assertIn("host/device request", report_text)
def test_periodic_resend_model_marks_heartbeat_constants(self):
semantics = only_semantics(self, planned_semantics_payload())
periodic = semantics["periodic_resend_model"]
periodic_text = semantic_text(periodic)
self.assertIn("f9c6", periodic_text)
self.assertIn("01f4", periodic_text)
self.assertIn("f9c8", periodic_text)
self.assertIn("14", periodic_text)
self.assertIn("faa3", periodic_text)
self.assertIn("80", periodic_text)
self.assertIn("bed5", periodic_text)
def test_gate_queue_model_surfaces_autonomous_tx_state_machine(self):
semantics = only_semantics(self, planned_semantics_payload())
gate = semantics["gate_queue_model"]
gate_text = semantic_text(gate)
self.assertIn("3fd3", gate_text)
self.assertIn("baf2", gate_text)
self.assertIn("faa2 == 0", gate_text)
self.assertIn("f9c0 == 0", gate_text)
self.assertIn("f9b5 != f9b0", gate_text)
self.assertIn("bb43", gate_text)
self.assertIn("be9e", gate_text)
self.assertIn("bed5", gate_text)
self.assertIn("f9c5", gate_text)
self.assertIn("commands 0x05", gate_text)
self.assertIn("0x06", gate_text)
self.assertIn("not rom constants", gate_text)
def test_missing_serial_reconstruction_candidates_emit_no_protocol_semantics(self):
payload = {
"serial_reconstruction": {"candidates": []},