static void I486OP(cmpxchg_rm8_r8)(i386_state *cpustate) // Opcode 0x0f b0 { UINT8 modrm = FETCH(cpustate); if( modrm >= 0xc0 ) { UINT8 dst = LOAD_RM8(modrm); UINT8 src = LOAD_REG8(modrm); if( REG8(AL) == dst ) { STORE_RM8(modrm, src); cpustate->ZF = 1; CYCLES(cpustate,CYCLES_CMPXCHG_REG_REG_T); } else { REG8(AL) = dst; cpustate->ZF = 0; CYCLES(cpustate,CYCLES_CMPXCHG_REG_REG_F); } } else { UINT32 ea = GetEA(cpustate,modrm); UINT8 dst = READ8(cpustate,ea); UINT8 src = LOAD_REG8(modrm); if( REG8(AL) == dst ) { WRITE8(cpustate,modrm, src); cpustate->ZF = 1; CYCLES(cpustate,CYCLES_CMPXCHG_REG_MEM_T); } else { REG8(AL) = dst; cpustate->ZF = 0; CYCLES(cpustate,CYCLES_CMPXCHG_REG_MEM_F); } } }
void i386_device::i486_cmpxchg_rm8_r8() // Opcode 0x0f b0 { UINT8 modrm = FETCH(); if( modrm >= 0xc0 ) { UINT8 dst = LOAD_RM8(modrm); UINT8 src = LOAD_REG8(modrm); if( REG8(AL) == dst ) { STORE_RM8(modrm, src); m_ZF = 1; CYCLES(CYCLES_CMPXCHG_REG_REG_T); } else { REG8(AL) = dst; m_ZF = 0; CYCLES(CYCLES_CMPXCHG_REG_REG_F); } } else { // TODO: Check write if needed UINT32 ea = GetEA(modrm,0); UINT8 dst = READ8(ea); UINT8 src = LOAD_REG8(modrm); if( REG8(AL) == dst ) { WRITE8(ea, src); m_ZF = 1; CYCLES(CYCLES_CMPXCHG_REG_MEM_T); } else { REG8(AL) = dst; m_ZF = 0; CYCLES(CYCLES_CMPXCHG_REG_MEM_F); } } }
static void I486OP(xadd_rm8_r8)(i386_state *cpustate) // Opcode 0x0f c0 { UINT8 modrm = FETCH(cpustate); if( modrm >= 0xc0 ) { UINT8 dst = LOAD_RM8(modrm); UINT8 src = LOAD_REG8(modrm); STORE_RM16(modrm, dst + src); STORE_REG16(modrm, dst); CYCLES(cpustate,CYCLES_XADD_REG_REG); } else { UINT32 ea = GetEA(cpustate,modrm); UINT8 dst = READ8(cpustate,ea); UINT8 src = LOAD_REG8(modrm); WRITE8(cpustate,ea, dst + src); STORE_REG8(modrm, dst); CYCLES(cpustate,CYCLES_XADD_REG_MEM); } }
void i386_device::i486_xadd_rm8_r8() // Opcode 0x0f c0 { UINT8 modrm = FETCH(); if( modrm >= 0xc0 ) { UINT8 dst = LOAD_RM8(modrm); UINT8 src = LOAD_REG8(modrm); STORE_REG8(modrm, dst); STORE_RM8(modrm, dst + src); CYCLES(CYCLES_XADD_REG_REG); } else { UINT32 ea = GetEA(modrm,1); UINT8 dst = READ8(ea); UINT8 src = LOAD_REG8(modrm); WRITE8(ea, dst + src); STORE_REG8(modrm, dst); CYCLES(CYCLES_XADD_REG_MEM); } }