mirror of
https://github.com/mnaberez/py65.git
synced 2024-10-31 22:06:12 +00:00
Merge 4e950d6ef5
into 74e2576894
This commit is contained in:
commit
8bb47a45a0
@ -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)
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user