Merge branch 'master' into pc98x1

This commit is contained in:
TC1995
2025-01-03 14:29:44 +01:00
15 changed files with 994 additions and 483 deletions

View File

@@ -206,7 +206,7 @@ int video_fullscreen_scale_maximized = 0; /* (C) Whether
also apply when maximized. */
int do_auto_pause = 0; /* (C) Auto-pause the emulator on focus
loss */
int raw_input = 0; /* (C) Use raw input */
int hook_enabled = 1; /* (C) Keyboard hook is enabled */
char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */
int other_ide_present = 0; /* IDE controllers from non-IDE cards are
@@ -453,6 +453,8 @@ delete_nvr_file(uint8_t flash)
fn = NULL;
}
extern void device_find_all_descs(void);
/*
* Perform initial startup of the PC.
*
@@ -562,7 +564,7 @@ usage:
printf("-S or --settings - show only the settings dialog\n");
#endif
printf("-V or --vmname name - overrides the name of the running VM\n");
printf("-W or --raw - uses raw input (compatibility-only outside Windows)\n");
printf("-W or --nohook - disables keyboard hook (compatibility-only outside Windows)\n");
printf("-X or --clear what - clears the 'what' (cmos/flash/both)\n");
printf("-Y or --donothing - do not show any UI or run the emulation\n");
printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n");
@@ -638,8 +640,8 @@ usage:
dump_missing = 1;
} else if (!strcasecmp(argv[c], "--donothing") || !strcasecmp(argv[c], "-Y")) {
do_nothing = 1;
} else if (!strcasecmp(argv[c], "--raw") || !strcasecmp(argv[c], "-W")) {
raw_input = 1;
} else if (!strcasecmp(argv[c], "--nohook") || !strcasecmp(argv[c], "-W")) {
hook_enabled = 0;
} else if (!strcasecmp(argv[c], "--keycodes") || !strcasecmp(argv[c], "-K")) {
if ((c + 1) == argc)
goto usage;

View File

@@ -1426,33 +1426,11 @@ cdrom_get_track_buffer(cdrom_t *dev, uint8_t *buf)
buf[8] = 0x00;
}
/* TODO: Actually implement this properly. */
void
cdrom_get_q(cdrom_t *dev, uint8_t *buf, int *curtoctrk, uint8_t mode)
{
track_info_t ti;
int first_track;
int last_track;
if (dev != NULL) {
dev->ops->get_tracks(dev, &first_track, &last_track);
dev->ops->get_track_info(dev, *curtoctrk, 0, &ti);
buf[0] = (ti.attr << 4) & 0xf0;
buf[1] = ti.number;
buf[2] = bin2bcd(*curtoctrk + 1);
buf[3] = ti.m;
buf[4] = ti.s;
buf[5] = ti.f;
buf[6] = 0x00;
dev->ops->get_track_info(dev, 1, 0, &ti);
buf[7] = ti.m;
buf[8] = ti.s;
buf[9] = ti.f;
if (*curtoctrk >= (last_track + 1))
*curtoctrk = 0;
else if (mode)
*curtoctrk = *curtoctrk + 1;
} else
memset(buf, 0x00, 10);
memset(buf, 0x00, 10);
}
uint8_t
@@ -2196,7 +2174,7 @@ cdrom_exit(uint8_t id)
memset(dev->image_path, 0, sizeof(dev->image_path));
pclog("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
}
@@ -2274,7 +2252,7 @@ cdrom_reload(uint8_t id)
#endif
/* Signal media change to the emulated machine. */
pclog("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
/* The drive was previously empty, transition directly to UNIT ATTENTION. */

View File

@@ -436,7 +436,7 @@ cdi_read_sector(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector)
const uint64_t seek = (sect + 150 - idx->start + idx->file_start) * trk->sector_size;
cdrom_image_backend_log("cdrom_read_sector(%08X): track %02X, index %02X, %016" PRIX64 ", %016" PRIX64 ", %i\n",
sector, track, index, trk->start, trk->sector_size);
sector, track, index, idx->start, trk->sector_size);
if (track_is_raw)
raw_size = trk->sector_size;
@@ -1477,12 +1477,18 @@ cdi_close(cd_img_t *cdi)
int
cdi_set_device(cd_img_t *cdi, const char *path)
{
int ret;
uintptr_t ext = path + strlen(path) - strrchr(path, '.');
int ret;
if ((ret = cdi_load_cue(cdi, path)))
return ret;
cdrom_image_backend_log("cdi_set_device(): %" PRIu64 ", %lli, %s\n",
ext, strlen(path), path + strlen(path) - ext + 1);
cdi_clear_tracks(cdi);
if ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "CUE")) {
if ((ret = cdi_load_cue(cdi, path)))
return ret;
cdi_clear_tracks(cdi);
}
if ((ret = cdi_load_iso(cdi, path)))
return ret;

View File

@@ -165,7 +165,7 @@ extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */
#endif
extern int pit_mode; /* (C) force setting PIT mode */
extern int fm_driver; /* (C) select FM sound driver */
extern int raw_input; /* (C) Use raw input */
extern int hook_enabled; /* (C) Keyboard hook is enabled */
/* Keyboard variables for future key combination redefinition. */
extern uint16_t key_prefix_1_1;

View File

@@ -603,6 +603,7 @@ extern int machine_at_pcm5330_init(const machine_t *);
extern int machine_at_ecs486_init(const machine_t *);
extern int machine_at_hot433a_init(const machine_t *);
extern int machine_at_pl4600c_init(const machine_t *);
extern int machine_at_atc1415_init(const machine_t *);
extern int machine_at_actionpc2600_init(const machine_t *);
extern int machine_at_actiontower8400_init(const machine_t *);

View File

@@ -0,0 +1,22 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Ensoniq AudioPCI family emulation.
*
* Authors: Cacodemon345
*
* Copyright 2024-2025 Cacodemon345.
*/
struct akm4531_t
{
unsigned char registers[256];
};
typedef struct akm4531_t akm4531_t;
double akm4531_apply_master_vol(unsigned short sample);

View File

@@ -185,6 +185,7 @@ extern const device_t ess_soundpiper_32_mca_device;
extern const device_t ess_chipchat_16_mca_device;
/* Ensoniq AudioPCI */
extern const device_t es1370_device;
extern const device_t es1371_device;
extern const device_t es1371_onboard_device;
extern const device_t es1373_device;

View File

@@ -48,6 +48,7 @@
#include <86box/hwm.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
#include <86box/sound.h>
int
machine_at_acc386_init(const machine_t *model)
@@ -1962,6 +1963,48 @@ machine_at_hot433a_init(const machine_t *model)
return ret;
}
int
machine_at_pl4600c_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/pl4600c/SST29EE010.BIN",
0x000e0000, 131072, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); /* Slot 01 */
pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); /* Slot 02 */
pci_register_slot(0x10, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x12, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); /* Onboard */
pci_register_slot(0x13, PCI_CARD_VIDEO, 0, 0, 0, 0); /* Onboard */
device_add(&umc_hb4_device);
device_add(&umc_8886af_device);
device_add(&um8663af_device);
device_add(&sst_flash_29ee010_device);
device_add(&keyboard_ps2_ami_pci_device);
if (gfxcard[0] == VID_INTERNAL)
device_add(&gd5430_onboard_pci_device);
if (sound_card_current[0] == SOUND_INTERNAL)
device_add(&ess_1688_device);
if (fdc_current[0] == FDC_INTERNAL){
fdd_set_turbo(0, 1);
fdd_set_turbo(1, 1);
}
return ret;
}
int
machine_at_atc1415_init(const machine_t *model)
{

View File

@@ -8668,6 +8668,47 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* Compaq Presario 7100 / 7200 Series, using MiTAC/Trigon PL4600C (486). */
/* Has a VIA VT82C42N KBC. */
{
.name = "[UMC 8881] Compaq Presario 7100/7200 Series 486",
.internal_name = "pl4600c",
.type = MACHINE_TYPE_486_S3,
.chipset = MACHINE_CHIPSET_UMC_UM8881,
.init = machine_at_pl4600c_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET3,
.block = CPU_BLOCK_NONE,
.min_bus = 0,
.max_bus = 0,
.min_voltage = 0,
.max_voltage = 0,
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND | MACHINE_APM,
.ram = {
.min = 1024,
.max = 65536,
.step = 1024
},
.nvrmask = 255,
.kbc_device = NULL,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &gd5430_onboard_pci_device,
.snd_device = &ess_1688_device,
.net_device = NULL
},
/* Has a VIA VT82C406 KBC+RTC that likely has identical commands to the VT82C42N. */
{
.name = "[VIA VT82C496G] DFI G486VPA",

View File

@@ -43,6 +43,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
#endif
#ifdef Q_OS_WINDOWS
# include "qt_rendererstack.hpp"
# include "qt_winrawinputfilter.hpp"
# include "qt_winmanagerfilter.hpp"
# include <86box/win.h>
@@ -143,50 +144,21 @@ keyboard_getkeymap()
}
}
static void
kbd_handle(uint16_t scancode, uint16_t flags)
{
if (flags & LLKHF_EXTENDED)
scancode |= 0x100;
/* Translate the scan code to 9-bit */
scancode = convert_scan_code(scancode);
/* Remap it according to the list from the Registry */
if ((scancode < (sizeof(scancode_map) / sizeof(scancode_map[0]))) && (scancode != scancode_map[scancode])) {
// pclog("Scan code remap: %03X -> %03X\n", scancode, scancode_map[scancode]);
scancode = scancode_map[scancode];
}
/* If it's not 0xFFFF, send it to the emulated
keyboard.
We use scan code 0xFFFF to mean a mapping that
has a prefix other than E0 and that is not E1 1D,
which is, for our purposes, invalid. */
/* Translate right CTRL to left ALT if the user has so
chosen. */
if ((scancode == 0x11d) && rctrl_is_lalt)
scancode = 0x038;
/* Normal scan code pass through, pass it through as is if
it's not an invalid scan code. */
if (scancode != 0xFFFF)
keyboard_input(!(flags & LLKHF_UP), scancode);
main_window->checkFullscreenHotkey();
}
static LRESULT CALLBACK
emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
LPKBDLLHOOKSTRUCT lpKdhs = (LPKBDLLHOOKSTRUCT) lParam;
/* Checks if CTRL was pressed. */
BOOL bCtrlDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);
BOOL is_over_window = (GetForegroundWindow() == ((HWND) main_window->winId()));
if ((GetForegroundWindow() == ((HWND) main_window->winId())) && !(lpKdhs->scanCode & 0xff00))
kbd_handle(lpKdhs->scanCode, lpKdhs->flags);
if (show_second_monitors) for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
const auto &secondaryRenderer = main_window->renderers[monitor_index];
is_over_window = is_over_window || ((secondaryRenderer != nullptr) &&
(GetForegroundWindow() == ((HWND) secondaryRenderer->winId())));
}
if ((nCode < 0) || (nCode != HC_ACTION) || (!mouse_capture && !video_fullscreen))
if ((nCode < 0) || (nCode != HC_ACTION)/* || (!mouse_capture && !video_fullscreen)*/ || !is_over_window)
return CallNextHookEx(NULL, nCode, wParam, lParam);
else if ((lpKdhs->scanCode == 0x01) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
@@ -480,7 +452,7 @@ main(int argc, char *argv[])
/* Force raw input if a debugger is present. */
if (IsDebuggerPresent()) {
pclog("WARNING: Debugged detected, forcing raw input\n");
raw_input = 1;
hook_enabled = 0;
}
/* Setup raw input */
@@ -547,7 +519,8 @@ main(int argc, char *argv[])
});
#ifdef Q_OS_WINDOWS
if (!raw_input) {
if (hook_enabled) {
/* Yes, low-level hooks *DO* work with raw input, at least global ones. */
llhook = SetWindowsHookEx(WH_KEYBOARD_LL, emu_LowLevelKeyboardProc, NULL, 0);
atexit([] () -> void {
if (llhook)

View File

@@ -64,9 +64,7 @@ WindowsRawInputFilter::Register(MainWindow *window)
.hwndTarget = nullptr}
};
if (raw_input && (RegisterRawInputDevices(rid, 2, sizeof(rid[0])) == FALSE))
return std::unique_ptr<WindowsRawInputFilter>(nullptr);
else if (!raw_input && RegisterRawInputDevices(&(rid[1]), 1, sizeof(rid[0])) == FALSE)
if (RegisterRawInputDevices(rid, 2, sizeof(rid[0])) == FALSE)
return std::unique_ptr<WindowsRawInputFilter>(nullptr);
std::unique_ptr<WindowsRawInputFilter> inputfilter(new WindowsRawInputFilter(window));
@@ -97,10 +95,7 @@ WindowsRawInputFilter::~WindowsRawInputFilter()
.hwndTarget = NULL}
};
if (raw_input)
RegisterRawInputDevices(rid, 2, sizeof(rid[0]));
else
RegisterRawInputDevices(&(rid[1]), 1, sizeof(rid[0]));
RegisterRawInputDevices(rid, 2, sizeof(rid[0]));
}
bool

View File

@@ -509,6 +509,9 @@ t128_init(const device_t *info)
if (!t128->bios_enabled && !(info->flags & DEVICE_MCA))
t128->status |= 0x80;
if (info->flags & DEVICE_MCA)
t128->status |= 0x08;
if (info->local == 0)
timer_add(&t128->timer, t128_callback, t128, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -144,8 +144,8 @@ sb_log(const char *fmt, ...)
static void
sb_get_buffer_sb2(int32_t *buffer, int len, void *priv)
{
sb_t *sb = (sb_t *) priv;
const sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
sb_t *sb = (sb_t *) priv;
const sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
double out_mono;
sb_dsp_update(&sb->dsp);
@@ -154,8 +154,8 @@ sb_get_buffer_sb2(int32_t *buffer, int len, void *priv)
cms_update(&sb->cms);
for (int c = 0; c < len * 2; c += 2) {
double out_l = 0.0;
double out_r = 0.0;
double out_l = 0.0;
double out_r = 0.0;
if (sb->cms_enabled) {
out_l += sb->cms.buffer[c];
@@ -195,15 +195,15 @@ sb_get_buffer_sb2(int32_t *buffer, int len, void *priv)
static void
sb_get_music_buffer_sb2(int32_t *buffer, int len, void *priv)
{
const sb_t *sb = (const sb_t *) priv;
const sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
const int32_t *opl_buf = NULL;
const sb_t *sb = (const sb_t *) priv;
const sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
const int32_t *opl_buf = NULL;
opl_buf = sb->opl.update(sb->opl.priv);
for (int c = 0; c < len * 2; c += 2) {
double out_l = 0.0;
double out_r = 0.0;
double out_l = 0.0;
double out_r = 0.0;
const double out_mono = ((double) opl_buf[c]) * 0.7171630859375;
@@ -341,8 +341,8 @@ sbpro_filter_cd_audio(int channel, double *buffer, void *priv)
static void
sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *priv)
{
sb_t *sb = (sb_t *) priv;
const sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
sb_t *sb = (sb_t *) priv;
const sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
double bass_treble;
sb_dsp_update(&sb->dsp);
@@ -415,7 +415,7 @@ sb_get_music_buffer_sb16_awe32(int32_t *buffer, const int len, void *priv)
const sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
const int dsp_rec_pos = sb->dsp.record_pos_write;
double bass_treble;
const int32_t *opl_buf = NULL;
const int32_t *opl_buf = NULL;
if (sb->opl_enabled)
opl_buf = sb->opl.update(sb->opl.priv);
@@ -508,7 +508,6 @@ sb_get_music_buffer_sb16_awe32(int32_t *buffer, const int len, void *priv)
sb->opl.reset_buffer(sb->opl.priv);
}
// TODO: Goldfinch
static void
sb_get_wavetable_buffer_goldfinch(int32_t *buffer, const int len, void *priv)
{
@@ -533,8 +532,8 @@ sb_get_wavetable_buffer_goldfinch(int32_t *buffer, const int len, void *priv)
static void
sb_get_wavetable_buffer_sb16_awe32(int32_t *buffer, const int len, void *priv)
{
sb_t *sb = (sb_t *) priv;
const sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
sb_t *sb = (sb_t *) priv;
const sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
double bass_treble;
emu8k_update(&sb->emu8k);
@@ -1215,7 +1214,7 @@ sb_ct1745_mixer_read(uint16_t addr, void *priv)
{
const sb_t *sb = (sb_t *) priv;
const sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
uint8_t ret = 0xff;
uint8_t ret = 0xff;
sb_log("sb_ct1745: received register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
@@ -1343,9 +1342,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *priv)
const uint8_t temp = ((sb->dsp.sb_irq8) ? 1 : 0) | ((sb->dsp.sb_irq16) ? 2 : 0) |
((sb->dsp.sb_irq401) ? 4 : 0);
if (sb->dsp.sb_type >= SBAWE32)
ret = temp | 0x80;
ret = temp | 0x80;
else
ret = temp | 0x40;
ret = temp | 0x40;
break;
case 0x83:
@@ -1371,22 +1370,22 @@ sb_ct1745_mixer_read(uint16_t addr, void *priv)
ret |= 0x01;
break;
case 0x49: /* Undocumented register used by some Creative drivers. */
case 0x4a: /* Undocumented register used by some Creative drivers. */
case 0x8c: /* Undocumented register used by some Creative drivers. */
case 0x8e: /* Undocumented register used by some Creative drivers. */
case 0x90: /* 3D Enhancement switch. */
case 0xfd: /* Undocumented register used by some Creative drivers. */
case 0xfe: /* Undocumented register used by some Creative drivers. */
case 0x49: /* Undocumented register used by some Creative drivers. */
case 0x4a: /* Undocumented register used by some Creative drivers. */
case 0x8c: /* Undocumented register used by some Creative drivers. */
case 0x8e: /* Undocumented register used by some Creative drivers. */
case 0x90: /* 3D Enhancement switch. */
case 0xfd: /* Undocumented register used by some Creative drivers. */
case 0xfe: /* Undocumented register used by some Creative drivers. */
ret = mixer->regs[mixer->index];
break;
case 0xff: /* Undocumented register used by some Creative drivers.
This and the upper bits of 0x82 seem to affect the
playback volume:
- Register FF = FF: Volume playback normal.
- Register FF = Not FF: Volume playback low unless
bit 6 of 82h is set. */
case 0xff: /* Undocumented register used by some Creative drivers.
This and the upper bits of 0x82 seem to affect the
playback volume:
- Register FF = FF: Volume playback normal.
- Register FF = Not FF: Volume playback low unless
bit 6 of 82h is set. */
if (sb->dsp.sb_type > SBAWE32)
ret = mixer->regs[mixer->index];
break;
@@ -1416,7 +1415,7 @@ sb_ct1745_mixer_reset(sb_t *sb)
static void
ess_base_write(uint16_t addr, uint8_t val, void *priv)
{
sb_t * ess = (sb_t *) priv;
sb_t *ess = (sb_t *) priv;
switch (addr & 0x000f) {
case 0x0002:
@@ -1435,7 +1434,7 @@ ess_base_write(uint16_t addr, uint8_t val, void *priv)
static uint8_t
ess_base_read(uint16_t addr, void *priv)
{
sb_t * ess = (sb_t *) priv;
sb_t *ess = (sb_t *) priv;
switch (addr & 0x000f) {
case 0x0002:
@@ -1462,7 +1461,7 @@ ess_base_read(uint16_t addr, void *priv)
static void
ess_fm_midi_write(uint16_t addr, uint8_t val, void *priv)
{
sb_t * ess = (sb_t *) priv;
sb_t *ess = (sb_t *) priv;
ess->dsp.activity &= 0x7f;
}
@@ -1470,7 +1469,7 @@ ess_fm_midi_write(uint16_t addr, uint8_t val, void *priv)
static uint8_t
ess_fm_midi_read(uint16_t addr, void *priv)
{
sb_t * ess = (sb_t *) priv;
sb_t *ess = (sb_t *) priv;
ess->dsp.activity &= 0x7f;
@@ -1548,8 +1547,8 @@ ess_mixer_write(uint16_t addr, uint8_t val, void *priv)
break;
case 0x0E:
mixer->output_filter = !(mixer->regs[0xE] & 0x20);
mixer->stereo = mixer->regs[0xE] & 2;
mixer->output_filter = !(mixer->regs[0xE] & 0x20);
mixer->stereo = mixer->regs[0xE] & 2;
sb_dsp_set_stereo(&ess->dsp, val & 2);
break;
@@ -1586,12 +1585,18 @@ ess_mixer_write(uint16_t addr, uint8_t val, void *priv)
/* More compatibility:
SoundBlaster Pro selects register 020h for 030h, 022h for 032h,
026h for 036h, and 028h for 038h. */
case 0x30: case 0x32: case 0x36: case 0x38:
case 0x30:
case 0x32:
case 0x36:
case 0x38:
case 0x3e:
mixer->regs[mixer->index - 0x10] = (val & 0xee);
break;
case 0x00: case 0x04: case 0x3a: case 0x3c:
case 0x00:
case 0x04:
case 0x3a:
case 0x3c:
break;
case 0x64:
@@ -1625,43 +1630,44 @@ ess_mixer_write(uint16_t addr, uint8_t val, void *priv)
}
}
if (ess->mpu != NULL) switch ((mixer->regs[0x40] >> 5) & 0x7) {
default:
break;
case 0:
mpu401_base_addr = 0x0000;
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, -1);
break;
case 1:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, -1);
break;
case 2:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, ess->dsp.sb_irqnum);
break;
case 3:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 11);
break;
case 4:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 9);
break;
case 5:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 5);
break;
case 6:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 7);
break;
case 7:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 10);
break;
}
if (ess->mpu != NULL)
switch ((mixer->regs[0x40] >> 5) & 0x7) {
default:
break;
case 0:
mpu401_base_addr = 0x0000;
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, -1);
break;
case 1:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, -1);
break;
case 2:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, ess->dsp.sb_irqnum);
break;
case 3:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 11);
break;
case 4:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 9);
break;
case 5:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 5);
break;
case 6:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 7);
break;
case 7:
mpu401_change_addr(ess->mpu, mpu401_base_addr);
mpu401_setirq(ess->mpu, 10);
break;
}
ess->midi_addr = mpu401_base_addr;
io_sethandler(addr, 0x0002,
ess_fm_midi_read, NULL, NULL,
@@ -1696,85 +1702,86 @@ ess_mixer_write(uint16_t addr, uint8_t val, void *priv)
uint8_t
ess_mixer_read(uint16_t addr, void *priv)
{
const sb_t * ess = (sb_t *) priv;
const sb_t *ess = (sb_t *) priv;
const ess_mixer_t *mixer = &ess->mixer_ess;
uint8_t ret = 0x0a;
if (!(addr & 1))
ret = mixer->index;
else switch (mixer->index) {
case 0x00:
case 0x0a:
case 0x0c:
case 0x0e:
case 0x14:
case 0x1a:
case 0x02:
case 0x06:
case 0x30:
case 0x32:
case 0x36:
case 0x38:
case 0x3e:
ret = mixer->regs[mixer->index];
break;
case 0x04:
case 0x22:
case 0x26:
case 0x28:
case 0x2e:
ret = mixer->regs[mixer->index] | 0x11;
break;
/* Bit 1 always set, bits 7-6 always clear on both the real ES688 and ES1688. */
case 0x1c:
ret = mixer->regs[mixer->index] | 0x10;
break;
/*
Real ES688: Always 0x00;
Real ES1688: Bit 2 always clear.
*/
case 0x40:
if (ess->dsp.sb_subtype > SB_SUBTYPE_ESS_ES1688)
else
switch (mixer->index) {
case 0x00:
case 0x0a:
case 0x0c:
case 0x0e:
case 0x14:
case 0x1a:
case 0x02:
case 0x06:
case 0x30:
case 0x32:
case 0x36:
case 0x38:
case 0x3e:
ret = mixer->regs[mixer->index];
else if (ess->dsp.sb_subtype >= SB_SUBTYPE_ESS_ES1688)
ret = mixer->regs[mixer->index] & 0xfb;
else
ret = 0x00;
break;
break;
/*
Real ES688: Always 0x00;
Real ES1688: All bits writable.
*/
case 0x48:
if (ess->dsp.sb_subtype >= SB_SUBTYPE_ESS_ES1688)
ret = mixer->regs[mixer->index];
else
ret = 0x00;
break;
case 0x04:
case 0x22:
case 0x26:
case 0x28:
case 0x2e:
ret = mixer->regs[mixer->index] | 0x11;
break;
/*
Return 0x00 so it has bit 3 clear, so NT 5.x drivers don't misdetect it as ES1788.
Bit 3 set and writable: ESSCFG detects the card as ES1788 if register 70h is read-only,
otherwise, as ES1887.
Bit 3 set and read-only: ESSCFG detects the card as ES1788 if register 70h is read-only,
otherwise, as ES1888.
Real ES688 and ES1688: Always 0x00.
*/
case 0x64:
if (ess->dsp.sb_subtype > SB_SUBTYPE_ESS_ES1688)
ret = (mixer->regs[mixer->index] & 0xf7) | 0x20;
else
ret = 0x00;
break;
/* Bit 1 always set, bits 7-6 always clear on both the real ES688 and ES1688. */
case 0x1c:
ret = mixer->regs[mixer->index] | 0x10;
break;
default:
sb_log("ess: Unknown mixer register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
break;
}
/*
Real ES688: Always 0x00;
Real ES1688: Bit 2 always clear.
*/
case 0x40:
if (ess->dsp.sb_subtype > SB_SUBTYPE_ESS_ES1688)
ret = mixer->regs[mixer->index];
else if (ess->dsp.sb_subtype >= SB_SUBTYPE_ESS_ES1688)
ret = mixer->regs[mixer->index] & 0xfb;
else
ret = 0x00;
break;
/*
Real ES688: Always 0x00;
Real ES1688: All bits writable.
*/
case 0x48:
if (ess->dsp.sb_subtype >= SB_SUBTYPE_ESS_ES1688)
ret = mixer->regs[mixer->index];
else
ret = 0x00;
break;
/*
Return 0x00 so it has bit 3 clear, so NT 5.x drivers don't misdetect it as ES1788.
Bit 3 set and writable: ESSCFG detects the card as ES1788 if register 70h is read-only,
otherwise, as ES1887.
Bit 3 set and read-only: ESSCFG detects the card as ES1788 if register 70h is read-only,
otherwise, as ES1888.
Real ES688 and ES1688: Always 0x00.
*/
case 0x64:
if (ess->dsp.sb_subtype > SB_SUBTYPE_ESS_ES1688)
ret = (mixer->regs[mixer->index] & 0xf7) | 0x20;
else
ret = 0x00;
break;
default:
sb_log("ess: Unknown mixer register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
break;
}
sb_log("[%04X:%08X] [R] %04X = %02X (%02X)\n", CS, cpu_state.pc, addr, ret, mixer->index);
@@ -1854,8 +1861,8 @@ sb_mcv_feedb(void *priv)
static uint8_t
sb_pro_mcv_read(int port, void *priv)
{
const sb_t *sb = (sb_t *) priv;
uint8_t ret = sb->pos_regs[port & 7];
const sb_t *sb = (sb_t *) priv;
uint8_t ret = sb->pos_regs[port & 7];
sb_log("sb_pro_mcv_read: port=%04x ret=%02x\n", port, ret);
@@ -1925,8 +1932,8 @@ sb_pro_mcv_write(int port, uint8_t val, void *priv)
static uint8_t
sb_16_reply_mca_read(int port, void *priv)
{
const sb_t *sb = (sb_t *) priv;
uint8_t ret = sb->pos_regs[port & 7];
const sb_t *sb = (sb_t *) priv;
uint8_t ret = sb->pos_regs[port & 7];
sb_log("sb_16_reply_mca_read: port=%04x ret=%02x\n", port, ret);
@@ -2153,7 +2160,7 @@ sb_16_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, void
mpu401_change_addr(sb->mpu, 0);
if (config->activate) {
uint8_t val = config->irq[0].irq;
uint8_t val = config->irq[0].irq;
addr = config->io[0].base;
if (addr != ISAPNP_IO_DISABLED) {
@@ -2225,7 +2232,7 @@ sb_16_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, void
static void
sb_vibra16_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, void *priv)
{
sb_t *sb = (sb_t *) priv;
sb_t *sb = (sb_t *) priv;
switch (ld) {
case 0: /* Audio */
@@ -2248,7 +2255,7 @@ goldfinch_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, v
break;
case 0: /* WaveTable */
emu8k_change_addr(&goldfinch->emu8k, (config->activate && (config->io[0].base != ISAPNP_IO_DISABLED)) ? config->io[0].base : 0);
emu8k_change_addr(&goldfinch->emu8k, (config->activate && (config->io[0].base != ISAPNP_IO_DISABLED)) ? config->io[0].base : 0);
break;
}
}
@@ -2513,7 +2520,7 @@ ess_x688_mca_read(const int port, void *priv)
static void
ess_soundpiper_mca_write(const int port, const uint8_t val, void *priv)
{
sb_t *ess = (sb_t *) priv;
sb_t *ess = (sb_t *) priv;
if (port < 0x102)
return;
@@ -2676,7 +2683,7 @@ ess_soundpiper_mca_write(const int port, const uint8_t val, void *priv)
static void
ess_chipchat_mca_write(int port, uint8_t val, void *priv)
{
sb_t *ess = (sb_t *) priv;
sb_t *ess = (sb_t *) priv;
if (port < 0x102)
return;
@@ -2811,7 +2818,7 @@ sb_1_init(UNUSED(const device_t *info))
2x0 to 2x3 -> CMS chip
2x6, 2xA, 2xC, 2xE -> DSP chip
2x8, 2x9, 388 and 389 FM chip */
sb_t * sb = malloc(sizeof(sb_t));
sb_t *sb = malloc(sizeof(sb_t));
const uint16_t addr = device_get_config_hex16("base");
memset(sb, 0, sizeof(sb_t));
@@ -2862,7 +2869,7 @@ sb_15_init(UNUSED(const device_t *info))
2x0 to 2x3 -> CMS chip
2x6, 2xA, 2xC, 2xE -> DSP chip
2x8, 2x9, 388 and 389 FM chip */
sb_t * sb = malloc(sizeof(sb_t));
sb_t *sb = malloc(sizeof(sb_t));
const uint16_t addr = device_get_config_hex16("base");
memset(sb, 0, sizeof(sb_t));
@@ -3223,7 +3230,7 @@ sb_pro_compat_init(UNUSED(const device_t *info))
static void *
sb_16_init(UNUSED(const device_t *info))
{
sb_t *sb = malloc(sizeof(sb_t));
sb_t *sb = malloc(sizeof(sb_t));
const uint16_t addr = device_get_config_hex16("base");
const uint16_t mpu_addr = device_get_config_hex16("base401");
@@ -3281,7 +3288,7 @@ sb_16_init(UNUSED(const device_t *info))
if (device_get_config_int("receive_input"))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
sb->gameport = gameport_add(&gameport_pnp_device);
sb->gameport = gameport_add(&gameport_pnp_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
@@ -3385,7 +3392,7 @@ sb_16_pnp_init(UNUSED(const device_t *info))
}
const char *pnp_rom_file = NULL;
uint16_t pnp_rom_len = 512;
uint16_t pnp_rom_len = 512;
switch (info->local) {
case SB_16_PNP_NOIDE:
pnp_rom_file = PNP_ROM_SB_16_PNP_NOIDE;
@@ -3447,7 +3454,6 @@ sb_vibra16xv_available(void)
return rom_present(PNP_ROM_SB_VIBRA16XV);
}
static void *
sb_vibra16_pnp_init(UNUSED(const device_t *info))
{
@@ -3482,7 +3488,7 @@ sb_vibra16_pnp_init(UNUSED(const device_t *info))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
switch (info->local) {
case SB_VIBRA16C: /* CTL7001 */
case SB_VIBRA16C: /* CTL7001 */
case SB_VIBRA16CL: /* CTL7002 */
sb->gameport = gameport_add(&gameport_pnp_device);
break;
@@ -3563,7 +3569,7 @@ sb_16_compat_init(const device_t *info)
sb_dsp_setdma16_enabled(&sb->dsp, 1);
sb_ct1745_mixer_reset(sb);
sb->opl_enabled = 1;
sb->opl_enabled = 1;
sb->mixer_enabled = 1;
sound_add_handler(sb_get_buffer_sb16_awe32, sb);
music_add_handler(sb_get_music_buffer_sb16_awe32, sb);
@@ -3573,7 +3579,7 @@ sb_16_compat_init(const device_t *info)
mpu401_init(sb->mpu, 0, 0, M_UART, (int) (intptr_t) info->local);
sb_dsp_set_mpu(&sb->dsp, sb->mpu);
sb->gameport = gameport_add(&gameport_pnp_device);
sb->gameport = gameport_add(&gameport_pnp_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
@@ -3694,7 +3700,7 @@ sb_awe32_init(UNUSED(const device_t *info))
if (device_get_config_int("receive_input"))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp);
sb->gameport = gameport_add(&gameport_pnp_device);
sb->gameport = gameport_add(&gameport_pnp_device);
sb->gameport_addr = 0x200;
gameport_remap(sb->gameport, sb->gameport_addr);
@@ -3887,7 +3893,7 @@ sb_awe32_pnp_init(const device_t *info)
static void *
ess_x688_init(UNUSED(const device_t *info))
{
sb_t *ess = calloc(sizeof(sb_t), 1);
sb_t *ess = calloc(sizeof(sb_t), 1);
const uint16_t addr = device_get_config_hex16("base");
const uint16_t ide_ctrl = (const uint16_t) device_get_config_int("ide_ctrl");
const uint16_t ide_base = ide_ctrl & 0x0fff;
@@ -4001,7 +4007,7 @@ ess_1688_968_pnp_available(void)
static void *
ess_x688_pnp_init(UNUSED(const device_t *info))
{
sb_t *ess = calloc(sizeof(sb_t), 1);
sb_t *ess = calloc(sizeof(sb_t), 1);
ess->pnp = 1 + (int) info->local;
@@ -4012,7 +4018,7 @@ ess_x688_pnp_init(UNUSED(const device_t *info))
sb_dsp_setdma16_supported(&ess->dsp, 0);
ess_mixer_reset(ess);
ess->mixer_enabled = 1;
ess->mixer_enabled = 1;
sound_add_handler(sb_get_buffer_ess, ess);
music_add_handler(sb_get_music_buffer_ess, ess);
sound_set_cd_audio_filter(ess_filter_cd_audio, ess);
@@ -4098,7 +4104,7 @@ ess_x688_mca_init(UNUSED(const device_t *info))
sb_dsp_setdma16_supported(&ess->dsp, 0);
ess_mixer_reset(ess);
ess->mixer_enabled = 1;
ess->mixer_enabled = 1;
sound_add_handler(sb_get_buffer_ess, ess);
music_add_handler(sb_get_music_buffer_ess, ess);
sound_set_cd_audio_filter(ess_filter_cd_audio, ess);
@@ -5584,7 +5590,6 @@ static const device_config_t ess_688_config[] = {
},
{ .name = "", .description = "", .type = CONFIG_END }
};
// clang-format on
static const device_config_t ess_1688_config[] = {
{
@@ -5722,7 +5727,6 @@ static const device_config_t ess_1688_config[] = {
},
{ .name = "", .description = "", .type = CONFIG_END }
};
// clang-format on
static const device_config_t ess_688_pnp_config[] = {
{
@@ -5734,7 +5738,6 @@ static const device_config_t ess_688_pnp_config[] = {
},
{ .name = "", .description = "", .type = CONFIG_END }
};
// clang-format on
static const device_config_t ess_1688_pnp_config[] = {
{

View File

@@ -153,6 +153,7 @@ static const SOUND_CARD sound_cards[] = {
{ &ess_soundpiper_32_mca_device },
{ &cmi8338_device },
{ &cmi8738_device },
{ &es1370_device },
{ &es1371_device },
{ &es1373_device },
{ &ct5880_device },