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