void bx_cpu_c::XLAT(BxInstruction_t *i) { Bit32u offset_32; Bit8u al; #if BX_CPU_LEVEL >= 3 if (i->as_32) { offset_32 = EBX + AL; } else #endif /* BX_CPU_LEVEL >= 3 */ { offset_32 = BX + AL; } if (!BX_NULL_SEG_REG(i->seg)) { read_virtual_byte(i->seg, offset_32, &al); } else { read_virtual_byte(BX_SEG_REG_DS, offset_32, &al); } AL = al; }
void bx_cpu_c::ADD_GbEb(BxInstruction_t *i) { Bit8u op1, op2, sum; /* op1 is a register, i->rm_addr is an index of a register */ op1 = BX_READ_8BIT_REG(i->nnn); /* op2 is a register or memory reference */ if (i->mod == 0xc0) { op2 = BX_READ_8BIT_REG(i->rm); } else { /* pointer, segment address pair */ read_virtual_byte(i->seg, i->rm_addr, &op2); } sum = op1 + op2; /* now write sum back to destination, which is a register */ BX_WRITE_8BIT_REG(i->nnn, sum); SET_FLAGS_OSZAPC_8(op1, op2, sum, BX_INSTR_ADD8); }
void bx_cpu_c::SUB_GbEb(BxInstruction_t *i) { Bit8u op1_8, op2_8, diff_8; /* op1 is a register, i->rm_addr is an index of a register */ op1_8 = BX_READ_8BIT_REG(i->nnn); /* op2 is a register or memory reference */ if (i->mod == 0xc0) { op2_8 = BX_READ_8BIT_REG(i->rm); } else { /* pointer, segment address pair */ read_virtual_byte(i->seg, i->rm_addr, &op2_8); } diff_8 = op1_8 - op2_8; /* now write diff back to destination, which is a register */ BX_WRITE_8BIT_REG(i->nnn, diff_8); SET_FLAGS_OSZAPC_8(op1_8, op2_8, diff_8, BX_INSTR_SUB8); }
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVSX_GwEbM(bxInstruction_c *i) { BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i)); /* sign extend byte op2 into word op1 */ BX_WRITE_16BIT_REG(i->nnn(), (Bit8s) op2_8); }
void bx_cpu_c::MOV_ALOb(BxInstruction_t *i) { Bit8u temp_8; Bit32u addr_32; addr_32 = i->Id; /* read from memory address */ if (!BX_NULL_SEG_REG(i->seg)) { read_virtual_byte(i->seg, addr_32, &temp_8); } else { read_virtual_byte(BX_SEG_REG_DS, addr_32, &temp_8); } /* write to register */ AL = temp_8; }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CMP_EbIbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit32u op1_8 = read_virtual_byte(i->seg(), eaddr); Bit32u op2_8 = i->Ib(); Bit32u diff_8 = op1_8 - op2_8; SET_FLAGS_OSZAPC_SUB_8(op1_8, op2_8, diff_8); BX_NEXT_INSTR(i); }
void BX_CPU_C::MOVSX_GdEb(bxInstruction_c *i) { Bit8u op2_8; if (i->modC0()) { op2_8 = BX_READ_8BIT_REGx(i->rm(),i->extend8bitL()); } else { /* pointer, segment address pair */ read_virtual_byte(i->seg(), RMAddr(i), &op2_8); } /* sign extend byte op2 into dword op1 */ BX_WRITE_32BIT_REGZ(i->nnn(), (Bit8s) op2_8); }
void bx_cpu_c::MOV_GbEb(BxInstruction_t *i) { Bit8u op2; if (i->mod == 0xc0) { op2 = BX_READ_8BIT_REG(i->rm); } else { /* pointer, segment address pair */ read_virtual_byte(i->seg, i->rm_addr, &op2); } BX_WRITE_8BIT_REG(i->nnn, op2); }
void BX_CPU_C::XLAT(bxInstruction_c *i) { bx_address offset; #if BX_SUPPORT_X86_64 if (i->as64L()) { offset = RBX + AL; } else #endif if (i->as32L()) { offset = EBX + AL; } else { offset = BX + AL; } read_virtual_byte(i->seg(), offset, &AL); }
void bx_cpu_c::CMP_EbIb(BxInstruction_t *i) { Bit8u op2_8, op1_8, diff_8; op2_8 = i->Ib; /* op1_8 is a register or memory reference */ if (i->mod == 0xc0) { op1_8 = BX_READ_8BIT_REG(i->rm); } else { /* pointer, segment address pair */ read_virtual_byte(i->seg, i->rm_addr, &op1_8); } diff_8 = op1_8 - op2_8; SET_FLAGS_OSZAPC_8(op1_8, op2_8, diff_8, BX_INSTR_CMP8); }
void BX_CPU_C::MOV_ALOd(bxInstruction_c *i) { read_virtual_byte(i->seg(), i->Id(), &AL); }
void BX_CPU_C::MOV_GbEEb(bxInstruction_c *i) { read_virtual_byte(i->seg(), RMAddr(i), &BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL())); }