[Core/Sound] Nuked OPN2: removed discrete ym3438 core

This commit is contained in:
nukeykt 2018-02-01 00:01:03 +09:00
parent 06b3950d73
commit 3aae6e4f09
3 changed files with 12 additions and 23 deletions

View File

@ -40,7 +40,7 @@
* OPLx decapsulated(Matthew Gambrell, Olli Niemitalo): * OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
* OPL2 ROMs. * OPL2 ROMs.
* *
* version: 1.0.7 * version: 1.0.8
*/ */
#include <string.h> #include <string.h>
@ -233,7 +233,7 @@ static const Bit32u fm_algorithm[4][6][8] = {
} }
}; };
static Bit32u chip_type = ym3438_type_discrete; static Bit32u chip_type = ym3438_mode_readmode;
void OPN2_DoIO(ym3438_t *chip) void OPN2_DoIO(ym3438_t *chip)
{ {
@ -995,7 +995,7 @@ void OPN2_ChOutput(ym3438_t *chip)
chip->mol = 0; chip->mol = 0;
chip->mor = 0; chip->mor = 0;
if (chip_type == ym3438_type_ym2612) if (chip_type & ym3438_mode_ym2612)
{ {
out_en = ((cycles & 3) == 3) || test_dac; out_en = ((cycles & 3) == 3) || test_dac;
/* YM2612 DAC emulation(not verified) */ /* YM2612 DAC emulation(not verified) */
@ -1028,11 +1028,6 @@ void OPN2_ChOutput(ym3438_t *chip)
else else
{ {
out_en = ((cycles & 3) != 0) || test_dac; out_en = ((cycles & 3) != 0) || test_dac;
/* Discrete YM3438 seems has the ladder effect too */
if (out >= 0 && chip_type == ym3438_type_discrete)
{
out++;
}
if (chip->ch_lock_l && out_en) if (chip->ch_lock_l && out_en)
{ {
chip->mol = out; chip->mol = out;
@ -1397,7 +1392,7 @@ Bit32u OPN2_ReadIRQPin(ym3438_t *chip)
Bit8u OPN2_Read(ym3438_t *chip, Bit32u port) Bit8u OPN2_Read(ym3438_t *chip, Bit32u port)
{ {
if ((port & 3) == 0 || chip_type == ym3438_type_asic) if ((port & 3) == 0 || (chip_type & ym3438_mode_readmode))
{ {
if (chip->mode_test_21[6]) if (chip->mode_test_21[6])
{ {
@ -1426,7 +1421,7 @@ Bit8u OPN2_Read(ym3438_t *chip, Bit32u port)
chip->status = (chip->busy << 7) | (chip->timer_b_overflow_flag << 1) chip->status = (chip->busy << 7) | (chip->timer_b_overflow_flag << 1)
| chip->timer_a_overflow_flag; | chip->timer_a_overflow_flag;
} }
if (chip_type == ym3438_type_ym2612) if (chip_type & ym3438_mode_ym2612)
{ {
chip->status_time = 300000; chip->status_time = 300000;
} }

View File

@ -39,16 +39,15 @@
* OPLx decapsulated(Matthew Gambrell, Olli Niemitalo): * OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
* OPL2 ROMs. * OPL2 ROMs.
* *
* version: 1.0.7 * version: 1.0.8
*/ */
#ifndef YM3438_H #ifndef YM3438_H
#define YM3438_H #define YM3438_H
enum { enum {
ym3438_type_discrete = 0, /* Discrete YM3438 (Teradrive) */ ym3438_mode_ym2612 = 0x01, /* Enables YM2612 emulation (MD1, MD2 VA2) */
ym3438_type_asic = 1, /* ASIC YM3438 (MD1 VA7, MD2, MD3, etc) */ ym3438_mode_readmode = 0x02, /* Enables status read on any port (TeraDrive, MD1 VA7, MD2, etc) */
ym3438_type_ym2612 = 2 /* YM2612 (MD1, MD2 VA2) */
}; };
#include <stdint.h> #include <stdint.h>

View File

@ -1156,19 +1156,14 @@ static void check_variables(void)
orig_value = config.ym3438; orig_value = config.ym3438;
if (!strcmp(var.value, "nuked (ym2612)")) if (!strcmp(var.value, "nuked (ym2612)"))
{ {
OPN2_SetChipType(ym3438_type_ym2612); OPN2_SetChipType(ym3438_mode_ym2612);
config.ym3438 = 1; config.ym3438 = 1;
} }
else if (!strcmp(var.value, "nuked (asic ym3438)")) else if (!strcmp(var.value, "nuked (ym3438)"))
{ {
OPN2_SetChipType(ym3438_type_asic); OPN2_SetChipType(ym3438_mode_readmode);
config.ym3438 = 2; config.ym3438 = 2;
} }
else if (!strcmp(var.value, "nuked (discrete ym3438)"))
{
OPN2_SetChipType(ym3438_type_discrete);
config.ym3438 = 3;
}
else else
{ {
config.ym3438 = 0; config.ym3438 = 0;
@ -1766,7 +1761,7 @@ void retro_set_environment(retro_environment_t cb)
{ "genesis_plus_gx_lock_on", "Cartridge lock-on; disabled|game genie|action replay (pro)|sonic & knuckles" }, { "genesis_plus_gx_lock_on", "Cartridge lock-on; disabled|game genie|action replay (pro)|sonic & knuckles" },
{ "genesis_plus_gx_ym2413", "Master System FM (YM2413); auto|disabled|enabled" }, { "genesis_plus_gx_ym2413", "Master System FM (YM2413); auto|disabled|enabled" },
#ifdef HAVE_YM3438_CORE #ifdef HAVE_YM3438_CORE
{ "genesis_plus_gx_ym2612", "Mega Drive / Genesis FM; mame (ym2612)|mame (asic ym3438)|mame (enhanced ym3438)|nuked (ym2612)|nuked (asic ym3438)|nuked (discrete ym3438)" }, { "genesis_plus_gx_ym2612", "Mega Drive / Genesis FM; mame (ym2612)|mame (asic ym3438)|mame (enhanced ym3438)|nuked (ym2612)|nuked (ym3438)" },
#else #else
{ "genesis_plus_gx_ym2612", "Mega Drive / Genesis FM; mame (ym2612)|mame (asic ym3438)|mame (enhanced ym3438)" }, { "genesis_plus_gx_ym2612", "Mega Drive / Genesis FM; mame (ym2612)|mame (asic ym3438)|mame (enhanced ym3438)" },
#endif #endif