mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-04 01:30:18 +00:00
Speed up run() by caching in local variables
This commit is contained in:
parent
1586b1808d
commit
9f5cd2e425
@ -439,17 +439,19 @@ class Monitor(cmd.Cmd):
|
|||||||
def _run(self, stopcodes):
|
def _run(self, stopcodes):
|
||||||
stopcodes = set(stopcodes)
|
stopcodes = set(stopcodes)
|
||||||
breakpoints = set(self._breakpoints)
|
breakpoints = set(self._breakpoints)
|
||||||
|
mpu = self._mpu
|
||||||
|
mem = self._mpu.memory
|
||||||
|
|
||||||
if not breakpoints: # optimization
|
if not breakpoints:
|
||||||
while True:
|
while True:
|
||||||
self._mpu.step()
|
mpu.step()
|
||||||
if self._mpu.memory[self._mpu.pc] in stopcodes:
|
if mem[mpu.pc] in stopcodes:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
while True:
|
while True:
|
||||||
self._mpu.step()
|
mpu.step()
|
||||||
pc = self._mpu.pc
|
pc = mpu.pc
|
||||||
if self._mpu.memory[pc] in stopcodes:
|
if mem[pc] in stopcodes:
|
||||||
break
|
break
|
||||||
if pc in breakpoints:
|
if pc in breakpoints:
|
||||||
msg = "Breakpoint %d reached."
|
msg = "Breakpoint %d reached."
|
||||||
|
Loading…
Reference in New Issue
Block a user