better formatted print outputs
This commit is contained in:
parent
18b5ea0570
commit
ebfb3a0112
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user