Merge branch 'master' into pc98x1

This commit is contained in:
TC1995
2024-07-29 10:10:47 +02:00
3 changed files with 29 additions and 10 deletions

View File

@@ -78,7 +78,11 @@ opFINIT(uint32_t fetchdat)
cpu_state.npxc = 0x37F;
#endif
codegen_set_rounding_mode(X87_ROUNDING_NEAREST);
#ifdef FPU_8087
cpu_state.npxs &= 0x4700;
#else
cpu_state.npxs = 0;
#endif
p = (uint64_t *) cpu_state.tag;
#ifdef USE_NEW_DYNAREC
*p = 0;
@@ -406,7 +410,11 @@ FSAVE(void)
cpu_state.npxc = 0x37F;
codegen_set_rounding_mode(X87_ROUNDING_NEAREST);
#ifdef FPU_8087
cpu_state.npxs &= 0x4700;
#else
cpu_state.npxs = 0;
#endif
p = (uint64_t *) cpu_state.tag;
#ifdef USE_NEW_DYNAREC
*p = 0;

View File

@@ -431,11 +431,12 @@ sf_FNSAVE_a16(uint32_t fetchdat)
}
#ifdef FPU_8087
fpu_state.swd = 0x3FF;
fpu_state.cwd = 0x3FF;
fpu_state.swd &= 0x4700;
#else
fpu_state.cwd = 0x37F;
#endif
fpu_state.swd = 0;
#endif
fpu_state.tos = 0;
fpu_state.tag = 0xffff;
cpu_state.ismmx = 0;
@@ -467,7 +468,7 @@ sf_FNSAVE_a32(uint32_t fetchdat)
}
# ifdef FPU_8087
fpu_state.swd = 0x3FF;
fpu_state.cwd = 0x3FF;
# else
fpu_state.cwd = 0x37F;
# endif
@@ -504,10 +505,11 @@ sf_FNINIT(uint32_t fetchdat)
cpu_state.pc++;
#ifdef FPU_8087
fpu_state.cwd = 0x3FF;
fpu_state.swd &= 0x4700;
#else
fpu_state.cwd = 0x37F;
#endif
fpu_state.swd = 0;
#endif
fpu_state.tos = 0;
fpu_state.tag = 0xffff;
fpu_state.foo = 0;

View File

@@ -88,7 +88,7 @@ sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv)
case 0:
sn76489->freqlo[3] = data & 0xf;
sn76489->latch[3] = (sn76489->freqlo[3] | (sn76489->freqhi[3] << 4)) << 6;
if (sn76489->extra_divide)
if (!sn76489->extra_divide)
sn76489->latch[3] &= 0x3ff;
if (!sn76489->latch[3])
sn76489->latch[3] = (sn76489->extra_divide ? 2048 : 1024) << 6;
@@ -101,7 +101,7 @@ sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv)
case 0x20:
sn76489->freqlo[2] = data & 0xf;
sn76489->latch[2] = (sn76489->freqlo[2] | (sn76489->freqhi[2] << 4)) << 6;
if (sn76489->extra_divide)
if (!sn76489->extra_divide)
sn76489->latch[2] &= 0x3ff;
if (!sn76489->latch[2])
sn76489->latch[2] = (sn76489->extra_divide ? 2048 : 1024) << 6;
@@ -114,7 +114,7 @@ sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv)
case 0x40:
sn76489->freqlo[1] = data & 0xf;
sn76489->latch[1] = (sn76489->freqlo[1] | (sn76489->freqhi[1] << 4)) << 6;
if (sn76489->extra_divide)
if (!sn76489->extra_divide)
sn76489->latch[1] &= 0x3ff;
if (!sn76489->latch[1])
sn76489->latch[1] = (sn76489->extra_divide ? 2048 : 1024) << 6;
@@ -132,7 +132,7 @@ sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv)
sn76489->latch[0] = sn76489->latch[1];
else
sn76489->latch[0] = 0x400 << (data & 3);
if (sn76489->extra_divide)
if (!sn76489->extra_divide)
sn76489->latch[0] &= 0x3ff;
if (!sn76489->latch[0])
sn76489->latch[0] = (sn76489->extra_divide ? 2048 : 1024) << 6;
@@ -157,9 +157,12 @@ sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv)
if (!sn76489->latch[0])
sn76489->latch[0] = 1024 << 6;
} else if ((sn76489->firstdat & 0x70) != 0x60) {
sn76489->freqhi[sn76489->lasttone] = data & 0x7F;
freq = sn76489->freqlo[sn76489->lasttone] | (sn76489->freqhi[sn76489->lasttone] << 4);
if (sn76489->extra_divide)
sn76489->freqhi[sn76489->lasttone] = data & 0x7F;
else
sn76489->freqhi[sn76489->lasttone] = data & 0x3F;
freq = sn76489->freqlo[sn76489->lasttone] | (sn76489->freqhi[sn76489->lasttone] << 4);
if (!sn76489->extra_divide)
freq &= 0x3ff;
if (!freq)
freq = sn76489->extra_divide ? 2048 : 1024;
@@ -174,6 +177,12 @@ void
sn74689_set_extra_divide(sn76489_t *sn76489, int enable)
{
sn76489->extra_divide = enable;
if (!enable) {
for (uint8_t c = 1; c < 4; c++)
sn76489->latch[c] &= ~(0x400 << 6);
sn76489->latch[0] &= ~(0x400 << 6);
}
}
void