Added run_ins method to debugger to run an instruction
This commit is contained in:
parent
5d484f08cf
commit
462639ade7
@ -4,10 +4,10 @@ RiscEmu (c) 2021 Anton Lydike
|
||||
SPDX-License-Identifier: MIT
|
||||
"""
|
||||
|
||||
|
||||
import typing
|
||||
from .Registers import Registers
|
||||
from .colors import FMT_DEBUG, FMT_NONE
|
||||
from .Executable import LoadedInstruction
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from . import *
|
||||
@ -40,6 +40,18 @@ def launch_debug_session(cpu: 'CPU', mmu: 'MMU', reg: 'Registers', prompt=""):
|
||||
print("Current instruction at 0x{:08X}:".format(cpu.pc))
|
||||
return mmu.read_ins(cpu.pc)
|
||||
|
||||
def run_ins(name, *args: str):
|
||||
if len(args) > 3:
|
||||
print("Invalid arg count!")
|
||||
return
|
||||
bin = mmu.get_bin_containing(cpu.pc)
|
||||
if bin is None:
|
||||
print(FMT_DEBUG + '[Debugger] Not in a section, can\'t execute instructions!' + FMT_NONE)
|
||||
return
|
||||
ins = LoadedInstruction(name, list(args), bin)
|
||||
print(FMT_DEBUG + "Running instruction " + ins + FMT_NONE)
|
||||
cpu.run_instruction(ins)
|
||||
|
||||
def cont(verbose=False):
|
||||
cpu.continue_from_debugger(verbose)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user