Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into usb-bochs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Dec 14, 2024
2 parents d9fec8a + 11b588c commit 13cc874
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 33 deletions.
18 changes: 4 additions & 14 deletions src/cpu/x86_ops_fpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
static int
opESCAPE_d8_a16(uint32_t fetchdat)
{
//pclog("D8 A16: fetchdat=%02x.\n", (fetchdat >> 3) & 0x1f);
return x86_opcodes_d8_a16[(fetchdat >> 3) & 0x1f](fetchdat);
}
static int
Expand All @@ -16,7 +15,6 @@ opESCAPE_d8_a32(uint32_t fetchdat)
static int
opESCAPE_d9_a16(uint32_t fetchdat)
{
//pclog("D9 A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_d9_a16[fetchdat & 0xff](fetchdat);
}
static int
Expand All @@ -28,7 +26,6 @@ opESCAPE_d9_a32(uint32_t fetchdat)
static int
opESCAPE_da_a16(uint32_t fetchdat)
{
//pclog("DA A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_da_a16[fetchdat & 0xff](fetchdat);
}
static int
Expand All @@ -40,7 +37,6 @@ opESCAPE_da_a32(uint32_t fetchdat)
static int
opESCAPE_db_a16(uint32_t fetchdat)
{
//pclog("DB A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_db_a16[fetchdat & 0xff](fetchdat);
}
static int
Expand All @@ -52,7 +48,6 @@ opESCAPE_db_a32(uint32_t fetchdat)
static int
opESCAPE_dc_a16(uint32_t fetchdat)
{
//pclog("DC A16: fetchdat=%02x.\n", (fetchdat >> 3) & 0x1f);
return x86_opcodes_dc_a16[(fetchdat >> 3) & 0x1f](fetchdat);
}
static int
Expand All @@ -64,7 +59,6 @@ opESCAPE_dc_a32(uint32_t fetchdat)
static int
opESCAPE_dd_a16(uint32_t fetchdat)
{
//pclog("DD A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_dd_a16[fetchdat & 0xff](fetchdat);
}
static int
Expand All @@ -76,7 +70,6 @@ opESCAPE_dd_a32(uint32_t fetchdat)
static int
opESCAPE_de_a16(uint32_t fetchdat)
{
//pclog("DE A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_de_a16[fetchdat & 0xff](fetchdat);
}
static int
Expand All @@ -88,7 +81,6 @@ opESCAPE_de_a32(uint32_t fetchdat)
static int
opESCAPE_df_a16(uint32_t fetchdat)
{
//pclog("DF A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_df_a16[fetchdat & 0xff](fetchdat);
}
static int
Expand All @@ -105,15 +97,13 @@ opWAIT(uint32_t fetchdat)
return 1;
}

#if 0
if (!cpu_use_dynarec && fpu_softfloat) {
#endif
if (fpu_softfloat) {
if (fpu_state.swd & FPU_SW_Summary) {
if (cr0 & 0x20) {
if (is486 && (cr0 & 0x20))
x86_int(16);
return 1;
}
else
picint(1 << 13);
return 1;
}
}
CLOCK_CYCLES(4);
Expand Down
9 changes: 2 additions & 7 deletions src/cpu/x86_ops_fpu_2386.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,10 @@ opWAIT(uint32_t fetchdat)
return 1;
}

#if 0
if (!cpu_use_dynarec && fpu_softfloat) {
#endif
if (fpu_softfloat) {
if (fpu_state.swd & FPU_SW_Summary) {
if (cr0 & 0x20) {
x86_int(16);
return 1;
}
picint(1 << 13);
return 1;
}
}
CLOCK_CYCLES(4);
Expand Down
5 changes: 4 additions & 1 deletion src/cpu/x87.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,10 @@ FPU_exception(uint32_t fetchdat, uint16_t exceptions, int store)
nmi = 1;
}
#else
picint(1 << 13);
if (is486 && (cr0 & 0x20))
x86_int(16);
else
picint(1 << 13);
#endif // FPU_8087
}
return unmasked;
Expand Down
8 changes: 3 additions & 5 deletions src/cpu/x87.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,10 @@ FPU_save_regi_tag(extFloat80_t reg, int tag, int stnr)
#define FPU_check_pending_exceptions() \
do { \
if (fpu_state.swd & FPU_SW_Summary) { \
if (cr0 & 0x20) { \
if (is486 && (cr0 & 0x20)) \
x86_int(16); \
return 1; \
} else { \
else \
picint(1 << 13); \
return 1; \
} \
return 1; \
} \
} while (0)
5 changes: 4 additions & 1 deletion src/cpu/x87_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ typedef union {
dst = src1 / (double) src2; \
else { \
fpu_log("FPU : divide by zero\n"); \
picint(1 << 13); \
if (is486 && (cr0 & 0x20)) \
x86_int(16); \
else \
picint(1 << 13); \
return 1; \
} \
} else \
Expand Down
14 changes: 9 additions & 5 deletions src/sound/ymfm/ymfm_fm.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,11 +1473,14 @@ void fm_engine_base<RegisterType>::assign_operators()
template<class RegisterType>
void fm_engine_base<RegisterType>::update_timer(uint32_t tnum, uint32_t enable, int32_t delta_clocks)
{
uint32_t subtract = !!(tnum >> 15);
tnum &= 0x7fff;

// if the timer is live, but not currently enabled, set the timer
if (enable && !m_timer_running[tnum])
{
// period comes from the registers, and is different for each
uint32_t period = (tnum == 0) ? (1024 - m_regs.timer_a_value()) : 16 * (256 - m_regs.timer_b_value());
uint32_t period = (tnum == 0) ? (1024 - subtract - m_regs.timer_a_value()) : 16 * (256 - subtract - m_regs.timer_b_value());

// caller can also specify a delta to account for other effects
period += delta_clocks;
Expand All @@ -1504,8 +1507,6 @@ void fm_engine_base<RegisterType>::update_timer(uint32_t tnum, uint32_t enable,
template<class RegisterType>
void fm_engine_base<RegisterType>::engine_timer_expired(uint32_t tnum)
{
assert(tnum == 0 || tnum == 1);

// update status
if (tnum == 0 && m_regs.enable_timer_a())
set_reset_status(STATUS_TIMERA, 0);
Expand All @@ -1521,8 +1522,11 @@ void fm_engine_base<RegisterType>::engine_timer_expired(uint32_t tnum)
m_modified_channels |= 1 << chnum;
}

// reset
m_timer_running[tnum] = false;
// Make sure the array does not go out of bounds to keep gcc happy
if ((tnum < 2) || (sizeof(m_timer_running) > (2 * sizeof(uint8_t)))) {
// reset
m_timer_running[tnum] = false;
}
update_timer(tnum, 1, 0);
}

Expand Down

0 comments on commit 13cc874

Please sign in to comment.