mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 08:52:40 +01:00
reg_convert.py
This commit is contained in:
parent
aec4570d19
commit
cef1b2bb99
17
papermario/reg_convert.py
Executable file
17
papermario/reg_convert.py
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
import fileinput
|
||||
import os
|
||||
import re
|
||||
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
asm_dir = script_dir + "/asm/"
|
||||
|
||||
regs = ["zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "s0",
|
||||
"s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"]
|
||||
|
||||
|
||||
for line in fileinput.input():
|
||||
for reg in regs:
|
||||
regex = re.compile("\\$" + reg)
|
||||
line = re.sub(regex, "$" + str(regs.index(reg)), line)
|
||||
print(line.rstrip())
|
Loading…
Reference in New Issue
Block a user