sh-dis/python/generate_sh4_directory.py
Zack Buhman 8a300ba4c6 initial SH4 emulator implementation in C
This currently only implements the SH2 instructions.
2024-04-22 20:53:36 +08:00

15 lines
551 B
Python

from instruction_table import untabulate_instructions_sh4
from instruction_file_name import instruction_file_name
for ins in untabulate_instructions_sh4():
code = list(f'{ins.code.code_bits:016b}')
for operand in ins.code.operands.values():
for i in range(operand.lsb, operand.lsb + operand.length):
code[15 - i] = operand.operand
file_name = instruction_file_name(ins)
path = os.path.join("sh4", file_name)
assert not os.path.exists(path)
with open(path, 'w') as f:
f.write(''.join(code) + '\n')