1
0

more serial improvements

This commit is contained in:
Aiden
2026-05-25 16:32:58 +10:00
parent 6ceed81765
commit 56829b6e0b
10 changed files with 16843 additions and 122 deletions

View File

@@ -88,6 +88,11 @@ class SerialReconstructionTest(unittest.TestCase):
def test_candidate_sci1_rx_frame_length_and_checksum_validation_pattern(self):
instructions = {
0x4FF0: ins(0x4FF0, "BSET.B", "#7, @H'FAA4", [0xFAA4]),
0x4FF4: ins(0x4FF4, "BCLR.B", "#5, @SCI1_SSR", [0xFEDC]),
0x4FF8: ins(0x4FF8, "BCLR.B", "#4, @SCI1_SSR", [0xFEDC]),
0x4FFC: ins(0x4FFC, "BCLR.B", "#3, @SCI1_SSR", [0xFEDC]),
0x4FFE: ins(0x4FFE, "BCLR.B", "#6, @SCI1_SSR", [0xFEDC]),
0x5000: ins(0x5000, "MOV:G.B", "@SCI1_RDR, R0", [0xFEDD]),
0x5004: ins(0x5004, "MOV:G.B", "R0, @(-H'0798,R1)", []),
0x5008: ins(0x5008, "ADD:Q.B", "#1, R1", []),
@@ -119,11 +124,24 @@ class SerialReconstructionTest(unittest.TestCase):
self.assertEqual(candidate["checksum_address"], 0xF865)
self.assertEqual(candidate["checksum_seed"], 0x5A)
self.assertIn("no explicit header", candidate["confidence_reason"])
self.assertIn("rx_rdrf_clear_before_rdr_read", candidate["evidence_addresses"])
self.assertIn("rx_eri_falls_through_to_rxi", candidate["evidence_addresses"])
self.assertTrue(candidate["rx_error_handling"]["fallthrough_to_rx_byte_path"])
self.assertTrue(candidate["rx_error_handling"]["rdrf_clear_before_rdr_read"])
self.assertEqual(candidate["rx_error_handling"]["error_latch_address"], 0xFAA4)
comment = serial_reconstruction_comment_for_instruction(analysis, 0x5138)
self.assertIn("candidate/evidence-supported SCI1 6-byte RX frame", comment)
self.assertIn("checksum H'F865", comment)
self.assertIn("confidence high", comment)
self.assertIn(
"ROM clears SCI1 SSR.RDRF before reading SCI1_RDR",
serial_reconstruction_comment_for_instruction(analysis, 0x4FFE),
)
self.assertIn(
"SCI1 ERI latches FAA4.bit7",
serial_reconstruction_comment_for_instruction(analysis, 0x4FF0),
)
def test_lone_tdr_write_does_not_emit_reconstruction(self):
instructions = {