mirror of
https://github.com/mnaberez/py65.git
synced 2025-04-04 07:29:31 +00:00
bugfix: long standing branch bug in assembler and disassembler
This commit is contained in:
parent
c264bd6707
commit
7e48fade90
@ -87,8 +87,7 @@ class Assembler:
|
||||
# relative branch
|
||||
absolute = int(''.join(operands), 16)
|
||||
relative = (absolute - pc) - 2
|
||||
if (relative < 1):
|
||||
relative = (relative ^ self.byteMask) + 1
|
||||
relative = relative & self.byteMask
|
||||
operands = [ (self.byteFmt % relative) ]
|
||||
|
||||
elif len(operands) == 2:
|
||||
|
@ -80,7 +80,7 @@ class Disassembler:
|
||||
elif addressing == 'rel':
|
||||
opv = self._mpu.ByteAt(pc + 1)
|
||||
targ = pc + 2
|
||||
if opv & (1<<self.byteWidth):
|
||||
if opv & (1<<(self.byteWidth-1)):
|
||||
targ -= (opv ^ self.byteMask) + 1
|
||||
else:
|
||||
targ += opv
|
||||
|
@ -236,7 +236,7 @@ class Monitor(cmd.Cmd):
|
||||
return
|
||||
|
||||
# assemble into memory
|
||||
bytes = self._assembler.assemble(line)
|
||||
bytes = self._assembler.assemble(line, pc=start)
|
||||
if bytes is None:
|
||||
self.stdout.write("\r$" + (self.addrFmt % start) + " ???\n")
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user