mirror of
https://github.com/mnaberez/py65.git
synced 2024-06-01 18:41:32 +00:00
Show an error if a value to fill is out of range
This commit is contained in:
parent
27230286a3
commit
1b279ef851
|
@ -1,13 +1,16 @@
|
||||||
2.0.0.dev0 (Next Release)
|
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
|
- Fixed a bug with character input that would cause characters to be
|
||||||
dropped when pasting in larger amounts of text. This makes it possible
|
dropped when pasting in larger amounts of text. This makes it possible
|
||||||
to paste programs into EhBASIC and Taliforth. Patch by SamCoVT.
|
to paste programs into EhBASIC and Taliforth. Patch by SamCoVT.
|
||||||
|
|
||||||
- Support for some older Python versions has been dropped. On Python 3,
|
- The ``fill`` command in the monitor now shows an error message if an
|
||||||
Py65 now requires Python 3.4 or later. On Python 2, Py65 now requires
|
address or value is out of range.
|
||||||
Python 2.7.
|
|
||||||
|
|
||||||
- Added ``irq()`` and ``nmi()`` methods to the ``MPU`` class, so that
|
- Added ``irq()`` and ``nmi()`` methods to the ``MPU`` class, so that
|
||||||
interrupts can be simulated. Patch by Irmen de Jong.
|
interrupts can be simulated. Patch by Irmen de Jong.
|
||||||
|
|
|
@ -505,7 +505,7 @@ class Monitor(cmd.Cmd):
|
||||||
# Switch to immediate (noncanonical) no-echo input mode on POSIX
|
# Switch to immediate (noncanonical) no-echo input mode on POSIX
|
||||||
# operating systems. This has no effect on Windows.
|
# operating systems. This has no effect on Windows.
|
||||||
console.noncanonical_mode(self.stdin)
|
console.noncanonical_mode(self.stdin)
|
||||||
|
|
||||||
if not breakpoints:
|
if not breakpoints:
|
||||||
while True:
|
while True:
|
||||||
mpu.step()
|
mpu.step()
|
||||||
|
@ -734,9 +734,18 @@ class Monitor(cmd.Cmd):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
start, end = self._address_parser.range(split[0])
|
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:
|
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:
|
else:
|
||||||
self._fill(start, end, filler)
|
self._fill(start, end, filler)
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,30 @@ class MonitorTests(unittest.TestCase):
|
||||||
out = stdout.getvalue()
|
out = stdout.getvalue()
|
||||||
self.assertTrue(out.startswith("Label not found: nonexistent"))
|
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
|
# goto
|
||||||
|
|
||||||
def test_shortcut_for_goto(self):
|
def test_shortcut_for_goto(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user