1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-10-31 22:06:12 +00:00
This commit is contained in:
leebehrens 2024-04-13 14:26:58 -07:00 committed by GitHub
commit 8bb47a45a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 0 deletions

View File

@ -202,6 +202,7 @@ class Monitor(cmd.Cmd):
'f': 'fill',
'>': 'fill',
'g': 'goto',
'go': 'go',
'h': 'help',
'?': 'help',
'l': 'load',
@ -495,6 +496,14 @@ class Monitor(cmd.Cmd):
brks = [0x00] # BRK
self._run(stopcodes=brks)
def help_go(self):
self._output("go")
self._output("Continue execution.")
def do_go(self, args):
brks = [0x00] # BRK
self._run(stopcodes=brks)
def _run(self, stopcodes):
stopcodes = set(stopcodes)
breakpoints = set(self._breakpoints)

View File

@ -541,6 +541,46 @@ class MonitorTests(unittest.TestCase):
mon.do_goto('0')
self.assertEqual(0x02, mon._mpu.pc)
# go
def test_shortcut_for_go(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.do_help('go')
out = stdout.getvalue()
self.assertTrue(out.startswith('go'))
def test_go_with_breakpoints_stops_execution_at_breakpoint(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon._breakpoints = [ 0x03 ]
mon._mpu.memory = [ 0xEA, 0xEA, 0xEA, 0xEA ]
mon._mpu.pc = 0x00
mon.do_go('')
out = stdout.getvalue()
self.assertTrue(out.startswith("Breakpoint 0 reached"))
self.assertEqual(0x03, mon._mpu.pc)
def test_go_with_breakpoints_stops_execution_at_brk(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon._breakpoints = [ 0x02 ]
mon._mpu.memory = [ 0xEA, 0xEA, 0x00, 0xEA ]
mon._mpu.pc = 0x00
mon.do_go('')
self.assertEqual(0x02, mon._mpu.pc)
def test_go_without_breakpoints_stops_execution_at_brk(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon._breakpoints = []
mon._mpu.memory = [ 0xEA, 0xEA, 0x00, 0xEA ]
mon._mpu.pc = 0x00
mon.do_go('')
self.assertEqual(0x02, mon._mpu.pc)
# help
def test_help_without_args_shows_documented_commands(self):