Moved integer registers, PC and flags_* variables into new cpu_state structure. Reduces recompiled code size slightly, small speedup (1-3%).

This commit is contained in:
SarahW 2016-04-20 21:39:41 +01:00
commit c81a91fd72
52 changed files with 1494 additions and 1408 deletions

View file

@ -4,11 +4,11 @@ static int opBT_w_r_a16(uint32_t fetchdat)
uint16_t temp;
fetch_ea_16(fetchdat);
eaaddr += ((regs[reg].w / 16) * 2); eal_r = 0;
eaaddr += ((cpu_state.regs[reg].w / 16) * 2); eal_r = 0;
temp = geteaw(); if (abrt) return 1;
flags_rebuild();
if (temp & (1 << (regs[reg].w & 15))) flags |= C_FLAG;
else flags &= ~C_FLAG;
if (temp & (1 << (cpu_state.regs[reg].w & 15))) flags |= C_FLAG;
else flags &= ~C_FLAG;
CLOCK_CYCLES(3);
return 0;
@ -18,11 +18,11 @@ static int opBT_w_r_a32(uint32_t fetchdat)
uint16_t temp;
fetch_ea_32(fetchdat);
eaaddr += ((regs[reg].w / 16) * 2); eal_r = 0;
eaaddr += ((cpu_state.regs[reg].w / 16) * 2); eal_r = 0;
temp = geteaw(); if (abrt) return 1;
flags_rebuild();
if (temp & (1 << (regs[reg].w & 15))) flags |= C_FLAG;
else flags &= ~C_FLAG;
if (temp & (1 << (cpu_state.regs[reg].w & 15))) flags |= C_FLAG;
else flags &= ~C_FLAG;
CLOCK_CYCLES(3);
return 0;
@ -32,11 +32,11 @@ static int opBT_l_r_a16(uint32_t fetchdat)
uint32_t temp;
fetch_ea_16(fetchdat);
eaaddr += ((regs[reg].l / 32) * 4); eal_r = 0;
eaaddr += ((cpu_state.regs[reg].l / 32) * 4); eal_r = 0;
temp = geteal(); if (abrt) return 1;
flags_rebuild();
if (temp & (1 << (regs[reg].l & 31))) flags |= C_FLAG;
else flags &= ~C_FLAG;
if (temp & (1 << (cpu_state.regs[reg].l & 31))) flags |= C_FLAG;
else flags &= ~C_FLAG;
CLOCK_CYCLES(3);
return 0;
@ -46,11 +46,11 @@ static int opBT_l_r_a32(uint32_t fetchdat)
uint32_t temp;
fetch_ea_32(fetchdat);
eaaddr += ((regs[reg].l / 32) * 4); eal_r = 0;
eaaddr += ((cpu_state.regs[reg].l / 32) * 4); eal_r = 0;
temp = geteal(); if (abrt) return 1;
flags_rebuild();
if (temp & (1 << (regs[reg].l & 31))) flags |= C_FLAG;
else flags &= ~C_FLAG;
if (temp & (1 << (cpu_state.regs[reg].l & 31))) flags |= C_FLAG;
else flags &= ~C_FLAG;
CLOCK_CYCLES(3);
return 0;
@ -63,10 +63,10 @@ static int opBT_l_r_a32(uint32_t fetchdat)
uint16_t temp; \
\
fetch_ea_16(fetchdat); \
eaaddr += ((regs[reg].w / 16) * 2); eal_r = eal_w = 0; \
eaaddr += ((cpu_state.regs[reg].w / 16) * 2); eal_r = eal_w = 0; \
temp = geteaw(); if (abrt) return 1; \
tempc = (temp & (1 << (regs[reg].w & 15))) ? 1 : 0; \
temp operation (1 << (regs[reg].w & 15)); \
tempc = (temp & (1 << (cpu_state.regs[reg].w & 15))) ? 1 : 0; \
temp operation (1 << (cpu_state.regs[reg].w & 15)); \
seteaw(temp); if (abrt) return 1; \
flags_rebuild(); \
if (tempc) flags |= C_FLAG; \
@ -81,10 +81,10 @@ static int opBT_l_r_a32(uint32_t fetchdat)
uint16_t temp; \
\
fetch_ea_32(fetchdat); \
eaaddr += ((regs[reg].w / 16) * 2); eal_r = eal_w = 0; \
eaaddr += ((cpu_state.regs[reg].w / 16) * 2); eal_r = eal_w = 0; \
temp = geteaw(); if (abrt) return 1; \
tempc = (temp & (1 << (regs[reg].w & 15))) ? 1 : 0; \
temp operation (1 << (regs[reg].w & 15)); \
tempc = (temp & (1 << (cpu_state.regs[reg].w & 15))) ? 1 : 0; \
temp operation (1 << (cpu_state.regs[reg].w & 15)); \
seteaw(temp); if (abrt) return 1; \
flags_rebuild(); \
if (tempc) flags |= C_FLAG; \
@ -99,10 +99,10 @@ static int opBT_l_r_a32(uint32_t fetchdat)
uint32_t temp; \
\
fetch_ea_16(fetchdat); \
eaaddr += ((regs[reg].l / 32) * 4); eal_r = eal_w = 0; \
eaaddr += ((cpu_state.regs[reg].l / 32) * 4); eal_r = eal_w = 0; \
temp = geteal(); if (abrt) return 1; \
tempc = (temp & (1 << (regs[reg].l & 31))) ? 1 : 0; \
temp operation (1 << (regs[reg].l & 31)); \
tempc = (temp & (1 << (cpu_state.regs[reg].l & 31))) ? 1 : 0; \
temp operation (1 << (cpu_state.regs[reg].l & 31)); \
seteal(temp); if (abrt) return 1; \
flags_rebuild(); \
if (tempc) flags |= C_FLAG; \
@ -117,10 +117,10 @@ static int opBT_l_r_a32(uint32_t fetchdat)
uint32_t temp; \
\
fetch_ea_32(fetchdat); \
eaaddr += ((regs[reg].l / 32) * 4); eal_r = eal_w = 0; \
eaaddr += ((cpu_state.regs[reg].l / 32) * 4); eal_r = eal_w = 0; \
temp = geteal(); if (abrt) return 1; \
tempc = (temp & (1 << (regs[reg].l & 31))) ? 1 : 0; \
temp operation (1 << (regs[reg].l & 31)); \
tempc = (temp & (1 << (cpu_state.regs[reg].l & 31))) ? 1 : 0; \
temp operation (1 << (cpu_state.regs[reg].l & 31)); \
seteal(temp); if (abrt) return 1; \
flags_rebuild(); \
if (tempc) flags |= C_FLAG; \
@ -164,7 +164,7 @@ static int opBA_w_a16(uint32_t fetchdat)
default:
pclog("Bad 0F BA opcode %02X\n", rmdat & 0x38);
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
break;
}
@ -204,7 +204,7 @@ static int opBA_w_a32(uint32_t fetchdat)
default:
pclog("Bad 0F BA opcode %02X\n", rmdat & 0x38);
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
break;
}
@ -245,7 +245,7 @@ static int opBA_l_a16(uint32_t fetchdat)
default:
pclog("Bad 0F BA opcode %02X\n", rmdat & 0x38);
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
break;
}
@ -285,7 +285,7 @@ static int opBA_l_a32(uint32_t fetchdat)
default:
pclog("Bad 0F BA opcode %02X\n", rmdat & 0x38);
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
break;
}