BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNLE_EbR(bxInstruction_c *i) { Bit8u result_8 = !(getB_ZF() | (getB_SF() ^ getB_OF())); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), result_8); BX_NEXT_INSTR(i); }
void BX_CPU_C::XCHG_EbGb(bxInstruction_c *i) { Bit8u op2, op1; op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()); /* op1 is a register or memory reference */ if (i->modC0()) { op1 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2); } else { /* pointer, segment address pair */ read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1); write_RMW_virtual_byte(op2); } BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1); }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::DEC_EbR(bxInstruction_c *i) { Bit32u op1_8 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); op1_8--; BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op1_8); SET_FLAGS_OSZAP_SUB_8(op1_8 + 1, 0, op1_8); BX_NEXT_INSTR(i); }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::NEG_EbR(bxInstruction_c *i) { Bit32u op1_8 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); op1_8 = - (Bit8s)(op1_8); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op1_8); SET_FLAGS_OSZAPC_SUB_8(0, 0 - op1_8, op1_8); BX_NEXT_INSTR(i); }
void BX_CPU_C::MOV_EbIb(bxInstruction_c *i) { Bit8u op2 = i->Ib(); if (i->modC0()) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2); } else { write_virtual_byte(i->seg(), RMAddr(i), &op2); } }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::SBB_EbIbR(bxInstruction_c *i) { Bit32u op1_8 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); Bit32u op2_8 = i->Ib(); Bit32u diff_8 = op1_8 - (op2_8 + getB_CF()); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), diff_8); SET_FLAGS_OSZAPC_SUB_8(op1_8, op2_8, diff_8); BX_NEXT_INSTR(i); }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::ADC_GbEbR(bxInstruction_c *i) { Bit32u op1 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()); Bit32u op2 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); Bit32u sum = op1 + op2 + getB_CF(); BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), sum); SET_FLAGS_OSZAPC_ADD_8(op1, op2, sum); BX_NEXT_INSTR(i); }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::XADD_EbGbR(bxInstruction_c *i) { /* XADD dst(r/m8), src(r8) * temp <-- src + dst | sum = op2 + op1 * src <-- dst | op2 = op1 * dst <-- tmp | op1 = sum */ Bit32u op1 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); Bit32u op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()); Bit32u sum = op1 + op2; // and write destination into source // Note: if both op1 & op2 are registers, the last one written // should be the sum, as op1 & op2 may be the same register. // For example: XADD AL, AL BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), sum); SET_FLAGS_OSZAPC_ADD_8(op1, op2, sum); BX_NEXT_INSTR(i); }
void BX_CPU_C::SETNB_Eb(bxInstruction_c *i) { Bit8u result_8; if (get_CF()==0) result_8 = 1; else result_8 = 0; /* now write result back to destination */ if (i->modC0()) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), result_8); } else { write_virtual_byte(i->seg(), RMAddr(i), &result_8); } }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CMPXCHG_EbGbR(bxInstruction_c *i) { Bit32u op1_8 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL()); Bit32u diff_8 = AL - op1_8; SET_FLAGS_OSZAPC_SUB_8(AL, op1_8, diff_8); if (diff_8 == 0) { // if accumulator == dest // dest <-- src Bit32u op2_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2_8); } else { // accumulator <-- dest AL = op1_8; } BX_NEXT_INSTR(i); }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::XADD_EbGbM(bxInstruction_c *i) { /* XADD dst(r/m8), src(r8) * temp <-- src + dst | sum = op2 + op1 * src <-- dst | op2 = op1 * dst <-- tmp | op1 = sum */ bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit32u op1 = read_RMW_virtual_byte(i->seg(), eaddr); Bit32u op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()); Bit32u sum = op1 + op2; write_RMW_virtual_byte(sum); /* and write destination into source */ BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1); SET_FLAGS_OSZAPC_ADD_8(op1, op2, sum); BX_NEXT_INSTR(i); }
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNB_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !getB_CF()); BX_NEXT_INSTR(i); }
void BX_CPU_C::MOV_GbEGb(bxInstruction_c *i) { Bit8u op2 = BX_READ_8BIT_REGx(i->rm(),i->extend8bitL()); BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op2); }