DiztinGUIsh icon indicating copy to clipboard operation
DiztinGUIsh copied to clipboard

error in Relative16 addressing?

Open binary1230 opened this issue 11 months ago • 1 comments

image

The highlighted cell magenta should (I think) be one byte after it.

the instruction "PER $0003" is using Relative16 addressing, and I think we're going wrong somewhere in CPU65816.cs GetIntermediateAddress():

            case Cpu65C816Constants.AddressMode.Relative16:
            {
                // something may be wrong here with the "PER" instruction (opcode 0x62).
                
                programCounter = data.ConvertPCtoSnes(offset + 3);
                bank = programCounter >> 16;
                var romByte = data.GetRomWord(offset + 1);
                if (!romByte.HasValue)
                    return -1;
                    
                return (bank << 16) | ((programCounter + (short)romByte) & 0xFFFF);
            }

can't track it down at the moment

binary1230 avatar Mar 26 '24 07:03 binary1230