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

DVI() private method

private DVI ( ushort operand ) : void
operand ushort
return void
        private void DVI(ushort operand)
        {
            try {
                ushort value;
                RegGeneral destination;
                BitPatternALU(operand, out value, out destination);
                if (value == 0) {
                    Interrupt_DivZeroFault(operand);
                    return;
                }
                if ((R[(int)destination] == 0x8000) && (value == 0xFFFF)) {
                    // R is unchanged.
                    FL_N = true;
                    FL_Z = false;
                    // C [Carry] Not effected.
                    FL_V = true;
                }
                else {
                    int result = (short)R[(int)destination] / (short)value;
                    R[(int)RegGeneral.R0] = (ushort)(result >> 16);
                    R[(int)destination] = (ushort)(result & 0x0000FFFF);
                    FL_N = (result & 0x8000) != 0;
                    FL_Z = result == 0x0000;
                    // C [Carry] Not effected.
                    FL_V = false;
                }
            }
            catch (SegFaultException e) {
                Interrupt_SegFault(e.SegmentType, operand, e.Address);
            }
        }