Fixed the implementation of XADD - fixes Windows 2000 Service Pack 4, and hopefully also Linux.
This commit is contained in:
@@ -132,83 +132,96 @@ static int opCMPXCHG8B_a32(uint32_t fetchdat)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* dest = eab, src = r8 */
|
||||||
static int opXADD_b_a16(uint32_t fetchdat)
|
static int opXADD_b_a16(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint8_t temp, temp2;
|
uint8_t temp;
|
||||||
|
uint8_t src, dest;
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
src = getr8(cpu_reg);
|
||||||
temp2 = getr8(cpu_reg);
|
dest = geteab(); if (cpu_state.abrt) return 1;
|
||||||
setr8(cpu_reg, temp);
|
temp = src + dest;
|
||||||
seteab(temp + temp2); if (cpu_state.abrt) return 1;
|
seteab(temp); if (cpu_state.abrt) return 1;
|
||||||
setadd8(temp, temp2);
|
setadd8(src, dest);
|
||||||
|
setr8(cpu_reg, dest);
|
||||||
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int opXADD_b_a32(uint32_t fetchdat)
|
static int opXADD_b_a32(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint8_t temp, temp2;
|
uint8_t temp;
|
||||||
|
uint8_t src, dest;
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
src = getr8(cpu_reg);
|
||||||
temp2 = getr8(cpu_reg);
|
dest = geteab(); if (cpu_state.abrt) return 1;
|
||||||
setr8(cpu_reg, temp);
|
temp = src + dest;
|
||||||
seteab(temp + temp2); if (cpu_state.abrt) return 1;
|
seteab(temp); if (cpu_state.abrt) return 1;
|
||||||
setadd8(temp, temp2);
|
setadd8(src, dest);
|
||||||
|
setr8(cpu_reg, dest);
|
||||||
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opXADD_w_a16(uint32_t fetchdat)
|
static int opXADD_w_a16(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t temp, temp2;
|
uint16_t temp;
|
||||||
|
uint16_t src, dest;
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
src = cpu_state.regs[cpu_reg].w;
|
||||||
temp2 = cpu_state.regs[cpu_reg].w;
|
dest = geteaw(); if (cpu_state.abrt) return 1;
|
||||||
cpu_state.regs[cpu_reg].w = temp;
|
temp = src + dest;
|
||||||
seteaw(temp + temp2); if (cpu_state.abrt) return 1;
|
seteaw(temp); if (cpu_state.abrt) return 1;
|
||||||
setadd16(temp, temp2);
|
setadd16(src, dest);
|
||||||
|
cpu_state.regs[cpu_reg].w = dest;
|
||||||
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int opXADD_w_a32(uint32_t fetchdat)
|
static int opXADD_w_a32(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t temp, temp2;
|
uint16_t temp;
|
||||||
|
uint16_t src, dest;
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
src = cpu_state.regs[cpu_reg].w;
|
||||||
temp2 = cpu_state.regs[cpu_reg].w;
|
dest = geteaw(); if (cpu_state.abrt) return 1;
|
||||||
cpu_state.regs[cpu_reg].w = temp;
|
temp = src + dest;
|
||||||
seteaw(temp + temp2); if (cpu_state.abrt) return 1;
|
seteaw(temp); if (cpu_state.abrt) return 1;
|
||||||
setadd16(temp, temp2);
|
setadd16(src, dest);
|
||||||
|
cpu_state.regs[cpu_reg].w = dest;
|
||||||
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opXADD_l_a16(uint32_t fetchdat)
|
static int opXADD_l_a16(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t temp, temp2;
|
uint32_t temp;
|
||||||
|
uint32_t src, dest;
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
src = cpu_state.regs[cpu_reg].l;
|
||||||
temp2 = cpu_state.regs[cpu_reg].l;
|
dest = geteal(); if (cpu_state.abrt) return 1;
|
||||||
cpu_state.regs[cpu_reg].l = temp;
|
temp = src + dest;
|
||||||
seteal(temp + temp2); if (cpu_state.abrt) return 1;
|
seteal(temp); if (cpu_state.abrt) return 1;
|
||||||
setadd32(temp, temp2);
|
setadd32(src, dest);
|
||||||
|
cpu_state.regs[cpu_reg].l = dest;
|
||||||
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int opXADD_l_a32(uint32_t fetchdat)
|
static int opXADD_l_a32(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t temp, temp2;
|
uint32_t temp;
|
||||||
|
uint32_t src, dest;
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
src = cpu_state.regs[cpu_reg].l;
|
||||||
temp2 = cpu_state.regs[cpu_reg].l;
|
dest = geteal(); if (cpu_state.abrt) return 1;
|
||||||
cpu_state.regs[cpu_reg].l = temp;
|
temp = src + dest;
|
||||||
seteal(temp + temp2); if (cpu_state.abrt) return 1;
|
seteal(temp); if (cpu_state.abrt) return 1;
|
||||||
setadd32(temp, temp2);
|
setadd32(src, dest);
|
||||||
|
cpu_state.regs[cpu_reg].l = dest;
|
||||||
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
CLOCK_CYCLES((cpu_mod == 3) ? 3 : 4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user