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

POP() private method

private POP ( ushort operand ) : void
operand ushort
return void
        private void POP(ushort operand)
        {
            ushort value;
            RegGeneral destination;
            BitPatternSTK(operand, out value, out destination);
            if ((value & 0x0001) == 0) {
                if ((value & 0x8000) != 0)
                    R[(int)RegGeneral.R7] = StackPop(operand);
                if ((value & 0x4000) != 0)
                    R[(int)RegGeneral.R6] = StackPop(operand);
                if ((value & 0x2000) != 0)
                    R[(int)RegGeneral.R5] = StackPop(operand);
                if ((value & 0x1000) != 0)
                    R[(int)RegGeneral.R4] = StackPop(operand);
                if ((value & 0x0800) != 0)
                    R[(int)RegGeneral.R3] = StackPop(operand);
                if ((value & 0x0400) != 0)
                    R[(int)RegGeneral.R2] = StackPop(operand);
                if ((value & 0x0200) != 0)
                    R[(int)RegGeneral.R1] = StackPop(operand);
                if ((value & 0x0100) != 0)
                    R[(int)RegGeneral.R0] = StackPop(operand);
            }
            else {
                if ((value & 0x2000) != 0 ||
                    (value & 0x1000) != 0 ||
                    (value & 0x0800) != 0) {
                    Interrupt_UndefFault(operand);
                }
                else {
                    if ((value & 0x0100) != 0)
                        FL = StackPop(operand);
                    if ((value & 0x0200) != 0)
                        PC = StackPop(operand);
                    if ((value & 0x0400) != 0)
                        PS = StackPop(operand);
                    if ((value & 0x4000) != 0)
                        USP = StackPop(operand);
                    if ((value & 0x8000) != 0)
                        SP = StackPop(operand);
                }
            }
        }