private void MDI(ushort operand)
{
ushort value;
RegGeneral destination;
try {
BitPatternALU(operand, out value, out destination);
if (value == 0) {
Interrupt_DivZeroFault(operand);
return;
}
int s_result = (short)R[(int)destination] % (short)value;
ushort r = (ushort)(s_result & 0x0000FFFF);
R[(int)destination] = r;
FL_N = (r & 0x8000) != 0;
FL_Z = r == 0x0000;
// C [Carry] Not effected.
// V [Overflow] Not effected.
}
catch (SegFaultException e) {
Interrupt_SegFault(e.SegmentType, operand, e.Address);
}
}