diff options
author | hap <happppp@users.noreply.github.com> | 2017-07-22 21:13:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-22 21:13:00 +0200 |
commit | 65179c6a71d149c817dd085fefebe8dbae0333dc (patch) | |
tree | 20ffb4d8f3ef82f4614f16ff9691c004bb555ece | |
parent | c33f141c53f8f167a3172768b8a42e895f6dfa19 (diff) | |
parent | 981b84be2186d6ef77aa182408d3c0b20f6548ff (diff) |
Merge pull request #2500 from DavidHaywood/180717
gaelco / ds5002fp changes:
-rw-r--r-- | scripts/target/mame/arcade.lua | 2 | ||||
-rw-r--r-- | scripts/target/mame/tiny.lua | 2 | ||||
-rw-r--r-- | src/devices/cpu/mcs51/mcs51.cpp | 84 | ||||
-rw-r--r-- | src/devices/cpu/mcs51/mcs51.h | 29 | ||||
-rw-r--r-- | src/mame/drivers/gaelco2.cpp | 204 | ||||
-rw-r--r-- | src/mame/drivers/glass.cpp | 131 | ||||
-rw-r--r-- | src/mame/drivers/targeth.cpp | 26 | ||||
-rw-r--r-- | src/mame/drivers/thoop2.cpp | 56 | ||||
-rw-r--r-- | src/mame/drivers/wrally.cpp | 63 | ||||
-rw-r--r-- | src/mame/includes/gaelco2.h | 14 | ||||
-rw-r--r-- | src/mame/includes/glass.h | 7 | ||||
-rw-r--r-- | src/mame/includes/targeth.h | 1 | ||||
-rw-r--r-- | src/mame/includes/thoop2.h | 11 | ||||
-rw-r--r-- | src/mame/machine/gaelco_ds5002fp.cpp | 100 | ||||
-rw-r--r-- | src/mame/machine/gaelco_ds5002fp.h | 58 |
15 files changed, 438 insertions, 350 deletions
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index daf1ededa1f..712bdb4a618 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1848,6 +1848,8 @@ files { MAME_DIR .. "src/mame/drivers/xorworld.cpp", MAME_DIR .. "src/mame/includes/xorworld.h", MAME_DIR .. "src/mame/video/xorworld.cpp", + MAME_DIR .. "src/mame/machine/gaelco_ds5002fp.cpp", + MAME_DIR .. "src/mame/machine/gaelco_ds5002fp.h", } createMAMEProjects(_target, _subtarget, "gameplan") diff --git a/scripts/target/mame/tiny.lua b/scripts/target/mame/tiny.lua index db3cb2525f6..f4ac6d81074 100644 --- a/scripts/target/mame/tiny.lua +++ b/scripts/target/mame/tiny.lua @@ -148,6 +148,8 @@ files{ MAME_DIR .. "src/mame/includes/wrally.h", MAME_DIR .. "src/mame/machine/wrally.cpp", MAME_DIR .. "src/mame/video/wrally.cpp", + MAME_DIR .. "src/mame/machine/gaelco_ds5002fp.cpp", + MAME_DIR .. "src/mame/machine/gaelco_ds5002fp.h", MAME_DIR .. "src/mame/drivers/looping.cpp", MAME_DIR .. "src/mame/drivers/supertnk.cpp", } diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index 46087800aab..1c682e06e0e 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -250,16 +250,17 @@ static ADDRESS_MAP_START(program_13bit, AS_PROGRAM, 8, mcs51_cpu_device) ADDRESS_MAP_END static ADDRESS_MAP_START(data_7bit, AS_DATA, 8, mcs51_cpu_device) - AM_RANGE(0x0000, 0x007f) AM_RAM - AM_RANGE(0x0100, 0x01ff) AM_RAM /* SFR */ + AM_RANGE(0x0000, 0x007f) AM_RAM AM_SHARE("scratchpad") + AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("sfr_ram") /* SFR */ ADDRESS_MAP_END static ADDRESS_MAP_START(data_8bit, AS_DATA, 8, mcs51_cpu_device) - AM_RANGE(0x0000, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x01ff) AM_RAM /* SFR */ + AM_RANGE(0x0000, 0x00ff) AM_RAM AM_SHARE("scratchpad") + AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("sfr_ram") /* SFR */ ADDRESS_MAP_END + mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_width, int data_width, uint8_t features) : cpu_device(mconfig, type, tag, owner, clock) , m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, @@ -271,6 +272,8 @@ mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type ty , m_features(features) , m_ram_mask( (data_width == 8) ? 0xFF : 0x7F ) , m_num_interrupts(5) + , m_sfr_ram(*this, "sfr_ram") + , m_scratchpad(*this, "scratchpad") , m_serial_tx_cb(*this) , m_serial_rx_cb(*this) , m_rtemp(0) @@ -369,8 +372,11 @@ at89c4051_device::at89c4051_device(const machine_config &mconfig, const char *ta { } +/* program width field is set to 0 because technically the SRAM isn't internal */ ds5002fp_device::ds5002fp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : mcs51_cpu_device(mconfig, DS5002FP, tag, owner, clock, 12, 7, FEATURE_DS5002FP | FEATURE_CMOS) + : mcs51_cpu_device(mconfig, DS5002FP, tag, owner, clock, 0, 7, FEATURE_DS5002FP | FEATURE_CMOS) + , device_nvram_interface(mconfig, *this) + , m_region(*this, "internal") { } @@ -463,7 +469,7 @@ void mcs51_cpu_device::iram_iwrite(offs_t a, uint8_t d) { if (a <= m_ram_mask) m #define B SFR_A(ADDR_B) #define SBUF SFR_A(ADDR_SBUF) -#define R_REG(r) m_internal_ram[(r) | (PSW & 0x18)] +#define R_REG(r) m_scratchpad[(r) | (PSW & 0x18)] #define DPTR ((DPH<<8) | DPL) /* 8052 Only registers */ @@ -522,7 +528,7 @@ void mcs51_cpu_device::iram_iwrite(offs_t a, uint8_t d) { if (a <= m_ram_mask) m #define SET_SBUF(v) SET_SFR_A(ADDR_SBUF, v) /* No actions triggered on write */ -#define SET_REG(r, v) do { m_internal_ram[(r) | (PSW & 0x18)] = (v); } while (0) +#define SET_REG(r, v) do { m_scratchpad[(r) | (PSW & 0x18)] = (v); } while (0) #define SET_DPTR(n) do { DPH = ((n) >> 8) & 0xff; DPL = (n) & 0xff; } while (0) @@ -740,12 +746,6 @@ uint8_t mcs51_cpu_device::r_acc() { return SFR_A(ADDR_ACC); } uint8_t mcs51_cpu_device::r_psw() { return SFR_A(ADDR_PSW); } -void mcs51_cpu_device::update_ptrs() -{ - m_internal_ram = (uint8_t *)m_data->get_write_ptr(0x00); - m_sfr_ram = (uint8_t *)m_data->get_write_ptr(0x100); -} - /* Generate an external ram address for read/writing using indirect addressing mode */ @@ -1958,8 +1958,6 @@ void mcs51_cpu_device::execute_run() { uint8_t op; - update_ptrs(); - /* external interrupts may have been set since we last checked */ m_inst_cycles = 0; check_irqs(); @@ -2107,9 +2105,6 @@ void mcs51_cpu_device::device_start() m_data = &space(AS_DATA); m_io = &space(AS_IO); - /* ensure these pointers are set before get_info is called */ - update_ptrs(); - m_serial_rx_cb.resolve_safe(0); m_serial_tx_cb.resolve_safe(); @@ -2232,8 +2227,6 @@ void mcs51_cpu_device::state_string_export(const device_state_entry &entry, std: /* Reset registers to the initial values */ void mcs51_cpu_device::device_reset() { - update_ptrs(); - m_last_line_state = 0; m_t0_cnt = 0; m_t1_cnt = 0; @@ -2292,11 +2285,11 @@ void mcs51_cpu_device::device_reset() { // set initial values (some of them are set using the bootstrap loader) PCON = 0; - MCON = m_ds5002fp.mcon & 0xfb; - RPCTL = m_ds5002fp.rpctl & 0x01; + MCON = m_sfr_ram[ADDR_MCON-0x80]; + RPCTL = m_sfr_ram[ADDR_RPCTL-0x80]; RPS = 0; RNR = 0; - CRCR = m_ds5002fp.crc & 0xf0; + CRCR = m_sfr_ram[ADDR_CRCR-0x80]; CRCL = 0; CRCH = 0; TA = 0; @@ -2469,6 +2462,51 @@ uint8_t ds5002fp_device::sfr_read(size_t offset) return m_data->read_byte((size_t) offset | 0x100); } +/* +Documentation states that having the battery connected "maintains the internal scratchpad RAM" and "certain SFRs" +(although it isn't clear exactly which SFRs except for those explicitly mentioned) +*/ + +void ds5002fp_device::nvram_default() +{ + memset( m_scratchpad, 0, 0x80 ); + memset( m_sfr_ram, 0, 0x80 ); + + int expected_bytes = 0x80 + 0x80; + + if (!m_region.found()) + { + logerror( "ds5002fp_device region not found\n" ); + } + else if( m_region->bytes() != expected_bytes ) + { + logerror( "ds5002fp_device region length 0x%x expected 0x%x\n", m_region->bytes(), expected_bytes ); + } + else + { + uint8_t *region = m_region->base(); + + memcpy( m_scratchpad, region, 0x80 ); region += 0x80; + memcpy( m_sfr_ram, region, 0x80 ); region += 0x80; + /* does anything else need storing? any registers that aren't in sfr ram? + It isn't clear if the various initial MCON registers etc. are just stored in sfr ram + or if the DS5002FP stores them elsewhere and the bootstrap copies them */ + } +} + +void ds5002fp_device::nvram_read( emu_file &file ) +{ + file.read( m_scratchpad, 0x80 ); + file.read( m_sfr_ram, 0x80 ); +} + +void ds5002fp_device::nvram_write( emu_file &file ) +{ + file.write( m_scratchpad, 0x80 ); + file.write( m_sfr_ram, 0x80 ); +} + + offs_t mcs51_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) { diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h index 9651b7e77fd..13f19d3fd28 100644 --- a/src/devices/cpu/mcs51/mcs51.h +++ b/src/devices/cpu/mcs51/mcs51.h @@ -159,8 +159,8 @@ protected: } m_uart; /* internal uart */ /* Internal Ram */ - uint8_t *m_internal_ram; /* 128 RAM (8031/51) + 128 RAM in second bank (8032/52) */ - uint8_t *m_sfr_ram; /* 128 SFR - these are in 0x80 - 0xFF */ + required_shared_ptr<uint8_t> m_sfr_ram; /* 128 SFR - these are in 0x80 - 0xFF */ + required_shared_ptr<uint8_t> m_scratchpad; /* 128 RAM (8031/51) + 128 RAM in second bank (8032/52) */ /* SFR Callbacks */ virtual void sfr_write(size_t offset, uint8_t data); @@ -197,7 +197,6 @@ protected: void clear_current_irq(); uint8_t r_acc(); uint8_t r_psw(); - void update_ptrs(); offs_t external_ram_iaddr(offs_t offset, offs_t mem_mask); uint8_t iram_read(size_t offset); void iram_write(size_t offset, uint8_t data); @@ -496,12 +495,18 @@ public: * Internal ram 128k and security features */ -#define MCFG_DS5002FP_CONFIG(_mcon, _rpctl, _crc) \ - ds5002fp_device::set_mcon(*device, _mcon); \ - ds5002fp_device::set_rpctl(*device, _rpctl); \ - ds5002fp_device::set_crc(*device, _crc); +/* these allow the default state of RAM to be set from a region */ +#define DS5002FP_SET_MON( _mcon) \ + ROM_FILL( 0xc6, 1, _mcon) -class ds5002fp_device : public mcs51_cpu_device +#define DS5002FP_SET_RPCTL( _rpctl) \ + ROM_FILL( 0xd8, 1, _rpctl) + +#define DS5002FP_SET_CRCR( _crcr) \ + ROM_FILL( 0xc1, 1, _crcr) + + +class ds5002fp_device : public mcs51_cpu_device, public device_nvram_interface { public: // construction/destruction @@ -511,12 +516,20 @@ public: static void set_rpctl(device_t &device, uint8_t rpctl) { downcast<ds5002fp_device &>(device).m_ds5002fp.rpctl = rpctl; } static void set_crc(device_t &device, uint8_t crc) { downcast<ds5002fp_device &>(device).m_ds5002fp.crc = crc; } + // device_nvram_interface overrides + virtual void nvram_default() override; + virtual void nvram_read( emu_file &file ) override; + virtual void nvram_write( emu_file &file ) override; + protected: virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; /* SFR Callbacks */ virtual void sfr_write(size_t offset, uint8_t data) override; virtual uint8_t sfr_read(size_t offset) override; + +private: + optional_memory_region m_region; }; diff --git a/src/mame/drivers/gaelco2.cpp b/src/mame/drivers/gaelco2.cpp index 5b5168b77d7..7e2a2bb81dd 100644 --- a/src/mame/drivers/gaelco2.cpp +++ b/src/mame/drivers/gaelco2.cpp @@ -18,7 +18,7 @@ Maniac Square | 1996 | GAE1 501 | 940411 | DS5002FP (unprotected version available) Snow Board | 1996 | CG-1V 366 | 960419/1 | Lattice IspLSI 1016-80LJ Bang! | 1998 | CG-1V 388 | 980921/1 | No - Gran Tesoro? | 1999 | CG-1V-149 | ? | DS5002FP (by Nova Desitec, might not fit here) + Play 2000 | 1999 | CG-1V-149 | ? | DS5002FP (by Nova Desitec) Notes: touchgo: @@ -32,7 +32,7 @@ #include "machine/eepromser.h" #include "sound/gaelco.h" -#include "cpu/mcs51/mcs51.h" +#include "machine/gaelco_ds5002fp.h" #include "rendlay.h" #include "screen.h" @@ -64,41 +64,6 @@ TILELAYOUT16(0x0400000) GFXDECODEINFO(0x0400000, 128) /*============================================================================ - DS5002FP - ============================================================================*/ - -READ8_MEMBER(gaelco2_state::dallas_share_r) -{ - uint8_t *shareram = (uint8_t *)m_shareram.target(); - return shareram[BYTE_XOR_BE(offset)]; -} - -WRITE8_MEMBER(gaelco2_state::dallas_share_w) -{ - uint8_t *shareram = (uint8_t *)m_shareram.target(); - shareram[BYTE_XOR_BE(offset)] = data; -} - -READ8_MEMBER(gaelco2_state::dallas_ram_r) -{ - return m_mcu_ram[offset]; -} - -WRITE8_MEMBER(gaelco2_state::dallas_ram_w) -{ - m_mcu_ram[offset] = data; -} - -static ADDRESS_MAP_START( dallas_rom, AS_PROGRAM, 8, gaelco2_state ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(dallas_ram_r, dallas_ram_w) /* Code in NVRAM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dallas_ram, AS_IO, 8, gaelco2_state ) - AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(dallas_share_r, dallas_share_w) /* confirmed that 0x8000 - 0xffff is a window into 68k shared RAM */ - AM_RANGE(0x10000, 0x17fff) AM_READWRITE(dallas_ram_r, dallas_ram_w) /* yes, the games access it as data and use it for temporary storage!! */ -ADDRESS_MAP_END - -/*============================================================================ MANIAC SQUARE (FINAL) ============================================================================*/ @@ -113,8 +78,8 @@ static ADDRESS_MAP_START( maniacsq_map, AS_PROGRAM, 16, gaelco2_state ) AM_RANGE(0x30004a, 0x30004b) AM_WRITENOP /* Sound muting? */ AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN") /* COINSW + SERVICESW */ AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w) /* Coin lockout + counters */ - AM_RANGE(0xfe0000, 0xfebfff) AM_RAM /* Work RAM */ - AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM */ + AM_RANGE(0xfe0000, 0xfe7fff) AM_RAM /* Work RAM */ + AM_RANGE(0xfe8000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM */ ADDRESS_MAP_END @@ -229,6 +194,10 @@ static MACHINE_CONFIG_START( maniacsq ) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( maniacsq_d5002fp, maniacsq ) + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) /* ? */ + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") +MACHINE_CONFIG_END ROM_START( maniacsq ) ROM_REGION( 0x040000, "maincpu", 0 ) /* 68000 code */ @@ -250,9 +219,14 @@ ROM_START( maniacsqa ) // REF 940411 ROM_LOAD16_BYTE( "MS_U_45.U45", 0x000000, 0x020000, CRC(98f4fdc0) SHA1(1e4d5b0a8a432de885c96319c21280d304b38db0) ) ROM_LOAD16_BYTE( "MS_U_44.U44", 0x000001, 0x020000, CRC(1785dd41) SHA1(5c6a65c00248971ce54c8185858393f2c52cc583) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "ms_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + ROM_REGION( 0x0280000, "gfx1", 0 ) /* GFX + Sound */ // all 4 roms on a sub-board, no IC positions marked ROM_LOAD( "MS1", 0x0000000, 0x0080000, CRC(d8551b2f) SHA1(78b5b07112bd89fed18055180e7cc64f8e0bd0b1) ) /* GFX + Sound */ @@ -487,7 +461,8 @@ static ADDRESS_MAP_START( alighunt_map, AS_PROGRAM, 16, gaelco2_state ) AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN") /* COINSW + SERVICESW */ AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w) /* Coin lockout + counters */ AM_RANGE(0x500006, 0x500007) AM_WRITENOP /* ??? */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0xfe0000, 0xfe7fff) AM_RAM /* Work RAM */ + AM_RANGE(0xfe8000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with D5002FP) */ ADDRESS_MAP_END @@ -601,6 +576,10 @@ static MACHINE_CONFIG_START( alighunt ) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( alighunt_d5002fp, alighunt ) + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) /* ? */ + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") +MACHINE_CONFIG_END /* PCB Layout: @@ -643,8 +622,14 @@ ROM_START( aligator ) ROM_LOAD16_BYTE( "u45", 0x000000, 0x080000, CRC(61c47c56) SHA1(6dd3fc6fdab252e0fb43c0793eef70203c888d7f) ) ROM_LOAD16_BYTE( "u44", 0x000001, 0x080000, CRC(f0be007a) SHA1(2112b2e5f020028b50c8f2c72c83c9fee7a78224) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ - ROM_LOAD( "aligator_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_LOAD( "touchgo_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x19 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) ROM_REGION( 0x1400000, "gfx1", 0 ) /* GFX + Sound */ /* 0x0000000-0x0ffffff filled in in the DRIVER_INIT */ @@ -844,17 +829,13 @@ static MACHINE_CONFIG_START( touchgo ) MCFG_DEVICE_ADD("gaelco", GAELCO_GAE1, 0) MCFG_GAELCO_SND_DATA("gfx1") MCFG_GAELCO_BANKS(0 * 0x0400000, 1 * 0x0400000, 0, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "lspeaker", 1.0) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( touchgo_d5002fp, touchgo ) - MCFG_CPU_ADD("mcu", DS5002FP, XTAL_24MHz/2) /* ? */ - MCFG_DS5002FP_CONFIG( 0x19, 0x00, 0x80 ) /* default config verified on chip */ - MCFG_CPU_PROGRAM_MAP(dallas_rom) - MCFG_CPU_IO_MAP(dallas_ram) - - MCFG_QUANTUM_PERFECT_CPU("mcu") + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) /* ? */ + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") MACHINE_CONFIG_END /* @@ -905,8 +886,16 @@ ROM_START( touchgo ) /* REF: 950906 */ ROM_LOAD16_BYTE( "tg_56", 0x000000, 0x080000, CRC(8ab065f3) SHA1(7664abd7e5f66ffca4a2865bba56ac36bd04f4e9) ) ROM_LOAD16_BYTE( "tg_57", 0x000001, 0x080000, CRC(0dfd3f65) SHA1(afb2ce8988c84f211ac71b84928ce4c421de7fee) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ - ROM_LOAD( "touchgo_ds5002fp.bin", 0x00000, 0x8000, BAD_DUMP CRC(e977d2db) SHA1(d6a4ef74eb776d9e898f25a70f0302f3199b4fa1) ) /* marked as BAD_DUMP until a 2nd board is used to verify */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_LOAD( "touchgo_ds5002fp.bin", 0x00000, 0x8000, BAD_DUMP CRC(a497e1af) SHA1(68ee1f87631183541adadf927fb18ed4422d5bb6) ) /* marked as BAD_DUMP until a 2nd board is used to verify */ + + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* touchgo requires some valids in scratchram to be initialized or it won't copy the high score table when it boots */ + ROM_LOAD( "touchgo_scratch", 0x00, 0x80, CRC(f9ca54ff) SHA1(416f7bd89442dc1f736efe457b0f9a7f4f9f0bd5) ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x19 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) ROM_REGION( 0x1400000, "gfx1", 0 ) /* GFX + Sound */ /* 0x0000000-0x0ffffff filled in in the DRIVER_INIT */ @@ -924,9 +913,17 @@ ROM_START( touchgon ) /* REF 950906, no plug-in daughterboard, Non North America ROM_LOAD16_BYTE( "tg56.bin", 0x000000, 0x080000, CRC(fd3b4642) SHA1(3cab42aecad5ee641711763c6047b56784c2bcf3) ) ROM_LOAD16_BYTE( "tg57.bin", 0x000001, 0x080000, CRC(ee891835) SHA1(9f8c60e5e3696b70f756c3521e10313005053cc7) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "touchgo_ds5002fp.bin", 0x00000, 0x8000, BAD_DUMP CRC(e977d2db) SHA1(d6a4ef74eb776d9e898f25a70f0302f3199b4fa1) ) /* marked as BAD_DUMP until a 2nd board is used to verify */ + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* touchgo requires some valids in scratchram to be initialized or it won't copy the high score table when it boots */ + ROM_LOAD( "touchgo_scratch", 0x00, 0x80, CRC(f9ca54ff) SHA1(416f7bd89442dc1f736efe457b0f9a7f4f9f0bd5) ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x19 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x1400000, "gfx1", 0 ) /* GFX + Sound */ /* 0x0000000-0x0ffffff filled in in the DRIVER_INIT */ ROM_LOAD( "ic69", 0x1000000, 0x0200000, CRC(18bb12d4) SHA1(ee6e7a63b86c56d71e62db0ae5892ab3ab94b0a0) ) /* GFX only */ @@ -943,9 +940,17 @@ ROM_START( touchgoe ) /* REF: 950510-1 */ ROM_LOAD16_BYTE( "tg56", 0x000000, 0x080000, CRC(6d0f5c65) SHA1(00db7a7da3ec1676169aa78fe4f08a7746c3accf) ) ROM_LOAD16_BYTE( "tg57", 0x000001, 0x080000, CRC(845787b5) SHA1(27c9910cd9f38328326ecb5cd093dfeb6d4f6244) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "touchgo_ds5002fp.bin", 0x00000, 0x8000, BAD_DUMP CRC(e977d2db) SHA1(d6a4ef74eb776d9e898f25a70f0302f3199b4fa1) ) /* marked as BAD_DUMP until a 2nd board is used to verify */ + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* touchgo requires some valids in scratchram to be initialized or it won't copy the high score table when it boots */ + ROM_LOAD( "touchgo_scratch", 0x00, 0x80, CRC(f9ca54ff) SHA1(416f7bd89442dc1f736efe457b0f9a7f4f9f0bd5) ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x19 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x1400000, "gfx1", 0 ) /* GFX + Sound */ /* 0x0000000-0x0ffffff filled in in the DRIVER_INIT */ ROM_LOAD( "ic69", 0x1000000, 0x0200000, CRC(18bb12d4) SHA1(ee6e7a63b86c56d71e62db0ae5892ab3ab94b0a0) ) /* GFX only */ @@ -1272,12 +1277,8 @@ static MACHINE_CONFIG_START( wrally2 ) MCFG_CPU_PROGRAM_MAP(wrally2_map) MCFG_CPU_VBLANK_INT_DRIVER("lscreen", gaelco2_state, irq6_line_hold) - MCFG_CPU_ADD("mcu", DS5002FP, XTAL_24MHz/2) /* ? */ - MCFG_DS5002FP_CONFIG( 0x69, 0x00, 0x80 ) /* default config verified on chip */ - MCFG_CPU_PROGRAM_MAP(dallas_rom) - MCFG_CPU_IO_MAP(dallas_ram) - - MCFG_QUANTUM_PERFECT_CPU("mcu") + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") MCFG_EEPROM_SERIAL_93C66_ADD("eeprom") @@ -1315,8 +1316,8 @@ static MACHINE_CONFIG_START( wrally2 ) MCFG_DEVICE_ADD("gaelco", GAELCO_GAE1, 0) MCFG_GAELCO_SND_DATA("gfx1") MCFG_GAELCO_BANKS(0 * 0x0200000, 1 * 0x0200000, 0, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "lspeaker", 1.0) MACHINE_CONFIG_END /* @@ -1425,8 +1426,8 @@ ROM_START( wrally2 ) ROM_LOAD16_BYTE( "wr2.64", 0x000000, 0x080000, CRC(4cdf4e1e) SHA1(a3b3ff4a70336b61c7bba5d518527bf4bd901867) ) ROM_LOAD16_BYTE( "wr2.63", 0x000001, 0x080000, CRC(94887c9f) SHA1(ad09f1fbeff4c3ba47f72346d261b22fa6a51457) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ - /* This SRAM has been dumped from 2 PCBs. The first had unused space filled as 0x00, the 2nd space was filled as 0xff. + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + /* This SRAM has been dumped from 2 PCBs. The first had unused space filled as 0xff, the 2nd space was filled as 0x00. In addition, the first had 2 bad bytes, one of which was identified at the time, the other not. For reference the one that was not is "1938: 18 <-> 9B" (part of a data table) @@ -1452,9 +1453,14 @@ ROM_START( wrally2 ) either way the 2nd dump is in much better state, so we're using that. */ - ROM_LOAD( "wr2_dallas.bin", 0x00000, 0x8000, CRC(4c532e9e) SHA1(d0aad72b204d4abd3b8d7d5bbaf8d2d2f78edaa6) ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x69 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x0a00000, "gfx1", 0 ) /* GFX + Sound */ ROM_LOAD( "wr2.16d", 0x0000000, 0x0080000, CRC(ad26086b) SHA1(487ffaaca57c9d030fc486b8cae6735ee40a0ac3) ) /* GFX only */ ROM_LOAD( "wr2.17d", 0x0080000, 0x0080000, CRC(c1ec0745) SHA1(a6c3ce9c889e6a53f4155f54d6655825af34a35b) ) /* GFX only */ @@ -1507,6 +1513,9 @@ Title is uncertain. A string at 27e00 says: "Play 2000 v5.01 (c) 1999", but there are also some gfxs that says "Gran Tesoro" all over the place. I don't know what's the correct title for this one... +see +http://web.archive.org/web/20001206204300/http://luckysunshine.com/products/gameboards/play2000.html + */ ROM_START( grtesoro ) @@ -1515,9 +1524,14 @@ ROM_START( grtesoro ) ROM_LOAD16_BYTE( "2.u39", 0x000000, 0x020000, BAD_DUMP CRC(9939299e) SHA1(55303a2adf199f4b5a60f57be7480b0e119f8624) ) ROM_LOAD16_BYTE( "1.u40", 0x000001, 0x020000, BAD_DUMP CRC(311c2f94) SHA1(963d6b5f479598145146fcb8b7c6ce77fbc92b07) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + ROM_REGION( 0x0300000, "gfx1", 0 ) /* GFX + Sound */ ROM_LOAD( "3.u54", 0x0000000, 0x0080000, CRC(085008ed) SHA1(06eb4f972d79eab13b1b3b6829ef280e079abdb6) ) ROM_LOAD( "4.u53", 0x0080000, 0x0080000, CRC(94dc37a7) SHA1(28f9832b61541b292682a6e2d2264abccd138a2e) ) @@ -1534,9 +1548,14 @@ ROM_START( grtesoro4 ) /* there are version 4.0 and version 1.0 strings in this, ROM_LOAD16_BYTE( "2.u39_v4", 0x000000, 0x020000, CRC(fff16141) SHA1(8493c3e58a231c03b152b336f43422a9a2d2618c) ) ROM_LOAD16_BYTE( "1.u40_v4", 0x000001, 0x020000, CRC(39f9d58e) SHA1(1cbdae2adc570f2a2e10a707075312ef717e2643) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + ROM_REGION( 0x0300000, "gfx1", 0 ) /* GFX + Sound */ ROM_LOAD( "3.u54", 0x0000000, 0x0080000, CRC(085008ed) SHA1(06eb4f972d79eab13b1b3b6829ef280e079abdb6) ) ROM_LOAD( "4.u53", 0x0080000, 0x0080000, CRC(94dc37a7) SHA1(28f9832b61541b292682a6e2d2264abccd138a2e) ) @@ -1549,44 +1568,9 @@ ROM_START( grtesoro4 ) /* there are version 4.0 and version 1.0 strings in this, ROM_END -READ16_MEMBER(gaelco2_state::maniacsqa_prot_r) -{ - int pc = space.device().safe_pc(); - - // if -1 is returned at any point on these checks the game instantly reports 'power failure' - // these are generally done right before the other checks - if (pc == 0x3dbc) return 0x0000; // must not be -1 - if (pc == 0x5ce4) return 0x0000; // must not be -1 - if (pc == 0x5d08) return 0x0000; // must not be -1 (stores 5 here just before) - if (pc == 0xaa90) return 0x0000; // must not be -1 - if (pc == 0xaab2) return 0x0000; // must not be -1 - if (pc == 0x9f10) return 0x0000; // must not be -1 - if (pc == 0x3b86) return 0x0000; // must not be -1 - - if (pc == 0x3dce) return 0x0000; // must be 0 - - if (pc == 0x25c2) return 0x0000; // writes 0 to 0xfe45fa then expects this to be 0 - - if (pc == 0x5cf6) return 0x0000; // must be 0 - if (pc == 0x5d1a) return 0x0000; // must be 0 - if (pc == 0xaaa0) return 0x0000; // must be 0? - - if (pc == 0xaac4) return 0x0000; // checks for 0, 2 possible code paths after - happens when piece is dropped - if (pc == 0xaad0) return 0x0a00; // if above ISN'T 0 this must be 0x0a00 (but code then dies, probably wants some data filled?) - // other code path just results in no more pieces dropping? maybe the MCU does the matching algorithm? - - printf("read at PC %08x\n", pc); - return m_shareram[(0xfedaa2 - 0xfec000) / 2]; - -} - -DRIVER_INIT_MEMBER(gaelco2_state,maniacsqa) -{ - m_maincpu->space(AS_PROGRAM).install_read_handler(0xfedaa2, 0xfedaa3, read16_delegate(FUNC(gaelco2_state::maniacsqa_prot_r), this) ); -} -GAME( 1994, aligator, 0, alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) -GAME( 1994, aligatorun,aligator,alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt (unprotected)", 0 ) +GAME( 1994, aligator, 0, alighunt_d5002fp, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) +GAME( 1994, aligatorun,aligator,alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt (unprotected)", 0 ) GAME( 1995, touchgo, 0, touchgo_d5002fp, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (World)", MACHINE_IMPERFECT_SOUND ) GAME( 1995, touchgon, touchgo, touchgo_d5002fp, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (Non North America)", MACHINE_IMPERFECT_SOUND ) @@ -1595,8 +1579,8 @@ GAME( 1995, touchgok, touchgo, touchgo, touchgo, gaelco2_state, touch GAME( 1995, wrally2, 0, wrally2, wrally2, wrally2_state, 0, ROT0, "Gaelco", "World Rally 2: Twin Racing", 0 ) -GAME( 1996, maniacsq, 0, maniacsq, maniacsq, gaelco2_state, 0, ROT0, "Gaelco", "Maniac Square (unprotected)", 0 ) -GAME( 1996, maniacsqa,maniacsq, maniacsq, maniacsq, gaelco2_state, maniacsqa,ROT0, "Gaelco", "Maniac Square (protected)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) +GAME( 1996, maniacsq, 0, maniacsq, maniacsq, gaelco2_state, 0, ROT0, "Gaelco", "Maniac Square (unprotected)", 0 ) +GAME( 1996, maniacsqa,maniacsq, maniacsq_d5002fp, maniacsq, gaelco2_state, 0, ROT0, "Gaelco", "Maniac Square (protected)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1996, snowboar, 0, snowboar, snowboar, gaelco2_state, 0, ROT0, "Gaelco", "Snow Board Championship (Version 2.1)", 0 ) GAME( 1996, snowboara,snowboar, snowboar, snowboar, gaelco2_state, snowboar, ROT0, "Gaelco", "Snow Board Championship (Version 2.0)", 0 ) @@ -1604,6 +1588,6 @@ GAME( 1996, snowboara,snowboar, snowboar, snowboar, gaelco2_state, snowboar, ROT GAME( 1998, bang, 0, bang, bang, bang_state, bang, ROT0, "Gaelco", "Bang!", 0 ) GAME( 1998, bangj, bang, bang, bang, bang_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 ) -// are these ACTUALLY Gaelco hardware, or do they just use the same Dallas? -GAME( 1999, grtesoro, 0, maniacsq, maniacsq, gaelco2_state, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v5.01) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) -GAME( 1999, grtesoro4, grtesoro,maniacsq, maniacsq, gaelco2_state, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v4.0) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) +// 2-in-1 gambling game, appears to be cloned Gaelco hardware complete with DS5002FP, or possibly manufactured by Gaelco for Nova Desitec but without any Gaelco branding. +GAME( 1999, grtesoro, 0, maniacsq, maniacsq, gaelco2_state, 0, ROT0, "Nova Desitec", "Play 2000 (Super Slot & Gran Tesoro) (v5.01) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) +GAME( 1999, grtesoro4, grtesoro,maniacsq, maniacsq, gaelco2_state, 0, ROT0, "Nova Desitec", "Play 2000 (Super Slot & Gran Tesoro) (v4.0) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/glass.cpp b/src/mame/drivers/glass.cpp index 7ff320ec5f8..c7d419d144e 100644 --- a/src/mame/drivers/glass.cpp +++ b/src/mame/drivers/glass.cpp @@ -14,6 +14,7 @@ except for the Promat licensed Korean version which is unprotected. #include "emu.h" #include "includes/glass.h" +#include "machine/gaelco_ds5002fp.h" #include "cpu/m68000/m68000.h" #include "sound/okim6295.h" #include "screen.h" @@ -96,7 +97,7 @@ static ADDRESS_MAP_START( glass_map, AS_PROGRAM, 16, glass_state ) AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status register */ AM_RANGE(0x70000a, 0x70004b) AM_WRITE(coin_w) /* Coin Counters/Lockout */ - AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("mainram") /* Work RAM (partially shared with DS5002FP) */ + AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (partially shared with DS5002FP) */ ADDRESS_MAP_END @@ -206,7 +207,6 @@ static MACHINE_CONFIG_START( glass ) MCFG_CPU_PROGRAM_MAP(glass_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", glass_state, interrupt) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -228,14 +228,24 @@ static MACHINE_CONFIG_START( glass ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( glass_ds5002fp, glass ) + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP_WRALLY, XTAL_24MHz / 2) /* verified on pcb */ + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") +MACHINE_CONFIG_END + ROM_START( glass ) /* Version 1.1 */ ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_BYTE( "1.c23", 0x000000, 0x040000, CRC(aeebd4ed) SHA1(04759dc146dff0fc74b78d70e79dfaebe68328f9) ) ROM_LOAD16_BYTE( "2.c22", 0x000001, 0x040000, CRC(165e2e01) SHA1(180a2e2b5151f2321d85ac23eff7fbc9f52023a5) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "glass_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( 0x88 ) + //DS5002FP_SET_RPCTL( 0x00 ) + //DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ @@ -256,9 +266,14 @@ ROM_START( glass10 ) /* Version 1.0 */ ROM_LOAD16_BYTE( "c23.bin", 0x000000, 0x040000, CRC(688cdf33) SHA1(b59dcc3fc15f72037692b745927b110e97d8282e) ) ROM_LOAD16_BYTE( "c22.bin", 0x000001, 0x040000, CRC(ab17c992) SHA1(1509b5b4bbfb4e022e0ab6fbbc0ffc070adfa531) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "glass_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ @@ -279,9 +294,14 @@ ROM_START( glass10a ) /* Title screen shows "GLASS" and under that "Break Editio ROM_LOAD16_BYTE( "spl-c23.bin", 0x000000, 0x040000, CRC(c1393bea) SHA1(a5f877ba38305a7b49fa3c96b9344cbf71e8c9ef) ) ROM_LOAD16_BYTE( "spl-c22.bin", 0x000001, 0x040000, CRC(0d6fa33e) SHA1(37e9258ef7e108d034c80abc8e5e5ab6dacf0a61) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "glass_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ @@ -341,91 +361,6 @@ void glass_state::ROM16_split_gfx( const char *src_reg, const char *dst_reg, int } } -/* How does the protection work? - - We know in World Rally it shares the whole of main RAM with the Dallas, with subtle reads and writes / values being checked.. so I guess this will be similar at least - and thus very hard to figure out if done properly - - */ - -READ16_MEMBER( glass_state::mainram_r ) -{ - uint16_t ret = m_mainram[offset]; - int pc = space.device().safe_pc(); - - if (offset == (0xfede96 - 0xfec000)>>1) - { - // this address seems important, the game will abort with 'power failure' depending on some reads, presumably referring to the power to the battery - - // there are also various code segments like the one below - /* - start: - tst.b this address - bne end - tst.b $fede1d.l - nop << why? - bne start - end: - */ - return 0x0000; - //printf("%06x read %06x - %04x %04x\n", pc , (offset*2 + 0xfec000), ret, mem_mask); - } - else if (offset == (0xfede1c - 0xfec000)>>1) - { - // related to above, could also be some command ack? - logerror("%06x read %06x - %04x %04x\n", pc, (offset*2 + 0xfec000), ret, mem_mask); - } - else if (offset == (0xfede26 - 0xfec000)>>1) - { - logerror("%06x read %06x - %04x %04x\n", pc, (offset*2 + 0xfec000), ret, mem_mask); - } - return ret; -} - -WRITE16_MEMBER( glass_state::mainram_w ) -{ - int pc = space.device().safe_pc(); - - COMBINE_DATA(&m_mainram[offset]); - - if (offset == (0xfede02 - 0xfec000)>>1) - { -// printf("%06x write %06x - %04x %04x\n", pc, (offset*2 + 0xfec000), data, mem_mask); - // several checks write here then expect it to appear mirrored, might be some kind of command + command ack - if (ACCESSING_BITS_8_15) // sometimes mask 0xff00, but not in cases which poll for change - { - mem_mask = 0x00ff; - data >>=8; - COMBINE_DATA(&m_mainram[offset]); - } - return; - } - else if (offset == (0xfede1c - 0xfec000)>>1) - { - // see notes about 0xfede96 in read, this address seems important - logerror("%06x write %06x - %04x %04x\n", pc, (offset*2 + 0xfec000), data, mem_mask); - if (mem_mask == 0x00ff) - { - int realdata = data; - - // don't store the bits written, game checks they get cleared? - data &= 0xff00; - COMBINE_DATA(&m_mainram[offset]); - - // a command? - if (realdata == 0x0002) - { - // there is a check on address 0xfede26 just after writing 0002 here.. - offset = (0xfede26 - 0xfec000) >> 1; - data = 0xff00; - mem_mask = 0xff00; - COMBINE_DATA(&m_mainram[offset]); - } - } - return; - } - -} DRIVER_INIT_MEMBER(glass_state, glass) { @@ -450,21 +385,13 @@ DRIVER_INIT_MEMBER(glass_state, glass) } -DRIVER_INIT_MEMBER(glass_state,glassp) -{ - DRIVER_INIT_CALL(glass); - - /* install custom handler over RAM for protection */ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::mainram_r), this), write16_delegate(FUNC(glass_state::mainram_w),this)); - -} // ALL versions of Glass contain the 'Break Edition' string (it just seems to be part of the title?) // The 2 version 1.0 releases are very similar code, it was thought that one was a break edition and the other wasn't, but as both contain the string this seems unlikely. // Version 1.1 releases also show Version 1994 on the title screen. These versions do not have skulls in the playfield (at least not on early stages) // The unprotected version appears to be a Korean set, is censored, and has different girl pictures. -GAME( 1994, glass, 0, glass, glass, glass_state, glassp, ROT0, "OMK / Gaelco", "Glass (Ver 1.1, Break Edition, Version 1994)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, glasskr, glass, glass, glass, glass_state, glass, ROT0, "OMK / Gaelco (Promat license)", "Glass (Ver 1.1, Break Edition, Version 1994) (censored, unprotected)", MACHINE_SUPPORTS_SAVE ) // promat stickers on program roms -GAME( 1993, glass10, glass, glass, glass, glass_state, glassp, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition) (set 1)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1993, glass10a, glass, glass, glass, glass_state, glassp, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition) (set 2)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, glass, 0, glass_ds5002fp, glass, glass_state, glass, ROT0, "OMK / Gaelco", "Glass (Ver 1.1, Break Edition, Version 1994)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, glasskr, glass, glass, glass, glass_state, glass, ROT0, "OMK / Gaelco (Promat license)", "Glass (Ver 1.1, Break Edition, Version 1994) (censored, unprotected)", MACHINE_SUPPORTS_SAVE ) // promat stickers on program roms +GAME( 1993, glass10, glass, glass_ds5002fp, glass, glass_state, glass, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition) (set 1)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1993, glass10a, glass, glass_ds5002fp, glass, glass_state, glass, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition) (set 2)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/targeth.cpp b/src/mame/drivers/targeth.cpp index 2da6b711d3e..0bc5f85d6e8 100644 --- a/src/mame/drivers/targeth.cpp +++ b/src/mame/drivers/targeth.cpp @@ -52,6 +52,7 @@ Sound: OKI M6295 #include "emu.h" #include "includes/targeth.h" +#include "machine/gaelco_ds5002fp.h" #include "cpu/m68000/m68000.h" #include "sound/okim6295.h" #include "screen.h" @@ -125,7 +126,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, targeth_state ) AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status register */ AM_RANGE(0x700010, 0x70001b) AM_WRITENOP /* ??? Guns reload related? */ AM_RANGE(0x70002a, 0x70003b) AM_WRITE(coin_counter_w) /* Coin counters */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM (partially shared with DS5002FP) */ + AM_RANGE(0xfe0000, 0xfe7fff) AM_RAM /* Work RAM */ + AM_RANGE(0xfe8000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with D5002FP) */ ADDRESS_MAP_END @@ -134,6 +136,10 @@ static ADDRESS_MAP_START( oki_map, 0, 8, targeth_state ) AM_RANGE(0x30000, 0x3ffff) AM_ROMBANK("okibank") ADDRESS_MAP_END +void targeth_state::machine_start() +{ + membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000); +} static INPUT_PORTS_START( targeth ) PORT_START("GUNX1") @@ -227,6 +233,9 @@ static MACHINE_CONFIG_START( targeth ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", targeth_state, interrupt, "screen", 0, 1) + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -253,9 +262,15 @@ ROM_START( targeth ) ROM_LOAD16_BYTE( "th2_b_c_23.c23", 0x000000, 0x040000, CRC(840887d6) SHA1(9a36b346608d531a62a2e0704ea44f12e07f9d91) ) // The "B" was hand written ROM_LOAD16_BYTE( "th2_b_c_22.c22", 0x000001, 0x040000, CRC(d2435eb8) SHA1(ce75a115dad8019c8e66a1c3b3e15f54781f65ae) ) // The "B" was hand written - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "targeth_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + + ROM_REGION( 0x200000, "gfx1", 0 ) /* Graphics */ ROM_LOAD( "targeth.i13", 0x000000, 0x080000, CRC(b892be24) SHA1(9cccaaacf20e77c7358f0ceac60b8a1012f1216c) ) ROM_LOAD( "targeth.i11", 0x080000, 0x080000, CRC(6797faf9) SHA1(112cffe72f91cb46c262e19a47b0cab3237dd60f) ) @@ -273,9 +288,14 @@ ROM_START( targetha ) ROM_LOAD16_BYTE( "c23.bin", 0x000000, 0x040000, CRC(e38a54e2) SHA1(239bfa6f1c0fc8aa0ad7de9be237bef55b384007) ) ROM_LOAD16_BYTE( "c22.bin", 0x000001, 0x040000, CRC(24fe3efb) SHA1(8f48f08a6db28966c9263be119883c9179e349ed) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "targeth_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + //DS5002FP_SET_MON( x ) + //DS5002FP_SET_RPCTL( x ) + //DS5002FP_SET_CRCR( x ) + ROM_REGION( 0x200000, "gfx1", 0 ) /* Graphics */ ROM_LOAD( "targeth.i13", 0x000000, 0x080000, CRC(b892be24) SHA1(9cccaaacf20e77c7358f0ceac60b8a1012f1216c) ) ROM_LOAD( "targeth.i11", 0x080000, 0x080000, CRC(6797faf9) SHA1(112cffe72f91cb46c262e19a47b0cab3237dd60f) ) diff --git a/src/mame/drivers/thoop2.cpp b/src/mame/drivers/thoop2.cpp index a45f8a92c42..629eacbe4d2 100644 --- a/src/mame/drivers/thoop2.cpp +++ b/src/mame/drivers/thoop2.cpp @@ -15,9 +15,8 @@ maybe bad dump of DS5002FP rom, maybe CPU bugs #include "emu.h" #include "includes/thoop2.h" - +#include "machine/gaelco_ds5002fp.h" #include "cpu/m68000/m68000.h" -#include "cpu/mcs51/mcs51.h" #include "machine/watchdog.h" #include "sound/okim6295.h" #include "screen.h" @@ -55,40 +54,6 @@ WRITE16_MEMBER(thoop2_state::coin_w) /* 05b unknown */ } -/*============================================================================ - DS5002FP - ============================================================================*/ - -READ8_MEMBER(thoop2_state::dallas_share_r) -{ - uint8_t *shareram = (uint8_t *)m_shareram.target(); - return shareram[BYTE_XOR_BE(offset)]; -} - -WRITE8_MEMBER(thoop2_state::dallas_share_w) -{ - uint8_t *shareram = (uint8_t *)m_shareram.target(); - shareram[BYTE_XOR_BE(offset)] = data; -} - -READ8_MEMBER(thoop2_state::dallas_ram_r) -{ - return m_mcu_ram[offset]; -} - -WRITE8_MEMBER(thoop2_state::dallas_ram_w) -{ - m_mcu_ram[offset] = data; -} - -static ADDRESS_MAP_START( dallas_rom, AS_PROGRAM, 8, thoop2_state ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(dallas_ram_r, dallas_ram_w) /* Code in NVRAM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dallas_ram, AS_IO, 8, thoop2_state ) - AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(dallas_share_r, dallas_share_w) /* confirmed that 0x8000 - 0xffff is a window into 68k shared RAM */ - AM_RANGE(0x10000, 0x17fff) AM_READWRITE(dallas_ram_r, dallas_ram_w) /* yes, the games access it as data and use it for temporary storage!! */ -ADDRESS_MAP_END static ADDRESS_MAP_START( thoop2_map, AS_PROGRAM, 16, thoop2_state ) @@ -232,16 +197,12 @@ GFXDECODE_END static MACHINE_CONFIG_START( thoop2 ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000,24000000/2) /* 12 MHz */ + MCFG_CPU_ADD("maincpu", M68000,XTAL_24MHz/2) /* 12 MHz */ MCFG_CPU_PROGRAM_MAP(thoop2_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", thoop2_state, irq6_line_hold) - MCFG_CPU_ADD("mcu", DS5002FP, XTAL_24MHz/2) /* ? */ - MCFG_DS5002FP_CONFIG( 0x79, 0x00, 0x80 ) /* default config verified on chip */ - MCFG_CPU_PROGRAM_MAP(dallas_rom) - MCFG_CPU_IO_MAP(dallas_ram) - - MCFG_QUANTUM_PERFECT_CPU("mcu") + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") MCFG_WATCHDOG_ADD("watchdog") @@ -267,14 +228,21 @@ static MACHINE_CONFIG_START( thoop2 ) MACHINE_CONFIG_END + ROM_START( thoop2 ) ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_BYTE( "th2c23.040", 0x000000, 0x080000, CRC(3e465753) SHA1(1ea1173b9fe5d652e7b5fafb822e2535cecbc198) ) ROM_LOAD16_BYTE( "th2c22.040", 0x000001, 0x080000, CRC(837205b7) SHA1(f78b90c2be0b4dddaba26f074ea00eff863cfdb2) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "thoop2_ds5002fp.bin", 0x00000, 0x8000, BAD_DUMP CRC(67cbf579) SHA1(40a543b9d0f57d374ceccb720be20b9e42ecc91a) ) /* marked as BAD_DUMP until a 2nd board is used to verify, also because game currently crashes */ + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x79 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x800000, "gfx1", 0 ) ROM_LOAD( "th2-h8.32m", 0x000000, 0x400000, CRC(60328a11) SHA1(fcdb374d2fc7ef5351a4181c471d192199dc2081) ) ROM_LOAD( "th2-h12.32m", 0x400000, 0x400000, CRC(b25c2d3e) SHA1(d70f3e4e2432d80c2ac87cd81208ada303bac04a) ) diff --git a/src/mame/drivers/wrally.cpp b/src/mame/drivers/wrally.cpp index 60401759c04..6dca3688eaa 100644 --- a/src/mame/drivers/wrally.cpp +++ b/src/mame/drivers/wrally.cpp @@ -128,7 +128,7 @@ The PCB has a layout that can either use the 4 rom set of I7, I9, I11 & I13 or l #include "includes/wrally.h" #include "cpu/m68000/m68000.h" -#include "cpu/mcs51/mcs51.h" +#include "machine/gaelco_ds5002fp.h" #include "sound/okim6295.h" #include "screen.h" #include "speaker.h" @@ -155,27 +155,7 @@ static ADDRESS_MAP_START( wrally_map, AS_PROGRAM, 16, wrally_state ) AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with DS5002FP) */ ADDRESS_MAP_END -READ8_MEMBER(wrally_state::dallas_share_r) -{ - uint8_t *shareram = (uint8_t *)m_shareram.target(); - - return shareram[BYTE_XOR_BE(offset)]; -} - -WRITE8_MEMBER(wrally_state::dallas_share_w) -{ - uint8_t *shareram = (uint8_t *)m_shareram.target(); - - shareram[BYTE_XOR_BE(offset)] = data; -} - -static ADDRESS_MAP_START( dallas_rom, AS_PROGRAM, 8, wrally_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM /* Code in NVRAM */ -ADDRESS_MAP_END -static ADDRESS_MAP_START( dallas_ram, AS_IO, 8, wrally_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(dallas_share_r, dallas_share_w) AM_MASK(0x3fff) /* Shared RAM with the main CPU */ -ADDRESS_MAP_END static ADDRESS_MAP_START( oki_map, 0, 8, wrally_state ) AM_RANGE(0x00000, 0x2ffff) AM_ROM @@ -280,12 +260,8 @@ static MACHINE_CONFIG_START( wrally ) MCFG_CPU_PROGRAM_MAP(wrally_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", wrally_state, irq6_line_hold) - MCFG_CPU_ADD("mcu", DS5002FP, XTAL_24MHz/2) /* verified on pcb */ - MCFG_DS5002FP_CONFIG( 0x88, 0x00, 0x80 ) - MCFG_CPU_PROGRAM_MAP(dallas_rom) - MCFG_CPU_IO_MAP(dallas_ram) - - MCFG_QUANTUM_TIME(attotime::from_hz(38400)) /* heavy sync */ + MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP_WRALLY, XTAL_24MHz / 2) /* verified on pcb */ + GAELCO_DS5002FP_SET_SHARE_TAG("shareram") /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -300,7 +276,6 @@ static MACHINE_CONFIG_START( wrally ) MCFG_PALETTE_ADD("palette", 1024*8) MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -315,9 +290,15 @@ ROM_START( wrally ) ROM_LOAD16_BYTE( "worldr17.c23", 0x000000, 0x080000, CRC(050f5629) SHA1(74fc2cd5114f3bc4b2429f1d8d7eeb1658f9f179) ) /* Only difference compared to set 2 is how the Dallas DS5002FP */ ROM_LOAD16_BYTE( "worldr16.c22", 0x000001, 0x080000, CRC(9e0d126c) SHA1(369360b7ec2c3497af3bf62b4eba24c3d9f94675) ) /* power failure shows on screen, IE: "Tension baja " */ - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x88 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x200000, "gfx1", 0 ) ROM_LOAD16_BYTE( "worldr21.i13", 0x000000, 0x080000, CRC(b7fddb12) SHA1(619a75daac8cbba7e85c97ca19733e2196d66d5c) ) ROM_LOAD16_BYTE( "worldr20.i11", 0x000001, 0x080000, CRC(58b2809a) SHA1(8741ec544c54e2a2f5d17ac2f8400ee2ce382e83) ) @@ -342,9 +323,15 @@ ROM_START( wrallya ) ROM_LOAD16_BYTE( "c23.bin", 0x000000, 0x080000, CRC(8b7d93c3) SHA1(ce4163eebc5d4a0c1266d650523b1ffc702d1b87) ) /* Only difference compared to set 1 is how the Dallas DS5002FP */ ROM_LOAD16_BYTE( "c22.bin", 0x000001, 0x080000, CRC(56da43b6) SHA1(02db8f969ed5e7f5e5356c45c0312faf5f000335) ) /* power failure shows on screen, IE: "Power Failure" */ - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x88 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x200000, "gfx1", 0 ) ROM_LOAD16_BYTE( "worldr21.i13", 0x000000, 0x080000, CRC(b7fddb12) SHA1(619a75daac8cbba7e85c97ca19733e2196d66d5c) ) ROM_LOAD16_BYTE( "worldr20.i11", 0x000001, 0x080000, CRC(58b2809a) SHA1(8741ec544c54e2a2f5d17ac2f8400ee2ce382e83) ) @@ -369,9 +356,15 @@ ROM_START( wrallyb ) ROM_LOAD16_BYTE( "rally_c23.c23", 0x000000, 0x080000, CRC(ddd6f833) SHA1(f12f82c412fa93f46020d50c2620974ae2fb502b) ) ROM_LOAD16_BYTE( "rally_c22.c22", 0x000001, 0x080000, CRC(59a0d35c) SHA1(7c6f376a53c1e6d793cbfb16861ee3298ee013a1) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x88 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x200000, "gfx1", 0 ) ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) /* Same data, different layout */ ROM_LOAD( "rally h-8.h8", 0x100000, 0x100000, CRC(58dcd024) SHA1(384ff296d3c7c8e0c4469231d1940de3cea89fc2) ) @@ -392,9 +385,15 @@ ROM_START( wrallyat ) /* Board Marked 930217, Atari License */ ROM_LOAD16_BYTE( "rally.c23", 0x000000, 0x080000, CRC(366595ad) SHA1(e16341ed9eacf9b729c28184268150ea9b62f185) ) /* North & South America only... */ ROM_LOAD16_BYTE( "rally.c22", 0x000001, 0x080000, CRC(0ad4ec6f) SHA1(991557cf25fe960b1c586e990e6019befe5a11d0) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) + ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) + /* these are the default states stored in NVRAM */ + DS5002FP_SET_MON( 0x88 ) + DS5002FP_SET_RPCTL( 0x00 ) + DS5002FP_SET_CRCR( 0x80 ) + ROM_REGION( 0x200000, "gfx1", 0 ) ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) /* Same data, different layout */ ROM_LOAD( "rally h-8.h8", 0x100000, 0x100000, CRC(58dcd024) SHA1(384ff296d3c7c8e0c4469231d1940de3cea89fc2) ) diff --git a/src/mame/includes/gaelco2.h b/src/mame/includes/gaelco2.h index 60c46381ab7..d4657749af3 100644 --- a/src/mame/includes/gaelco2.h +++ b/src/mame/includes/gaelco2.h @@ -17,18 +17,9 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_generic_paletteram_16(*this, "paletteram"), - m_shareram(*this, "shareram"), - m_mcu_ram(*this, "mcu") + m_shareram(*this, "shareram") { } - - DECLARE_READ16_MEMBER(maniacsqa_prot_r); - - DECLARE_READ8_MEMBER(dallas_ram_r); - DECLARE_WRITE8_MEMBER(dallas_ram_w); - DECLARE_READ8_MEMBER(dallas_share_r); - DECLARE_WRITE8_MEMBER(dallas_share_w); - DECLARE_WRITE16_MEMBER(gaelco2_coin_w); DECLARE_WRITE16_MEMBER(gaelco2_coin2_w); DECLARE_WRITE16_MEMBER(touchgo_coin_w); @@ -39,7 +30,6 @@ public: DECLARE_DRIVER_INIT(touchgo); DECLARE_DRIVER_INIT(snowboar); DECLARE_DRIVER_INIT(alighunt); - DECLARE_DRIVER_INIT(maniacsqa); TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen0); TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen1); TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen0_dual); @@ -74,8 +64,6 @@ private: required_device<palette_device> m_palette; required_shared_ptr<uint16_t> m_generic_paletteram_16; optional_shared_ptr<uint16_t> m_shareram; - optional_region_ptr<uint8_t> m_mcu_ram; - }; diff --git a/src/mame/includes/glass.h b/src/mame/includes/glass.h index a0af86de946..dabe0bb901d 100644 --- a/src/mame/includes/glass.h +++ b/src/mame/includes/glass.h @@ -17,7 +17,7 @@ public: m_videoram(*this, "videoram"), m_vregs(*this, "vregs"), m_spriteram(*this, "spriteram"), - m_mainram(*this, "mainram") { } + m_shareram(*this, "shareram") { } /* devices */ @@ -29,7 +29,7 @@ public: required_shared_ptr<uint16_t> m_videoram; required_shared_ptr<uint16_t> m_vregs; required_shared_ptr<uint16_t> m_spriteram; - required_shared_ptr<uint16_t> m_mainram; + required_shared_ptr<uint16_t> m_shareram; /* video-related */ tilemap_t *m_pant[2]; @@ -46,11 +46,8 @@ public: DECLARE_WRITE16_MEMBER(coin_w); DECLARE_WRITE16_MEMBER(blitter_w); DECLARE_WRITE16_MEMBER(vram_w); - DECLARE_READ16_MEMBER(mainram_r); - DECLARE_WRITE16_MEMBER(mainram_w); DECLARE_DRIVER_INIT(glass); - DECLARE_DRIVER_INIT(glassp); virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; diff --git a/src/mame/includes/targeth.h b/src/mame/includes/targeth.h index c2c5231100f..caa695e2d49 100644 --- a/src/mame/includes/targeth.h +++ b/src/mame/includes/targeth.h @@ -30,6 +30,7 @@ public: TILE_GET_INFO_MEMBER(get_tile_info_screen1); virtual void video_start() override; + virtual void machine_start() override; TIMER_DEVICE_CALLBACK_MEMBER(interrupt); diff --git a/src/mame/includes/thoop2.h b/src/mame/includes/thoop2.h index 389f0154862..34ac8d40a23 100644 --- a/src/mame/includes/thoop2.h +++ b/src/mame/includes/thoop2.h @@ -10,20 +10,13 @@ public: m_palette(*this, "palette"), m_videoram(*this, "videoram"), m_vregs(*this, "vregs"), - m_spriteram(*this, "spriteram"), - m_shareram(*this, "shareram"), - m_mcu_ram(*this, "mcu") + m_spriteram(*this, "spriteram") { } DECLARE_WRITE16_MEMBER(OKIM6295_bankswitch_w); DECLARE_WRITE16_MEMBER(coin_w); DECLARE_WRITE16_MEMBER(vram_w); - DECLARE_READ8_MEMBER(dallas_ram_r); - DECLARE_WRITE8_MEMBER(dallas_ram_w); - DECLARE_READ8_MEMBER(dallas_share_r); - DECLARE_WRITE8_MEMBER(dallas_share_w); - virtual void machine_start() override; virtual void video_start() override; @@ -45,6 +38,4 @@ private: required_shared_ptr<uint16_t> m_videoram; required_shared_ptr<uint16_t> m_vregs; required_shared_ptr<uint16_t> m_spriteram; - required_shared_ptr<uint16_t> m_shareram; - required_region_ptr<uint8_t> m_mcu_ram; }; diff --git a/src/mame/machine/gaelco_ds5002fp.cpp b/src/mame/machine/gaelco_ds5002fp.cpp new file mode 100644 index 00000000000..16336e3dc7b --- /dev/null +++ b/src/mame/machine/gaelco_ds5002fp.cpp @@ -0,0 +1,100 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +#include "emu.h" +#include "machine/gaelco_ds5002fp.h" + +DEFINE_DEVICE_TYPE(GAELCO_DS5002FP, gaelco_ds5002fp_device, "gaelco_ds5002fp", "Gaelco DS5002FP") +DEFINE_DEVICE_TYPE(GAELCO_DS5002FP_WRALLY, gaelco_ds5002fp_wrally_device, "gaelco_ds5002fp_wr", "Gaelco DS5002FP (World Rally)") + + +gaelco_ds5002fp_device_base::gaelco_ds5002fp_device_base(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock) + : device_t(mconfig, type, tag, owner, clock), + m_shareram(*this, finder_base::DUMMY_TAG), + m_sram(*this, "sram") +{ +} + +void gaelco_ds5002fp_device_base::static_set_share_tag(device_t &device, const char *tag) +{ + downcast<gaelco_ds5002fp_device_base &>(device).m_shareram.set_tag(tag); +} + +READ8_MEMBER(gaelco_ds5002fp_device_base::shareram_r) +{ + uint8_t *shareram = (uint8_t *)m_shareram.target(); + return shareram[BYTE_XOR_BE(offset)]; +} + +WRITE8_MEMBER(gaelco_ds5002fp_device_base::shareram_w) +{ + uint8_t *shareram = (uint8_t *)m_shareram.target(); + shareram[BYTE_XOR_BE(offset)] = data; +} + +READ8_MEMBER(gaelco_ds5002fp_device_base::sram_r) +{ + return m_sram[offset]; +} + +WRITE8_MEMBER(gaelco_ds5002fp_device_base::sram_w) +{ + m_sram[offset] = data; +} + +void gaelco_ds5002fp_device_base::device_start() +{ +} + +void gaelco_ds5002fp_device_base::device_reset() +{ +} + +gaelco_ds5002fp_device::gaelco_ds5002fp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : gaelco_ds5002fp_device_base(mconfig, GAELCO_DS5002FP, tag, owner, clock) +{ +} + +static ADDRESS_MAP_START( dallas_rom, AS_PROGRAM, 8, gaelco_ds5002fp_device ) + AM_RANGE(0x00000, 0x07fff) AM_READ(sram_r) /* Code in SRAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dallas_ram, AS_IO, 8, gaelco_ds5002fp_device ) + AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(shareram_r, shareram_w) /* confirmed that 0x8000 - 0xffff is a window into 68k shared RAM */ + AM_RANGE(0x10000, 0x17fff) AM_RAM AM_SHARE("sram") /* yes, the games access it as data and use it for temporary storage!! */ +ADDRESS_MAP_END + +MACHINE_CONFIG_MEMBER(gaelco_ds5002fp_device::device_add_mconfig) + MCFG_CPU_ADD("mcu", DS5002FP, DERIVED_CLOCK(1, 1)) + MCFG_CPU_PROGRAM_MAP(dallas_rom) + MCFG_CPU_IO_MAP(dallas_ram) + + MCFG_QUANTUM_PERFECT_CPU("mcu") + + MCFG_NVRAM_ADD_0FILL("sram") +MACHINE_CONFIG_END + + +gaelco_ds5002fp_wrally_device::gaelco_ds5002fp_wrally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : gaelco_ds5002fp_device_base(mconfig, GAELCO_DS5002FP_WRALLY, tag, owner, clock) +{ +} + +static ADDRESS_MAP_START( dallas_rom_wr, AS_PROGRAM, 8, gaelco_ds5002fp_wrally_device ) + AM_RANGE(0x00000, 0x07fff) AM_READ(sram_r) /* Code in SRAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dallas_ram_wr, AS_IO, 8, gaelco_ds5002fp_wrally_device ) + AM_RANGE(0x00000, 0x0ffff) AM_READWRITE(shareram_r, shareram_w) AM_MASK(0x3fff) /* Shared RAM with the main CPU */ + AM_RANGE(0x10000, 0x17fff) AM_RAM AM_SHARE("sram") /*don't think World Rally actually uses it for storage tho */ +ADDRESS_MAP_END + +MACHINE_CONFIG_MEMBER(gaelco_ds5002fp_wrally_device::device_add_mconfig) + MCFG_CPU_ADD("mcu", DS5002FP, DERIVED_CLOCK(1, 1)) + MCFG_CPU_PROGRAM_MAP(dallas_rom_wr) + MCFG_CPU_IO_MAP(dallas_ram_wr) + + MCFG_QUANTUM_PERFECT_CPU("mcu") + + MCFG_NVRAM_ADD_0FILL("sram") +MACHINE_CONFIG_END + diff --git a/src/mame/machine/gaelco_ds5002fp.h b/src/mame/machine/gaelco_ds5002fp.h new file mode 100644 index 00000000000..088f9d11fe9 --- /dev/null +++ b/src/mame/machine/gaelco_ds5002fp.h @@ -0,0 +1,58 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +#ifndef MAME_MACHINE_GAELCO_DS5002FP_H +#define MAME_MACHINE_GAELCO_DS5002FP_H + +#pragma once + +#include "cpu/mcs51/mcs51.h" +#include "machine/nvram.h" + +DECLARE_DEVICE_TYPE(GAELCO_DS5002FP, gaelco_ds5002fp_device) +DECLARE_DEVICE_TYPE(GAELCO_DS5002FP_WRALLY, gaelco_ds5002fp_wrally_device) + +#define GAELCO_DS5002FP_SET_SHARE_TAG(_tag) \ + gaelco_ds5002fp_device_base::static_set_share_tag(*device, "^" _tag); + +class gaelco_ds5002fp_device_base : public device_t +{ +public: + static void static_set_share_tag(device_t &device, const char *tag); + + DECLARE_READ8_MEMBER(sram_r); + DECLARE_WRITE8_MEMBER(sram_w); + DECLARE_READ8_MEMBER(shareram_r); + DECLARE_WRITE8_MEMBER(shareram_w); + +protected: + gaelco_ds5002fp_device_base(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock); + + virtual void device_start() override; + virtual void device_reset() override; + +private: + required_shared_ptr<uint16_t> m_shareram; + required_region_ptr<uint8_t> m_sram; +}; + + +class gaelco_ds5002fp_device : public gaelco_ds5002fp_device_base +{ +public: + gaelco_ds5002fp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_add_mconfig(machine_config &config) override; +}; + + +class gaelco_ds5002fp_wrally_device : public gaelco_ds5002fp_device_base +{ +public: + gaelco_ds5002fp_wrally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual void device_add_mconfig(machine_config &config) override; +}; + +#endif // MAME_MACHINE_GAELCO_DS5002FP_H |