mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-16 03:30:01 +00:00
Fix interpretation of range in disassemble command
This commit is contained in:
parent
81906116f3
commit
321c9cfb36
@ -3,6 +3,9 @@
|
||||
- Disassembling can now wrap around memory if the start address
|
||||
given is greater than the end address.
|
||||
|
||||
- Fixed the disassembler to accept a range of "start:end" instead of
|
||||
"start:end+1" for consistency with the other commands.
|
||||
|
||||
0.14 (2012-11-30)
|
||||
|
||||
- Assembling now detects syntax errors, overflows, and bad labels
|
||||
|
@ -284,11 +284,9 @@ class Monitor(cmd.Cmd):
|
||||
try:
|
||||
start = self._address_parser.number(splitted[0])
|
||||
bytes = self._assembler.assemble(statement, start)
|
||||
|
||||
end = start + len(bytes)
|
||||
self._mpu.memory[start:end] = bytes
|
||||
rangestr = (self.addrFmt + ":" + self.addrFmt) % (start, end)
|
||||
self.do_disassemble(rangestr)
|
||||
self.do_disassemble(self.addrFmt % start)
|
||||
except KeyError:
|
||||
self._output("Bad label: %s" % args)
|
||||
except OverflowError:
|
||||
@ -367,16 +365,10 @@ class Monitor(cmd.Cmd):
|
||||
end = start
|
||||
|
||||
max_address = (2 ** self._mpu.ADDR_WIDTH) - 1
|
||||
|
||||
if start == end:
|
||||
end += 1
|
||||
if end > max_address:
|
||||
end = 0
|
||||
|
||||
cur_address = start
|
||||
needs_wrap = start > end
|
||||
|
||||
while needs_wrap or cur_address < end:
|
||||
while needs_wrap or cur_address <= end:
|
||||
length, disasm = self._disassembler.instruction_at(cur_address)
|
||||
self._output(self._format_disassembly(cur_address, length, disasm))
|
||||
|
||||
@ -384,7 +376,7 @@ class Monitor(cmd.Cmd):
|
||||
while remaining:
|
||||
remaining -= 1
|
||||
cur_address += 1
|
||||
if cur_address > max_address:
|
||||
if start > end and cur_address > max_address:
|
||||
needs_wrap = False
|
||||
cur_address = 0
|
||||
|
||||
@ -409,7 +401,7 @@ class Monitor(cmd.Cmd):
|
||||
def help_disassemble(self):
|
||||
self._output("disassemble <address_range>")
|
||||
self._output("Disassemble instructions in the address range.")
|
||||
self._output('Range is specified like "<start>:<end+1>".')
|
||||
self._output('Range is specified like "<start>:<end>".')
|
||||
|
||||
def help_step(self):
|
||||
self._output("step")
|
||||
|
@ -295,7 +295,7 @@ class MonitorTests(unittest.TestCase):
|
||||
mon._mpu.memory[0xc000] = 0xEA # => NOP
|
||||
mon._mpu.memory[0xc001] = 0xEA # => NOP
|
||||
mon._mpu.step()
|
||||
mon.do_disassemble("c000:c002")
|
||||
mon.do_disassemble("c000:c001")
|
||||
|
||||
out = stdout.getvalue()
|
||||
disasm = "$c000 ea NOP\n$c001 ea NOP\n"
|
||||
@ -323,7 +323,7 @@ class MonitorTests(unittest.TestCase):
|
||||
mon._mpu.memory[0x0003] = 0xE4
|
||||
mon._mpu.memory[0x0004] = 0xFF # => $FFE4
|
||||
mon._mpu.memory[0x0005] = 0xEA # => NOP
|
||||
mon.do_disassemble("ffff:6")
|
||||
mon.do_disassemble("ffff:5")
|
||||
out = stdout.getvalue()
|
||||
disasm = ("$ffff 20 d2 ff JSR $ffd2\n"
|
||||
"$0002 20 e4 ff JSR $ffe4\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user