Пример #1
0
        public void Parse(Emulator emu)
        {
            mod    = 0;
            opcode = regIndex = 0;
            rm     = 0;
            sib    = 0;
            disp32 = disp8 = 0;

            Byte code;

            code = (Byte)emu.getCode8(0);

            mod    = (Byte)((code & 0xC0) >> 6);
            opcode = regIndex = (Byte)((code & 0x38) >> 3);
            rm     = (Byte)(code & 0x07);

            emu.eip++;

            if (mod != 0x03 && rm == 0x04)
            {
                sib = (Byte)emu.getCode8(0);
                emu.eip++;
            }

            if ((mod == 0x00 && rm == 0x05) || mod == 0x02)
            {
                disp32   = emu.getCode32(0);
                emu.eip += 4;
            }
            else if (mod == 0x01)
            {
                disp8    = (Byte)emu.getCode8(0);
                emu.eip += 1;
            }
        }
Пример #2
0
        // opcode 0x58-0x5F
        public static void pop_r32(Emulator emu)
        {
            Byte reg = (Byte)(emu.getCode8(0) - 0x58);

            emu.setRegister32(reg, emu.pop32());
            emu.eip += 1;
        }
Пример #3
0
        // opcode 0x50-0x57
        public static void push_r32(Emulator emu)
        {
            Byte reg = (Byte)(emu.getCode8(0) - 0x50);

            emu.push32(emu.getRegister32(reg));
            emu.eip += 1;
        }
Пример #4
0
        // opcode 0x6A
        public static void push_imm8(Emulator emu)
        {
            Byte value = (Byte)emu.getCode8(1);

            emu.push32(value);
            emu.eip += 2;
        }
Пример #5
0
        // opcode 0xC7
        public static void mov_r32_imm32(Emulator emu)
        {
            Byte   reg   = (Byte)(emu.getCode8(0) - 0xB8);
            UInt32 value = emu.getCode32(1);

            emu.registers[reg] = value;
            emu.eip           += 5;
        }