Compare commits

..

2 Commits

3 changed files with 7 additions and 4 deletions

View File

@ -25,7 +25,7 @@ def parse_dbg(dbg_json_dict: dict) -> DbgDict:
dbg_copy = cast(DbgDict, dbg_copy) dbg_copy = cast(DbgDict, dbg_copy)
return dbg_copy return dbg_copy
if __name__ == "__main__": def main():
parser = ArgumentParser( parser = ArgumentParser(
prog="dp32dbg", prog="dp32dbg",
description="Bad debugger for DP32 processor" description="Bad debugger for DP32 processor"
@ -54,4 +54,7 @@ if __name__ == "__main__":
with open (dbg_dict["src"], 'r') as f: with open (dbg_dict["src"], 'r') as f:
src = f.read() src = f.read()
dbg_tui.main(dbg, src) dbg_tui.run_tui(dbg, src)
if __name__ == "__main__":
main()

View File

@ -156,7 +156,7 @@ class DebuggerUI:
self.history_index %= len(self.commands_history) self.history_index %= len(self.commands_history)
self.prompt_panel.set_text(self.commands_history[self.history_index]) self.prompt_panel.set_text(self.commands_history[self.history_index])
def main(debugger: Debugger, srcfile: str): def run_tui(debugger: Debugger, srcfile: str):
root = py_cui.PyCUI(3, 1) root = py_cui.PyCUI(3, 1)
root.set_title("Stupid DP32 debugger") root.set_title("Stupid DP32 debugger")
root.set_status_bar_text("") root.set_status_bar_text("")

View File

@ -141,7 +141,7 @@ class Debugger:
elif re.fullmatch( elif re.fullmatch(
# r0-r255 # r0-r255
r'r(0|[1-9][0-9]|1[0-9][0-9]|2[1-4][1-9]|25[1-5])', r'r([0-9]|[1-9][0-9]|1[0-9][0-9]|2[1-4][1-9]|25[1-5])',
to_print): to_print):
index = int(to_print[1:]) index = int(to_print[1:])
return f"{to_print}: {self._vm.registers[index].value}" return f"{to_print}: {self._vm.registers[index].value}"