diff --git a/riscemu/CPU.py b/riscemu/CPU.py index 02b6e5b..fac3519 100644 --- a/riscemu/CPU.py +++ b/riscemu/CPU.py @@ -76,7 +76,7 @@ class CPU: def step(self): if self.exit: - print(FMT_CPU + "Program exited with code {}".format(self.exit_code) + FMT_NONE) + print(FMT_CPU + "[CPU] Program exited with code {}".format(self.exit_code) + FMT_NONE) else: try: self.cycle += 1 diff --git a/riscemu/Executable.py b/riscemu/Executable.py index 3602f17..4f7865f 100644 --- a/riscemu/Executable.py +++ b/riscemu/Executable.py @@ -204,7 +204,7 @@ class LoadedMemorySection: ins = repr(self.content[i]) print(fmt_str.format(self.base + i, ins)) else: - print(FMT_MEM + "{}, viewing {} bytes:".format( + print(FMT_MEM + "{}, viewing {} bytes:".format( self, end - start ) + FMT_NONE) for i in range(start, end, bytes_per_row): diff --git a/riscemu/MMU.py b/riscemu/MMU.py index e9be0d1..ec60e29 100644 --- a/riscemu/MMU.py +++ b/riscemu/MMU.py @@ -49,7 +49,7 @@ class MMU: self.global_symbols.update(loaded_bin.exported_symbols) - print(FMT_MEM + "Successfully loaded{}: {}".format(FMT_NONE, loaded_bin)) + print(FMT_MEM + "[MMU] Successfully loaded{}: {}".format(FMT_NONE, loaded_bin)) return loaded_bin @@ -79,7 +79,7 @@ class MMU: sec.dump(addr, *args, **kwargs) def symbol(self, symb:str): - print(FMT_MEM + "Lookup for symbol {}:".format(symb) + FMT_NONE) + print(FMT_MEM + "[MMU] Lookup for symbol {}:".format(symb) + FMT_NONE) if symb in self.global_symbols: print(" Found global symbol {}: 0x{:X}".format(symb, self.global_symbols[symb])) for b in self.binaries: diff --git a/riscemu/helpers.py b/riscemu/helpers.py index 235d53c..ecd8019 100644 --- a/riscemu/helpers.py +++ b/riscemu/helpers.py @@ -3,6 +3,7 @@ from .Exceptions import NumberFormatException from .colors import * from .Exceptions import * + def align_addr(addr: int, to_bytes: int = 8): """ align an address to `to_bytes` (meaning addr & to_bytes = 0) @@ -21,6 +22,7 @@ def parse_numeric_argument(arg: str): except ValueError as ex: raise ParseException('Invalid immediate argument \"{}\", maybe missing symbol?'.format(arg), (arg, ex)) + def int_to_bytes(val, bytes=4, unsigned=False): """ int -> byte (two's complement)