mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-04 01:30:18 +00:00
Flags (P) can now be changed from the "registers" command.
This commit is contained in:
parent
f1c27198b2
commit
cb63d94776
@ -6,6 +6,10 @@ Next Release
|
||||
- Fixed that relative branch calculations would not use the correct
|
||||
start address when assembling in the monitor. Closes #10.
|
||||
|
||||
- The processor status register ("p" or "flags") can now be changed
|
||||
in the monitor using the "registers" command with an argument of
|
||||
"p", such as "registers p=00".
|
||||
|
||||
0.6 (2009-08-11)
|
||||
|
||||
- Added monitor shortcut "a" for "assemble".
|
||||
|
@ -295,13 +295,15 @@ class Monitor(cmd.Cmd):
|
||||
return self._output("Syntax error: %s" % args)
|
||||
|
||||
for register, value in pairs:
|
||||
if register not in ('pc', 'sp', 'a', 'x', 'y'):
|
||||
if register not in ('pc', 'sp', 'a', 'x', 'y', 'p'):
|
||||
self._output("Invalid register: %s" % register)
|
||||
else:
|
||||
try:
|
||||
intval = self._address_parser.number(value) & 0xFFFF
|
||||
if len(register) == 1:
|
||||
intval &= 0xFF
|
||||
if register == 'p':
|
||||
register = 'flags'
|
||||
setattr(self._mpu, register, intval)
|
||||
except KeyError, why:
|
||||
self._output(why[0])
|
||||
|
@ -266,13 +266,14 @@ class MonitorTests(unittest.TestCase):
|
||||
def test_registers_updates_all_registers(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon.do_registers('a=42,x=43,y=44, sp=45, pc=4600')
|
||||
mon.do_registers('a=42,x=43,y=44,p=45, sp=46, pc=4600')
|
||||
out = stdout.getvalue()
|
||||
self.assertEqual("", out)
|
||||
self.assertEqual(0x42, mon._mpu.a)
|
||||
self.assertEqual(0x43, mon._mpu.x)
|
||||
self.assertEqual(0x44, mon._mpu.y)
|
||||
self.assertEqual(0x45, mon._mpu.sp)
|
||||
self.assertEqual(0x45, mon._mpu.flags)
|
||||
self.assertEqual(0x46, mon._mpu.sp)
|
||||
self.assertEqual(0x4600, mon._mpu.pc)
|
||||
|
||||
def test_help_registers(self):
|
||||
|
Loading…
Reference in New Issue
Block a user