feat: добавлена простая поддержка точек останова
This commit is contained in:
10
src/vm.py
10
src/vm.py
@ -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:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user