dragon gun through the generic protection implementation (nw)

This commit is contained in:
David Haywood 2013-07-21 10:47:09 +00:00
parent 076b0f7f7d
commit be46e114b7
4 changed files with 50 additions and 42 deletions

View File

@ -345,6 +345,12 @@ WRITE32_MEMBER(deco32_state::deco32_sound_w)
m_audiocpu->set_input_line(0, HOLD_LINE);
}
void deco32_state::deco32_sound_cb( address_space &space, UINT16 data, UINT16 mem_mask )
{
soundlatch_byte_w(space,0,data & 0xff);
m_audiocpu->set_input_line(0, HOLD_LINE);
}
READ32_MEMBER(deco32_state::deco32_71_r)
{
/* Bit 0x80 goes high when sprite DMA is complete, and low
@ -692,6 +698,7 @@ static ADDRESS_MAP_START( captaven_map, AS_PROGRAM, 32, deco32_state )
AM_RANGE(0x128000, 0x128fff) AM_DEVREAD("ioprot", deco146_device,captaven_prot_r)
AM_RANGE(0x1280c8, 0x1280cb) AM_WRITE(deco32_sound_w)
AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(deco32_nonbuffered_palette_w) AM_SHARE("paletteram") /* Palette RAM */
AM_RANGE(0x148000, 0x14800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w)
AM_RANGE(0x160000, 0x167fff) AM_RAM /* Extra work RAM */
@ -816,13 +823,34 @@ static ADDRESS_MAP_START( fghthsta_memmap, AS_PROGRAM, 32, deco32_state )
ADDRESS_MAP_END
READ16_MEMBER( deco32_state::dg_protection_region_0_146_r )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
UINT8 cs = 0;
UINT16 data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
}
WRITE16_MEMBER( deco32_state::dg_protection_region_0_146_w )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
UINT8 cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
// the video drawing (especially sprite) code on this is too slow to cope with proper partial updates
// raster effects appear to need some work on it anyway?
static ADDRESS_MAP_START( dragngun_map, AS_PROGRAM, 32, dragngun_state )
AM_RANGE(0x000000, 0x0fffff) AM_ROM
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram")
AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r)
AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
// AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r)
AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) AM_MIRROR(0xff000000)
// AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w)
AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(deco32_buffered_palette_w) AM_SHARE("paletteram")
AM_RANGE(0x138000, 0x138003) AM_NOP /* Palette dma complete in bit 0x8? ack? return 0 else tight loop */
@ -868,8 +896,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( lockload_map, AS_PROGRAM, 32, dragngun_state )
AM_RANGE(0x000000, 0x0fffff) AM_ROM
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram")
AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r)
AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
// AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r)
// AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) AM_MIRROR(0xff000000)
AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w)
AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(deco32_buffered_palette_w) AM_SHARE("paletteram")
@ -1231,7 +1261,7 @@ static INPUT_PORTS_START( fghthist )
INPUT_PORTS_END
static INPUT_PORTS_START( dragngun )
PORT_START("IN0")
PORT_START("INPUTS")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
@ -1249,23 +1279,12 @@ static INPUT_PORTS_START( dragngun )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
PORT_START("IN1")
PORT_START("SYSTEM")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) //check //test BUTTON F2
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_START("DSW")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) /* Would be a dipswitch, but only 1 present on board */
@ -1318,7 +1337,7 @@ static INPUT_PORTS_START( dragngun )
INPUT_PORTS_END
static INPUT_PORTS_START( lockload )
PORT_START("IN0")
PORT_START("INPUTS")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
@ -1336,12 +1355,11 @@ static INPUT_PORTS_START( lockload )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
PORT_START("IN1")
PORT_START("SYSTEM")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) //check //test BUTTON F2
PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_START("DSW")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) /* Would be a dipswitch, but only 1 present on board */
@ -1982,6 +2000,10 @@ static MACHINE_CONFIG_START( dragngun, dragngun_state )
MCFG_VIDEO_START_OVERRIDE(dragngun_state,dragngun)
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb)
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -2060,6 +2082,8 @@ static MACHINE_CONFIG_START( lockload, dragngun_state )
MCFG_VIDEO_START_OVERRIDE(dragngun_state,lockload)
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb)
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -145,6 +145,9 @@ public:
UINT16 port_c_fghthist(int unused);
READ32_MEMBER( fghthist_protection_region_0_146_r );
WRITE32_MEMBER( fghthist_protection_region_0_146_w );
READ16_MEMBER( dg_protection_region_0_146_r );
WRITE16_MEMBER( dg_protection_region_0_146_w );
void deco32_sound_cb( address_space &space, UINT16 data, UINT16 mem_mask );
};

View File

@ -1496,24 +1496,6 @@ READ32_MEMBER(deco_146_base_device::captaven_prot_r)
}
// alt read addresses? make sure this isn't 104
READ32_MEMBER(deco_146_base_device::dragngun_prot_r)
{
// logerror("%08x:Read prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask);
// this should be vblank in the port!
if (!m_strobe) m_strobe=8;
else m_strobe=0;
switch (offset<<1) {
case 0x140/2: return 0xffff0000 | ioport(":IN0")->read(); /* IN0 */
case 0xadc/2: return 0xffff0000 | ioport(":IN1")->read() | m_strobe; /* IN1 */
case 0x6a0/2: return 0xffff0000 | ioport(":DSW")->read(); /* IN2 (Dip switch) */
}
return 0xffffffff;
}
const device_type DECO146PROT = &device_creator<deco146_device>;

View File

@ -54,7 +54,6 @@ public:
static void set_use_magic_read_address_xor(device_t &device, int use_xor);
// legacy stuff
DECLARE_READ32_MEMBER(dragngun_prot_r);
DECLARE_READ32_MEMBER(captaven_prot_r);
DECLARE_READ16_MEMBER(lemmings_prot_r);
DECLARE_READ16_MEMBER(robocop2_prot_r);