roundtrip.py converts the radare2 disassembly (qunexus_v2.2.1.asm) into a
single sdas8051 assembler source (firmware.asm) and verifies it re-assembles
byte-identical to the 54,279-byte stock image (base 0x2400).
31,051 of 31,346 items (99.06%) re-assemble from mnemonics; 295 are
pinned to .db where r2's display syntax doesn't round-trip through
sdas8051 (256 ajmp/acall that sdas8051 mis-encodes, 39 data-in-code).
Converges in 3 iterations.
Also adds patch_usb1_to_cv.asm (the USB-1->CV patch as a standalone
sdas8051 source) and verify_patch_asm.py (proves the assembled patch
matches the bytes written to the device over C2).
Reproduce: python3 roundtrip.py
Decompiled from stock QuNexus_Firmware_v2.2.1.bin (EFM8UB20F64G / 8051,
base 0x2400, 54279 bytes) with radare2 6.2.0.
- qunexus_v2.2.1.asm : full linear disassembly (37287 lines, byte-faithful)
- pseudocode_all.c : r2 pdc pseudocode for all 1002 functions
- functions.txt : function index (1002 functions)
- regen.sh + r2script.r2 : one-command reproduction (brew install radare2)
Verified: reconstructing the binary from the asm byte-columns reproduces the
original image byte-for-byte (30560 instructions + 195 data gaps).