feat: добавлена простая поддержка точек останова

This commit is contained in:
ElectronixTM
2025-03-29 01:03:55 +03:00
parent 320f876f97
commit fe5d51258b

View File

@ -21,6 +21,9 @@ class VMCC(IntFlag):
NEGATIVE = 1 << 1 NEGATIVE = 1 << 1
ZERO = 1 << 0 ZERO = 1 << 0
class Breakpoint(Exception):
address: int
@dataclass @dataclass
class VM: class VM:
instr_callbacks: ClassVar[dict[OpcodeDescription, Callable]] instr_callbacks: ClassVar[dict[OpcodeDescription, Callable]]
@ -114,11 +117,10 @@ class VM:
""" """
Continue from current breakpoint Continue from current breakpoint
""" """
while ((self.pc.value < len(self.mem) // 4) while self.pc.value < len(self.mem):
and not self.pc.value in self.breakpoints): if self.pc.value in self.breakpoints:
raise Breakpoint(self.pc.value)
self.step() self.step()
print("breakpoint")
input()
def run(self) -> None: def run(self) -> None:
""" """