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