private static void add_rm32_imm8(Emulator emu, ModRM modrm) { UInt32 rm32 = modrm.get_rm32(emu); UInt32 imm8 = (UInt32)emu.getSignedCode8(0); emu.eip += 1; modrm.set_rm32(emu, rm32 + imm8); }
// opcode 0x89 public static void mov_rm32_r32(Emulator emu) { emu.eip += 1; ModRM modrm = new ModRM(); modrm.Parse(emu); UInt32 r32 = modrm.get_r32(emu); modrm.set_rm32(emu, r32); }
// opcode 0xB8~0xBF public static void mov_rm32_imm32(Emulator emu) { emu.eip++; ModRM modrm = new ModRM(); modrm.Parse(emu); UInt32 value = emu.getCode32(0); emu.eip += 4; modrm.set_rm32(emu, value); }
static void sub_rm32_imm8(Emulator emu, ModRM modrm) { UInt32 rm32 = modrm.get_rm32(emu); UInt32 imm8 = (UInt32)emu.getSignedCode8(0); emu.eip += 1; UInt64 result = (UInt64)rm32 - (UInt64)imm8; modrm.set_rm32(emu, (UInt32)result); emu.update_eflags_sub(rm32, imm8, result); }
private static void inc_rm32(Emulator emu, ModRM modrm) { UInt32 value = modrm.get_rm32(emu); modrm.set_rm32(emu, value + 1); }