diff --git a/src/py65/monitor.py b/src/py65/monitor.py index 8007301..5cf7c86 100644 --- a/src/py65/monitor.py +++ b/src/py65/monitor.py @@ -597,9 +597,14 @@ class Monitor(cmd.Cmd): def help_mem(self): self._output("mem ") self._output("Display the contents of memory.") + self._output('Range is specified like "".') def do_mem(self, args): - start, end = self._address_parser.range(args) + split = shlex.split(args) + if len(split) != 1: + return self.help_mem() + + start, end = self._address_parser.range(split[0]) line = self.addrFmt % start + ":" for address in range(start, end+1): diff --git a/src/py65/tests/test_monitor.py b/src/py65/tests/test_monitor.py index a9487f4..142b2bd 100644 --- a/src/py65/tests/test_monitor.py +++ b/src/py65/tests/test_monitor.py @@ -441,7 +441,23 @@ class MonitorTests(unittest.TestCase): mon.do_help('m') out = stdout.getvalue() - self.assertTrue(out.startswith('mem')) + self.assertTrue(out.startswith('mem ')) + + def test_do_mem_shows_help_when_given_no_args(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_mem('') + + out = stdout.getvalue() + self.assertTrue(out.startswith('mem ')) + + def test_do_mem_shows_help_when_given_extra_args(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_mem('c000 c001') + + out = stdout.getvalue() + self.assertTrue(out.startswith('mem ')) # mpu