Initial commit of dynamic recompiler.
Various CPU changes to support dynamic recompiler.
This commit is contained in:
parent
17cae8a2d7
commit
4676daade4
52 changed files with 3740 additions and 1139 deletions
|
|
@ -12,7 +12,7 @@
|
|||
temp = (temp << 1) | temp2; \
|
||||
c--; \
|
||||
} \
|
||||
seteab(temp); if (abrt) return 0; \
|
||||
seteab(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((flags & C_FLAG) ^ (temp >> 7)) flags |= V_FLAG; \
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
if (temp2) temp |= 0x80; \
|
||||
c--; \
|
||||
} \
|
||||
seteab(temp); if (abrt) return 0; \
|
||||
seteab(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((temp ^ (temp >> 1)) & 0x40) flags |= V_FLAG; \
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
c--; \
|
||||
if (is486) cycles--; \
|
||||
} \
|
||||
seteab(temp); if (abrt) return 0; \
|
||||
seteab(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((flags & C_FLAG) ^ (temp >> 7)) flags |= V_FLAG; \
|
||||
|
|
@ -58,20 +58,20 @@
|
|||
c--; \
|
||||
if (is486) cycles--; \
|
||||
} \
|
||||
seteab(temp); if (abrt) return 0; \
|
||||
seteab(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((temp ^ (temp >> 1)) & 0x40) flags |= V_FLAG; \
|
||||
cycles -= ((mod == 3) ? 9 : 10); \
|
||||
break; \
|
||||
case 0x20: case 0x30: /*SHL b,CL*/ \
|
||||
seteab(temp << c); if (abrt) return 0; \
|
||||
seteab(temp << c); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SHL8, temp_orig, c, (temp << c) & 0xff); \
|
||||
if ((temp << (c - 1)) & 0x80) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
break; \
|
||||
case 0x28: /*SHR b,CL*/ \
|
||||
seteab(temp >> c); if (abrt) return 0; \
|
||||
seteab(temp >> c); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SHR8, temp_orig, c, temp >> c); \
|
||||
if ((temp >> (c - 1)) & 1) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
if (temp & 0x40) temp |= 0x80; \
|
||||
c--; \
|
||||
} \
|
||||
seteab(temp); if (abrt) return 0; \
|
||||
seteab(temp); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SAR8, temp_orig, c, temp); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
temp = (temp << 1) | temp2; \
|
||||
c--; \
|
||||
} \
|
||||
seteaw(temp); if (abrt) return 0; \
|
||||
seteaw(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((flags & C_FLAG) ^ (temp >> 15)) flags |= V_FLAG; \
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
if (temp2) temp |= 0x8000; \
|
||||
c--; \
|
||||
} \
|
||||
seteaw(temp); if (abrt) return 0; \
|
||||
seteaw(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((temp ^ (temp >> 1)) & 0x4000) flags |= V_FLAG; \
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
c--; \
|
||||
if (is486) cycles--; \
|
||||
} \
|
||||
seteaw(temp); if (abrt) return 0; \
|
||||
seteaw(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((flags & C_FLAG) ^ (temp >> 15)) flags |= V_FLAG; \
|
||||
|
|
@ -152,20 +152,20 @@
|
|||
c--; \
|
||||
if (is486) cycles--; \
|
||||
} \
|
||||
seteaw(temp); if (abrt) return 0; \
|
||||
seteaw(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((temp ^ (temp >> 1)) & 0x4000) flags |= V_FLAG; \
|
||||
cycles -= ((mod == 3) ? 9 : 10); \
|
||||
break; \
|
||||
case 0x20: case 0x30: /*SHL w, c*/ \
|
||||
seteaw(temp << c); if (abrt) return 0; \
|
||||
seteaw(temp << c); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SHL16, temp_orig, c, (temp << c) & 0xffff); \
|
||||
if ((temp << (c - 1)) & 0x8000) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
break; \
|
||||
case 0x28: /*SHR w, c*/ \
|
||||
seteaw(temp >> c); if (abrt) return 0; \
|
||||
seteaw(temp >> c); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SHR16, temp_orig, c, temp >> c); \
|
||||
if ((temp >> (c - 1)) & 1) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
|
|
@ -178,7 +178,7 @@
|
|||
if (temp & 0x4000) temp |= 0x8000; \
|
||||
c--; \
|
||||
} \
|
||||
seteaw(temp); if (abrt) return 0; \
|
||||
seteaw(temp); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SAR16, temp_orig, c, temp); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
temp = (temp << 1) | temp2; \
|
||||
c--; \
|
||||
} \
|
||||
seteal(temp); if (abrt) return 0; \
|
||||
seteal(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((flags & C_FLAG) ^ (temp >> 31)) flags |= V_FLAG; \
|
||||
|
|
@ -214,7 +214,7 @@
|
|||
if (temp2) temp |= 0x80000000; \
|
||||
c--; \
|
||||
} \
|
||||
seteal(temp); if (abrt) return 0; \
|
||||
seteal(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((temp ^ (temp >> 1)) & 0x40000000) flags |= V_FLAG; \
|
||||
|
|
@ -230,7 +230,7 @@
|
|||
c--; \
|
||||
if (is486) cycles--; \
|
||||
} \
|
||||
seteal(temp); if (abrt) return 0; \
|
||||
seteal(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((flags & C_FLAG) ^ (temp >> 31)) flags |= V_FLAG; \
|
||||
|
|
@ -246,20 +246,20 @@
|
|||
c--; \
|
||||
if (is486) cycles--; \
|
||||
} \
|
||||
seteal(temp); if (abrt) return 0; \
|
||||
seteal(temp); if (abrt) return 1; \
|
||||
flags &= ~(C_FLAG | V_FLAG); \
|
||||
if (temp2) flags |= C_FLAG; \
|
||||
if ((temp ^ (temp >> 1)) & 0x40000000) flags |= V_FLAG; \
|
||||
cycles -= ((mod == 3) ? 9 : 10); \
|
||||
break; \
|
||||
case 0x20: case 0x30: /*SHL l, c*/ \
|
||||
seteal(temp << c); if (abrt) return 0; \
|
||||
seteal(temp << c); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SHL32, temp_orig, c, temp << c); \
|
||||
if ((temp << (c - 1)) & 0x80000000) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
break; \
|
||||
case 0x28: /*SHR l, c*/ \
|
||||
seteal(temp >> c); if (abrt) return 0; \
|
||||
seteal(temp >> c); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SHR32, temp_orig, c, temp >> c); \
|
||||
if ((temp >> (c - 1)) & 1) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
|
|
@ -272,7 +272,7 @@
|
|||
if (temp & 0x40000000) temp |= 0x80000000; \
|
||||
c--; \
|
||||
} \
|
||||
seteal(temp); if (abrt) return 0; \
|
||||
seteal(temp); if (abrt) return 1; \
|
||||
set_flags_shift(FLAGS_SAR32, temp_orig, c, temp); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
cycles -= ((mod == 3) ? 3 : 7); \
|
||||
|
|
@ -288,7 +288,7 @@ static int opC0_a16(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_16(fetchdat);
|
||||
c = readmemb(cs, pc) & 31; pc++;
|
||||
temp = geteab(); if (abrt) return 0;
|
||||
temp = geteab(); if (abrt) return 1;
|
||||
OP_SHIFT_b(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ static int opC0_a32(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_32(fetchdat);
|
||||
c = readmemb(cs, pc) & 31; pc++;
|
||||
temp = geteab(); if (abrt) return 0;
|
||||
temp = geteab(); if (abrt) return 1;
|
||||
OP_SHIFT_b(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -312,7 +312,7 @@ static int opC1_w_a16(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_16(fetchdat);
|
||||
c = readmemb(cs, pc) & 31; pc++;
|
||||
temp = geteaw(); if (abrt) return 0;
|
||||
temp = geteaw(); if (abrt) return 1;
|
||||
OP_SHIFT_w(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ static int opC1_w_a32(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_32(fetchdat);
|
||||
c = readmemb(cs, pc) & 31; pc++;
|
||||
temp = geteaw(); if (abrt) return 0;
|
||||
temp = geteaw(); if (abrt) return 1;
|
||||
OP_SHIFT_w(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ static int opC1_l_a16(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_16(fetchdat);
|
||||
c = readmemb(cs, pc) & 31; pc++;
|
||||
temp = geteal(); if (abrt) return 0;
|
||||
temp = geteal(); if (abrt) return 1;
|
||||
OP_SHIFT_l(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -348,7 +348,7 @@ static int opC1_l_a32(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_32(fetchdat);
|
||||
c = readmemb(cs, pc) & 31; pc++;
|
||||
temp = geteal(); if (abrt) return 0;
|
||||
temp = geteal(); if (abrt) return 1;
|
||||
OP_SHIFT_l(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -360,7 +360,7 @@ static int opD0_a16(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
temp = geteab(); if (abrt) return 0;
|
||||
temp = geteab(); if (abrt) return 1;
|
||||
OP_SHIFT_b(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -371,7 +371,7 @@ static int opD0_a32(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
temp = geteab(); if (abrt) return 0;
|
||||
temp = geteab(); if (abrt) return 1;
|
||||
OP_SHIFT_b(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -382,7 +382,7 @@ static int opD1_w_a16(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
temp = geteaw(); if (abrt) return 0;
|
||||
temp = geteaw(); if (abrt) return 1;
|
||||
OP_SHIFT_w(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -393,7 +393,7 @@ static int opD1_w_a32(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
temp = geteaw(); if (abrt) return 0;
|
||||
temp = geteaw(); if (abrt) return 1;
|
||||
OP_SHIFT_w(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -404,7 +404,7 @@ static int opD1_l_a16(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
temp = geteal(); if (abrt) return 0;
|
||||
temp = geteal(); if (abrt) return 1;
|
||||
OP_SHIFT_l(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@ static int opD1_l_a32(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
temp = geteal(); if (abrt) return 0;
|
||||
temp = geteal(); if (abrt) return 1;
|
||||
OP_SHIFT_l(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -428,7 +428,7 @@ static int opD2_a16(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_16(fetchdat);
|
||||
c = CL & 31;
|
||||
temp = geteab(); if (abrt) return 0;
|
||||
temp = geteab(); if (abrt) return 1;
|
||||
OP_SHIFT_b(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -440,7 +440,7 @@ static int opD2_a32(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_32(fetchdat);
|
||||
c = CL & 31;
|
||||
temp = geteab(); if (abrt) return 0;
|
||||
temp = geteab(); if (abrt) return 1;
|
||||
OP_SHIFT_b(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -452,7 +452,7 @@ static int opD3_w_a16(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_16(fetchdat);
|
||||
c = CL & 31;
|
||||
temp = geteaw(); if (abrt) return 0;
|
||||
temp = geteaw(); if (abrt) return 1;
|
||||
OP_SHIFT_w(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -464,7 +464,7 @@ static int opD3_w_a32(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_32(fetchdat);
|
||||
c = CL & 31;
|
||||
temp = geteaw(); if (abrt) return 0;
|
||||
temp = geteaw(); if (abrt) return 1;
|
||||
OP_SHIFT_w(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -476,7 +476,7 @@ static int opD3_l_a16(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_16(fetchdat);
|
||||
c = CL & 31;
|
||||
temp = geteal(); if (abrt) return 0;
|
||||
temp = geteal(); if (abrt) return 1;
|
||||
OP_SHIFT_l(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -488,7 +488,7 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
|
||||
fetch_ea_32(fetchdat);
|
||||
c = CL & 31;
|
||||
temp = geteal(); if (abrt) return 0;
|
||||
temp = geteal(); if (abrt) return 1;
|
||||
OP_SHIFT_l(c);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -497,12 +497,12 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
#define SHLD_w() \
|
||||
if (count) \
|
||||
{ \
|
||||
uint16_t tempw = geteaw(); if (abrt) return 0; \
|
||||
uint16_t tempw = geteaw(); if (abrt) return 1; \
|
||||
int tempc = ((tempw << (count - 1)) & (1 << 15)) ? 1 : 0; \
|
||||
uint32_t templ = (tempw << 16) | regs[reg].w; \
|
||||
if (count <= 16) tempw = templ >> (16 - count); \
|
||||
else tempw = (templ << count) >> 16; \
|
||||
seteaw(tempw); if (abrt) return 0; \
|
||||
seteaw(tempw); if (abrt) return 1; \
|
||||
setznp16(tempw); \
|
||||
flags_rebuild(); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
|
|
@ -511,10 +511,10 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
#define SHLD_l() \
|
||||
if (count) \
|
||||
{ \
|
||||
uint32_t templ = geteal(); if (abrt) return 0; \
|
||||
uint32_t templ = geteal(); if (abrt) return 1; \
|
||||
int tempc = ((templ << (count - 1)) & (1 << 31)) ? 1 : 0; \
|
||||
templ = (templ << count) | (regs[reg].l >> (32 - count)); \
|
||||
seteal(templ); if (abrt) return 0; \
|
||||
seteal(templ); if (abrt) return 1; \
|
||||
setznp32(templ); \
|
||||
flags_rebuild(); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
|
|
@ -524,11 +524,11 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
#define SHRD_w() \
|
||||
if (count) \
|
||||
{ \
|
||||
uint16_t tempw = geteaw(); if (abrt) return 0; \
|
||||
uint16_t tempw = geteaw(); if (abrt) return 1; \
|
||||
int tempc = (tempw >> (count - 1)) & 1; \
|
||||
uint32_t templ = tempw | (regs[reg].w << 16); \
|
||||
tempw = templ >> count; \
|
||||
seteaw(tempw); if (abrt) return 0; \
|
||||
seteaw(tempw); if (abrt) return 1; \
|
||||
setznp16(tempw); \
|
||||
flags_rebuild(); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
|
|
@ -537,10 +537,10 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
#define SHRD_l() \
|
||||
if (count) \
|
||||
{ \
|
||||
uint32_t templ = geteal(); if (abrt) return 0; \
|
||||
uint32_t templ = geteal(); if (abrt) return 1; \
|
||||
int tempc = (templ >> (count - 1)) & 1; \
|
||||
templ = (templ >> count) | (regs[reg].l << (32 - count)); \
|
||||
seteal(templ); if (abrt) return 0; \
|
||||
seteal(templ); if (abrt) return 1; \
|
||||
setznp32(templ); \
|
||||
flags_rebuild(); \
|
||||
if (tempc) flags |= C_FLAG; \
|
||||
|
|
|
|||
Loading…
Reference in a new issue