made CPU.run_instruction public

float_support
Anton Lydike 4 years ago
parent da895f00cd
commit ff5ba9a7ef

@ -116,7 +116,7 @@ class CPU:
ins = self.mmu.read_ins(self.pc) ins = self.mmu.read_ins(self.pc)
print(FMT_CPU + " Running 0x{:08X}:{} {}".format(self.pc, FMT_NONE, ins)) print(FMT_CPU + " Running 0x{:08X}:{} {}".format(self.pc, FMT_NONE, ins))
self.pc += 1 self.pc += 1
self.__run_instruction(ins) self.run_instruction(ins)
except LaunchDebuggerException: except LaunchDebuggerException:
print(FMT_CPU + "[CPU] Returning to debugger!" + FMT_NONE) print(FMT_CPU + "[CPU] Returning to debugger!" + FMT_NONE)
except RiscemuBaseException as ex: except RiscemuBaseException as ex:
@ -134,7 +134,7 @@ class CPU:
if verbose: if verbose:
print(FMT_CPU + " Running 0x{:08X}:{} {}".format(self.pc, FMT_NONE, ins)) print(FMT_CPU + " Running 0x{:08X}:{} {}".format(self.pc, FMT_NONE, ins))
self.pc += 1 self.pc += 1
self.__run_instruction(ins) self.run_instruction(ins)
except RiscemuBaseException as ex: except RiscemuBaseException as ex:
if not isinstance(ex, LaunchDebuggerException): if not isinstance(ex, LaunchDebuggerException):
print(FMT_ERROR + "[CPU] excpetion caught at 0x{:08X}: {}:".format(self.pc - 1, ins) + FMT_NONE) print(FMT_ERROR + "[CPU] excpetion caught at 0x{:08X}: {}:".format(self.pc - 1, ins) + FMT_NONE)
@ -156,7 +156,12 @@ class CPU:
print() print()
print(FMT_CPU + "Program stopped without exiting - perhaps you stopped the debugger?" + FMT_NONE) 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: if ins.name in self.instructions:
self.instructions[ins.name](ins) self.instructions[ins.name](ins)
else: else:

Loading…
Cancel
Save