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

PSH() private method

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