From 8b5d547107094767a9d51c02ecf7c2701e89b32e Mon Sep 17 00:00:00 2001 From: Ry Date: Tue, 7 Feb 2023 00:47:03 -0800 Subject: [PATCH] rv2fox: Understand .zero directive --- gcc/rv2fox | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/rv2fox b/gcc/rv2fox index e0a9d29..e7b64b2 100755 --- a/gcc/rv2fox +++ b/gcc/rv2fox @@ -68,6 +68,13 @@ class Emitter: for d in data: self.write(f'data.{size} {d}') + def zero(self, *data): + """ + Emit zeros + """ + for d in data: + self.write(f'data.fill 0, {d}') + def strz(self, *data): """ Emit null-terminated string @@ -183,6 +190,8 @@ class Converter: pass # ignore elif m := re.fullmatch(r'word\s+([^\s]+)', line): self.e.data(*m.groups()) + elif m := re.fullmatch(r'zero\s+([^\s]+)', line): + self.e.zero(*m.groups()) elif m := re.fullmatch(r'string\s+\"(.*)\"', line): self.e.strz(*m.groups()) elif m := re.fullmatch(r'asciz\s+\"(.*)\"', line):