diff --git a/CHANGES.rst b/CHANGES.rst index bb4707a..5cb3bcd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,13 +1,16 @@ 2.0.0.dev0 (Next Release) ------------------------- +- Support for some older Python versions has been dropped. On Python 3, + Py65 now requires Python 3.4 or later. On Python 2, Py65 now requires + Python 2.7. + - Fixed a bug with character input that would cause characters to be dropped when pasting in larger amounts of text. This makes it possible to paste programs into EhBASIC and Taliforth. Patch by SamCoVT. -- Support for some older Python versions has been dropped. On Python 3, - Py65 now requires Python 3.4 or later. On Python 2, Py65 now requires - Python 2.7. +- The ``fill`` command in the monitor now shows an error message if an + address or value is out of range. - Added ``irq()`` and ``nmi()`` methods to the ``MPU`` class, so that interrupts can be simulated. Patch by Irmen de Jong. diff --git a/py65/monitor.py b/py65/monitor.py index 8027e44..c288bdc 100644 --- a/py65/monitor.py +++ b/py65/monitor.py @@ -505,7 +505,7 @@ class Monitor(cmd.Cmd): # Switch to immediate (noncanonical) no-echo input mode on POSIX # operating systems. This has no effect on Windows. console.noncanonical_mode(self.stdin) - + if not breakpoints: while True: mpu.step() @@ -734,9 +734,18 @@ class Monitor(cmd.Cmd): try: start, end = self._address_parser.range(split[0]) - filler = list(map(self._address_parser.number, split[1:])) + filler = [] + for piece in split[1:]: + value = self._address_parser.number(piece) + if value > self.byteMask: + raise OverflowError(value) + filler.append(value) except KeyError as exc: - self._output(exc.args[0]) # "Label not found: foo" + # "Label not found: foo" + self._output(exc.args[0]) + except OverflowError as exc: + # "Overflow: $10000" + self._output("Overflow: $%x" % exc.args[0]) else: self._fill(start, end, filler) diff --git a/py65/tests/test_monitor.py b/py65/tests/test_monitor.py index 92f2bc2..2060463 100644 --- a/py65/tests/test_monitor.py +++ b/py65/tests/test_monitor.py @@ -474,6 +474,30 @@ class MonitorTests(unittest.TestCase): out = stdout.getvalue() self.assertTrue(out.startswith("Label not found: nonexistent")) + def test_do_fill_bad_start_address(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_fill('10000 00') + + out = stdout.getvalue() + self.assertTrue(out.startswith("Overflow: $10000")) + + def test_do_fill_bad_end_address(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_fill('ffff:10000 00 00') + + out = stdout.getvalue() + self.assertTrue(out.startswith("Overflow: $10000")) + + def test_do_fill_bad_data(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_fill('0 100') + + out = stdout.getvalue() + self.assertTrue(out.startswith("Overflow: $100")) + # goto def test_shortcut_for_goto(self):