Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
@@ -129,23 +129,24 @@ esdi_at_log(const char *fmt, ...)
|
||||
static __inline void
|
||||
irq_raise(esdi_t *esdi)
|
||||
{
|
||||
if (!(esdi->fdisk & 2))
|
||||
picint(1 << 14);
|
||||
|
||||
esdi->irqstat = 1;
|
||||
if (!(esdi->fdisk & 2))
|
||||
picint_common(1 << 14, PIC_IRQ_EDGE, 1, NULL);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
irq_lower(UNUSED(esdi_t *esdi))
|
||||
irq_lower(esdi_t *esdi)
|
||||
{
|
||||
picintc(1 << 14);
|
||||
esdi->irqstat = 0;
|
||||
if (!(esdi->fdisk & 2))
|
||||
picint_common(1 << 14, PIC_IRQ_EDGE, 0, NULL);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
irq_update(UNUSED(esdi_t *esdi))
|
||||
irq_update(esdi_t *esdi)
|
||||
{
|
||||
if (esdi->irqstat && !((pic2.irr | pic2.isr) & 0x40) && !(esdi->fdisk & 2))
|
||||
picint(1 << 14);
|
||||
uint8_t set = !(esdi->fdisk & 2) && esdi->irqstat;
|
||||
picint_common(1 << 14, PIC_IRQ_EDGE, set, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -263,6 +264,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv)
|
||||
double seek_time;
|
||||
double xfer_time;
|
||||
off64_t addr;
|
||||
uint8_t old;
|
||||
|
||||
esdi_at_log("WD1007 write(%04x, %02x)\n", port, val);
|
||||
|
||||
@@ -411,15 +413,15 @@ esdi_write(uint16_t port, uint8_t val, void *priv)
|
||||
esdi_set_callback(esdi, 500 * HDC_TIME);
|
||||
esdi->reset = 1;
|
||||
esdi->status = STAT_BUSY;
|
||||
}
|
||||
|
||||
if (val & 0x04) {
|
||||
} else if (!(esdi->fdisk & 0x04) && (val & 0x04)) {
|
||||
/* Drive held in reset. */
|
||||
esdi_set_callback(esdi, 0);
|
||||
esdi->status = STAT_BUSY;
|
||||
}
|
||||
old = esdi->fdisk;
|
||||
esdi->fdisk = val;
|
||||
irq_update(esdi);
|
||||
if (!(val & 0x02) && (old & 0x02))
|
||||
irq_update(esdi);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -134,26 +134,27 @@ st506_at_log(const char *fmt, ...)
|
||||
# define st506_at_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
static __inline void
|
||||
irq_raise(mfm_t *mfm)
|
||||
{
|
||||
if (!(mfm->fdisk & 2))
|
||||
picint(1 << 14);
|
||||
|
||||
mfm->irqstat = 1;
|
||||
if (!(mfm->fdisk & 2))
|
||||
picint_common(1 << 14, PIC_IRQ_EDGE, 1, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
irq_lower(UNUSED(mfm_t *mfm))
|
||||
static __inline void
|
||||
irq_lower(mfm_t *mfm)
|
||||
{
|
||||
picintc(1 << 14);
|
||||
mfm->irqstat = 0;
|
||||
if (!(mfm->fdisk & 2))
|
||||
picint_common(1 << 14, PIC_IRQ_EDGE, 0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
static __inline void
|
||||
irq_update(mfm_t *mfm)
|
||||
{
|
||||
if (mfm->irqstat && !((pic2.irr | pic2.isr) & 0x40) && !(mfm->fdisk & 2))
|
||||
picint(1 << 14);
|
||||
uint8_t set = !(mfm->fdisk & 2) && mfm->irqstat;
|
||||
picint_common(1 << 14, PIC_IRQ_EDGE, set, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -378,6 +379,7 @@ static void
|
||||
mfm_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
mfm_t *mfm = (mfm_t *) priv;
|
||||
uint8_t old;
|
||||
|
||||
st506_at_log("WD1003 write(%04x, %02x)\n", port, val);
|
||||
|
||||
@@ -408,7 +410,7 @@ mfm_write(uint16_t port, uint8_t val, void *priv)
|
||||
|
||||
case 0x01f6: /* drive/head */
|
||||
mfm->head = val & 0xF;
|
||||
mfm->drvsel = (val & 0x10) ? 1 : 0;
|
||||
mfm->drvsel = !!(val & 0x10);
|
||||
if (mfm->drives[mfm->drvsel].present)
|
||||
mfm->status = STAT_READY | STAT_DSC;
|
||||
else
|
||||
@@ -425,15 +427,15 @@ mfm_write(uint16_t port, uint8_t val, void *priv)
|
||||
timer_set_delay_u64(&mfm->callback_timer, 500 * MFM_TIME);
|
||||
mfm->reset = 1;
|
||||
mfm->status = STAT_BUSY;
|
||||
}
|
||||
|
||||
if (val & 0x04) {
|
||||
} else if (!(mfm->fdisk & 0x04) && (val & 0x04)) {
|
||||
/* Drive held in reset. */
|
||||
timer_disable(&mfm->callback_timer);
|
||||
mfm->status = STAT_BUSY;
|
||||
}
|
||||
old = mfm->fdisk;
|
||||
mfm->fdisk = val;
|
||||
irq_update(mfm);
|
||||
if (!(val & 0x02) && (old & 0x02))
|
||||
irq_update(mfm);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -406,6 +406,8 @@ void emu8k_close(emu8k_t *emu8k);
|
||||
|
||||
void emu8k_update(emu8k_t *emu8k);
|
||||
|
||||
#define EMU8K_ROM_PATH "roms/sound/creative/awe32.raw"
|
||||
|
||||
/*
|
||||
|
||||
Section E - Introduction to the EMU8000 Chip
|
||||
|
@@ -413,7 +413,7 @@ void
|
||||
plat_power_off(void)
|
||||
{
|
||||
plat_mouse_capture(0);
|
||||
confirm_exit = 0;
|
||||
confirm_exit_cmdl = 0;
|
||||
nvr_save();
|
||||
config_save();
|
||||
|
||||
|
@@ -2172,7 +2172,7 @@ emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
|
||||
int c;
|
||||
double out;
|
||||
|
||||
fp = rom_fopen("roms/sound/creative/awe32.raw", "rb");
|
||||
fp = rom_fopen(EMU8K_ROM_PATH, "rb");
|
||||
if (!fp)
|
||||
fatal("AWE32.RAW not found\n");
|
||||
|
||||
|
@@ -43,6 +43,14 @@
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define PNP_ROM_SB_VIBRA16XV "roms/sound/creative/CT4170 PnP.BIN"
|
||||
#define PNP_ROM_SB_VIBRA16C "roms/sound/creative/CT4180 PnP.BIN"
|
||||
#define PNP_ROM_SB_32_PNP "roms/sound/creative/CT3600 PnP.BIN"
|
||||
#define PNP_ROM_SB_AWE32_PNP "roms/sound/creative/CT3980 PnP.BIN"
|
||||
#define PNP_ROM_SB_AWE64_VALUE "roms/sound/creative/CT4520 PnP.BIN"
|
||||
#define PNP_ROM_SB_AWE64 "roms/sound/creative/CTL009DA.BIN"
|
||||
#define PNP_ROM_SB_AWE64_GOLD "roms/sound/creative/CT4540 PnP.BIN"
|
||||
|
||||
/* 0 to 7 -> -14dB to 0dB i 2dB steps. 8 to 15 -> 0 to +14dB in 2dB steps.
|
||||
Note that for positive dB values, this is not amplitude, it is amplitude - 1. */
|
||||
static const double sb_bass_treble_4bits[] = {
|
||||
@@ -1768,6 +1776,27 @@ sb_awe32_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pr
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sb_awe64_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
switch (ld) {
|
||||
case 0: /* Audio */
|
||||
case 2: /* WaveTable */
|
||||
sb_16_pnp_config_changed(ld, config, sb);
|
||||
break;
|
||||
|
||||
case 1: /* Game */
|
||||
case 3: /* IDE */
|
||||
sb_16_pnp_config_changed(ld ^ 2, config, sb);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sb_awe64_gold_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv)
|
||||
{
|
||||
@@ -2376,13 +2405,13 @@ sb_16_pnp_init(UNUSED(const device_t *info))
|
||||
static int
|
||||
sb_vibra16xv_available(void)
|
||||
{
|
||||
return rom_present("roms/sound/creative/CT4170 PnP.BIN");
|
||||
return rom_present(PNP_ROM_SB_VIBRA16XV);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_vibra16c_available(void)
|
||||
{
|
||||
return rom_present("roms/sound/creative/CT4180 PnP.BIN");
|
||||
return rom_present(PNP_ROM_SB_VIBRA16C);
|
||||
}
|
||||
|
||||
static void *
|
||||
@@ -2424,11 +2453,11 @@ sb_vibra16_pnp_init(UNUSED(const device_t *info))
|
||||
const char *pnp_rom_file = NULL;
|
||||
switch (info->local) {
|
||||
case 0:
|
||||
pnp_rom_file = "roms/sound/creative/CT4170 PnP.BIN";
|
||||
pnp_rom_file = PNP_ROM_SB_VIBRA16XV;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pnp_rom_file = "roms/sound/creative/CT4180 PnP.BIN";
|
||||
pnp_rom_file = PNP_ROM_SB_VIBRA16C;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2503,37 +2532,37 @@ sb_16_compat_init(const device_t *info)
|
||||
static int
|
||||
sb_awe32_available(void)
|
||||
{
|
||||
return rom_present("roms/sound/creative/awe32.raw");
|
||||
return rom_present(EMU8K_ROM_PATH);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_32_pnp_available(void)
|
||||
{
|
||||
return sb_awe32_available() && rom_present("roms/sound/creative/CT3600 PnP.BIN");
|
||||
return sb_awe32_available() && rom_present(PNP_ROM_SB_32_PNP);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_awe32_pnp_available(void)
|
||||
{
|
||||
return sb_awe32_available() && rom_present("roms/sound/creative/CT3980 PnP.BIN");
|
||||
return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE32_PNP);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_awe64_value_available(void)
|
||||
{
|
||||
return sb_awe32_available() && rom_present("roms/sound/creative/CT4520 PnP.BIN");
|
||||
return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE64_VALUE);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_awe64_available(void)
|
||||
{
|
||||
return sb_awe32_available() && rom_present("roms/sound/creative/CT4520 PnP.BIN");
|
||||
return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE64);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_awe64_gold_available(void)
|
||||
{
|
||||
return sb_awe32_available() && rom_present("roms/sound/creative/CT4540 PnP.BIN");
|
||||
return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE64_GOLD);
|
||||
}
|
||||
|
||||
static void *
|
||||
@@ -2647,26 +2676,29 @@ sb_awe32_pnp_init(const device_t *info)
|
||||
|
||||
sb->gameport = gameport_add(&gameport_pnp_device);
|
||||
|
||||
if ((info->local != 2) && (info->local != 3) && (info->local != 4))
|
||||
if ((info->local != 2) && (info->local != 4))
|
||||
device_add(&ide_qua_pnp_device);
|
||||
|
||||
const char *pnp_rom_file = NULL;
|
||||
switch (info->local) {
|
||||
case 0:
|
||||
pnp_rom_file = "roms/sound/creative/CT3600 PnP.BIN";
|
||||
pnp_rom_file = PNP_ROM_SB_32_PNP;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pnp_rom_file = "roms/sound/creative/CT3980 PnP.BIN";
|
||||
pnp_rom_file = PNP_ROM_SB_AWE32_PNP;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pnp_rom_file = PNP_ROM_SB_AWE64_VALUE;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
pnp_rom_file = "roms/sound/creative/CT4520 PnP.BIN";
|
||||
pnp_rom_file = PNP_ROM_SB_AWE64;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
pnp_rom_file = "roms/sound/creative/CT4540 PnP.BIN";
|
||||
pnp_rom_file = PNP_ROM_SB_AWE64_GOLD;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2692,8 +2724,11 @@ sb_awe32_pnp_init(const device_t *info)
|
||||
isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe32_pnp_config_changed, NULL, NULL, NULL, sb);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_pnp_config_changed, NULL, NULL, NULL, sb);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 4:
|
||||
isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_gold_pnp_config_changed, NULL, NULL, NULL, sb);
|
||||
break;
|
||||
@@ -2708,7 +2743,7 @@ sb_awe32_pnp_init(const device_t *info)
|
||||
sb_dsp_setdma16(&sb->dsp, ISAPNP_DMA_DISABLED);
|
||||
|
||||
mpu401_change_addr(sb->mpu, 0);
|
||||
if ((info->local != 2) && (info->local != 3) && (info->local != 4))
|
||||
if ((info->local != 2) && (info->local != 4))
|
||||
ide_remove_handlers(3);
|
||||
|
||||
emu8k_change_addr(&sb->emu8k, 0);
|
||||
|
@@ -697,7 +697,7 @@ plat_get_exe_name(char *s, int size)
|
||||
void
|
||||
plat_power_off(void)
|
||||
{
|
||||
confirm_exit = 0;
|
||||
confirm_exit_cmdl = 0;
|
||||
nvr_save();
|
||||
config_save();
|
||||
|
||||
|
@@ -2596,15 +2596,16 @@ mach_recalctimings(svga_t *svga)
|
||||
mach_log("ON[0]=%d, ON[1]=%d, exton[0]=%d, exton[1]=%d, vendormode0=%d, vendormode1=%d.\n", dev->on[0], dev->on[1], mach->ext_on[0], mach->ext_on[1], dev->vendor_mode[0], dev->vendor_mode[1]);
|
||||
if (dev->on[0] || dev->on[1]) {
|
||||
mach_log("8514/A ON.\n");
|
||||
dev->h_disp = dev->hdisp;
|
||||
dev->h_total = dev->htotal + 1;
|
||||
dev->h_blankstart = dev->hblankstart;
|
||||
dev->h_blank_end_val = dev->hblank_end_val;
|
||||
dev->v_total = dev->vtotal;
|
||||
dev->v_syncstart = dev->vsyncstart;
|
||||
dev->dispend = dev->vdisp;
|
||||
dev->rowcount = !!(dev->disp_cntl & 0x08);
|
||||
|
||||
dev->h_disp = dev->hdisp;
|
||||
dev->dispend = dev->vdisp;
|
||||
|
||||
if (dev->dispend == 766)
|
||||
dev->dispend += 2;
|
||||
|
||||
@@ -2636,6 +2637,7 @@ mach_recalctimings(svga_t *svga)
|
||||
dev->v_total >>= 1;
|
||||
}
|
||||
|
||||
mach_log("HDISP=%d.\n", dev->h_disp);
|
||||
dev->pitch = dev->ext_pitch;
|
||||
dev->rowoffset = dev->ext_crt_pitch;
|
||||
if ((mach->accel.ext_ge_config & 0x800) || (!(mach->accel.ext_ge_config & 0x8000) && !(mach->accel.ext_ge_config & 0x800))) {
|
||||
@@ -3626,9 +3628,21 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
|
||||
if (((dev->disp_cntl & 0x60) == 0x20) || (((dev->disp_cntl & 0x60) == 0x40) && !(dev->accel.advfunc_cntl & 0x04)) || (mach->accel.clock_sel & 0x01)) {
|
||||
dev->hdisped = val;
|
||||
dev->hdisp = (dev->hdisped + 1) << 3;
|
||||
if ((dev->hdisp == 640) && ((mach->shadow_set & 0x03) == 0x02) && (((dev->disp_cntl & 0x60) == 0x40) && !(dev->accel.advfunc_cntl & 0x04)))
|
||||
svga_recalctimings(svga);
|
||||
else if ((dev->hdisp == 1024) && !(mach->accel.clock_sel & 0x01) && ((dev->disp_cntl & 0x60) == 0x40)) {
|
||||
if (dev->accel.advfunc_cntl & 0x04) {
|
||||
dev->hdisp = 1024;
|
||||
dev->vdisp = 768;
|
||||
} else {
|
||||
dev->hdisp = 640;
|
||||
dev->vdisp = 480;
|
||||
}
|
||||
svga_recalctimings(svga);
|
||||
}
|
||||
}
|
||||
}
|
||||
mach_log("[%04X:%08X]: ATI 8514/A: H_DISP write 06E8 = %d, actual val=%d, set lock=%x, shadow set=%x, advfunc=%x, dispcntl=%02x.\n", CS, cpu_state.pc, dev->hdisp, ((val + 1) << 3), mach->shadow_cntl, mach->shadow_set, dev->accel.advfunc_cntl & 4, dev->disp_cntl & 0x60);
|
||||
mach_log("[%04X:%08X]: ATI 8514/A: H_DISP write 06E8 = %d, actual val=%d, set lock=%x, shadow set=%x, advfunc bit 2=%x, dispcntl=%02x, clocksel bit 0=%x.\n", CS, cpu_state.pc, dev->hdisp, ((val + 1) << 3), mach->shadow_cntl, mach->shadow_set, dev->accel.advfunc_cntl & 0x04, dev->disp_cntl & 0x60, mach->accel.clock_sel & 0x01);
|
||||
break;
|
||||
|
||||
case 0xae8:
|
||||
@@ -3733,7 +3747,7 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
|
||||
mach->ext_on[port & 1] = dev->on[port & 1];
|
||||
mach32_updatemapping(mach, svga);
|
||||
dev->vendor_mode[port & 1] = 0;
|
||||
mach_log("ATI 8514/A: (0x%04x): ON=%d, shadow crt=%x.\n", port, dev->on[port & 1], dev->accel.advfunc_cntl & 4);
|
||||
mach_log("ATI 8514/A: (0x%04x): ON=%d, shadow crt=%x, hdisp=%d.\n", port, dev->on[port & 1], dev->accel.advfunc_cntl & 4, dev->hdisp);
|
||||
svga_recalctimings(svga);
|
||||
break;
|
||||
|
||||
|
@@ -383,7 +383,7 @@ win_notify_dlg_closed(void)
|
||||
void
|
||||
plat_power_off(void)
|
||||
{
|
||||
confirm_exit = 0;
|
||||
confirm_exit_cmdl = 0;
|
||||
nvr_save();
|
||||
config_save();
|
||||
|
||||
|
Reference in New Issue
Block a user