mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-07 20:31:47 +00:00
Show help when address range is entered incorrectly
This commit is contained in:
parent
90d983c3cb
commit
1a6b3fd5a9
@ -328,7 +328,11 @@ class Monitor(cmd.Cmd):
|
|||||||
start += bytes
|
start += bytes
|
||||||
|
|
||||||
def do_disassemble(self, args):
|
def do_disassemble(self, args):
|
||||||
start, end = self._address_parser.range(args)
|
split = shlex.split(args)
|
||||||
|
if len(split) != 1:
|
||||||
|
return self.help_disassemble()
|
||||||
|
|
||||||
|
start, end = self._address_parser.range(split[0])
|
||||||
if start == end:
|
if start == end:
|
||||||
end += 1
|
end += 1
|
||||||
|
|
||||||
@ -350,6 +354,7 @@ class Monitor(cmd.Cmd):
|
|||||||
def help_disassemble(self):
|
def help_disassemble(self):
|
||||||
self._output("disassemble <address_range>")
|
self._output("disassemble <address_range>")
|
||||||
self._output("Disassemble instructions in the address range.")
|
self._output("Disassemble instructions in the address range.")
|
||||||
|
self._output('Range is specified like "<start>:<end+1>".')
|
||||||
|
|
||||||
def help_step(self):
|
def help_step(self):
|
||||||
self._output("step")
|
self._output("step")
|
||||||
|
@ -246,6 +246,20 @@ class MonitorTests(unittest.TestCase):
|
|||||||
out = stdout.getvalue()
|
out = stdout.getvalue()
|
||||||
self.assertTrue(out.startswith('disassemble'))
|
self.assertTrue(out.startswith('disassemble'))
|
||||||
|
|
||||||
|
def test_help_disassemble(self):
|
||||||
|
stdout = StringIO()
|
||||||
|
mon = Monitor(stdout=stdout)
|
||||||
|
mon.help_disassemble()
|
||||||
|
out = stdout.getvalue()
|
||||||
|
self.assertTrue(out.startswith('disassemble <address_range>'))
|
||||||
|
|
||||||
|
def test_disassemble_shows_help_when_given_extra_args(self):
|
||||||
|
stdout = StringIO()
|
||||||
|
mon = Monitor(stdout=stdout)
|
||||||
|
mon.do_disassemble("c000 c001")
|
||||||
|
out = stdout.getvalue()
|
||||||
|
self.assertTrue(out.startswith('disassemble <address_range>'))
|
||||||
|
|
||||||
# fill
|
# fill
|
||||||
|
|
||||||
def test_shortcut_f_for_fill(self):
|
def test_shortcut_f_for_fill(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user