Implement clock-dividing for FPUs on clock-multiplied 386s
This is done by making it so that if the FPU is not at least a 487SX, the clock cycles are multiplied by the CPU multiplier.
This commit is contained in:
@@ -23,7 +23,7 @@ static int opFILDiw_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
x87_push((double)temp);
|
||||
CLOCK_CYCLES(x87_timings.fild_16);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fild_16) : (x87_timings.fild_16 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -35,7 +35,7 @@ static int opFILDiw_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
x87_push((double)temp);
|
||||
CLOCK_CYCLES(x87_timings.fild_16);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fild_16) : (x87_timings.fild_16 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -48,7 +48,7 @@ static int opFISTiw_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteaw((int16_t)temp64);
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_16) : (x87_timings.fist_16 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -60,7 +60,7 @@ static int opFISTiw_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteaw((int16_t)temp64);
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_16) : (x87_timings.fist_16 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#endif
|
||||
@@ -74,7 +74,7 @@ static int opFISTPiw_a16(uint32_t fetchdat)
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteaw((int16_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_16) : (x87_timings.fist_16 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -87,7 +87,7 @@ static int opFISTPiw_a32(uint32_t fetchdat)
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteaw((int16_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_16) : (x87_timings.fist_16 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -103,7 +103,7 @@ static int opFILDiq_a16(uint32_t fetchdat)
|
||||
cpu_state.MM[cpu_state.TOP&7].q = temp64;
|
||||
FP_TAG_DEFAULT;
|
||||
|
||||
CLOCK_CYCLES(x87_timings.fild_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fild_64) : (x87_timings.fild_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -118,7 +118,7 @@ static int opFILDiq_a32(uint32_t fetchdat)
|
||||
cpu_state.MM[cpu_state.TOP&7].q = temp64;
|
||||
FP_TAG_DEFAULT;
|
||||
|
||||
CLOCK_CYCLES(x87_timings.fild_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fild_64) : (x87_timings.fild_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -147,7 +147,7 @@ static int FBSTP_a16(uint32_t fetchdat)
|
||||
if (ST(0) < 0.0) tempc |= 0x80;
|
||||
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fbstp);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fbstp) : (x87_timings.fbstp * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -175,7 +175,7 @@ static int FBSTP_a32(uint32_t fetchdat)
|
||||
if (ST(0) < 0.0) tempc |= 0x80;
|
||||
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fbstp);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fbstp) : (x87_timings.fbstp * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -192,7 +192,7 @@ static int FISTPiq_a16(uint32_t fetchdat)
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteaq(temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fist_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_64) : (x87_timings.fist_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -208,7 +208,7 @@ static int FISTPiq_a32(uint32_t fetchdat)
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteaq(temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fist_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_64) : (x87_timings.fist_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -221,7 +221,7 @@ static int opFILDil_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
templ = geteal(); if (cpu_state.abrt) return 1;
|
||||
x87_push((double)templ);
|
||||
CLOCK_CYCLES(x87_timings.fild_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fild_32) : (x87_timings.fild_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -233,7 +233,7 @@ static int opFILDil_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
templ = geteal(); if (cpu_state.abrt) return 1;
|
||||
x87_push((double)templ);
|
||||
CLOCK_CYCLES(x87_timings.fild_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fild_32) : (x87_timings.fild_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -246,7 +246,7 @@ static int opFISTil_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteal((int32_t)temp64);
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_32) : (x87_timings.fist_32 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -258,7 +258,7 @@ static int opFISTil_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteal((int32_t)temp64);
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_32) : (x87_timings.fist_32 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#endif
|
||||
@@ -272,7 +272,7 @@ static int opFISTPil_a16(uint32_t fetchdat)
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteal((int32_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_32) : (x87_timings.fist_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -285,7 +285,7 @@ static int opFISTPil_a32(uint32_t fetchdat)
|
||||
temp64 = x87_fround(ST(0));
|
||||
seteal((int32_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fist_32) : (x87_timings.fist_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -298,7 +298,7 @@ static int opFLDe_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
t=x87_ld80(); if (cpu_state.abrt) return 1;
|
||||
x87_push(t);
|
||||
CLOCK_CYCLES(x87_timings.fld_80);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fld_80) : (x87_timings.fld_80 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -310,7 +310,7 @@ static int opFLDe_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
t=x87_ld80(); if (cpu_state.abrt) return 1;
|
||||
x87_push(t);
|
||||
CLOCK_CYCLES(x87_timings.fld_80);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fld_80) : (x87_timings.fld_80 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -322,7 +322,7 @@ static int opFSTPe_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fld_80);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fld_80) : (x87_timings.fld_80 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -333,7 +333,7 @@ static int opFSTPe_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fld_80);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fld_80) : (x87_timings.fld_80 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -346,7 +346,7 @@ static int opFLDd_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
t.i = geteaq(); if (cpu_state.abrt) return 1;
|
||||
x87_push(t.d);
|
||||
CLOCK_CYCLES(x87_timings.fld_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fld_64) : (x87_timings.fld_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -358,7 +358,7 @@ static int opFLDd_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
t.i = geteaq(); if (cpu_state.abrt) return 1;
|
||||
x87_push(t.d);
|
||||
CLOCK_CYCLES(x87_timings.fld_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fld_64) : (x87_timings.fld_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -371,7 +371,7 @@ static int opFSTd_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
t.d = ST(0);
|
||||
seteaq(t.i);
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_64) : (x87_timings.fst_64 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -383,7 +383,7 @@ static int opFSTd_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
t.d = ST(0);
|
||||
seteaq(t.i);
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_64) : (x87_timings.fst_64 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#endif
|
||||
@@ -397,7 +397,7 @@ static int opFSTPd_a16(uint32_t fetchdat)
|
||||
t.d = ST(0);
|
||||
seteaq(t.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_64) : (x87_timings.fst_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -410,7 +410,7 @@ static int opFSTPd_a32(uint32_t fetchdat)
|
||||
t.d = ST(0);
|
||||
seteaq(t.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_64) : (x87_timings.fst_64 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -423,7 +423,7 @@ static int opFLDs_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
ts.i = geteal(); if (cpu_state.abrt) return 1;
|
||||
x87_push((double)ts.s);
|
||||
CLOCK_CYCLES(x87_timings.fld_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_32) : (x87_timings.fst_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -435,7 +435,7 @@ static int opFLDs_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
ts.i = geteal(); if (cpu_state.abrt) return 1;
|
||||
x87_push((double)ts.s);
|
||||
CLOCK_CYCLES(x87_timings.fld_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_32) : (x87_timings.fst_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -448,7 +448,7 @@ static int opFSTs_a16(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i);
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_32) : (x87_timings.fst_32 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -460,7 +460,7 @@ static int opFSTs_a32(uint32_t fetchdat)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i);
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_32) : (x87_timings.fst_32 * cpu_multi));
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
#endif
|
||||
@@ -474,7 +474,7 @@ static int opFSTPs_a16(uint32_t fetchdat)
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_32) : (x87_timings.fst_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#ifndef FPU_8087
|
||||
@@ -487,7 +487,7 @@ static int opFSTPs_a32(uint32_t fetchdat)
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
CLOCK_CYCLES((fpu_type >= FPU_487SX) ? (x87_timings.fst_32) : (x87_timings.fst_32 * cpu_multi));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user