mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-04 01:30:18 +00:00
Interactive assembly now sets PC=0 if assembling reaches top of memory
This commit is contained in:
parent
ca04dad8cb
commit
5a47382f7d
@ -328,18 +328,22 @@ class Monitor(cmd.Cmd):
|
|||||||
# assemble into memory
|
# assemble into memory
|
||||||
try:
|
try:
|
||||||
bytes = self._assembler.assemble(line, pc=start)
|
bytes = self._assembler.assemble(line, pc=start)
|
||||||
|
numbytes = len(bytes)
|
||||||
|
|
||||||
end = start + len(bytes)
|
end = start + numbytes
|
||||||
self._mpu.memory[start:end] = bytes
|
self._mpu.memory[start:end] = bytes
|
||||||
|
|
||||||
# print disassembly
|
# print disassembly
|
||||||
bytes, disasm = self._disassembler.instruction_at(start)
|
_, disasm = self._disassembler.instruction_at(start)
|
||||||
disassembly = self._format_disassembly(start, bytes, disasm)
|
fdisasm = self._format_disassembly(start, numbytes, disasm)
|
||||||
indent = ' ' * (len(prompt + line) + 5)
|
indent = ' ' * (len(prompt + line) + 5)
|
||||||
self.stdout.write("\r" + indent + "\r")
|
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:
|
except KeyError:
|
||||||
addr = self.addrFmt % start
|
addr = self.addrFmt % start
|
||||||
self.stdout.write("\r$%s ?Label\n" % addr)
|
self.stdout.write("\r$%s ?Label\n" % addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user