shift some more bits around for further studying (nw)

This commit is contained in:
David Haywood 2013-07-19 15:43:29 +00:00
parent 2038ce82ad
commit f6b13b94ba
9 changed files with 123 additions and 72 deletions

View File

@ -123,23 +123,6 @@ WRITE16_MEMBER(cninja_state::cninja_irq_w)
logerror("%08x: Unmapped IRQ write %d %04x\n", space.device().safe_pc(), offset, data);
}
READ16_MEMBER(cninja_state::robocop2_prot_r)
{
switch (offset << 1)
{
case 0x41a: /* Player 1 & 2 input ports */
return ioport("IN0")->read();
case 0x320: /* Coins */
return ioport("IN1")->read();
case 0x4e6: /* Dip switches */
return ioport("DSW")->read();
case 0x504: /* PC: 6b6. b4, 2c, 36 written before read */
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset);
return 0x84;
}
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset);
return 0;
}
/**********************************************************************************/
@ -310,7 +293,7 @@ static ADDRESS_MAP_START( robocop2_map, AS_PROGRAM, 16, cninja_state )
AM_RANGE(0x180000, 0x1807ff) AM_RAM AM_SHARE("spriteram")
// AM_RANGE(0x18c000, 0x18c0ff) AM_WRITE(cninja_loopback_w) /* Protection writes */
AM_RANGE(0x18c000, 0x18c7ff) AM_READ(robocop2_prot_r) /* Protection device */
AM_RANGE(0x18c000, 0x18c7ff) AM_DEVREAD("ioprot", deco146_device,robocop2_prot_r) /* Protection device */
AM_RANGE(0x18c064, 0x18c065) AM_WRITE(cninja_sound_w)
AM_RANGE(0x198000, 0x198001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */
AM_RANGE(0x1a8000, 0x1a9fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
@ -1196,6 +1179,8 @@ static MACHINE_CONFIG_START( robocop2, cninja_state )
decospr_device::set_gfx_region(*device, 3);
decospr_device::set_pri_callback(*device, cninja_pri_callback);
MCFG_DECO146_ADD("ioprot")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -353,18 +353,6 @@ READ32_MEMBER(deco32_state::deco32_71_r)
return 0xffffffff;
}
READ32_MEMBER(deco32_state::captaven_prot_r)
{
/* Protection/IO chip 75, same as Lemmings & Robocop 2 */
switch (offset<<2) {
case 0x0a0: return ioport("IN0")->read(); /* Player 1 & 2 controls */
case 0x158: return ioport("IN1")->read(); /* Player 3 & 4 controls */
case 0xed4: return ioport("IN2")->read(); /* Misc */
}
logerror("%08x: Unmapped protection read %04x\n",space.device().safe_pc(),offset<<2);
return 0xffffffff;
}
READ32_MEMBER(deco32_state::captaven_soundcpu_r)
{
@ -415,23 +403,6 @@ READ32_MEMBER(deco32_state::lockload_gun_mirror_r)
return ioport("IN3")->read() | ioport("LIGHT0_X")->read() | (ioport("LIGHT0_X")->read()<<16) | (ioport("LIGHT0_X")->read()<<24); //((machine().rand()%0xff)<<16);
}
READ32_MEMBER(deco32_state::dragngun_prot_r)
{
// logerror("%08x:Read prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask);
if (!m_strobe) m_strobe=8;
else m_strobe=0;
//definitely vblank in locked load
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;
}
READ32_MEMBER(dragngun_state::dragngun_lightgun_r)
{
@ -720,7 +691,7 @@ static ADDRESS_MAP_START( captaven_map, AS_PROGRAM, 32, deco32_state )
AM_RANGE(0x110000, 0x111fff) AM_READWRITE(deco32_spriteram_r, deco32_spriteram_w)
AM_RANGE(0x120000, 0x127fff) AM_RAM AM_SHARE("ram") /* Main RAM */
AM_RANGE(0x128000, 0x128fff) AM_READ(captaven_prot_r)
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)
@ -813,7 +784,7 @@ ADDRESS_MAP_END
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_READ(dragngun_prot_r)
AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r)
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")
@ -860,7 +831,7 @@ 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_READ(dragngun_prot_r)
AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r)
AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w)
@ -1732,6 +1703,7 @@ static MACHINE_CONFIG_START( captaven, deco32_state )
decospr_device::set_gfx_region(*device, 3);
decospr_device::set_pri_callback(*device, captaven_pri_callback);
MCFG_DECO146_ADD("ioprot")
MCFG_VIDEO_START_OVERRIDE(deco32_state,captaven)
@ -1782,6 +1754,8 @@ static MACHINE_CONFIG_START( fghthist, deco32_state ) /* DE-0380-2 PCB */
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
decospr_device::set_gfx_region(*device, 3);
MCFG_DECO146_ADD("ioprot")
MCFG_VIDEO_START_OVERRIDE(deco32_state,fghthist)
/* sound hardware */
@ -1829,6 +1803,8 @@ static MACHINE_CONFIG_START( fghthsta, deco32_state ) /* DE-0395-1 PCB */
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
decospr_device::set_gfx_region(*device, 3);
MCFG_DECO146_ADD("ioprot")
MCFG_VIDEO_START_OVERRIDE(deco32_state,fghthist)
/* sound hardware */
@ -1945,6 +1921,8 @@ static MACHINE_CONFIG_START( dragngun, dragngun_state )
MCFG_VIDEO_START_OVERRIDE(dragngun_state,dragngun)
MCFG_DECO146_ADD("ioprot")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -2021,6 +1999,8 @@ static MACHINE_CONFIG_START( lockload, dragngun_state )
MCFG_VIDEO_START_OVERRIDE(dragngun_state,lockload)
MCFG_DECO146_ADD("ioprot")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -42,23 +42,7 @@ READ16_MEMBER(lemmings_state::lemmings_trackball_r)
return 0;
}
/* Same as Robocop 2 protection chip */
READ16_MEMBER(lemmings_state::lemmings_prot_r)
{
switch (offset << 1)
{
case 0x41a:
return ioport("BUTTONS")->read();
case 0x320:
return ioport("SYSTEM")->read();
case 0x4e6:
return ioport("DSW")->read();
}
return 0;
}
WRITE16_MEMBER(lemmings_state::lemmings_palette_24bit_w)
{
@ -96,7 +80,7 @@ static ADDRESS_MAP_START( lemmings_map, AS_PROGRAM, 16, lemmings_state )
AM_RANGE(0x160000, 0x160fff) AM_RAM_WRITE(lemmings_palette_24bit_w) AM_SHARE("paletteram")
AM_RANGE(0x170000, 0x17000f) AM_RAM_WRITE(lemmings_control_w) AM_SHARE("control_data")
AM_RANGE(0x190000, 0x19000f) AM_READ(lemmings_trackball_r)
AM_RANGE(0x1a0000, 0x1a07ff) AM_READ(lemmings_prot_r)
AM_RANGE(0x1a0000, 0x1a07ff) AM_DEVREAD("ioprot", deco146_device,lemmings_prot_r)
AM_RANGE(0x1a0064, 0x1a0065) AM_WRITE(lemmings_sound_w)
AM_RANGE(0x1c0000, 0x1c0001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* 1 written once a frame */
AM_RANGE(0x1e0000, 0x1e0001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) /* 1 written once a frame */
@ -276,6 +260,7 @@ static MACHINE_CONFIG_START( lemmings, lemmings_state )
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
decospr_device::set_gfx_region(*device, 0);
MCFG_DECO146_ADD("ioprot")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -65,7 +65,6 @@ public:
DECLARE_WRITE16_MEMBER(stoneage_sound_w);
DECLARE_READ16_MEMBER(cninja_irq_r);
DECLARE_WRITE16_MEMBER(cninja_irq_w);
DECLARE_READ16_MEMBER(robocop2_prot_r);
DECLARE_WRITE16_MEMBER(cninja_pf12_control_w);
DECLARE_WRITE16_MEMBER(cninja_pf34_control_w);
DECLARE_WRITE8_MEMBER(sound_bankswitch_w);

View File

@ -13,6 +13,7 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_deco146(*this, "ioprot"),
m_decobsmt(*this, "decobsmt"),
m_spriteram(*this, "spriteram"),
m_ram(*this, "ram"),
@ -33,6 +34,7 @@ public:
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<deco146_device> m_deco146;
optional_device<decobsmt_device> m_decobsmt;
optional_device<buffered_spriteram32_device> m_spriteram;
required_shared_ptr<UINT32> m_ram;
@ -54,7 +56,7 @@ public:
int m_raster_enable;
timer_device *m_raster_irq_timer;
UINT8 m_nslasher_sound_irq;
int m_strobe;
int m_tattass_eprom_bit;
int m_lastClock;
char m_buffer[32];
@ -89,13 +91,11 @@ public:
DECLARE_WRITE32_MEMBER(deco32_irq_controller_w);
DECLARE_WRITE32_MEMBER(deco32_sound_w);
DECLARE_READ32_MEMBER(deco32_71_r);
DECLARE_READ32_MEMBER(captaven_prot_r);
DECLARE_READ32_MEMBER(captaven_soundcpu_r);
DECLARE_READ32_MEMBER(fghthist_control_r);
DECLARE_WRITE32_MEMBER(fghthist_eeprom_w);
DECLARE_READ32_MEMBER(dragngun_service_r);
DECLARE_READ32_MEMBER(lockload_gun_mirror_r);
DECLARE_READ32_MEMBER(dragngun_prot_r);
DECLARE_READ32_MEMBER(tattass_prot_r);
DECLARE_WRITE32_MEMBER(tattass_prot_w);
DECLARE_WRITE32_MEMBER(tattass_control_w);

View File

@ -1,5 +1,6 @@
#include "video/bufsprite.h"
#include "video/decospr.h"
#include "machine/deco146.h"
class lemmings_state : public driver_device
{
@ -8,6 +9,7 @@ public:
: driver_device(mconfig, type, tag),
m_bitmap0(2048, 256),
m_audiocpu(*this, "audiocpu"),
m_deco146(*this, "ioprot"),
m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2") ,
m_paletteram(*this, "paletteram"),
@ -27,6 +29,7 @@ public:
UINT8 m_vram_buffer[2048 * 64]; // 64 bytes per VRAM character
/* devices */
required_device<cpu_device> m_audiocpu;
optional_device<deco146_device> m_deco146;
required_device<buffered_spriteram16_device> m_spriteram;
required_device<buffered_spriteram16_device> m_spriteram2;
/* memory pointers */
@ -40,7 +43,6 @@ public:
DECLARE_WRITE16_MEMBER(lemmings_control_w);
DECLARE_READ16_MEMBER(lemmings_trackball_r);
DECLARE_READ16_MEMBER(lemmings_prot_r);
DECLARE_WRITE16_MEMBER(lemmings_palette_24bit_w);
DECLARE_WRITE16_MEMBER(lemmings_sound_w);
DECLARE_WRITE8_MEMBER(lemmings_sound_ack_w);

View File

@ -18,6 +18,7 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_deco146(*this, "ioprot"),
m_decocomn(*this, "deco_common"),
m_deco_tilegen1(*this, "tilegen1"),
m_deco_tilegen2(*this, "tilegen2"),
@ -36,6 +37,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
optional_device<deco146_device> m_deco146;
required_device<decocomn_device> m_decocomn;
required_device<deco16ic_device> m_deco_tilegen1;
required_device<deco16ic_device> m_deco_tilegen2;

View File

@ -1435,6 +1435,96 @@ void deco146_device::device_reset()
m_latchflag = 0;
}
/****************************************************************************************************
*****************************************************************************************************
*****************************************************************************************************
*****************************************************************************************************
Old style minimal handlers (where games only really use the I/O)
currently used by
Robocop 2
Lemmings
Dragon Gun
Captain America
*****************************************************************************************************
*****************************************************************************************************
*****************************************************************************************************
****************************************************************************************************/
// alt read addresses (same as nitroball if you reverse lnes)
READ16_MEMBER(deco146_device::robocop2_prot_r)
{
switch (offset << 1)
{
case 0x41a: /* Player 1 & 2 input ports */
return ioport(":IN0")->read();
case 0x320: /* Coins */
return ioport(":IN1")->read();
case 0x4e6: /* Dip switches */
return ioport(":DSW")->read();
case 0x504: /* PC: 6b6. b4, 2c, 36 written before read */
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset);
return 0x84;
}
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset);
return 0;
}
// alt read addresses (same as nitroball if you reverse lnes)
/* Same as Robocop 2 protection chip */
READ16_MEMBER(deco146_device::lemmings_prot_r)
{
switch (offset << 1)
{
case 0x41a:
return ioport(":BUTTONS")->read();
case 0x320:
return ioport(":SYSTEM")->read();
case 0x4e6:
return ioport(":DSW")->read();
}
return 0;
}
// standard read addresses
READ32_MEMBER(deco146_device::captaven_prot_r)
{
/* Protection/IO chip 75, same as Lemmings & Robocop 2 */
switch (offset<<2) {
case 0x0a0: return ioport(":IN0")->read(); /* Player 1 & 2 controls */
case 0x158: return ioport(":IN1")->read(); /* Player 3 & 4 controls */
case 0xed4: return ioport(":IN2")->read(); /* Misc */
}
logerror("%08x: Unmapped protection read %04x\n",space.device().safe_pc(),offset<<2);
return 0xffffffff;
}
// alt read addresses? make sure this isn't 104
READ32_MEMBER(deco146_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;
}
/****************************************************************************************************
*****************************************************************************************************
*****************************************************************************************************

View File

@ -13,6 +13,12 @@ public:
void write_data(address_space &space, UINT16 address, UINT16 data, UINT16 mem_mask, UINT8 &csflags);
UINT16 read_data(UINT16 address, UINT16 mem_mask, UINT8 &csflags);
// 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);
protected:
virtual void device_config_complete();
virtual void device_start();
@ -41,6 +47,8 @@ protected:
int m_latchflag;
int m_strobe;
private:
UINT8 region_selects[6];