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

SUB() private method

private SUB ( ushort operand ) : void
operand ushort
return void
        private void SUB(ushort operand)
        {
            ushort value;
            RegGeneral destination;
            try {
                BitPatternALU(operand, out value, out destination);
                int u_result = R[(int)destination] - value;
                int s_result = (short)R[(int)destination] - (short)value;
                R[(int)destination] = (ushort)(u_result & 0x0000FFFF);
                FL_N = (u_result & 0x8000) != 0;
                FL_Z = u_result == 0x0000;
                FL_C = (u_result & 0xFFFF0000) != 0;
                FL_V = (s_result < -0x8000) | (s_result > 0x7FFF);
            }
            catch (SegFaultException e) {
                Interrupt_SegFault(e.SegmentType, operand, e.Address);
            }
        }