Added a second S3 ViRGE/DX card, this one with VBE 2.0 BIOS;

Added the ability to use a standalone MPU-401 if the selected sound card is not SB16 or AWE32.
This commit is contained in:
OBattler
2017-06-03 20:32:58 +02:00
parent 85714741ab
commit 224368b791
12 changed files with 255 additions and 15 deletions

View File

@@ -21,12 +21,15 @@
*/
#include "../ibm.h"
#include "../device.h"
#include "../io.h"
#include "../pic.h"
#include "../timer.h"
#include "../win/plat_midi.h" /*YUCK*/
#include "sound.h"
#include "snd_mpu401.h"
#include <malloc.h>
#include <stdarg.h>
enum
@@ -38,6 +41,8 @@ enum
static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val);
static void MPU401_EOIHandlerDispatch(void *p);
int mpu401_standalone_enable = 0;
static int mpu401_event_callback = 0;
static int mpu401_eoi_callback = 0;
static int mpu401_reset_callback = 0;
@@ -749,3 +754,118 @@ void mpu401_init(mpu_t *mpu, uint16_t addr, int irq, int mode)
MPU401_Reset(mpu);
}
void mpu401_device_add(void)
{
char *n;
if (!mpu401_standalone_enable)
{
return;
}
n = sound_card_getname(sound_card_current);
if (n != NULL)
{
if (!strcmp(n, "sb16") || !strcmp(n, "sbawe32"))
{
return;
}
}
device_add(&mpu401_device);
}
void *mpu401_standalone_init()
{
mpu_t *mpu;
mpu = malloc(sizeof(mpu_t));
memset(mpu, 0, sizeof(mpu_t));
pclog("mpu_init\n");
mpu401_init(mpu, device_get_config_hex16("base"), device_get_config_int("irq"), device_get_config_int("mode"));
return mpu;
}
void mpu401_standalone_close(void *p)
{
mpu_t *mpu = (mpu_t *)p;
free(mpu);
}
static device_config_t mpu401_standalone_config[] =
{
{
"base", "MPU-401 Address", CONFIG_HEX16, "", 0x330,
{
{
"0x300", 0x300
},
{
"0x330", 0x330
},
{
""
}
}
},
{
"irq", "MPU-401 IRQ", CONFIG_SELECTION, "", 9,
{
{
"IRQ 9", 9
},
{
"IRQ 3", 3
},
{
"IRQ 4", 4
},
{
"IRQ 5", 5
},
{
"IRQ 7", 7
},
{
"IRQ 10", 10
},
{
""
}
}
},
{
"mode", "Mode", CONFIG_SELECTION, "", 1,
{
{
"UART", M_UART
},
{
"Intelligent", M_INTELLIGENT
},
{
""
}
}
},
{
"", "", -1
}
};
device_t mpu401_device =
{
"MPU-401 (Standalone)",
0,
mpu401_standalone_init,
mpu401_standalone_close,
NULL,
NULL,
NULL,
NULL,
mpu401_standalone_config
};

View File

@@ -83,3 +83,8 @@ typedef struct mpu_t
uint8_t MPU401_ReadData(mpu_t *mpu);
void mpu401_init(mpu_t *mpu, uint16_t addr, int irq, int mode);
extern int mpu401_standalone_enable;
void mpu401_device_add(void);
device_t mpu401_device;

View File

@@ -3925,7 +3925,7 @@ static void *s3_virge_988_init()
return virge;
}
static void *s3_virge_375_init()
static void *s3_virge_375_init(wchar_t *romfn)
{
virge_t *virge = malloc(sizeof(virge_t));
memset(virge, 0, sizeof(virge_t));
@@ -3940,7 +3940,7 @@ static void *s3_virge_375_init()
s3_virge_hwcursor_draw,
s3_virge_overlay_draw);
rom_init(&virge->bios_rom, L"roms/86c375_1.bin", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
rom_init(&virge->bios_rom, romfn, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
if (PCI)
mem_mapping_disable(&virge->bios_rom.mapping);
@@ -4021,6 +4021,16 @@ static void *s3_virge_375_init()
return virge;
}
static void *s3_virge_375_1_init()
{
return s3_virge_init(L"roms/86c375_1.bin");
}
static void *s3_virge_375_4_init()
{
return s3_virge_init(L"roms/86c375_4.bin");
}
static void s3_virge_close(void *p)
{
virge_t *virge = (virge_t *)p;
@@ -4054,11 +4064,16 @@ static int s3_virge_988_available()
return rom_present(L"roms/diamondstealth3000.VBI");
}
static int s3_virge_375_available()
static int s3_virge_375_1_available()
{
return rom_present(L"roms/86c375_1.bin");
}
static int s3_virge_375_4_available()
{
return rom_present(L"roms/86c375_4.bin");
}
static void s3_virge_speed_changed(void *p)
{
virge_t *virge = (virge_t *)p;
@@ -4190,9 +4205,22 @@ device_t s3_virge_375_device =
{
"S3 ViRGE/DX",
0,
s3_virge_375_init,
s3_virge_375_1_init,
s3_virge_close,
s3_virge_375_available,
s3_virge_375_1_available,
s3_virge_speed_changed,
s3_virge_force_redraw,
s3_virge_add_status_info,
s3_virge_config
};
device_t s3_virge_375_4_device =
{
"S3 ViRGE/DX (VBE 2.0)",
0,
s3_virge_375_4_init,
s3_virge_close,
s3_virge_375_4_available,
s3_virge_speed_changed,
s3_virge_force_redraw,
s3_virge_add_status_info,

View File

@@ -4,3 +4,4 @@
extern device_t s3_virge_device;
extern device_t s3_virge_988_device;
extern device_t s3_virge_375_device;
extern device_t s3_virge_375_4_device;

View File

@@ -101,6 +101,7 @@ static VIDEO_CARD video_cards[] =
{"Phoenix S3 Trio64", "px_trio64", &s3_phoenix_trio64_device, GFX_PHOENIX_TRIO64},
{"Plantronics ColorPlus", "plantronics", &colorplus_device, GFX_COLORPLUS},
{"S3 ViRGE/DX", "virge375", &s3_virge_375_device, GFX_VIRGEDX},
{"S3 ViRGE/DX (VBE 2.0)", "virge375_vbe20", &s3_virge_375_4_device, GFX_VIRGEDX4},
{"Trident TGUI9440", "tgui9440", &tgui9440_device, GFX_TGUI9440},
{"Trident TVGA8900D", "tvga8900d", &tvga8900d_device, GFX_TVGA},
{"Tseng ET4000AX", "et4000ax", &et4000_device, GFX_ET4000},

View File

@@ -327,7 +327,7 @@ BEGIN
PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14
END
CONFIGUREDLG_SOUND DIALOG DISCARDABLE 97, 0, 267, 78
CONFIGUREDLG_SOUND DIALOG DISCARDABLE 97, 0, 267, 98
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -338,14 +338,20 @@ BEGIN
COMBOBOX IDC_COMBO_MIDI,71,25,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "MIDI Out Device:",1801,7,26,59,10
CONTROL "CMS / Game Blaster",IDC_CHECKCMS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,87,43,80,10
CONTROL "Standalone MPU-401",IDC_CHECK_MPU401,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,45,199,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MPU401,214,44,46,12
CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,43,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,7,63,94,10
CONTROL "CMS / Game Blaster",IDC_CHECKCMS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,63,94,10
CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,174,43,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,7,81,94,10
CONTROL "Use Nuked OPL",IDC_CHECKNUKEDOPL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,61,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,147,81,94,10
END
CONFIGUREDLG_NETWORK DIALOG DISCARDABLE 97, 0, 267, 63

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.0 2017/05/30
* Version: @(#)resource.h 1.0.1 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -51,7 +51,9 @@
#define IDC_CHECKNUKEDOPL 1018
#define IDC_COMBO_JOYSTICK 1018
#define IDC_CHECK_SYNC 1019
#define IDC_CHECK_MPU401 1019
#define IDC_LIST_FLOPPY_DRIVES 1020
#define IDC_CONFIGURE_MPU401 1020
#define IDC_LIST_CDROM_DRIVES 1021
#define IDC_CONFIGURE_MACHINE 1022
#define IDC_COMBO_LANG 1023

View File

@@ -37,6 +37,7 @@
#include "../network.h"
#include "../sound/sound.h"
#include "../sound/snd_dbopl.h"
#include "../sound/snd_mpu401.h"
#include "../video/video.h"
#include "../video/vid_voodoo.h"
#include "../gameport.h"
@@ -56,7 +57,7 @@ static int temp_gfxcard, temp_video_speed, temp_voodoo;
static int temp_mouse, temp_joystick;
/* Sound category */
static int temp_sound_card, temp_midi_id, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type;
static int temp_sound_card, temp_midi_id, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type;
/* Network category */
static int temp_net_type, temp_net_card;
@@ -117,6 +118,7 @@ static void win_settings_init(void)
/* Sound category */
temp_sound_card = sound_card_current;
temp_midi_id = midi_id;
temp_mpu401 = mpu401_standalone_enable;
temp_SSI2001 = SSI2001;
temp_GAMEBLASTER = GAMEBLASTER;
temp_GUS = GUS;
@@ -180,6 +182,7 @@ static int win_settings_changed(void)
/* Sound category */
i = i || (sound_card_current != temp_sound_card);
i = i || (midi_id != temp_midi_id);
i = i || (mpu401_standalone_enable != temp_mpu401);
i = i || (SSI2001 != temp_SSI2001);
i = i || (GAMEBLASTER != temp_GAMEBLASTER);
i = i || (GUS != temp_GUS);
@@ -275,6 +278,7 @@ static void win_settings_save(void)
/* Sound category */
sound_card_current = temp_sound_card;
midi_id = temp_midi_id;
mpu401_standalone_enable = temp_mpu401;
SSI2001 = temp_SSI2001;
GAMEBLASTER = temp_GAMEBLASTER;
GUS = temp_GUS;
@@ -1102,6 +1106,38 @@ int find_irq_in_array(int irq, int def)
static char midi_dev_name_buf[512];
int mpu401_present(void)
{
char *n;
n = sound_card_getname(temp_sound_card);
if (n != NULL)
{
if (!strcmp(n, "sb16") || !strcmp(n, "sbawe32"))
{
return 1;
}
}
return temp_mpu401 ? 1 : 0;
}
int mpu401_standalone_allow(void)
{
char *n;
n = sound_card_getname(temp_sound_card);
if (n != NULL)
{
if (!strcmp(n, "sb16") || !strcmp(n, "sbawe32"))
{
return 0;
}
}
return 1;
}
static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
@@ -1174,6 +1210,13 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
if (c == temp_midi_id)
SendMessage(h, CB_SETCURSEL, c, 0);
}
EnableWindow(h, mpu401_present() ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401);
EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE);
h=GetDlgItem(hdlg, IDC_CHECKCMS);
SendMessage(h, BM_SETCHECK, temp_GAMEBLASTER, 0);
@@ -1214,6 +1257,21 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
{
EnableWindow(h, FALSE);
}
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
EnableWindow(h, mpu401_present() ? TRUE : FALSE);
break;
case IDC_CHECK_MPU401:
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401);
EnableWindow(h, mpu401_present() ? TRUE : FALSE);
break;
case IDC_CONFIGURE_MPU401:
deviceconfig_open(hdlg, (void *)&mpu401_device);
break;
}
return FALSE;
@@ -1225,6 +1283,9 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
temp_midi_id = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECKCMS);
temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0);

View File

@@ -30,6 +30,7 @@
#include "win/plat_joystick.h"
#include "win/plat_midi.h"
#include "sound/snd_dbopl.h"
#include "sound/snd_mpu401.h"
#include "sound/snd_opl.h"
#include "sound/sound.h"
#include "video/video.h"
@@ -976,6 +977,7 @@ static void loadconfig_sound(void)
sound_card_current = 0;
midi_id = config_get_int(cat, "midi_host_device", 0);
mpu401_standalone_enable = !!config_get_int(cat, "mpu401_standalone", 0);
SSI2001 = !!config_get_int(cat, "ssi2001", 0);
GAMEBLASTER = !!config_get_int(cat, "gameblaster", 0);
@@ -2004,6 +2006,15 @@ static void saveconfig_sound(void)
config_set_int(cat, "midi_host_device", midi_id);
}
if (mpu401_standalone_enable == 0)
{
config_delete_var(cat, "mpu401_standalone");
}
else
{
config_set_int(cat, "mpu401_standalone", mpu401_standalone_enable);
}
if (SSI2001 == 0)
{
config_delete_var(cat, "ssi2001");

View File

@@ -528,6 +528,7 @@ enum
GFX_OTI037, /*Oak OTI-037*/
GFX_VIRGEVX, /*S3 Virge/VX*/
GFX_VIRGEDX4, /*S3 Virge/DX (VBE 2.0)*/
GFX_MAX
};

View File

@@ -8,7 +8,7 @@
*
* Emulation core dispatcher.
*
* Version: @(#)pc.c 1.0.0 2017/05/30
* Version: @(#)pc.c 1.0.1 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -64,6 +64,7 @@
#include "sound/sound.h"
#include "sound/snd_cms.h"
#include "sound/snd_dbopl.h"
#include "sound/snd_mpu401.h"
#include "sound/snd_opl.h"
#include "sound/snd_gus.h"
#include "sound/snd_sb.h"
@@ -522,6 +523,8 @@ void resetpchard(void)
scsi_card_init();
sound_card_init();
if (mpu401_standalone_enable)
mpu401_device_add();
if (GUS)
device_add(&gus_device);
if (GAMEBLASTER)

View File

@@ -150,7 +150,8 @@ void pci_issue_irq(int irq)
if (irq_elcr)
{
picintlevel(1 << irq);
/* picintlevel(1 << irq); */
picint(1 << irq);
}
else
{