1
0
mirror of https://github.com/mnaberez/py65.git synced 2025-01-01 11:29:32 +00:00

Interactive assembly now sets PC=0 if assembling reaches top of memory

This commit is contained in:
Mike Naberezny 2012-11-25 11:03:13 -08:00
parent ca04dad8cb
commit 5a47382f7d

View File

@ -328,18 +328,22 @@ class Monitor(cmd.Cmd):
# assemble into memory
try:
bytes = self._assembler.assemble(line, pc=start)
numbytes = len(bytes)
end = start + len(bytes)
end = start + numbytes
self._mpu.memory[start:end] = bytes
# print disassembly
bytes, disasm = self._disassembler.instruction_at(start)
disassembly = self._format_disassembly(start, bytes, disasm)
_, disasm = self._disassembler.instruction_at(start)
fdisasm = self._format_disassembly(start, numbytes, disasm)
indent = ' ' * (len(prompt + line) + 5)
self.stdout.write("\r" + indent + "\r")
self.stdout.write(disassembly + "\n")
self.stdout.write(fdisasm + "\n")
start += bytes
# advance to next address
start += numbytes
if start >= (2 ** self._mpu.ADDR_WIDTH):
start = 0
except KeyError:
addr = self.addrFmt % start
self.stdout.write("\r$%s ?Label\n" % addr)