From ff5ba9a7ef210a8d95a6cfd41af1f24233a0b771 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sat, 24 Apr 2021 18:20:06 +0200 Subject: [PATCH] made CPU.run_instruction public --- riscemu/CPU.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/riscemu/CPU.py b/riscemu/CPU.py index 6577359..a51103d 100644 --- a/riscemu/CPU.py +++ b/riscemu/CPU.py @@ -116,7 +116,7 @@ class CPU: ins = self.mmu.read_ins(self.pc) print(FMT_CPU + " Running 0x{:08X}:{} {}".format(self.pc, FMT_NONE, ins)) self.pc += 1 - self.__run_instruction(ins) + self.run_instruction(ins) except LaunchDebuggerException: print(FMT_CPU + "[CPU] Returning to debugger!" + FMT_NONE) except RiscemuBaseException as ex: @@ -134,7 +134,7 @@ class CPU: if verbose: print(FMT_CPU + " Running 0x{:08X}:{} {}".format(self.pc, FMT_NONE, ins)) self.pc += 1 - self.__run_instruction(ins) + self.run_instruction(ins) except RiscemuBaseException as ex: if not isinstance(ex, LaunchDebuggerException): print(FMT_ERROR + "[CPU] excpetion caught at 0x{:08X}: {}:".format(self.pc - 1, ins) + FMT_NONE) @@ -156,7 +156,12 @@ class CPU: print() print(FMT_CPU + "Program stopped without exiting - perhaps you stopped the debugger?" + FMT_NONE) - def __run_instruction(self, ins: 'LoadedInstruction'): + def run_instruction(self, ins: 'LoadedInstruction'): + """ + Execute a single instruction + + :param ins: The instruction to execute + """ if ins.name in self.instructions: self.instructions[ins.name](ins) else: