Skip to content

error in Relative16 addressing? #102

@binary1230

Description

@binary1230

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions