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,7 +4,7 @@ static int opFILDiw_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FILDw %08X:%08X\n", easeg, cpu_state.eaaddr);
temp = geteaw(); if (abrt) return 1;
temp = geteaw(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", (double)temp);
x87_push((double)temp);
CLOCK_CYCLES(13);
@ -16,7 +16,7 @@ static int opFILDiw_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FILDw %08X:%08X\n", easeg, cpu_state.eaaddr);
temp = geteaw(); if (abrt) return 1;
temp = geteaw(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", (double)temp);
x87_push((double)temp);
CLOCK_CYCLES(13);
@ -34,7 +34,7 @@ static int opFISTiw_a16(uint32_t fetchdat)
fatal("FISTw overflow %i\n", temp64);*/
seteaw((int16_t)temp64);
CLOCK_CYCLES(29);
return abrt;
return cpu_state.abrt;
}
static int opFISTiw_a32(uint32_t fetchdat)
{
@ -47,7 +47,7 @@ static int opFISTiw_a32(uint32_t fetchdat)
fatal("FISTw overflow %i\n", temp64);*/
seteaw((int16_t)temp64);
CLOCK_CYCLES(29);
return abrt;
return cpu_state.abrt;
}
static int opFISTPiw_a16(uint32_t fetchdat)
@ -59,7 +59,7 @@ static int opFISTPiw_a16(uint32_t fetchdat)
temp64 = x87_fround(ST(0));
/* if (temp64 > 32767 || temp64 < -32768)
fatal("FISTw overflow %i\n", temp64);*/
seteaw((int16_t)temp64); if (abrt) return 1;
seteaw((int16_t)temp64); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(29);
return 0;
@ -73,7 +73,7 @@ static int opFISTPiw_a32(uint32_t fetchdat)
temp64 = x87_fround(ST(0));
/* if (temp64 > 32767 || temp64 < -32768)
fatal("FISTw overflow %i\n", temp64);*/
seteaw((int16_t)temp64); if (abrt) return 1;
seteaw((int16_t)temp64); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(29);
return 0;
@ -85,11 +85,11 @@ static int opFILDiq_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FILDl %08X:%08X\n", easeg, cpu_state.eaaddr);
temp64 = geteaq(); if (abrt) return 1;
temp64 = geteaq(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f %08X %08X\n", (double)temp64, readmeml(easeg,cpu_state.eaaddr), readmeml(easeg,cpu_state.eaaddr+4));
x87_push((double)temp64);
ST_i64[TOP] = temp64;
tag[TOP] |= TAG_UINT64;
MM[cpu_state.TOP].q = temp64;
cpu_state.tag[cpu_state.TOP] |= TAG_UINT64;
CLOCK_CYCLES(10);
return 0;
@ -100,11 +100,11 @@ static int opFILDiq_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FILDl %08X:%08X\n", easeg, cpu_state.eaaddr);
temp64 = geteaq(); if (abrt) return 1;
temp64 = geteaq(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f %08X %08X\n", (double)temp64, readmeml(easeg,cpu_state.eaaddr), readmeml(easeg,cpu_state.eaaddr+4));
x87_push((double)temp64);
ST_i64[TOP] = temp64;
tag[TOP] |= TAG_UINT64;
MM[cpu_state.TOP].q = temp64;
cpu_state.tag[cpu_state.TOP] |= TAG_UINT64;
CLOCK_CYCLES(10);
return 0;
@ -132,7 +132,7 @@ static int FBSTP_a16(uint32_t fetchdat)
}
tempc = (uint8_t)floor(fmod(tempd, 10.0));
if (ST(0) < 0.0) tempc |= 0x80;
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (abrt) return 1;
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (cpu_state.abrt) return 1;
x87_pop();
return 0;
}
@ -158,7 +158,7 @@ static int FBSTP_a32(uint32_t fetchdat)
}
tempc = (uint8_t)floor(fmod(tempd, 10.0));
if (ST(0) < 0.0) tempc |= 0x80;
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (abrt) return 1;
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (cpu_state.abrt) return 1;
x87_pop();
return 0;
}
@ -169,11 +169,11 @@ static int FISTPiq_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FISTPl %08X:%08X\n", easeg, cpu_state.eaaddr);
if (tag[TOP] & TAG_UINT64)
temp64 = ST_i64[TOP];
if (cpu_state.tag[cpu_state.TOP] & TAG_UINT64)
temp64 = MM[cpu_state.TOP].q;
else
temp64 = x87_fround(ST(0));
seteaq(temp64); if (abrt) return 1;
seteaq(temp64); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(29);
return 0;
@ -184,11 +184,11 @@ static int FISTPiq_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FISTPl %08X:%08X\n", easeg, cpu_state.eaaddr);
if (tag[TOP] & TAG_UINT64)
temp64 = ST_i64[TOP];
if (cpu_state.tag[cpu_state.TOP] & TAG_UINT64)
temp64 = MM[cpu_state.TOP].q;
else
temp64 = x87_fround(ST(0));
seteaq(temp64); if (abrt) return 1;
seteaq(temp64); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(29);
return 0;
@ -200,7 +200,7 @@ static int opFILDil_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FILDs %08X:%08X\n", easeg, cpu_state.eaaddr);
templ = geteal(); if (abrt) return 1;
templ = geteal(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f %08X %i\n", (double)templ, templ, templ);
x87_push((double)templ);
CLOCK_CYCLES(9);
@ -212,7 +212,7 @@ static int opFILDil_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FILDs %08X:%08X\n", easeg, cpu_state.eaaddr);
templ = geteal(); if (abrt) return 1;
templ = geteal(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f %08X %i\n", (double)templ, templ, templ);
x87_push((double)templ);
CLOCK_CYCLES(9);
@ -230,7 +230,7 @@ static int opFISTil_a16(uint32_t fetchdat)
fatal("FISTl out of range! %i\n", temp64);*/
seteal((int32_t)temp64);
CLOCK_CYCLES(28);
return abrt;
return cpu_state.abrt;
}
static int opFISTil_a32(uint32_t fetchdat)
{
@ -243,7 +243,7 @@ static int opFISTil_a32(uint32_t fetchdat)
fatal("FISTl out of range! %i\n", temp64);*/
seteal((int32_t)temp64);
CLOCK_CYCLES(28);
return abrt;
return cpu_state.abrt;
}
static int opFISTPil_a16(uint32_t fetchdat)
@ -255,7 +255,7 @@ static int opFISTPil_a16(uint32_t fetchdat)
temp64 = x87_fround(ST(0));
/* if (temp64 > 2147483647 || temp64 < -2147483647)
fatal("FISTl out of range! %i\n", temp64);*/
seteal((int32_t)temp64); if (abrt) return 1;
seteal((int32_t)temp64); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(28);
return 0;
@ -269,7 +269,7 @@ static int opFISTPil_a32(uint32_t fetchdat)
temp64 = x87_fround(ST(0));
/* if (temp64 > 2147483647 || temp64 < -2147483647)
fatal("FISTl out of range! %i\n", temp64);*/
seteal((int32_t)temp64); if (abrt) return 1;
seteal((int32_t)temp64); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(28);
return 0;
@ -281,7 +281,7 @@ static int opFLDe_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FLDe %08X:%08X\n", easeg, cpu_state.eaaddr);
t=x87_ld80(); if (abrt) return 1;
t=x87_ld80(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", t);
x87_push(t);
CLOCK_CYCLES(6);
@ -293,7 +293,7 @@ static int opFLDe_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FLDe %08X:%08X\n", easeg, cpu_state.eaaddr);
t=x87_ld80(); if (abrt) return 1;
t=x87_ld80(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", t);
x87_push(t);
CLOCK_CYCLES(6);
@ -305,7 +305,7 @@ static int opFSTPe_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FSTPe %08X:%08X\n", easeg, cpu_state.eaaddr);
x87_st80(ST(0)); if (abrt) return 1;
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(6);
return 0;
@ -315,7 +315,7 @@ static int opFSTPe_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FSTPe %08X:%08X\n", easeg, cpu_state.eaaddr);
x87_st80(ST(0)); if (abrt) return 1;
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(6);
return 0;
@ -327,7 +327,7 @@ static int opFLDd_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FLDd %08X:%08X\n", easeg, cpu_state.eaaddr);
t.i = geteaq(); if (abrt) return 1;
t.i = geteaq(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", t.d);
x87_push(t.d);
CLOCK_CYCLES(3);
@ -339,7 +339,7 @@ static int opFLDd_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FLDd %08X:%08X\n", easeg, cpu_state.eaaddr);
t.i = geteaq(); if (abrt) return 1;
t.i = geteaq(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", t.d);
x87_push(t.d);
CLOCK_CYCLES(3);
@ -355,7 +355,7 @@ static int opFSTd_a16(uint32_t fetchdat)
t.d = ST(0);
seteaq(t.i);
CLOCK_CYCLES(8);
return abrt;
return cpu_state.abrt;
}
static int opFSTd_a32(uint32_t fetchdat)
{
@ -366,7 +366,7 @@ static int opFSTd_a32(uint32_t fetchdat)
t.d = ST(0);
seteaq(t.i);
CLOCK_CYCLES(8);
return abrt;
return cpu_state.abrt;
}
static int opFSTPd_a16(uint32_t fetchdat)
@ -377,7 +377,7 @@ static int opFSTPd_a16(uint32_t fetchdat)
CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
t.d = ST(0);
seteaq(t.i); if (abrt) return 1;
seteaq(t.i); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(8);
return 0;
@ -390,7 +390,7 @@ static int opFSTPd_a32(uint32_t fetchdat)
CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
t.d = ST(0);
seteaq(t.i); if (abrt) return 1;
seteaq(t.i); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(8);
return 0;
@ -402,7 +402,7 @@ static int opFLDs_a16(uint32_t fetchdat)
FP_ENTER();
fetch_ea_16(fetchdat);
if (fplog) pclog("FLDs %08X:%08X\n", easeg, cpu_state.eaaddr);
ts.i = geteal(); if (abrt) return 1;
ts.i = geteal(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", ts.s);
x87_push((double)ts.s);
CLOCK_CYCLES(3);
@ -414,7 +414,7 @@ static int opFLDs_a32(uint32_t fetchdat)
FP_ENTER();
fetch_ea_32(fetchdat);
if (fplog) pclog("FLDs %08X:%08X\n", easeg, cpu_state.eaaddr);
ts.i = geteal(); if (abrt) return 1;
ts.i = geteal(); if (cpu_state.abrt) return 1;
if (fplog) pclog(" %f\n", ts.s);
x87_push((double)ts.s);
CLOCK_CYCLES(3);
@ -430,7 +430,7 @@ static int opFSTs_a16(uint32_t fetchdat)
ts.s = (float)ST(0);
seteal(ts.i);
CLOCK_CYCLES(7);
return abrt;
return cpu_state.abrt;
}
static int opFSTs_a32(uint32_t fetchdat)
{
@ -441,7 +441,7 @@ static int opFSTs_a32(uint32_t fetchdat)
ts.s = (float)ST(0);
seteal(ts.i);
CLOCK_CYCLES(7);
return abrt;
return cpu_state.abrt;
}
static int opFSTPs_a16(uint32_t fetchdat)
@ -451,7 +451,7 @@ static int opFSTPs_a16(uint32_t fetchdat)
fetch_ea_16(fetchdat);
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
ts.s = (float)ST(0);
seteal(ts.i); if (abrt) return 1;
seteal(ts.i); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(7);
return 0;
@ -463,7 +463,7 @@ static int opFSTPs_a32(uint32_t fetchdat)
fetch_ea_32(fetchdat);
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
ts.s = (float)ST(0);
seteal(ts.i); if (abrt) return 1;
seteal(ts.i); if (cpu_state.abrt) return 1;
x87_pop();
CLOCK_CYCLES(7);
return 0;