1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-11 09:29:30 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
leebehrens
c8e63581fe
Merge 4e950d6ef5 into cf03901114 2023-10-18 22:49:43 -05:00
leebehrens
4e950d6ef5 Delete settings.json 2019-06-09 13:00:53 -05:00
leebehrens
edcdeceebe Added go command, help, tests
Added support for `go` command to continue execution at the current PC, help for `go`, and tests
2019-06-09 12:45:39 -05:00
2 changed files with 49 additions and 0 deletions

View File

@ -199,6 +199,7 @@ class Monitor(cmd.Cmd):
'f': 'fill',
'>': 'fill',
'g': 'goto',
'go': 'go',
'h': 'help',
'?': 'help',
'l': 'load',
@ -491,6 +492,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)

View File

@ -539,6 +539,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):