rv2fox: Support .string directive

This commit is contained in:
Ry 2023-02-05 17:10:24 -08:00
parent f5ad080bac
commit b779853772

View File

@ -68,6 +68,13 @@ class Emitter:
for d in data:
self.write(f'data.{size} {d}')
def strz(self, *data):
"""
Emit null-terminated string
"""
for d in data:
self.write(f'data.strz \"{d}\"')
def nop(self):
"""
Emit a nop instruction
@ -170,6 +177,8 @@ class Converter:
pass # ignore
elif m := re.fullmatch(r'word\s+([^\s]+)', line):
self.e.data(*m.groups())
elif m := re.fullmatch(r'string\s+\"(.*)\"', line):
self.e.strz(*m.groups())
def reg(self, reg):
"""