better formatted print outputs

float_support
Anton Lydike 4 years ago
parent 18b5ea0570
commit ebfb3a0112

@ -76,7 +76,7 @@ class CPU:
def step(self): def step(self):
if self.exit: 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: else:
try: try:
self.cycle += 1 self.cycle += 1

@ -49,7 +49,7 @@ class MMU:
self.global_symbols.update(loaded_bin.exported_symbols) 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 return loaded_bin
@ -79,7 +79,7 @@ class MMU:
sec.dump(addr, *args, **kwargs) sec.dump(addr, *args, **kwargs)
def symbol(self, symb:str): 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: if symb in self.global_symbols:
print(" Found global symbol {}: 0x{:X}".format(symb, self.global_symbols[symb])) print(" Found global symbol {}: 0x{:X}".format(symb, self.global_symbols[symb]))
for b in self.binaries: for b in self.binaries:

@ -3,6 +3,7 @@ from .Exceptions import NumberFormatException
from .colors import * from .colors import *
from .Exceptions import * from .Exceptions import *
def align_addr(addr: int, to_bytes: int = 8): def align_addr(addr: int, to_bytes: int = 8):
""" """
align an address to `to_bytes` (meaning addr & to_bytes = 0) 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: except ValueError as ex:
raise ParseException('Invalid immediate argument \"{}\", maybe missing symbol?'.format(arg), (arg, ex)) raise ParseException('Invalid immediate argument \"{}\", maybe missing symbol?'.format(arg), (arg, ex))
def int_to_bytes(val, bytes=4, unsigned=False): def int_to_bytes(val, bytes=4, unsigned=False):
""" """
int -> byte (two's complement) int -> byte (two's complement)

Loading…
Cancel
Save