Exemplo n.º 1
0
        private static int GetLineByteLength(int offset)
        {
            int max = 1, step = 1;
            int size = Data.GetROMSize();

            switch (Data.GetFlag(offset))
            {
            case Data.FlagType.Opcode:
                switch (Data.GetArchitechture(offset))
                {
                case Data.Architechture.CPU65C816: return(CPU65C816.GetInstructionLength(offset));

                case Data.Architechture.APUSPC700: return(1);

                case Data.Architechture.GPUSuperFX: return(1);
                }
                return(1);

            case Data.FlagType.Unreached:
            case Data.FlagType.Operand:
            case Data.FlagType.Data8Bit:
            case Data.FlagType.Graphics:
            case Data.FlagType.Music:
            case Data.FlagType.Empty:
                max = dataPerLine;
                break;

            case Data.FlagType.Text:
                max = 21;
                break;

            case Data.FlagType.Data16Bit:
                step = 2;
                max  = dataPerLine;
                break;

            case Data.FlagType.Data24Bit:
                step = 3;
                max  = dataPerLine;
                break;

            case Data.FlagType.Data32Bit:
                step = 4;
                max  = dataPerLine;
                break;

            case Data.FlagType.Pointer16Bit:
                step = 2;
                max  = 2;
                break;

            case Data.FlagType.Pointer24Bit:
                step = 3;
                max  = 3;
                break;

            case Data.FlagType.Pointer32Bit:
                step = 4;
                max  = 4;
                break;
            }

            int min = step, myBank = offset / bankSize;

            while (
                min < max &&
                offset + min < size &&
                Data.GetFlag(offset + min) == Data.GetFlag(offset) &&
                Data.GetLabel(offset + min) == "" &&
                (offset + min) / bankSize == myBank
                )
            {
                min += step;
            }
            return(min);
        }