Initial commit of dynamic recompiler.

Various CPU changes to support dynamic recompiler.
This commit is contained in:
TomW 2014-11-05 21:24:16 +00:00
commit 4676daade4
52 changed files with 3740 additions and 1139 deletions

View file

@ -98,56 +98,56 @@ static int opMOV_SP_imm(uint32_t fetchdat)
static int opMOV_EAX_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
EAX = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_EBX_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
EBX = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_ECX_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
ECX = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_EDX_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
EDX = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_ESI_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
ESI = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_EDI_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
EDI = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_EBP_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
EBP = templ;
cycles -= timing_rr;
return 0;
}
static int opMOV_ESP_imm(uint32_t fetchdat)
{
uint32_t templ = getlong(); if (abrt) return 0;
uint32_t templ = getlong(); if (abrt) return 1;
ESP = templ;
cycles -= timing_rr;
return 0;
@ -157,63 +157,63 @@ static int opMOV_b_imm_a16(uint32_t fetchdat)
{
uint8_t temp;
fetch_ea_16(fetchdat);
temp = readmemb(cs,pc); pc++; if (abrt) return 0;
temp = readmemb(cs,pc); pc++; if (abrt) return 1;
seteab(temp);
cycles -= timing_rr;
return 0;
return abrt;
}
static int opMOV_b_imm_a32(uint32_t fetchdat)
{
uint8_t temp;
fetch_ea_32(fetchdat);
temp = getbyte(); if (abrt) return 0;
temp = getbyte(); if (abrt) return 1;
seteab(temp);
cycles -= timing_rr;
return 0;
return abrt;
}
static int opMOV_w_imm_a16(uint32_t fetchdat)
{
uint16_t temp;
fetch_ea_16(fetchdat);
temp = getword(); if (abrt) return 0;
temp = getword(); if (abrt) return 1;
seteaw(temp);
cycles -= timing_rr;
return 0;
return abrt;
}
static int opMOV_w_imm_a32(uint32_t fetchdat)
{
uint16_t temp;
fetch_ea_32(fetchdat);
temp = getword(); if (abrt) return 0;
temp = getword(); if (abrt) return 1;
seteaw(temp);
cycles -= timing_rr;
return 0;
return abrt;
}
static int opMOV_l_imm_a16(uint32_t fetchdat)
{
uint32_t temp;
fetch_ea_16(fetchdat);
temp = getlong(); if (abrt) return 0;
temp = getlong(); if (abrt) return 1;
seteal(temp);
cycles -= timing_rr;
return 0;
return abrt;
}
static int opMOV_l_imm_a32(uint32_t fetchdat)
{
uint32_t temp;
fetch_ea_32(fetchdat);
temp = getlong(); if (abrt) return 0;
temp = getlong(); if (abrt) return 1;
seteal(temp);
cycles -= timing_rr;
return 0;
return abrt;
}
static int opMOV_AL_a16(uint32_t fetchdat)
{
uint16_t addr = getwordf();
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 0;
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 1;
AL = temp;
cycles -= (is486) ? 1 : 4;
return 0;
@ -221,7 +221,7 @@ static int opMOV_AL_a16(uint32_t fetchdat)
static int opMOV_AL_a32(uint32_t fetchdat)
{
uint32_t addr = getlong();
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 0;
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 1;
AL = temp;
cycles -= (is486) ? 1 : 4;
return 0;
@ -229,7 +229,7 @@ static int opMOV_AL_a32(uint32_t fetchdat)
static int opMOV_AX_a16(uint32_t fetchdat)
{
uint16_t addr = getwordf();
uint16_t temp = readmemw(ea_seg->base, addr); if (abrt) return 0;
uint16_t temp = readmemw(ea_seg->base, addr); if (abrt) return 1;
AX = temp;
cycles -= (is486) ? 1 : 4;
return 0;
@ -237,23 +237,23 @@ static int opMOV_AX_a16(uint32_t fetchdat)
static int opMOV_AX_a32(uint32_t fetchdat)
{
uint32_t addr = getlong();
uint16_t temp = readmemw(ea_seg->base, addr); if (abrt) return 0;
uint16_t temp = readmemw(ea_seg->base, addr); if (abrt) return 1;
AX = temp;
cycles -= (is486) ? 1 : 4;
return 0;
}
static int opMOV_EAX_a16(uint32_t fetchdat)
{
uint16_t addr = getwordf(); if (abrt) return 0;
uint32_t temp = readmeml(ea_seg->base, addr); if (abrt) return 0;
uint16_t addr = getwordf();
uint32_t temp = readmeml(ea_seg->base, addr); if (abrt) return 1;
EAX = temp;
cycles -= (is486) ? 1 : 4;
return 0;
}
static int opMOV_EAX_a32(uint32_t fetchdat)
{
uint32_t addr = getlong(); if (abrt) return 0;
uint32_t temp = readmeml(ea_seg->base, addr); if (abrt) return 0;
uint32_t addr = getlong();
uint32_t temp = readmeml(ea_seg->base, addr); if (abrt) return 1;
EAX = temp;
cycles -= (is486) ? 1 : 4;
return 0;
@ -264,42 +264,42 @@ static int opMOV_a16_AL(uint32_t fetchdat)
uint16_t addr = getwordf();
writememb(ea_seg->base, addr, AL);
cycles -= (is486) ? 1 : 2;
return 0;
return abrt;
}
static int opMOV_a32_AL(uint32_t fetchdat)
{
uint32_t addr = getlong();
writememb(ea_seg->base, addr, AL);
cycles -= (is486) ? 1 : 2;
return 0;
return abrt;
}
static int opMOV_a16_AX(uint32_t fetchdat)
{
uint16_t addr = getwordf();
writememw(ea_seg->base, addr, AX);
cycles -= (is486) ? 1 : 2;
return 0;
return abrt;
}
static int opMOV_a32_AX(uint32_t fetchdat)
{
uint32_t addr = getlong();
uint32_t addr = getlong(); if (abrt) return 1;
writememw(ea_seg->base, addr, AX);
cycles -= (is486) ? 1 : 2;
return 0;
return abrt;
}
static int opMOV_a16_EAX(uint32_t fetchdat)
{
uint16_t addr = getwordf();
writememl(ea_seg->base, addr, EAX);
cycles -= (is486) ? 1 : 2;
return 0;
return abrt;
}
static int opMOV_a32_EAX(uint32_t fetchdat)
{
uint32_t addr = getlong();
uint32_t addr = getlong(); if (abrt) return 1;
writememl(ea_seg->base, addr, EAX);
cycles -= (is486) ? 1 : 2;
return 0;
return abrt;
}
@ -339,18 +339,18 @@ static int opLEA_l_a32(uint32_t fetchdat)
int opXLAT_a16(uint32_t fetchdat)
static int opXLAT_a16(uint32_t fetchdat)
{
uint32_t addr = (BX + AL)&0xFFFF;
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 0;
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 1;
AL = temp;
cycles -= 5;
return 0;
}
int opXLAT_a32(uint32_t fetchdat)
static int opXLAT_a32(uint32_t fetchdat)
{
uint32_t addr = EBX + AL;
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 0;
uint8_t temp = readmemb(ea_seg->base, addr); if (abrt) return 1;
AL = temp;
cycles -= 5;
return 0;
@ -371,7 +371,7 @@ static int opMOV_b_r_a16(uint32_t fetchdat)
seteab(getr8(reg));
cycles -= is486 ? 1 : 2;
}
return 0;
return abrt;
}
static int opMOV_b_r_a32(uint32_t fetchdat)
{
@ -388,7 +388,7 @@ static int opMOV_b_r_a32(uint32_t fetchdat)
seteab(getr8(reg));
cycles -= is486 ? 1 : 2;
}
return 0;
return abrt;
}
static int opMOV_w_r_a16(uint32_t fetchdat)
{
@ -405,7 +405,7 @@ static int opMOV_w_r_a16(uint32_t fetchdat)
seteaw(regs[reg].w);
cycles -= is486 ? 1 : 2;
}
return 0;
return abrt;
}
static int opMOV_w_r_a32(uint32_t fetchdat)
{
@ -422,7 +422,7 @@ static int opMOV_w_r_a32(uint32_t fetchdat)
seteaw(regs[reg].w);
cycles -= is486 ? 1 : 2;
}
return 0;
return abrt;
}
static int opMOV_l_r_a16(uint32_t fetchdat)
{
@ -439,7 +439,7 @@ static int opMOV_l_r_a16(uint32_t fetchdat)
seteal(regs[reg].l);
cycles -= is486 ? 1 : 2;
}
return 0;
return abrt;
}
static int opMOV_l_r_a32(uint32_t fetchdat)
{
@ -456,7 +456,7 @@ static int opMOV_l_r_a32(uint32_t fetchdat)
seteal(regs[reg].l);
cycles -= is486 ? 1 : 2;
}
return 0;
return abrt;
}
static int opMOV_r_b_a16(uint32_t fetchdat)
@ -472,7 +472,7 @@ static int opMOV_r_b_a16(uint32_t fetchdat)
uint8_t temp;
fetch_ea_16(fetchdat);
CHECK_READ(ea_seg, eaaddr, eaaddr);
temp = geteab(); if (abrt) return 0;
temp = geteab(); if (abrt) return 1;
setr8(reg, temp);
cycles -= is486 ? 1 : 4;
}
@ -491,7 +491,7 @@ static int opMOV_r_b_a32(uint32_t fetchdat)
uint8_t temp;
fetch_ea_32(fetchdat);
CHECK_READ(ea_seg, eaaddr, eaaddr);
temp = geteab(); if (abrt) return 0;
temp = geteab(); if (abrt) return 1;
setr8(reg, temp);
cycles -= is486 ? 1 : 4;
}
@ -510,7 +510,7 @@ static int opMOV_r_w_a16(uint32_t fetchdat)
uint16_t temp;
fetch_ea_16(fetchdat);
CHECK_READ(ea_seg, eaaddr, eaaddr+1);
temp = geteaw(); if (abrt) return 0;
temp = geteaw(); if (abrt) return 1;
regs[reg].w = temp;
cycles -= (is486) ? 1 : 4;
}
@ -529,7 +529,7 @@ static int opMOV_r_w_a32(uint32_t fetchdat)
uint16_t temp;
fetch_ea_32(fetchdat);
CHECK_READ(ea_seg, eaaddr, eaaddr+1);
temp = geteaw(); if (abrt) return 0;
temp = geteaw(); if (abrt) return 1;
regs[reg].w = temp;
cycles -= (is486) ? 1 : 4;
}
@ -548,7 +548,7 @@ static int opMOV_r_l_a16(uint32_t fetchdat)
uint32_t temp;
fetch_ea_16(fetchdat);
CHECK_READ(ea_seg, eaaddr, eaaddr+3);
temp = geteal(); if (abrt) return 0;
temp = geteal(); if (abrt) return 1;
regs[reg].l = temp;
cycles -= is486 ? 1 : 4;
}
@ -567,7 +567,7 @@ static int opMOV_r_l_a32(uint32_t fetchdat)
uint32_t temp;
fetch_ea_32(fetchdat);
CHECK_READ(ea_seg, eaaddr, eaaddr+3);
temp = geteal(); if (abrt) return 0;
temp = geteal(); if (abrt) return 1;
regs[reg].l = temp;
cycles -= is486 ? 1 : 4;
}