The NCR 53C810 is now threaded;
Reverted my IDIV fixes - fixes font glitches in Windows XP and possibly other things as well; Slight fix to line repeat detection in pclog_ex().
This commit is contained in:
@@ -463,31 +463,28 @@ int divl(uint32_t val)
|
||||
}
|
||||
int idivl(int32_t val)
|
||||
{
|
||||
uint64_t templ;
|
||||
int64_t tempsrc, tempws, tempws2 = 0;
|
||||
int64_t num, quo;
|
||||
int32_t rem, quo32;
|
||||
|
||||
if (val == 0) {
|
||||
divexcp(); /* Divide by zero. */
|
||||
return 1;
|
||||
}
|
||||
if (val==0)
|
||||
{
|
||||
divexcp();
|
||||
return 1;
|
||||
}
|
||||
|
||||
templ = (uint64_t) EDX;
|
||||
templ = (templ << 32) | EAX;
|
||||
tempsrc = (int64_t) templ;
|
||||
tempws = tempsrc / val;
|
||||
num=(((uint64_t)EDX)<<32)|EAX;
|
||||
quo=num/val;
|
||||
rem=num%val;
|
||||
quo32=(int32_t)(quo&0xFFFFFFFF);
|
||||
|
||||
if ((tempws > 2147483647LL) || (tempws < -2147483648LL)) {
|
||||
divexcp();
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempws = (int32_t) tempws;
|
||||
tempws2 = (int32_t) (templ % val);
|
||||
|
||||
EDX = (int32_t) tempws2;
|
||||
EAX = (int32_t) tempws;
|
||||
|
||||
return 0;
|
||||
if (quo!=(int64_t)quo32)
|
||||
{
|
||||
divexcp();
|
||||
return 1;
|
||||
}
|
||||
EDX=rem;
|
||||
EAX=quo32;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -84,8 +84,12 @@ static inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs)
|
||||
while (block)
|
||||
{
|
||||
if (a == block->cmp)
|
||||
break;
|
||||
else if (a < block->cmp)
|
||||
{
|
||||
if (!((block->status ^ cpu_cur_status) & CPU_STATUS_FLAGS) &&
|
||||
((block->status & cpu_cur_status & CPU_STATUS_MASK) == (cpu_cur_status & CPU_STATUS_MASK)))
|
||||
break;
|
||||
}
|
||||
if (a < block->cmp)
|
||||
block = block->left;
|
||||
else
|
||||
block = block->right;
|
||||
|
||||
@@ -64,9 +64,10 @@ static int opSETALC(uint32_t fetchdat)
|
||||
|
||||
static int opF6_a16(uint32_t fetchdat)
|
||||
{
|
||||
int32_t tempsrc, tempdst, tempws, tempws2 = 0;
|
||||
int tempws, tempws2 = 0;
|
||||
uint16_t tempw, src16;
|
||||
uint8_t src, dst;
|
||||
int8_t temps;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
dst = geteab(); if (cpu_state.abrt) return 1;
|
||||
@@ -130,32 +131,24 @@ static int opF6_a16(uint32_t fetchdat)
|
||||
PREFETCH_RUN(is486 ? 16 : 14, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 0);
|
||||
break;
|
||||
case 0x38: /*IDIV AL,b*/
|
||||
if (dst == 0) {
|
||||
x86_int(0); /* Divide by zero. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempsrc = (int16_t) AX;
|
||||
tempdst = (int8_t) dst;
|
||||
|
||||
tempws = tempsrc / tempdst;
|
||||
|
||||
if ((tempws > 127) || (tempws < -128)) {
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempws = (int8_t) tempws;
|
||||
tempws2 = (int8_t) (tempsrc % tempdst);
|
||||
|
||||
AH = (uint8_t) tempws2;
|
||||
AL = (uint8_t) tempws;
|
||||
|
||||
if (!cpu_iscyrix) {
|
||||
flags_rebuild();
|
||||
flags|=0x8D5; /*Not a Cyrix*/
|
||||
}
|
||||
|
||||
tempws = (int)(int16_t)AX;
|
||||
if (dst != 0) tempws2 = tempws / (int)((int8_t)dst);
|
||||
temps = tempws2 & 0xff;
|
||||
if (dst && ((int)temps == tempws2))
|
||||
{
|
||||
AH = (tempws % (int)((int8_t)dst)) & 0xff;
|
||||
AL = tempws2 & 0xff;
|
||||
if (!cpu_iscyrix)
|
||||
{
|
||||
flags_rebuild();
|
||||
flags|=0x8D5; /*Not a Cyrix*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
CLOCK_CYCLES(19);
|
||||
PREFETCH_RUN(19, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 0);
|
||||
break;
|
||||
@@ -168,9 +161,10 @@ static int opF6_a16(uint32_t fetchdat)
|
||||
}
|
||||
static int opF6_a32(uint32_t fetchdat)
|
||||
{
|
||||
int tempsrc, tempdst, tempws, tempws2 = 0;
|
||||
int tempws, tempws2 = 0;
|
||||
uint16_t tempw, src16;
|
||||
uint8_t src, dst;
|
||||
int8_t temps;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
dst = geteab(); if (cpu_state.abrt) return 1;
|
||||
@@ -234,32 +228,24 @@ static int opF6_a32(uint32_t fetchdat)
|
||||
PREFETCH_RUN(is486 ? 16 : 14, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 1);
|
||||
break;
|
||||
case 0x38: /*IDIV AL,b*/
|
||||
if (dst == 0) {
|
||||
x86_int(0); /* Divide by zero. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempsrc = (int16_t) AX;
|
||||
tempdst = (int8_t) dst;
|
||||
|
||||
tempws = tempsrc / tempdst;
|
||||
|
||||
if ((tempws > 127) || (tempws < -128)) {
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempws = (int8_t) tempws;
|
||||
tempws2 = (int8_t) (tempsrc % tempdst);
|
||||
|
||||
AH = (uint8_t) tempws2;
|
||||
AL = (uint8_t) tempws;
|
||||
|
||||
if (!cpu_iscyrix) {
|
||||
flags_rebuild();
|
||||
flags|=0x8D5; /*Not a Cyrix*/
|
||||
}
|
||||
|
||||
tempws = (int)(int16_t)AX;
|
||||
if (dst != 0) tempws2 = tempws / (int)((int8_t)dst);
|
||||
temps = tempws2 & 0xff;
|
||||
if (dst && ((int)temps == tempws2))
|
||||
{
|
||||
AH = (tempws % (int)((int8_t)dst)) & 0xff;
|
||||
AL = tempws2 & 0xff;
|
||||
if (!cpu_iscyrix)
|
||||
{
|
||||
flags_rebuild();
|
||||
flags|=0x8D5; /*Not a Cyrix*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
CLOCK_CYCLES(19);
|
||||
PREFETCH_RUN(19, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 1);
|
||||
break;
|
||||
@@ -276,7 +262,8 @@ static int opF6_a32(uint32_t fetchdat)
|
||||
static int opF7_w_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t templ, templ2;
|
||||
int32_t tempsrc, tempdst, tempws, tempws2 = 0;
|
||||
int tempws, tempws2 = 0;
|
||||
int16_t temps16;
|
||||
uint16_t src, dst;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
@@ -339,32 +326,21 @@ static int opF7_w_a16(uint32_t fetchdat)
|
||||
CLOCK_CYCLES(is486 ? 24 : 22);
|
||||
PREFETCH_RUN(is486 ? 24 : 22, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 0);
|
||||
break;
|
||||
case 0x38: /*IDIV DX:AX,w*/
|
||||
if (dst == 0) {
|
||||
x86_int(0); /* Divide by zero. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
templ = (uint32_t) DX;
|
||||
templ = (templ << 16) | AX;
|
||||
tempsrc = (int32_t) templ;
|
||||
tempdst = (int16_t) dst;
|
||||
|
||||
tempws = tempsrc / tempdst;
|
||||
|
||||
if ((tempws > 32767) || (tempws < -32768)) {
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempws = (int16_t) tempws;
|
||||
tempws2 = (int16_t) (tempsrc % tempdst);
|
||||
|
||||
DX = (uint16_t) tempws2;
|
||||
AX = (uint16_t) tempws;
|
||||
|
||||
if (!cpu_iscyrix) setznp16(AX); /*Not a Cyrix*/
|
||||
|
||||
case 0x38: /*IDIV AX,w*/
|
||||
tempws = (int)((DX << 16)|AX);
|
||||
if (dst) tempws2 = tempws / (int)((int16_t)dst);
|
||||
temps16 = tempws2 & 0xffff;
|
||||
if ((dst != 0) && ((int)temps16 == tempws2))
|
||||
{
|
||||
DX = tempws % (int)((int16_t)dst);
|
||||
AX = tempws2 & 0xffff;
|
||||
if (!cpu_iscyrix) setznp16(AX); /*Not a Cyrix*/
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
CLOCK_CYCLES(27);
|
||||
PREFETCH_RUN(27, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 0);
|
||||
break;
|
||||
@@ -378,7 +354,8 @@ static int opF7_w_a16(uint32_t fetchdat)
|
||||
static int opF7_w_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t templ, templ2;
|
||||
int tempsrc, tempdst, tempws, tempws2 = 0;
|
||||
int tempws, tempws2 = 0;
|
||||
int16_t temps16;
|
||||
uint16_t src, dst;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
@@ -441,32 +418,21 @@ static int opF7_w_a32(uint32_t fetchdat)
|
||||
CLOCK_CYCLES(is486 ? 24 : 22);
|
||||
PREFETCH_RUN(is486 ? 24 : 22, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 1);
|
||||
break;
|
||||
case 0x38: /*IDIV DX:AX,w*/
|
||||
if (dst == 0) {
|
||||
x86_int(0); /* Divide by zero. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
templ = (uint32_t) DX;
|
||||
templ = (templ << 16) | AX;
|
||||
tempsrc = (int32_t) templ;
|
||||
tempdst = (int16_t) dst;
|
||||
|
||||
tempws = tempsrc / tempdst;
|
||||
|
||||
if ((tempws > 32767) || (tempws < -32768)) {
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tempws = (int16_t) tempws;
|
||||
tempws2 = (int16_t) (tempsrc % tempdst);
|
||||
|
||||
DX = (uint16_t) tempws2;
|
||||
AX = (uint16_t) tempws;
|
||||
|
||||
if (!cpu_iscyrix) setznp16(AX); /*Not a Cyrix*/
|
||||
|
||||
case 0x38: /*IDIV AX,w*/
|
||||
tempws = (int)((DX << 16)|AX);
|
||||
if (dst) tempws2 = tempws / (int)((int16_t)dst);
|
||||
temps16 = tempws2 & 0xffff;
|
||||
if ((dst != 0) && ((int)temps16 == tempws2))
|
||||
{
|
||||
DX = tempws % (int)((int16_t)dst);
|
||||
AX = tempws2 & 0xffff;
|
||||
if (!cpu_iscyrix) setznp16(AX); /*Not a Cyrix*/
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_int(0);
|
||||
return 1;
|
||||
}
|
||||
CLOCK_CYCLES(27);
|
||||
PREFETCH_RUN(27, 2, rmdat, (cpu_mod == 3) ? 0:1,0,0,0, 1);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user