vmetal: Sound improvements

- Implement IRQ used to loop ES-8712 music (much like gcpinbal). All extant samples should be playable now.
- Reduce unreasonably high OKIM6295 volume.
- MACHINE_IMPERFECT_SOUND flag removed.

Add a reset line callback for the ES-8712. This will be used to reset the MSM5205/MSM6585 when the implementation is rewritten to use those devices. For now, it's used for IRQ generation in vmetal, whose program seems to use a separate gate to prevent unwanted IRQs when the device is reset. (gcpinbal appears to do the same with a rather subtle difference.)

Removed the probably bogus and already unused auto-repeat feature from the ES-8712 device. All known games that loop samples do so by status polling or IRQs.
This commit is contained in:
AJR 2017-02-09 09:44:38 -05:00
parent 21ad768aad
commit 331801e9be
4 changed files with 48 additions and 59 deletions

View File

@ -48,6 +48,7 @@ es8712_device::es8712_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, ES8712, "ES8712", tag, owner, clock, "es8712", __FILE__),
device_sound_interface(mconfig, *this),
m_rom(*this, DEVICE_SELF),
m_reset_handler(*this),
m_playing(0),
m_base_offset(0),
m_sample(0),
@ -56,7 +57,6 @@ es8712_device::es8712_device(const machine_config &mconfig, const char *tag, dev
m_step(0),
m_start(0),
m_end(0),
m_repeat(0),
m_bank_offset(0),
m_stream(nullptr)
{
@ -71,9 +71,10 @@ void es8712_device::device_start()
{
compute_tables();
m_reset_handler.resolve_safe();
m_start = 0;
m_end = 0;
m_repeat = 0;
m_bank_offset = 0;
@ -98,8 +99,9 @@ void es8712_device::device_reset()
/* update the stream, then turn it off */
m_stream->update();
m_playing = 0;
m_repeat = 0;
}
m_reset_handler(1);
}
@ -195,17 +197,9 @@ void es8712_device::generate_adpcm(stream_sample_t *buffer, int samples)
/* next! */
if (++sample >= count)
{
if (m_repeat)
{
sample = 0;
signal = -2;
step = 0;
}
else
{
m_playing = 0;
break;
}
m_playing = 0;
m_reset_handler(1);
break;
}
}
@ -240,7 +234,6 @@ void es8712_device::es8712_state_save_register()
save_item(NAME(m_start));
save_item(NAME(m_end));
save_item(NAME(m_repeat));
}
@ -279,11 +272,12 @@ void es8712_device::play()
{
if (!m_playing)
{
logerror("Playing sample range %06x-%06x\n", m_start + m_bank_offset, m_end + m_bank_offset);
m_playing = 1;
m_reset_handler(0);
m_base_offset = m_start;
m_sample = 0;
m_count = 2 * (m_end - m_start + 1);
m_repeat = 0;//1;
/* also reset the ADPCM parameters */
m_signal = -2;
@ -293,13 +287,14 @@ void es8712_device::play()
/* invalid samples go here */
else
{
logerror("ES871295:'%s' requested to play invalid sample range %06x-%06x\n", tag(), m_start, m_end);
logerror("Request to play invalid sample range %06x-%06x\n", m_start + m_bank_offset, m_end + m_bank_offset);
if (m_playing)
{
/* update the stream */
m_stream->update();
m_playing = 0;
m_reset_handler(1);
}
}
}

View File

@ -15,6 +15,8 @@
MCFG_DEVICE_ADD(_tag, ES8712, _clock)
#define MCFG_ES8712_REPLACE(_tag, _clock) \
MCFG_DEVICE_REPLACE(_tag, ES8712, _clock)
#define MCFG_ES8712_RESET_HANDLER(_devcb) \
devcb = &es8712_device::set_reset_handler(*device, DEVCB_##_devcb);
//**************************************************************************
@ -31,6 +33,9 @@ public:
es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~es8712_device() { }
// static configuration
template<class _Object> static devcb_base &set_reset_handler(device_t &device, _Object object) { return downcast<es8712_device &>(device).m_reset_handler.set_callback(object); }
protected:
// device-level overrides
virtual void device_start() override;
@ -56,6 +61,8 @@ private:
private:
required_region_ptr<uint8_t> m_rom;
devcb_write_line m_reset_handler;
uint8_t m_playing; /* 1 if we're actively playing */
uint32_t m_base_offset; /* pointer to the base memory location */
@ -67,7 +74,6 @@ private:
uint32_t m_start; /* starting address for the next loop */
uint32_t m_end; /* ending address for the next loop */
uint8_t m_repeat; /* Repeat current sample when 1 */
int32_t m_bank_offset;
sound_stream *m_stream; /* which stream are we playing on? */

View File

@ -84,8 +84,7 @@ To Do:
- Bang Bang Ball / Bubble Buster slow to a crawl when you press a
button between levels, on a real PCB it speeds up instead (related
to above?)
- vmetal: ES8712 sound may not be quite right. Samples are currently looped, but
whether they should and how, is unknown. Where does the M6585 hook up to?
- vmetal: ES8712 actually controls a M6585 and an unknown logic selector chip.
Notes:
@ -94,34 +93,6 @@ Notes:
- Sprite zoom in Mouja at the end of a match looks wrong, but it's been verified
to be the same on the original board
- vmetal: has Sega and Taito logos in the roms ?!
- vmetal: Many samples in the ADPCM ROM are actually not used.
Snd Offset Writes Sample Range
0000 0004 0002 0006 000a 0008 000c
-- ---------------------------------- -------------
00 006e 0001 00ab 003c 0002 003a 003a 01ab6e-023a3c
01 003d 0002 003a 001d 0002 007e 007e 023a3d-027e1d
02 00e2 0003 0005 002e 0003 00f3 00f3 0305e2-03f32e
03 000a 0005 001e 00f6 0005 00ec 00ec 051e0a-05ecf6
04 00f7 0005 00ec 008d 0006 0060 0060 05ecf7-06608d
05 0016 0008 002e 0014 0009 0019 0019 082e16-091914
06 0015 0009 0019 0094 000b 0015 0015 091915-0b1594
07 0010 000d 0012 00bf 000d 0035 0035 0d1210-0d35bf
08 00ce 000e 002f 0074 000f 0032 0032 0e2fce-0f3274
09 0000 0000 0000 003a 0000 007d 007d 000000-007d3a
0a 0077 0000 00fa 008d 0001 00b6 00b6 00fa77-01b68d
0b 008e 0001 00b6 00b3 0002 0021 0021 01b68e-0221b3
0c 0062 0002 00f7 0038 0003 00de 00de 02f762-03de38
0d 00b9 0005 00ab 00ef 0006 0016 0016 05abb9-0616ef
0e 00dd 0007 0058 00db 0008 001a 001a 0758dd-081adb
0f 00dc 0008 001a 002e 0008 008a 008a 081adc-088a2e
10 00db 0009 00d7 00ff 000a 0046 0046 09d7db-0a46ff
11 0077 000c 0003 006d 000c 0080 0080 0c0377-0c806d
12 006e 000c 0080 006c 000d 0002 0002 0c806e-0d026c
13 006d 000d 0002 002b 000d 0041 0041 0d026d-0d412b
14 002c 000d 0041 002a 000d 00be 00be 0d412c-0dbe2a
15 002b 000d 00be 0029 000e 0083 0083 0dbe2b-0e8329
16 002a 000e 0083 00ee 000f 0069 0069 0e832a-0f69ee
driver modified by Hau
***************************************************************************/
@ -1910,10 +1881,9 @@ WRITE8_MEMBER(metro_state::vmetal_control_w)
// machine().bookkeeping().coin_lockout_w(0, data & 0x01); /* always on in game mode?? */
machine().bookkeeping().coin_lockout_w(1, data & 0x02); /* never activated in game mode?? */
if ((data & 0x40) == 0)
m_essnd->reset();
else
m_essnd->play();
m_essnd_gate = BIT(data, 6);
if (!m_essnd_gate)
m_maincpu->set_input_line(3, CLEAR_LINE);
if (data & 0x10)
m_essnd->set_bank_base(0x100000);
@ -1924,9 +1894,15 @@ WRITE8_MEMBER(metro_state::vmetal_control_w)
logerror("%s: Writing unknown bits %04x to $200000\n",machine().describe_context(),data);
}
WRITE8_MEMBER(metro_state::vmetal_se_control_w)
WRITE8_MEMBER(metro_state::es8712_reset_w)
{
logerror("%s: Writing %02x to $500000\n", machine().describe_context(), data);
m_essnd->reset();
}
WRITE_LINE_MEMBER(metro_state::vmetal_es8712_irq)
{
if (m_essnd_gate)
m_maincpu->set_input_line(3, state);
}
static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state )
@ -1954,7 +1930,7 @@ static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state )
AM_RANGE(0x300000, 0x31ffff) AM_READ(balcube_dsw_r) // DSW x 3
AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
AM_RANGE(0x400002, 0x400003) AM_DEVWRITE8("oki", okim6295_device, write, 0x00ff)
AM_RANGE(0x500000, 0x500001) AM_WRITE8(vmetal_se_control_w, 0xff00)
AM_RANGE(0x500000, 0x500001) AM_WRITE8(es8712_reset_w, 0xff00)
AM_RANGE(0x500000, 0x50000d) AM_DEVWRITE8("essnd", es8712_device, write, 0x00ff)
AM_RANGE(0xf00000, 0xf0ffff) AM_RAM AM_MIRROR(0x0f0000) // RAM (mirrored)
ADDRESS_MAP_END
@ -4324,9 +4300,10 @@ static MACHINE_CONFIG_START( vmetal, metro_state )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_OKIM6295_ADD("oki", XTAL_1MHz, OKIM6295_PIN7_HIGH)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_ES8712_ADD("essnd", 12000)
MCFG_ES8712_RESET_HANDLER(WRITELINE(metro_state, vmetal_es8712_irq))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
// OKI M6585 not hooked up...
@ -6267,6 +6244,14 @@ DRIVER_INIT_MEMBER(metro_state,blzntrnd)
m_irq_line = 1;
}
DRIVER_INIT_MEMBER(metro_state,vmetal)
{
metro_common();
m_irq_line = 1;
m_essnd_gate = false;
save_item(NAME(m_essnd_gate));
}
DRIVER_INIT_MEMBER(metro_state,mouja)
{
metro_common();
@ -6339,5 +6324,5 @@ GAME( 1996, mouja, 0, mouja, mouja, metro_state, mouja, ROT0
GAME( 1997, gakusai, 0, gakusai, gakusai, metro_state, gakusai, ROT0, "MakeSoft", "Mahjong Gakuensai (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1998, gakusai2, 0, gakusai2, gakusai, metro_state, gakusai, ROT0, "MakeSoft", "Mahjong Gakuensai 2 (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 2000, puzzlet, 0, puzzlet, puzzlet, metro_state, puzzlet, ROT0, "Unies Corporation", "Puzzlet (Japan)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1995, vmetal, 0, vmetal, vmetal, metro_state, blzntrnd, ROT90, "Excellent System", "Varia Metal", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1995, vmetaln, vmetal, vmetal, vmetal, metro_state, blzntrnd, ROT90, "Excellent System (New Ways Trading Co. license)", "Varia Metal (New Ways Trading Co.)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1995, vmetal, 0, vmetal, vmetal, metro_state, vmetal, ROT90, "Excellent System", "Varia Metal", MACHINE_SUPPORTS_SAVE )
GAME( 1995, vmetaln, vmetal, vmetal, vmetal, metro_state, vmetal, ROT90, "Excellent System (New Ways Trading Co. license)", "Varia Metal (New Ways Trading Co.)", MACHINE_SUPPORTS_SAVE )

View File

@ -112,6 +112,7 @@ public:
int m_porta;
int m_portb;
int m_busy_sndcpu;
bool m_essnd_gate;
/* misc */
int m_gakusai_oki_bank_lo;
@ -168,11 +169,13 @@ public:
// vmetal
DECLARE_WRITE8_MEMBER(vmetal_control_w);
DECLARE_WRITE8_MEMBER(vmetal_se_control_w);
DECLARE_WRITE8_MEMBER(es8712_reset_w);
DECLARE_WRITE_LINE_MEMBER(vmetal_es8712_irq);
DECLARE_DRIVER_INIT(karatour);
DECLARE_DRIVER_INIT(daitorid);
DECLARE_DRIVER_INIT(blzntrnd);
DECLARE_DRIVER_INIT(vmetal);
DECLARE_DRIVER_INIT(mouja);
DECLARE_DRIVER_INIT(balcube);
DECLARE_DRIVER_INIT(gakusai);