diff --git a/py65/monitor.py b/py65/monitor.py index 42f755f..0c6809b 100644 --- a/py65/monitor.py +++ b/py65/monitor.py @@ -202,6 +202,7 @@ class Monitor(cmd.Cmd): 'f': 'fill', '>': 'fill', 'g': 'goto', + 'go': 'go', 'h': 'help', '?': 'help', 'l': 'load', @@ -494,6 +495,14 @@ class Monitor(cmd.Cmd): self._mpu.pc = self._address_parser.number(args) 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) diff --git a/py65/tests/test_monitor.py b/py65/tests/test_monitor.py index 2060463..097e473 100644 --- a/py65/tests/test_monitor.py +++ b/py65/tests/test_monitor.py @@ -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):