improve naming etc.

This commit is contained in:
David Haywood 2017-07-20 13:01:05 +01:00
parent d1159c6f07
commit 2834e15e9a
7 changed files with 36 additions and 17 deletions

View File

@ -196,6 +196,7 @@ 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 )
@ -577,6 +578,7 @@ 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
/*
@ -833,6 +835,7 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( touchgo_d5002fp, touchgo )
MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2) /* ? */
GAELCO_DS5002FP_SET_SHARE_TAG("shareram")
MACHINE_CONFIG_END
/*
@ -1275,6 +1278,7 @@ static MACHINE_CONFIG_START( wrally2 )
MCFG_CPU_VBLANK_INT_DRIVER("lscreen", gaelco2_state, irq6_line_hold)
MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2)
GAELCO_DS5002FP_SET_SHARE_TAG("shareram")
MCFG_EEPROM_SERIAL_93C66_ADD("eeprom")

View File

@ -230,6 +230,7 @@ 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 */

View File

@ -234,6 +234,7 @@ static MACHINE_CONFIG_START( targeth )
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)

View File

@ -202,6 +202,7 @@ static MACHINE_CONFIG_START( thoop2 )
MCFG_CPU_VBLANK_INT_DRIVER("screen", thoop2_state, irq6_line_hold)
MCFG_DEVICE_ADD("gaelco_ds5002fp", GAELCO_DS5002FP, XTAL_24MHz / 2)
GAELCO_DS5002FP_SET_SHARE_TAG("shareram")
MCFG_WATCHDOG_ADD("watchdog")

View File

@ -261,6 +261,7 @@ static MACHINE_CONFIG_START( wrally )
MCFG_CPU_VBLANK_INT_DRIVER("screen", wrally_state, irq6_line_hold)
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)

View File

@ -6,33 +6,39 @@
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, ":shareram"),
m_mcu_ram(*this, "sram")
m_shareram(*this, finder_base::DUMMY_TAG),
m_sram(*this, "sram")
{
}
READ8_MEMBER(gaelco_ds5002fp_device_base::dallas_share_r)
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::dallas_share_w)
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::dallas_ram_r)
READ8_MEMBER(gaelco_ds5002fp_device_base::sram_r)
{
return m_mcu_ram[offset];
return m_sram[offset];
}
WRITE8_MEMBER(gaelco_ds5002fp_device_base::dallas_ram_w)
WRITE8_MEMBER(gaelco_ds5002fp_device_base::sram_w)
{
m_mcu_ram[offset] = data;
m_sram[offset] = data;
}
void gaelco_ds5002fp_device_base::device_start()
@ -49,11 +55,11 @@ gaelco_ds5002fp_device::gaelco_ds5002fp_device(const machine_config &mconfig, co
}
static ADDRESS_MAP_START( dallas_rom, AS_PROGRAM, 8, gaelco_ds5002fp_device )
AM_RANGE(0x00000, 0x07fff) AM_READ(dallas_ram_r) /* Code in NVRAM */
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(dallas_share_r, dallas_share_w) /* confirmed that 0x8000 - 0xffff is a window into 68k shared RAM */
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
@ -74,11 +80,11 @@ gaelco_ds5002fp_wrally_device::gaelco_ds5002fp_wrally_device(const machine_confi
}
static ADDRESS_MAP_START( dallas_rom_wr, AS_PROGRAM, 8, gaelco_ds5002fp_wrally_device )
AM_RANGE(0x00000, 0x07fff) AM_READ(dallas_ram_r) /* Code in NVRAM */
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(dallas_share_r, dallas_share_w) AM_MASK(0x3fff) /* Shared RAM with the main CPU */
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

View File

@ -11,13 +11,18 @@
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:
DECLARE_READ8_MEMBER(dallas_ram_r);
DECLARE_WRITE8_MEMBER(dallas_ram_w);
DECLARE_READ8_MEMBER(dallas_share_r);
DECLARE_WRITE8_MEMBER(dallas_share_w);
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);
@ -27,7 +32,7 @@ protected:
private:
required_shared_ptr<uint16_t> m_shareram;
required_region_ptr<uint8_t> m_mcu_ram;
required_region_ptr<uint8_t> m_sram;
};