Initial commit: ADSP-219x disassembler, docs, test ROMs, analysis tools
- Standalone Python disassembler for 24-bit ADSP-219x instructions - Complete instruction set reference (PDFs + extracted text) - Architecture documentation and getting-started guide - Test ROM generator with packed (3-byte) and padded (4-byte) formats - r2pipe-based analysis script for radare2 integration
This commit is contained in:
37
testrom/gen_testrom.py
Normal file
37
testrom/gen_testrom.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import sys
|
||||
import struct
|
||||
import os
|
||||
|
||||
# Opcode constants
|
||||
TYPE1_NOP = 0xC00000
|
||||
TYPE6_AX0 = 0x400000
|
||||
TYPE10_JUMP_ALWAYS = 0x18000F
|
||||
TYPE30_NOP = 0x000000
|
||||
|
||||
def create_rom(filename, format=3):
|
||||
"""
|
||||
Creates a synthetic ADSP-219x ROM with known instruction patterns.
|
||||
"""
|
||||
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
||||
instructions = [
|
||||
TYPE30_NOP, # 0x0000: NOP
|
||||
TYPE6_AX0 | (0x1234 << 4), # 0x0001: AX0 = 0x1234
|
||||
TYPE10_JUMP_ALWAYS | (0x0100 << 4), # 0x0002: JUMP 0x0100
|
||||
# ... add more test patterns ...
|
||||
]
|
||||
|
||||
with open(filename, "wb") as f:
|
||||
for ins in instructions:
|
||||
if format == 3:
|
||||
# Big-endian 3-byte pack
|
||||
f.write(struct.pack(">I", ins)[1:])
|
||||
else:
|
||||
# Big-endian 4-byte pad
|
||||
f.write(struct.pack(">I", ins))
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Ensure full path to base_test.bin
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
create_rom(os.path.join(base_dir, "test_roms/base_test.bin"), 3)
|
||||
create_rom(os.path.join(base_dir, "test_roms/padded_test.bin"), 4)
|
||||
print("Test ROMs generated in test_roms/")
|
||||
Reference in New Issue
Block a user