예제 #1
0
 public void Dispatch(Cpu8086 cpu, OpCodeManager.Instruction instruction)
 {
     if (cpu.GetFlags().Has(FlagsRegister.Overflow))
     {
         cpu.Interrupt(4);
     }
 }
예제 #2
0
        public void Dispatch(Cpu8086 cpu, OpCodeManager.Instruction instruction)
        {
            var value1 = (int)(((uint)cpu.GetRegister(Register.DX) << 16) | cpu.GetRegister(Register.AX));
            int value2 = (short)InstructionHelper.GetInstructionValue(cpu, instruction.Flag, instruction.SegmentPrefix, instruction.Argument1, instruction.Argument1Value, instruction.Argument1Displacement);

            if ((uint)value1 == 0x80000000 || value2 == 0)
            {
                cpu.Interrupt(0);
                return;
            }

            var quotient  = value1 / value2;
            var remainder = value1 % value2;

            if ((quotient & 0xFFFF) != quotient)
            {
                cpu.Interrupt(0);
                return;
            }

            cpu.SetRegister(Register.AX, (ushort)quotient);
            cpu.SetRegister(Register.DX, (ushort)remainder);
        }
예제 #3
0
        public void Dispatch(Cpu8086 cpu, OpCodeManager.Instruction instruction)
        {
            uint value1 = cpu.GetRegister(Register.AX);
            uint value2 = (byte)InstructionHelper.GetInstructionValue(cpu, instruction.Flag, instruction.SegmentPrefix, instruction.Argument1, instruction.Argument1Value, instruction.Argument1Displacement);

            if (value2 == 0)
            {
                cpu.Interrupt(0);
                return;
            }

            var quotient = value1 / value2;

            if (quotient > 0xFF)
            {
                cpu.Interrupt(0);
                return;
            }

            var remainder = value1 % value2;

            cpu.SetRegisterU8(Register.AL, (byte)quotient);
            cpu.SetRegisterU8(Register.AH, (byte)remainder);
        }
예제 #4
0
 public void Dispatch(Cpu8086 cpu, OpCodeManager.Instruction instruction)
 {
     Debug.Assert(instruction.Argument1 == OpCodeManager.ARG_CONSTANT);
     cpu.Interrupt((byte)instruction.Argument1Value, true);
 }