From 9afbd0373372cd5266e6422b9de19de6fb24b47b Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Wed, 21 Apr 2021 20:36:26 +0200 Subject: [PATCH] added .word pseudo op --- riscemu/ExecutableParser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/riscemu/ExecutableParser.py b/riscemu/ExecutableParser.py index 9a6dff2..fc2f251 100644 --- a/riscemu/ExecutableParser.py +++ b/riscemu/ExecutableParser.py @@ -1,4 +1,4 @@ -from .helpers import parse_numeric_argument +from .helpers import parse_numeric_argument, int_to_bytes from .Executable import Executable, InstructionMemorySection, MemorySection, MemoryFlags from .Exceptions import * @@ -115,6 +115,12 @@ class ExecutableParser: def op_align(self, op: 'RiscVPseudoOpToken'): pass + def op_word(self, op: 'RiscVPseudoOpToken'): + ASSERT_LEN(op.args, 1) + val = parse_numeric_argument(op.args[0]) + self.curr_sec().add(int_to_bytes(val, 4)) + + ## Section handler code def set_sec(self, name: str, flags: MemoryFlags, cls=MemorySection): if name not in self.sections: