Ypsilon.Emulation.Processor.YCPU.DisassembleSTK C# (CSharp) Method

DisassembleSTK() private method

private DisassembleSTK ( string name, ushort operand, ushort nextword, ushort address, bool showMemoryContents, ushort &instructionSize ) : string
name string
operand ushort
nextword ushort
address ushort
showMemoryContents bool
instructionSize ushort
return string
        private string DisassembleSTK(string name, ushort operand, ushort nextword, ushort address, bool showMemoryContents, out ushort instructionSize)
        {
            instructionSize = 2;
            string flags = "{0}{1}{2}{3}{4}{5}{6}{7}";
            if ((operand & 0x0001) == 0x0000) {
                flags = string.Format(flags,
                    (operand & 0x8000) != 0 ? "R7 " : string.Empty,
                    (operand & 0x4000) != 0 ? "R6 " : string.Empty,
                    (operand & 0x2000) != 0 ? "R5 " : string.Empty,
                    (operand & 0x1000) != 0 ? "R4 " : string.Empty,
                    (operand & 0x0800) != 0 ? "R3 " : string.Empty,
                    (operand & 0x0400) != 0 ? "R2 " : string.Empty,
                    (operand & 0x0200) != 0 ? "R1 " : string.Empty,
                    (operand & 0x0100) != 0 ? "R0 " : string.Empty);
            }
            else {
                flags = string.Format(flags,
                    (operand & 0x8000) != 0 ? "SP " : string.Empty,
                    (operand & 0x4000) != 0 ? "USP " : string.Empty,
                    (operand & 0x2000) != 0 ? "?? " : string.Empty,
                    (operand & 0x1000) != 0 ? "?? " : string.Empty,
                    (operand & 0x0800) != 0 ? "?? " : string.Empty,
                    (operand & 0x0400) != 0 ? "PS " : string.Empty,
                    (operand & 0x0200) != 0 ? "PC " : string.Empty,
                    (operand & 0x0100) != 0 ? "FL " : string.Empty);
            }
            if (flags == string.Empty)
                flags = "<NONE>";
            return $"{name,-8}{flags}";
        }