Следующий код безобразен, но выполняет свою работу:
import re # regular expressions
with open("write_file.py","w") as outf:
with open("read_file.asm","r") as inf:
for line in inf:
search_target = "(^)([^_a-zA-Z0-9]*)(MOV)( )([a-zA-Z0-9_]+)( *)(,)(.*)"
result = re.match(search_target, line, flags=re.I)
if isinstance(result, type(None)):
print(line, file=outf, end="")
else:
groups = [g for g in result.groups()]
del groups[2]
del groups[2]
groups[4] = " = "
print(''.join(groups), file=outf, end="")