Moved more variables into cpu_state structure.

This commit is contained in:
SarahW 2016-08-21 21:28:23 +01:00
commit eb126fd822
50 changed files with 1454 additions and 1481 deletions

View file

@ -4,13 +4,13 @@ static int opFADD ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
if ((npxc >> 10) & 3) \
fesetround(rounding_modes[(npxc >> 10) & 3]); \
ST(0) += use_var; \
if ((npxc >> 10) & 3) \
fesetround(FE_TONEAREST); \
tag[TOP] &= ~TAG_UINT64; \
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64; \
CLOCK_CYCLES(8); \
return 0; \
} \
@ -19,7 +19,7 @@ static int opFCOM ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
npxs &= ~(C0|C2|C3); \
npxs |= x87_compare(ST(0), (double)use_var); \
CLOCK_CYCLES(4); \
@ -30,7 +30,7 @@ static int opFCOMP ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
npxs &= ~(C0|C2|C3); \
npxs |= x87_compare(ST(0), (double)use_var); \
x87_pop(); \
@ -42,9 +42,9 @@ static int opFDIV ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
x87_div(ST(0), ST(0), use_var); \
tag[TOP] &= ~TAG_UINT64; \
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64; \
CLOCK_CYCLES(73); \
return 0; \
} \
@ -53,9 +53,9 @@ static int opFDIVR ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
x87_div(ST(0), use_var, ST(0)); \
tag[TOP] &= ~TAG_UINT64; \
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64; \
CLOCK_CYCLES(73); \
return 0; \
} \
@ -64,9 +64,9 @@ static int opFMUL ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
ST(0) *= use_var; \
tag[TOP] &= ~TAG_UINT64; \
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64; \
CLOCK_CYCLES(11); \
return 0; \
} \
@ -75,9 +75,9 @@ static int opFSUB ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
ST(0) -= use_var; \
tag[TOP] &= ~TAG_UINT64; \
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64; \
CLOCK_CYCLES(8); \
return 0; \
} \
@ -86,9 +86,9 @@ static int opFSUBR ## name ## _a ## a_size(uint32_t fetchdat) \
optype t; \
FP_ENTER(); \
fetch_ea_ ## a_size(fetchdat); \
load_var = get(); if (abrt) return 1; \
load_var = get(); if (cpu_state.abrt) return 1; \
ST(0) = use_var - ST(0); \
tag[TOP] &= ~TAG_UINT64; \
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64; \
CLOCK_CYCLES(8); \
return 0; \
}
@ -113,7 +113,7 @@ static int opFADD(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FADD\n");
ST(0) = ST(0) + ST(fetchdat & 7);
tag[TOP] &= ~TAG_UINT64;
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64;
CLOCK_CYCLES(8);
return 0;
}
@ -123,7 +123,7 @@ static int opFADDr(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FADD\n");
ST(fetchdat & 7) = ST(fetchdat & 7) + ST(0);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
CLOCK_CYCLES(8);
return 0;
}
@ -133,7 +133,7 @@ static int opFADDP(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FADDP\n");
ST(fetchdat & 7) = ST(fetchdat & 7) + ST(0);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
x87_pop();
CLOCK_CYCLES(8);
return 0;
@ -224,7 +224,7 @@ static int opFDIV(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FDIV\n");
x87_div(ST(0), ST(0), ST(fetchdat & 7));
tag[TOP] &= ~TAG_UINT64;
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64;
CLOCK_CYCLES(73);
return 0;
}
@ -234,7 +234,7 @@ static int opFDIVr(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FDIV\n");
x87_div(ST(fetchdat & 7), ST(fetchdat & 7), ST(0));
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
CLOCK_CYCLES(73);
return 0;
}
@ -244,7 +244,7 @@ static int opFDIVP(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FDIVP\n");
x87_div(ST(fetchdat & 7), ST(fetchdat & 7), ST(0));
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
x87_pop();
CLOCK_CYCLES(73);
return 0;
@ -256,7 +256,7 @@ static int opFDIVR(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FDIVR\n");
x87_div(ST(0), ST(fetchdat&7), ST(0));
tag[TOP] &= ~TAG_UINT64;
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64;
CLOCK_CYCLES(73);
return 0;
}
@ -266,7 +266,7 @@ static int opFDIVRr(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FDIVR\n");
x87_div(ST(fetchdat & 7), ST(0), ST(fetchdat & 7));
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
CLOCK_CYCLES(73);
return 0;
}
@ -276,7 +276,7 @@ static int opFDIVRP(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FDIVR\n");
x87_div(ST(fetchdat & 7), ST(0), ST(fetchdat & 7));
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
x87_pop();
CLOCK_CYCLES(73);
return 0;
@ -288,7 +288,7 @@ static int opFMUL(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FMUL\n");
ST(0) = ST(0) * ST(fetchdat & 7);
tag[TOP] &= ~TAG_UINT64;
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64;
CLOCK_CYCLES(16);
return 0;
}
@ -298,7 +298,7 @@ static int opFMULr(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FMUL\n");
ST(fetchdat & 7) = ST(0) * ST(fetchdat & 7);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
CLOCK_CYCLES(16);
return 0;
}
@ -308,7 +308,7 @@ static int opFMULP(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FMULP\n");
ST(fetchdat & 7) = ST(0) * ST(fetchdat & 7);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
x87_pop();
CLOCK_CYCLES(16);
return 0;
@ -320,7 +320,7 @@ static int opFSUB(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSUB\n");
ST(0) = ST(0) - ST(fetchdat & 7);
tag[TOP] &= ~TAG_UINT64;
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64;
CLOCK_CYCLES(8);
return 0;
}
@ -330,7 +330,7 @@ static int opFSUBr(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSUB\n");
ST(fetchdat & 7) = ST(fetchdat & 7) - ST(0);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
CLOCK_CYCLES(8);
return 0;
}
@ -340,7 +340,7 @@ static int opFSUBP(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSUBP\n");
ST(fetchdat & 7) = ST(fetchdat & 7) - ST(0);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
x87_pop();
CLOCK_CYCLES(8);
return 0;
@ -352,7 +352,7 @@ static int opFSUBR(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSUBR\n");
ST(0) = ST(fetchdat & 7) - ST(0);
tag[TOP] &= ~TAG_UINT64;
cpu_state.tag[cpu_state.TOP] &= ~TAG_UINT64;
CLOCK_CYCLES(8);
return 0;
}
@ -362,7 +362,7 @@ static int opFSUBRr(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSUBR\n");
ST(fetchdat & 7) = ST(0) - ST(fetchdat & 7);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
CLOCK_CYCLES(8);
return 0;
}
@ -372,7 +372,7 @@ static int opFSUBRP(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSUBRP\n");
ST(fetchdat & 7) = ST(0) - ST(fetchdat & 7);
tag[(TOP + fetchdat) & 7] &= ~TAG_UINT64;
cpu_state.tag[(cpu_state.TOP + fetchdat) & 7] &= ~TAG_UINT64;
x87_pop();
CLOCK_CYCLES(8);
return 0;