Esempio n. 1
0
        public void interpret(X86Instruction instr)
        {
            int temp;

            switch (instr.type)
            {
            case X86Instruction.EnumInstructionType.MOV_INTINT:
                integerRegisters[instr.dest] = integerRegisters[instr.a];
                break;

            case X86Instruction.EnumInstructionType.ADD_INTCONST:
                integerRegisters[instr.dest] += instr.immediate;
                break;

            case X86Instruction.EnumInstructionType.SUB_INTCONST:
                integerRegisters[instr.dest] -= instr.immediate;
                break;

            case X86Instruction.EnumInstructionType.EXCHANGEINT_INT:
                temp = integerRegisters[instr.dest];
                integerRegisters[instr.dest] = integerRegisters[instr.a];
                integerRegisters[instr.a]    = temp;
                break;

            case X86Instruction.EnumInstructionType.ADD_INT:
                integerRegisters[instr.dest] += integerRegisters[instr.a];
                break;

            case X86Instruction.EnumInstructionType.SUB_INT:
                integerRegisters[instr.dest] -= integerRegisters[instr.a];
                break;

            case X86Instruction.EnumInstructionType.MUL_INT:
                integerRegisters[instr.dest] *= integerRegisters[instr.a];
                break;

            case X86Instruction.EnumInstructionType.HORIZONTALADD_FLOATVECTOR4:
                instructionHorizontalAdd_floatVector4(instr);
                break;

            case X86Instruction.EnumInstructionType.HORIZONTALSUB_FLOATVECTOR4:
                instructionHorizontalSub_floatVector4(instr);
                break;

            case X86Instruction.EnumInstructionType.ADD_FLOATVECTOR4:
                instructionAdd_floatVector4(instr);
                break;

            case X86Instruction.EnumInstructionType.SUB_FLOATVECTOR4:
                instructionSub_floatVector4(instr);
                break;

            case X86Instruction.EnumInstructionType.MUL_FLOATVECTOR4:
                instructionMul_floatVector4(instr);
                break;

            case X86Instruction.EnumInstructionType.DIV_FLOATVECTOR4:
                instructionDiv_floatVector4(instr);
                break;

            case X86Instruction.EnumInstructionType.SHUFFLE_FLOATVECTOR4:
                instructionShuffle_floatVector4(instr);
                break;
            }
        }