From aa9bc95573f1fdab9bba3bcf2b3002956cfaf551 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Sat, 4 Aug 2012 05:19:46 +0000 Subject: Sega 16-bit cleanup, part 1 (still more coming): * Converted FD1089/FD1094 into proper devices, derived from m68000. They now handle their own decryption and memory management, so we can remove all the calls for initialization/reset/etc. The key now lives as a 'key' subdevice under the CPU, and the FD1089/1094 are now specified just like any other CPU. * Removed the horrible s16fd and s24fd files. Good riddance. * Created a helper class for managing fd1094 decryption caches. * Converted the memory mapper into a new modern device and updated the segas16b, segaorun, and segas18 drivers to use it. Fixed ROM memory mapping so that the source ROMs can be loaded contiguously, removing a bunch of hacks. * Untangled the joined segas1x_state and split the states for each system into their own classes. Cleaned up some implementations. * Added support for member functions to be called as DRIVER_INIT functions. To do this, #define MODERN_DRIVER_INIT prior to #including "emu.h" and you will be required to specify a class and member function for your driver init. * Fully modernized the segas16b and segas18 drivers. New working games added ----------------------- GP Rider (Japan) [ShouTime, Charles MacDonald, Aaron Giles] Last Survivor [ShouTime, Charles MacDonald, Aaron Giles, 9ofzeven, TrevEB, Dr. Spankenstein, ghoolster, Surgeville, Tormod, Tjaberg, Waremonger] (Note: A couple games are still busted, but most are working. Will follow up with more updates.) --- src/emu/driver.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'src/emu/driver.c') diff --git a/src/emu/driver.c b/src/emu/driver.c index 9a66448870d..a2cdb5c08d5 100644 --- a/src/emu/driver.c +++ b/src/emu/driver.c @@ -471,14 +471,15 @@ void driver_device::soundlatch_sync_callback(void *ptr, INT32 param) // writing to sound latches //------------------------------------------------- -WRITE8_MEMBER( driver_device::soundlatch_byte_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 0 | (data << 8)); } -WRITE16_MEMBER( driver_device::soundlatch_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 0 | (data << 8)); } -WRITE8_MEMBER( driver_device::soundlatch2_byte_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 1 | (data << 8)); } -WRITE16_MEMBER( driver_device::soundlatch2_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 1 | (data << 8)); } -WRITE8_MEMBER( driver_device::soundlatch3_byte_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 2 | (data << 8)); } -WRITE16_MEMBER( driver_device::soundlatch3_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 2 | (data << 8)); } -WRITE8_MEMBER( driver_device::soundlatch4_byte_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 3 | (data << 8)); } -WRITE16_MEMBER( driver_device::soundlatch4_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 3 | (data << 8)); } +void driver_device::soundlatch_write(UINT8 index, UINT32 data) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), index | (data << 8)); } +WRITE8_MEMBER( driver_device::soundlatch_byte_w ) { soundlatch_write(0, data); } +WRITE16_MEMBER( driver_device::soundlatch_word_w ) { soundlatch_write(0, data); } +WRITE8_MEMBER( driver_device::soundlatch2_byte_w ) { soundlatch_write(1, data); } +WRITE16_MEMBER( driver_device::soundlatch2_word_w ) { soundlatch_write(1, data); } +WRITE8_MEMBER( driver_device::soundlatch3_byte_w ) { soundlatch_write(2, data); } +WRITE16_MEMBER( driver_device::soundlatch3_word_w ) { soundlatch_write(2, data); } +WRITE8_MEMBER( driver_device::soundlatch4_byte_w ) { soundlatch_write(3, data); } +WRITE16_MEMBER( driver_device::soundlatch4_word_w ) { soundlatch_write(3, data); } //------------------------------------------------- @@ -486,14 +487,15 @@ WRITE16_MEMBER( driver_device::soundlatch4_word_w ) { machine().scheduler().sync // reading from sound latches //------------------------------------------------- -READ8_MEMBER( driver_device::soundlatch_byte_r ) { m_latch_read[0] = 1; return m_latched_value[0]; } -READ16_MEMBER( driver_device::soundlatch_word_r ) { m_latch_read[0] = 1; return m_latched_value[0]; } -READ8_MEMBER( driver_device::soundlatch2_byte_r ) { m_latch_read[1] = 1; return m_latched_value[1]; } -READ16_MEMBER( driver_device::soundlatch2_word_r ) { m_latch_read[1] = 1; return m_latched_value[1]; } -READ8_MEMBER( driver_device::soundlatch3_byte_r ) { m_latch_read[2] = 1; return m_latched_value[2]; } -READ16_MEMBER( driver_device::soundlatch3_word_r ) { m_latch_read[2] = 1; return m_latched_value[2]; } -READ8_MEMBER( driver_device::soundlatch4_byte_r ) { m_latch_read[3] = 1; return m_latched_value[3]; } -READ16_MEMBER( driver_device::soundlatch4_word_r ) { m_latch_read[3] = 1; return m_latched_value[3]; } +UINT32 driver_device::soundlatch_read(UINT8 index) { m_latch_read[index] = 1; return m_latched_value[index]; } +READ8_MEMBER( driver_device::soundlatch_byte_r ) { return soundlatch_read(0); } +READ16_MEMBER( driver_device::soundlatch_word_r ) { return soundlatch_read(0); } +READ8_MEMBER( driver_device::soundlatch2_byte_r ) { return soundlatch_read(1); } +READ16_MEMBER( driver_device::soundlatch2_word_r ) { return soundlatch_read(1); } +READ8_MEMBER( driver_device::soundlatch3_byte_r ) { return soundlatch_read(2); } +READ16_MEMBER( driver_device::soundlatch3_word_r ) { return soundlatch_read(2); } +READ8_MEMBER( driver_device::soundlatch4_byte_r ) { return soundlatch_read(3); } +READ16_MEMBER( driver_device::soundlatch4_word_r ) { return soundlatch_read(3); } //------------------------------------------------- @@ -501,10 +503,11 @@ READ16_MEMBER( driver_device::soundlatch4_word_r ) { m_latch_read[3] = 1; return // for clearing sound latches //------------------------------------------------- -WRITE8_MEMBER( driver_device::soundlatch_clear_byte_w ) { m_latched_value[0] = m_latch_clear_value; } -WRITE8_MEMBER( driver_device::soundlatch2_clear_byte_w ) { m_latched_value[1] = m_latch_clear_value; } -WRITE8_MEMBER( driver_device::soundlatch3_clear_byte_w ) { m_latched_value[2] = m_latch_clear_value; } -WRITE8_MEMBER( driver_device::soundlatch4_clear_byte_w ) { m_latched_value[3] = m_latch_clear_value; } +void driver_device::soundlatch_clear(UINT8 index) { m_latched_value[index] = m_latch_clear_value; } +WRITE8_MEMBER( driver_device::soundlatch_clear_byte_w ) { soundlatch_clear(0); } +WRITE8_MEMBER( driver_device::soundlatch2_clear_byte_w ) { soundlatch_clear(1); } +WRITE8_MEMBER( driver_device::soundlatch3_clear_byte_w ) { soundlatch_clear(2); } +WRITE8_MEMBER( driver_device::soundlatch4_clear_byte_w ) { soundlatch_clear(3); } -- cgit v1.2.3-70-g09d2