diff options
author | Dirk Best <mail@dirk-best.de> | 2017-09-22 03:47:59 +0200 |
---|---|---|
committer | Dirk Best <mail@dirk-best.de> | 2017-09-22 03:51:24 +0200 |
commit | c7d1aeb956c3d25ca8f30ab6b27f33ce4e599f25 (patch) | |
tree | 7a4057f6d9b586b9447b2c40b77cbb88f1e275bd | |
parent | 5e8a590c68701aa667c982924ea994e7c9dcec1f (diff) |
deco32: Improvements and cleanups
* Emulate LC7535 based volume control for Dragon Gun board based games
* Add DSW3 and DIP locations to Captain Avenger
* Reorganize driver and start cleaning it up (in progress)
-rw-r--r-- | scripts/src/sound.lua | 12 | ||||
-rw-r--r-- | scripts/target/mame/arcade.lua | 1 | ||||
-rw-r--r-- | scripts/target/mame/mess.lua | 1 | ||||
-rw-r--r-- | src/devices/sound/lc7535.cpp | 154 | ||||
-rw-r--r-- | src/devices/sound/lc7535.h | 96 | ||||
-rw-r--r-- | src/mame/drivers/deco32.cpp | 1931 | ||||
-rw-r--r-- | src/mame/includes/deco32.h | 61 | ||||
-rw-r--r-- | src/mame/video/deco32.cpp | 13 |
8 files changed, 1218 insertions, 1051 deletions
diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua index d96a6b73466..27bb7dbb826 100644 --- a/scripts/src/sound.lua +++ b/scripts/src/sound.lua @@ -1445,3 +1445,15 @@ if (SOUNDS["TA7630"]~=null) then MAME_DIR .. "src/devices/sound/ta7630.h", } end + +--------------------------------------------------- +-- Sanyo LC7535 +--@src/devices/sound/lc7535.h,SOUNDS["LC7535"] = true +--------------------------------------------------- + +if (SOUNDS["LC7535"]~=null) then + files { + MAME_DIR .. "src/devices/sound/lc7535.cpp", + MAME_DIR .. "src/devices/sound/lc7535.h", + } +end diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 6a0e4b7092b..3971eca9b3f 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -268,6 +268,7 @@ SOUNDS["DAC76"] = true SOUNDS["TA7630"] = true SOUNDS["MM5837"] = true --SOUNDS["DAVE"] = true +SOUNDS["LC7535"] = true -------------------------------------------------- -- specify available video cores diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 73f87e5faa1..8bdf4c09b37 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -269,6 +269,7 @@ SOUNDS["MEA8000"] = true --SOUNDS["DAC76"] = true --SOUNDS["MM5837"] = true SOUNDS["DAVE"] = true +--SOUNDS["LC7535"] = true -------------------------------------------------- -- specify available video cores diff --git a/src/devices/sound/lc7535.cpp b/src/devices/sound/lc7535.cpp new file mode 100644 index 00000000000..00f86ea2945 --- /dev/null +++ b/src/devices/sound/lc7535.cpp @@ -0,0 +1,154 @@ +// license: BSD-3-Clause +// copyright-holders: Dirk Best +/*************************************************************************** + + Sanyo LC7535 + + Electronic Volume/Loudness Control with Serial Data Control + + It uses the Sanyo CCB (Computer Control Bus) to communicate. The + device address is 0x08 or 0x09 (depending on the select pin). + +***************************************************************************/ + +#include "emu.h" +#include "lc7535.h" + + +//************************************************************************** +// CONSTEXPR DEFINITIONS +//************************************************************************** + +constexpr int lc7535_device::m_5db[]; +constexpr int lc7535_device::m_1db[]; + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(LC7535, lc7535_device, "lc7535", "Sanyo LC7535") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// lc7535_device - constructor +//------------------------------------------------- + +lc7535_device::lc7535_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, LC7535, tag, owner, clock), + m_select_cb(*this), + m_addr(0), m_data(0), + m_count(0), + m_ce(0), m_di(0), m_clk(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void lc7535_device::device_start() +{ + // resolve callbacks + m_select_cb.resolve(); + m_volume_cb.bind_relative_to(*owner()); + + // register for save states + save_item(NAME(m_addr)); + save_item(NAME(m_data)); + save_item(NAME(m_count)); + save_item(NAME(m_ce)); + save_item(NAME(m_di)); + save_item(NAME(m_clk)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void lc7535_device::device_reset() +{ +} + +//------------------------------------------------- +// normalize - convert attenuation to range 0-1 +//------------------------------------------------- + +float lc7535_device::normalize(int attenuation) +{ + return (attenuation + (MAX * (-1.0))) / (MAX * (-1.0)); +} + + +//************************************************************************** +// INTERFACE +//************************************************************************** + +WRITE_LINE_MEMBER( lc7535_device::ce_w ) +{ + m_ce = state; +} + +WRITE_LINE_MEMBER( lc7535_device::di_w ) +{ + m_di = state; +} + +WRITE_LINE_MEMBER( lc7535_device::clk_w ) +{ + if (m_clk == 0 && state == 1) + { + if (m_ce == 0) + { + if (m_count == 0) + m_addr = 0; + + m_addr <<= 1; + m_addr |= m_di; + + if (++m_count == 4) + { + m_addr = bitswap(m_addr, 0, 1, 2, 3); + m_count = 0; + } + } + else + { + // our address is either 8 or 9 + if (m_addr == (8 | (m_select_cb() ? 0 : 1))) + { + m_data <<= 1; + m_data |= m_di; + + if (++m_count == 16) + { + m_data = bitswap(m_data, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + + // right channel + int att_r = m_1db[(m_data >> 4) & 0x07]; + if (att_r != MAX) + att_r += m_5db[(m_data >> 0) & 0x0f]; + + // left channel + int att_l = m_1db[(m_data >> 12) & 0x07]; + if (att_l != MAX) + att_l += m_5db[(m_data >> 8) & 0x0f]; + + bool loudness = bool(BIT(m_data, 7)); + + if (!m_volume_cb.isnull()) + m_volume_cb(att_r, att_l, loudness); + + m_addr = 0; + m_count = 0; + } + } + } + } + + m_clk = state; +} diff --git a/src/devices/sound/lc7535.h b/src/devices/sound/lc7535.h new file mode 100644 index 00000000000..0ca10aa5a32 --- /dev/null +++ b/src/devices/sound/lc7535.h @@ -0,0 +1,96 @@ +// license: BSD-3-Clause +// copyright-holders: Dirk Best +/*************************************************************************** + + Sanyo LC7535 + + Electronic Volume/Loudness Control with Serial Data Control + + ___ ___ + L5dBIN 1 |* u | 22 R5dBIN + LCT1 2 | | 21 RCT1 + LCT2 3 | | 20 RCT2 + L5dBOUT 4 | | 19 R5dBOUT + L1dBIN 5 | | 18 R1dBIN + L1dBOUT 6 |LC7535P| 17 R1dBOUT + LVM 7 | | 16 RVM + VEE 8 | | 16 VCC + S 9 | | 14 CE + VDD 10 | | 13 DI + VSS 11 |_______| 12 CLK + +***************************************************************************/ + +#ifndef MAME_SOUND_LC7535_H +#define MAME_SOUND_LC7535_H + +#pragma once + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_LC7535_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, LC7535, 0) + +#define MCFG_LC7535_SELECT_CB(_read) \ + devcb = &lc7535_device::set_select_callback(*device, DEVCB_##_read); + +#define MCFG_LC7535_VOLUME_CB(_class, _method) \ + lc7535_device::set_volume_callback(*device, lc7535_device::volume_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define LC7535_VOLUME_CHANGED(name) void name(int attenuation_right, int attenuation_left, bool loudness) + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class lc7535_device : public device_t +{ +public: + // construction/destruction + lc7535_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + typedef device_delegate<void (int attenuation_right, int attenuation_left, bool loudness)> volume_delegate; + + static void set_volume_callback(device_t &device, volume_delegate &&cb) + { downcast<lc7535_device &>(device).m_volume_cb = std::move(cb); } + + template <class Object> static devcb_base &set_select_callback(device_t &device, Object &&cb) + { return downcast<lc7535_device &>(device).m_select_cb.set_callback(std::forward<Object>(cb)); } + + // serial interface + DECLARE_WRITE_LINE_MEMBER( ce_w ); + DECLARE_WRITE_LINE_MEMBER( di_w ); + DECLARE_WRITE_LINE_MEMBER( clk_w ); + + float normalize(int attenuation); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + // maximum attenuation is -98 dB for infinity + enum { MAX = -98 }; + + static constexpr int m_5db[16] = { -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, -0 }; + static constexpr int m_1db[8] = { MAX, MAX, -4, -3, -2, -1, 0, MAX }; + + // callbacks + devcb_read_line m_select_cb; + volume_delegate m_volume_cb; + + // state + uint8_t m_addr; + uint16_t m_data; + int m_count, m_ce, m_di, m_clk; +}; + +// device type definition +DECLARE_DEVICE_TYPE(LC7535, lc7535_device) + +#endif // MAME_SOUND_LC7535_H diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp index 844937b2fce..d12e8bae2d0 100644 --- a/src/mame/drivers/deco32.cpp +++ b/src/mame/drivers/deco32.cpp @@ -375,94 +375,581 @@ NOTE: There are several unpopulated locations (denoted by *) for additional rom #include "machine/input_merger.h" #include "speaker.h" -/**********************************************************************************/ -// TODO: probably clears both player 1 and player 2 -WRITE32_MEMBER(dragngun_state::gun_irq_ack_w) +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( captaven_map, AS_PROGRAM, 32, deco32_state ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM + AM_RANGE(0x100000, 0x100007) AM_READ(_71_r) + AM_RANGE(0x100000, 0x100003) AM_WRITE(buffer_spriteram_w) + AM_RANGE(0x108000, 0x108003) AM_WRITENOP /* ? */ + AM_RANGE(0x110000, 0x111fff) AM_READWRITE(spriteram_r, spriteram_w) + AM_RANGE(0x120000, 0x127fff) AM_RAM AM_SHARE("ram") /* Main RAM */ + AM_RANGE(0x128000, 0x12ffff) AM_READWRITE16(deco_146_r, deco_146_w, 0x0000ffff) + AM_RANGE(0x130000, 0x131fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") + AM_RANGE(0x148000, 0x14800f) AM_DEVICE8("irq", deco_irq_device, map, 0x000000ff) + AM_RANGE(0x160000, 0x167fff) AM_RAM /* Extra work RAM */ + AM_RANGE(0x168000, 0x168003) AM_READ8(captaven_dsw1_r, 0x000000ff) + AM_RANGE(0x168000, 0x168003) AM_READ8(captaven_dsw2_r, 0x0000ff00) + AM_RANGE(0x168000, 0x168003) AM_READ8(captaven_dsw3_r, 0x00ff0000) + AM_RANGE(0x168000, 0x168003) AM_READ8(captaven_soundcpu_status_r, 0xff000000) + AM_RANGE(0x178000, 0x178003) AM_WRITE(pri_w) + AM_RANGE(0x180000, 0x18001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x190000, 0x191fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x192000, 0x193fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) /* Mirror address - bug in program code */ + AM_RANGE(0x194000, 0x195fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x1a0000, 0x1a3fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x1a4000, 0x1a5fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x1c0000, 0x1c001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x1d0000, 0x1d1fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x1d4000, 0x1d5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) // unused + AM_RANGE(0x1e0000, 0x1e3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x1e4000, 0x1e5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") // unused +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fghthist_map, AS_PROGRAM, 32, deco32_state ) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x000000, 0x001fff) AM_ROM AM_WRITE(pf1_data_w) // wtf?? + AM_RANGE(0x000000, 0x0fffff) AM_ROM + AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x120020, 0x120023) AM_READ16(fghthist_in0_r, 0x0000ffff) + AM_RANGE(0x120024, 0x120027) AM_READ16(fghthist_in1_r, 0x0000ffff) + AM_RANGE(0x120028, 0x12002b) AM_READ8(eeprom_r, 0x000000ff) + AM_RANGE(0x12002c, 0x12002f) AM_WRITE8(eeprom_w, 0x000000ff) + AM_RANGE(0x12002c, 0x12002f) AM_WRITE8(volume_w, 0x0000ff00) + AM_RANGE(0x1201fc, 0x1201ff) AM_WRITE(sound_w) + AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) + AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) + AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram_r, spriteram_w) + AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram_w) + AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") + AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x16c000, 0x16c01f) AM_READNOP + AM_RANGE(0x17c000, 0x17c03f) AM_READNOP + AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(deco_146_r, deco_146_w, 0xffff0000) AM_SHARE("prot32ram") // only maps on 16-bits + AM_RANGE(0x208800, 0x208803) AM_WRITENOP /* ? */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fghthsta_memmap, AS_PROGRAM, 32, deco32_state ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM + AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) + AM_RANGE(0x150000, 0x150003) AM_WRITE8(eeprom_w, 0x000000ff) + AM_RANGE(0x150000, 0x150003) AM_WRITE8(volume_w, 0x0000ff00) + AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) + AM_RANGE(0x16c010, 0x16c013) AM_READNOP + AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram_r, spriteram_w) + AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram_w) + AM_RANGE(0x17c020, 0x17c023) AM_READNOP + AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") + AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(deco_146_r, deco_146_w, 0xffff0000) AM_SHARE("prot32ram") // only maps on 16-bits +ADDRESS_MAP_END + +// 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(0x0000000, 0x00fffff) AM_ROM + AM_RANGE(0x0100000, 0x011ffff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x0120000, 0x0127fff) AM_READWRITE16(deco_146_r, deco_146_w, 0x0000ffff) +// AM_RANGE(0x01204c0, 0x01204c3) AM_WRITE(sound_w) + AM_RANGE(0x0128000, 0x012800f) AM_DEVICE8("irq", deco_irq_device, map, 0x000000ff) + AM_RANGE(0x0130000, 0x0131fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x0138000, 0x0138003) AM_NOP /* Palette dma complete in bit 0x8? ack? return 0 else tight loop */ + AM_RANGE(0x0138008, 0x013800b) AM_WRITE(palette_dma_w) + AM_RANGE(0x0170100, 0x0170103) AM_WRITENOP + AM_RANGE(0x0170038, 0x017003b) AM_WRITENOP + AM_RANGE(0x017002C, 0x017002f) AM_WRITENOP + AM_RANGE(0x0170224, 0x0170227) AM_WRITENOP + AM_RANGE(0x0180000, 0x018001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x0190000, 0x0191fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x0194000, 0x0195fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x01a0000, 0x01a3fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x01a4000, 0x01a5fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x01c0000, 0x01c001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x01d0000, 0x01d1fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x01d4000, 0x01d5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) // unused + AM_RANGE(0x01e0000, 0x01e3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x01e4000, 0x01e5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") // unused + AM_RANGE(0x0204800, 0x0204fff) AM_RAM // ace? 0x10 byte increments only // 13f ff stuff + AM_RANGE(0x0208000, 0x0208fff) AM_RAM AM_SHARE("lay0") + AM_RANGE(0x020c000, 0x020cfff) AM_RAM AM_SHARE("lay1") + AM_RANGE(0x0210000, 0x0217fff) AM_RAM AM_SHARE("look0") + AM_RANGE(0x0218000, 0x021ffff) AM_RAM AM_SHARE("look1") + AM_RANGE(0x0220000, 0x0221fff) AM_RAM AM_SHARE("spriteram") /* Main spriteram */ + AM_RANGE(0x0228000, 0x02283ff) AM_RAM //0x10 byte increments only + AM_RANGE(0x0230000, 0x0230003) AM_WRITE(spriteram_dma_w) + AM_RANGE(0x0300000, 0x03fffff) AM_ROM + AM_RANGE(0x0400000, 0x0400003) AM_DEVREADWRITE8("oki3", okim6295_device, read, write, 0x000000ff) + AM_RANGE(0x0410000, 0x0410003) AM_WRITE(volume_w) + AM_RANGE(0x0418000, 0x0418003) AM_WRITE(speaker_switch_w) + AM_RANGE(0x0420000, 0x0420003) AM_READWRITE8(eeprom_r, eeprom_w, 0x000000ff) + AM_RANGE(0x0430000, 0x043001f) AM_WRITE(lightgun_w) + AM_RANGE(0x0438000, 0x0438003) AM_READ(lightgun_r) + AM_RANGE(0x0440000, 0x0440003) AM_READ_PORT("IN2") + AM_RANGE(0x0500000, 0x0500003) AM_WRITE(sprite_control_w) + // this is clearly the dvi video related area + AM_RANGE(0x1000000, 0x1000007) AM_READ(unk_video_r) + AM_RANGE(0x1000100, 0x1007fff) AM_RAM + AM_RANGE(0x10b0000, 0x10b01ff) AM_RAM + AM_RANGE(0x1400000, 0x1ffffff) AM_ROM AM_REGION("dvi", 0x00000) // reads from here during boss battles when the videos should be displayed at the offsets where the DVI headers are // as a result it ends up writing what looks like pointers to the frame data in the ram area above +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lockloadu_map, AS_PROGRAM, 32, dragngun_state ) + AM_IMPORT_FROM(dragngun_map) + AM_RANGE(0x0170000, 0x0170007) AM_READ(lockload_gun_mirror_r) /* Not on Dragongun */ +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, 0x127fff) AM_READWRITE16(deco_146_r, deco_146_w, 0x0000ffff) + AM_RANGE(0x128000, 0x12800f) AM_DEVICE8("irq", deco_irq_device, map, 0x000000ff) + AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x138000, 0x138003) AM_READONLY AM_WRITENOP //palette dma complete in bit 0x8? ack? return 0 else tight loop + AM_RANGE(0x138008, 0x13800b) AM_WRITE(palette_dma_w) + AM_RANGE(0x170000, 0x170007) AM_READ(lockload_gun_mirror_r) /* Not on Dragongun */ + AM_RANGE(0x178008, 0x17800f) AM_WRITE(gun_irq_ack_w) /* Gun read ACK's */ + AM_RANGE(0x180000, 0x18001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x190000, 0x191fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x194000, 0x195fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x1a0000, 0x1a3fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x1a4000, 0x1a5fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x1c0000, 0x1c001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x1d0000, 0x1d1fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x1d4000, 0x1d5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) // unused + AM_RANGE(0x1e0000, 0x1e3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x1e4000, 0x1e5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") // unused + AM_RANGE(0x204800, 0x204fff) AM_RAM //0x10 byte increments only + AM_RANGE(0x208000, 0x208fff) AM_RAM AM_SHARE("lay0") + AM_RANGE(0x20c000, 0x20cfff) AM_RAM AM_SHARE("lay1") + AM_RANGE(0x210000, 0x217fff) AM_RAM AM_SHARE("look0") + AM_RANGE(0x218000, 0x21ffff) AM_RAM AM_SHARE("look1") + AM_RANGE(0x220000, 0x221fff) AM_RAM AM_SHARE("spriteram") /* Main spriteram */ + AM_RANGE(0x228000, 0x2283ff) AM_RAM //0x10 byte increments only + AM_RANGE(0x230000, 0x230003) AM_WRITE(spriteram_dma_w) + AM_RANGE(0x300000, 0x3fffff) AM_ROM + AM_RANGE(0x410000, 0x410003) AM_WRITE(volume_w) + AM_RANGE(0x420000, 0x420003) AM_READWRITE8(eeprom_r, eeprom_w, 0x000000ff) + AM_RANGE(0x440000, 0x440003) AM_READ_PORT("IN2") + AM_RANGE(0x500000, 0x500003) AM_WRITE(sprite_control_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tattass_map, AS_PROGRAM, 32, deco32_state ) + AM_RANGE(0x000000, 0x0f7fff) AM_ROM + AM_RANGE(0x0f8000, 0x0fffff) AM_ROM AM_WRITENOP + AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x120000, 0x120003) AM_NOP /* ACIA (unused) */ + AM_RANGE(0x130000, 0x130003) AM_WRITENOP /* Coin port (unused?) */ + AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) + AM_RANGE(0x150000, 0x150003) AM_WRITE(tattass_control_w) /* Volume port/Eprom/Priority */ + AM_RANGE(0x162000, 0x162fff) AM_RAM /* 'Jack' RAM!? */ + AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(ace_ram_w) AM_SHARE("ace_ram") + AM_RANGE(0x164000, 0x164003) AM_WRITENOP /* Palette control BG2/3 ($1a constant) */ + AM_RANGE(0x164004, 0x164007) AM_WRITENOP /* Palette control Obj1 ($6 constant) */ + AM_RANGE(0x164008, 0x16400b) AM_WRITENOP /* Palette control Obj2 ($5 constant) */ + AM_RANGE(0x16400c, 0x16400f) AM_WRITENOP + AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x16c000, 0x16c003) AM_WRITENOP + AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) + AM_RANGE(0x170000, 0x171fff) AM_READWRITE(spriteram_r, spriteram_w) + AM_RANGE(0x174000, 0x174003) AM_WRITENOP /* Sprite DMA mode (2) */ + AM_RANGE(0x174010, 0x174013) AM_WRITE(buffer_spriteram_w) + AM_RANGE(0x174018, 0x17401b) AM_WRITENOP /* Sprite 'CPU' (unused) */ + AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram2_r, spriteram2_w) + AM_RANGE(0x17c000, 0x17c003) AM_WRITENOP /* Sprite DMA mode (2) */ + AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram2_w) + AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */ + AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") + AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(deco_104_r, deco_104_w, 0xffff0000) + AM_RANGE(0x200000, 0x207fff) AM_READ16(nslasher_debug_r, 0x0000ffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nslasher_map, AS_PROGRAM, 32, deco32_state ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM + AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x120000, 0x1200ff) AM_NOP /* ACIA (unused) */ + AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) + AM_RANGE(0x150000, 0x150003) AM_WRITE8(eeprom_w, 0x000000ff) + AM_RANGE(0x150000, 0x150003) AM_WRITE8(volume_w, 0x0000ff00) + AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(ace_ram_w) AM_SHARE("ace_ram") /* 'Ace' RAM!? */ + AM_RANGE(0x164000, 0x164003) AM_WRITENOP /* Palette control BG2/3 ($1a constant) */ + AM_RANGE(0x164004, 0x164007) AM_WRITENOP /* Palette control Obj1 ($4 constant) */ + AM_RANGE(0x164008, 0x16400b) AM_WRITENOP /* Palette control Obj2 ($6 constant) */ + AM_RANGE(0x16400c, 0x16400f) AM_WRITENOP + AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x16c000, 0x16c003) AM_WRITENOP + AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) + AM_RANGE(0x170000, 0x171fff) AM_READWRITE(spriteram_r, spriteram_w) + AM_RANGE(0x174000, 0x174003) AM_WRITENOP /* Sprite DMA mode (2) */ + AM_RANGE(0x174010, 0x174013) AM_WRITE(buffer_spriteram_w) + AM_RANGE(0x174018, 0x17401b) AM_WRITENOP /* Sprite 'CPU' (unused) */ + AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram2_r, spriteram2_w) + AM_RANGE(0x17c000, 0x17c003) AM_WRITENOP /* Sprite DMA mode (2) */ + AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram2_w) + AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */ + AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") + AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") + AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) + AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) + AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") + AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") + AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(deco_104_r, deco_104_w, 0xffff0000) + AM_RANGE(0x200000, 0x207fff) AM_READ16(nslasher_debug_r, 0x0000ffff) // seems to be debug switches / code activated by this? +ADDRESS_MAP_END + +// H6280 based sound +static ADDRESS_MAP_START( h6280_sound_map, AS_PROGRAM, 8, deco32_state ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM + AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) + AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write) + AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write) + AM_RANGE(0x140000, 0x140001) AM_DEVREAD("soundlatch", generic_latch_8_device, read) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8") + AM_RANGE(0x1fec00, 0x1fec01) AM_DEVWRITE("audiocpu", h6280_device, timer_w) + AM_RANGE(0x1ff400, 0x1ff403) AM_DEVWRITE("audiocpu", h6280_device, irq_status_w) +ADDRESS_MAP_END + +// Z80 based sound +static ADDRESS_MAP_START( z80_sound_mem, AS_PROGRAM, 8, deco32_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x87ff) AM_RAM + AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) + AM_RANGE(0xb000, 0xb000) AM_DEVREADWRITE("oki1", okim6295_device, read, write) + AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("oki2", okim6295_device, read, write) + AM_RANGE(0xd000, 0xd000) AM_READ(latch_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80_sound_io, AS_IO, 8, deco32_state ) + AM_RANGE(0x0000, 0xffff) AM_ROM AM_REGION("audiocpu", 0) +ADDRESS_MAP_END + + +//************************************************************************** +// PROTECTION +//************************************************************************** + +READ16_MEMBER( deco32_state::deco_104_r ) { - m_deco_irq->lightgun_irq_ack_w(data); + offs_t real_address = 0 + (offset *2); + offs_t 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_t cs = 0; + + return m_deco104->read_data( deco146_addr, mem_mask, cs ); } -WRITE32_MEMBER(deco32_state::sound_w) +WRITE16_MEMBER( deco32_state::deco_104_w ) { - m_soundlatch->write(space, 0, data & 0xff); - m_audiocpu->set_input_line(0, HOLD_LINE); + offs_t real_address = 0 + (offset *2); + offs_t 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_t cs = 0; + + m_deco104->write_data( space, deco146_addr, data, mem_mask, cs ); +} + +READ16_MEMBER( deco32_state::deco_146_r ) +{ + offs_t real_address = 0 + (offset * 2); + offs_t 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_t cs = 0; + + return m_deco146->read_data(deco146_addr, mem_mask, cs); } -void deco32_state::deco32_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ) +WRITE16_MEMBER( deco32_state::deco_146_w ) +{ + offs_t real_address = 0 + (offset * 2); + offs_t 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_t cs = 0; + + m_deco146->write_data(space, deco146_addr, data, mem_mask, cs); +} + + +//************************************************************************** +// SOUND +//************************************************************************** + +WRITE32_MEMBER( deco32_state::sound_w ) { m_soundlatch->write(space, 0, data & 0xff); m_audiocpu->set_input_line(0, HOLD_LINE); } -void deco32_state::deco32_set_audio_output(uint8_t raw_data) +READ8_MEMBER(deco32_state::latch_r) +{ + /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ + m_nslasher_sound_irq &= ~0x02; + m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + + return m_soundlatch->read(space,0); +} + +WRITE8_MEMBER( deco32_state::volume_w ) { // TODO: assume linear with a 0.0-1.0 dB scale for now - uint8_t raw_vol = 0xff - raw_data; + uint8_t raw_vol = 0xff - data; float vol_output = ((float)raw_vol) / 255.0f; m_ym2151->set_output_gain(ALL_OUTPUTS, vol_output); m_oki1->set_output_gain(ALL_OUTPUTS, vol_output); m_oki2->set_output_gain(ALL_OUTPUTS, vol_output); +} - //popmessage("%02x %02x %f",raw_data,raw_vol,vol_output); +READ8_MEMBER( deco32_state::captaven_soundcpu_status_r ) +{ + // 7------- sound cpu status (0 = busy) + // -6543210 unknown + + return 0xff; } -READ32_MEMBER(deco32_state::_71_r) +WRITE32_MEMBER( dragngun_state::volume_w ) { - /* Bit 0x80 goes high when sprite DMA is complete, and low - while it's in progress, we don't bother to emulate it */ - return 0xffffffff; + m_vol_main->ce_w(BIT(data, 2)); + m_vol_main->clk_w(BIT(data, 1)); + m_vol_main->di_w(BIT(data, 0)); + + m_vol_gun->ce_w(BIT(data, 2)); + m_vol_gun->clk_w(BIT(data, 1)); + m_vol_gun->di_w(BIT(data, 0)); } +WRITE32_MEMBER( dragngun_state::speaker_switch_w ) +{ + // TODO: This should switch the oki3 output between the gun speaker and the standard speakers + m_gun_speaker_disabled = bool(BIT(data, 0)); -READ32_MEMBER(deco32_state::captaven_soundcpu_r) + logerror("Gun speaker: %s\n", m_gun_speaker_disabled ? "Disabled" : "Enabled"); +} + +LC7535_VOLUME_CHANGED( dragngun_state::volume_main_changed ) { - /* Top byte - top bit low == sound cpu busy, bottom word is dips */ - return 0xffff0000 | ioport("DSW2")->read(); + // TODO: Support loudness + logerror("Main speaker volume: left = %d dB, right %d dB, loudness = %s\n", attenuation_left, attenuation_right, loudness ? "on" :"off"); + + // convert to 0.0 - 1.0 + float gain_l = m_vol_main->normalize(attenuation_left); + float gain_r = m_vol_main->normalize(attenuation_right); + + m_ym2151->set_output_gain(0, gain_l); + m_ym2151->set_output_gain(1, gain_r); // left and right are always set to the same value + m_oki1->set_output_gain(ALL_OUTPUTS, gain_l); + m_oki2->set_output_gain(ALL_OUTPUTS, gain_l); + + if (m_oki3.found() && m_gun_speaker_disabled) + m_oki3->set_output_gain(ALL_OUTPUTS, gain_l); } -READ32_MEMBER(deco32_state::fghthist_control_r) +LC7535_VOLUME_CHANGED( dragngun_state::volume_gun_changed ) { - switch (offset) { - case 0: return 0xffff0000 | ioport("IN0")->read(); - case 1: return 0xffff0000 | ioport("IN1")->read(); //check top bits?? - case 2: return 0xfffffffe | m_eeprom->do_read(); - } + logerror("Gun speaker volume: left = %d dB, right %d dB, loudness = %s\n", attenuation_left, attenuation_right, loudness ? "on" :"off"); - return 0xffffffff; + if (m_oki3.found() && !m_gun_speaker_disabled) + m_oki3->set_output_gain(ALL_OUTPUTS, m_vol_gun->normalize(attenuation_left)); } +void deco32_state::deco32_sound_cb(address_space &space, uint16_t data, uint16_t mem_mask) +{ + m_soundlatch->write(space, 0, data & 0xff); + m_audiocpu->set_input_line(0, HOLD_LINE); +} -WRITE32_MEMBER(deco32_state::fghthist_eeprom_w) +void deco32_state::nslasher_sound_cb(address_space &space, uint16_t data, uint16_t mem_mask) { - if (ACCESSING_BITS_0_7) { - m_eeprom->clk_write((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); - m_eeprom->di_write((data & 0x10) >> 4); - m_eeprom->cs_write((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ + m_soundlatch->write(space,0,(data)&0xff); + m_nslasher_sound_irq |= 0x02; + m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); +} - pri_w(space,0,data&0x1,0xffffffff); /* Bit 0 - layer priority toggle */ - } +void deco32_state::tattass_sound_cb(address_space &space, uint16_t data, uint16_t mem_mask) +{ + /* 'Swap bits 0 and 3 to correct for design error from BSMT schematic' */ + int soundcommand = (data)&0xff; + soundcommand = BITSWAP8(soundcommand,7,6,5,4,0,2,1,3); + m_decobsmt->bsmt_comms_w(space, 0, soundcommand); +} - if (ACCESSING_BITS_8_15) +WRITE_LINE_MEMBER( deco32_state::sound_irq_nslasher ) +{ + /* bit 0 of nslasher_sound_irq specifies IRQ from sound chip */ + if (state) + m_nslasher_sound_irq |= 0x01; + else + m_nslasher_sound_irq &= ~0x01; + m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE8_MEMBER( deco32_state::sound_bankswitch_w ) +{ + m_oki1->set_rom_bank((data >> 0) & 1); + m_oki2->set_rom_bank((data >> 1) & 1); +} + + +//************************************************************************** +// VIDEO +//************************************************************************** + +WRITE32_MEMBER( deco32_state::vblank_ack_w ) +{ + m_maincpu->set_input_line(ARM_IRQ_LINE, CLEAR_LINE); +} + +READ32_MEMBER(deco32_state::spriteram_r) +{ + return m_spriteram16[offset] ^ 0xffff0000; +} + +WRITE32_MEMBER( deco32_state::spriteram_w ) +{ + data &= 0x0000ffff; + mem_mask &= 0x0000ffff; + COMBINE_DATA(&m_spriteram16[offset]); +} + +WRITE32_MEMBER( deco32_state::buffer_spriteram_w ) +{ + memcpy(m_spriteram16_buffered, m_spriteram16, 0x1000); +} + +READ32_MEMBER( deco32_state::spriteram2_r ) +{ + return m_spriteram16_2[offset] ^ 0xffff0000; +} + +WRITE32_MEMBER( deco32_state::spriteram2_w ) +{ + data &= 0x0000ffff; + mem_mask &= 0x0000ffff; + COMBINE_DATA(&m_spriteram16_2[offset]); +} + +WRITE32_MEMBER( deco32_state::buffer_spriteram2_w ) +{ + memcpy(m_spriteram16_2_buffered, m_spriteram16_2, 0x1000); +} + +// tattass tests these as 32-bit ram, even if only 16-bits are hooked up to the tilemap chip - does it mirror parts of the dword? +WRITE32_MEMBER( deco32_state::pf1_rowscroll_w ) { COMBINE_DATA(&m_pf1_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf1_rowscroll[offset]); } +WRITE32_MEMBER( deco32_state::pf2_rowscroll_w ) { COMBINE_DATA(&m_pf2_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf2_rowscroll[offset]); } +WRITE32_MEMBER( deco32_state::pf3_rowscroll_w ) { COMBINE_DATA(&m_pf3_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf3_rowscroll[offset]); } +WRITE32_MEMBER( deco32_state::pf4_rowscroll_w ) { COMBINE_DATA(&m_pf4_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf4_rowscroll[offset]); } + +READ32_MEMBER( dragngun_state::unk_video_r) +{ + return machine().rand(); +} + +DECOSPR_PRIORITY_CB_MEMBER( deco32_state::captaven_pri_callback ) +{ + if ((pri & 0x60) == 0x00) + { + return 0; // above everything + } + else if ((pri & 0x60) == 0x20) { - // Volume port - deco32_set_audio_output((data >> 8) & 0xff); + return 0xfff0; // above the 2nd playfield } + else if ((pri & 0x60) == 0x40) + { + return 0xfffc; // above the 1st playfield + } + else + { + return 0xfffe; // under everything + } +} + +DECO16IC_BANK_CB_MEMBER( deco32_state::captaven_bank_callback ) +{ + bank = bank >> 4; + bank = (bank & 2) >> 1; + + return bank * 0x4000; +} + +DECO16IC_BANK_CB_MEMBER( deco32_state::fghthist_bank_callback ) +{ + bank = bank >> 4; + bank = (bank & 1) | ((bank & 4) >> 1) | ((bank & 2) << 1); + + return bank * 0x1000; +} + +DECO16IC_BANK_CB_MEMBER( dragngun_state::bank_1_callback ) +{ + bank = bank >> 4; + return bank * 0x1000; +} + + +DECO16IC_BANK_CB_MEMBER( dragngun_state::bank_2_callback ) +{ + bank = bank >> 5; + return bank * 0x1000; +} + +DECO16IC_BANK_CB_MEMBER( deco32_state::tattass_bank_callback ) +{ + bank = bank >> 4; + return bank * 0x1000; } -/**********************************************************************************/ +//************************************************************************** +// INPUTS +//************************************************************************** + +READ8_MEMBER( deco32_state::captaven_dsw1_r ) { return ioport("DSW1")->read(); } +READ8_MEMBER( deco32_state::captaven_dsw2_r ) { return ioport("DSW2")->read(); } +READ8_MEMBER( deco32_state::captaven_dsw3_r ) { return ioport("DSW3")->read(); } +READ16_MEMBER( deco32_state::fghthist_in0_r ) { return ioport("IN0")->read(); } +READ16_MEMBER( deco32_state::fghthist_in1_r ) { return ioport("IN1")->read(); } -READ32_MEMBER(dragngun_state::service_r) +// TODO: probably clears both player 1 and player 2 +WRITE32_MEMBER( dragngun_state::gun_irq_ack_w ) { -// logerror("%08x:Read service\n",space.device().safe_pc()); - return ioport("IN2")->read(); + m_deco_irq->lightgun_irq_ack_w(data); } // TODO: improve this, Y axis not understood at all -READ32_MEMBER(dragngun_state::lockload_gun_mirror_r) +READ32_MEMBER( dragngun_state::lockload_gun_mirror_r ) { //logerror("%08x:Read gun %d\n",space.device().safe_pc(),offset); @@ -478,10 +965,11 @@ READ32_MEMBER(dragngun_state::lockload_gun_mirror_r) return ~0; } -READ32_MEMBER(dragngun_state::lightgun_r) +READ32_MEMBER( dragngun_state::lightgun_r ) { /* Ports 0-3 are read, but seem unused */ - switch (m_lightgun_port) { + switch (m_lightgun_port) + { case 4: return ioport("LIGHT0_X")->read(); case 5: return ioport("LIGHT1_X")->read(); case 6: return ioport("LIGHT0_Y")->read(); @@ -492,33 +980,61 @@ READ32_MEMBER(dragngun_state::lightgun_r) return 0; } -WRITE32_MEMBER(dragngun_state::lightgun_w) +WRITE32_MEMBER( dragngun_state::lightgun_w ) { // logerror("Lightgun port %d\n",m_lightgun_port); m_lightgun_port=offset; } -READ32_MEMBER(dragngun_state::eeprom_r) +INPUT_CHANGED_MEMBER( dragngun_state::lockload_gun_trigger ) { - return 0xfffffffe | m_eeprom->do_read(); + switch ((uint8_t)(uintptr_t)param) + { + case 0: m_deco_irq->lightgun1_trigger_w(!newval); break; + case 1: m_deco_irq->lightgun2_trigger_w(!newval); break; + } } -WRITE32_MEMBER(dragngun_state::eeprom_w) + +//************************************************************************** +// EEPROM +//************************************************************************** + +READ8_MEMBER( deco32_state::eeprom_r ) { - if (ACCESSING_BITS_0_7) { - m_eeprom->clk_write((data & 0x2) ? ASSERT_LINE : CLEAR_LINE); - m_eeprom->di_write(data & 0x1); - m_eeprom->cs_write((data & 0x4) ? ASSERT_LINE : CLEAR_LINE); - return; - } - logerror("%s:Write control 1 %08x %08x\n",machine().describe_context(),offset,data); + return 0xfe | m_eeprom->do_read(); } +WRITE8_MEMBER( deco32_state::eeprom_w ) +{ + // 7------- unknown + // -6------ eeprom cs + // --5----- eeprom clk + // ---4---- eeprom di + // ----32-- unknown + // ------1- bg2/3 joint mode (8bpp) (not used by fghthist?) + // -------0 layer priority + + m_eeprom->clk_write(BIT(data, 5) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->di_write(BIT(data, 4)); + m_eeprom->cs_write(BIT(data, 6) ? ASSERT_LINE : CLEAR_LINE); + + pri_w(space, 0, data & 0x03, 0xffffffff); +} -/**********************************************************************************/ - +WRITE8_MEMBER( dragngun_state::eeprom_w ) +{ + // 76543--- unknown + // -----2-- eeprom cs + // ------1- eeprom clk + // -------0 eeprom di + + m_eeprom->clk_write(BIT(data, 1) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->di_write(BIT(data, 0)); + m_eeprom->cs_write(BIT(data, 2) ? ASSERT_LINE : CLEAR_LINE); +} -WRITE32_MEMBER(deco32_state::tattass_control_w) +WRITE32_MEMBER( deco32_state::tattass_control_w ) { /* Eprom in low byte */ if (ACCESSING_BITS_0_7) { /* Byte write to low byte only (different from word writing including low byte) */ @@ -645,522 +1161,176 @@ WRITE32_MEMBER(deco32_state::tattass_control_w) //logerror("%08x: %08x data\n",data,mem_mask); } - -/**********************************************************************************/ - - -void deco32_state::nslasher_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ) -{ - /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ - m_soundlatch->write(space,0,(data)&0xff); - m_nslasher_sound_irq |= 0x02; - m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); -} - -READ16_MEMBER(deco32_state::port_b_tattass) +READ16_MEMBER( deco32_state::port_b_tattass ) { return m_tattass_eprom_bit; } -void deco32_state::tattass_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ) -{ - /* 'Swap bits 0 and 3 to correct for design error from BSMT schematic' */ - int soundcommand = (data)&0xff; - soundcommand = BITSWAP8(soundcommand,7,6,5,4,0,2,1,3); - m_decobsmt->bsmt_comms_w(space, 0, soundcommand); -} - -WRITE32_MEMBER(deco32_state::nslasher_eeprom_w) -{ - if (ACCESSING_BITS_0_7) - { - m_eeprom->clk_write((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); - m_eeprom->di_write((data & 0x10) >> 4); - m_eeprom->cs_write((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); - - pri_w(space,0,data&0x3,0xffffffff); /* Bit 0 - layer priority toggle, Bit 1 - BG2/3 Joint mode (8bpp) */ - } - -// popmessage("%08x",data); - if (ACCESSING_BITS_8_15) - deco32_set_audio_output((data >> 8) & 0xff); -} - -/**********************************************************************************/ +//************************************************************************** +// MACHINE +//************************************************************************** - -READ32_MEMBER(deco32_state::spriteram_r) +READ16_MEMBER( deco32_state::nslasher_debug_r ) { - return m_spriteram16[offset] ^ 0xffff0000; + return 0xffff; } -WRITE32_MEMBER(deco32_state::spriteram_w) +READ32_MEMBER( deco32_state::_71_r ) { - data &= 0x0000ffff; - mem_mask &= 0x0000ffff; - COMBINE_DATA(&m_spriteram16[offset]); + /* Bit 0x80 goes high when sprite DMA is complete, and low + while it's in progress, we don't bother to emulate it */ + return 0xffffffff; } -WRITE32_MEMBER(deco32_state::buffer_spriteram_w) +DRIVER_INIT_MEMBER( deco32_state, captaven ) { - memcpy(m_spriteram16_buffered, m_spriteram16, 0x1000); -} + deco56_decrypt_gfx(machine(), "gfx1"); + deco56_decrypt_gfx(machine(), "gfx2"); -READ32_MEMBER(deco32_state::spriteram2_r) -{ - return m_spriteram16_2[offset] ^ 0xffff0000; + save_item(NAME(m_nslasher_sound_irq)); } -WRITE32_MEMBER(deco32_state::spriteram2_w) -{ - data &= 0x0000ffff; - mem_mask &= 0x0000ffff; - COMBINE_DATA(&m_spriteram16_2[offset]); -} +extern void process_dvi_data(device_t *device,uint8_t* dvi_data, int offset, int regionsize); -WRITE32_MEMBER(deco32_state::buffer_spriteram2_w) +void dragngun_state::dragngun_init_common() { - memcpy(m_spriteram16_2_buffered, m_spriteram16_2, 0x1000); -} - - -// tattass tests these as 32-bit ram, even if only 16-bits are hooked up to the tilemap chip - does it mirror parts of the dword? -WRITE32_MEMBER(deco32_state::pf1_rowscroll_w){ COMBINE_DATA(&m_pf1_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf1_rowscroll[offset]); } -WRITE32_MEMBER(deco32_state::pf2_rowscroll_w){ COMBINE_DATA(&m_pf2_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf2_rowscroll[offset]); } -WRITE32_MEMBER(deco32_state::pf3_rowscroll_w){ COMBINE_DATA(&m_pf3_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf3_rowscroll[offset]); } -WRITE32_MEMBER(deco32_state::pf4_rowscroll_w){ COMBINE_DATA(&m_pf4_rowscroll32[offset]); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&m_pf4_rowscroll[offset]); } - - -static ADDRESS_MAP_START( captaven_map, AS_PROGRAM, 32, deco32_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM - - AM_RANGE(0x100000, 0x100007) AM_READ(_71_r) - AM_RANGE(0x100000, 0x100003) AM_WRITE(buffer_spriteram_w) - AM_RANGE(0x108000, 0x108003) AM_WRITENOP /* ? */ - AM_RANGE(0x110000, 0x111fff) AM_READWRITE(spriteram_r, spriteram_w) - AM_RANGE(0x120000, 0x127fff) AM_RAM AM_SHARE("ram") /* Main RAM */ - -// AM_RANGE(0x128000, 0x128fff) AM_DEVREAD("ioprot", deco146_device,captaven_prot_r) -// AM_RANGE(0x1280c8, 0x1280cb) AM_WRITE(sound_w) - AM_RANGE(0x128000, 0x12ffff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) - - AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(nonbuffered_palette_w) AM_SHARE("paletteram") /* Palette RAM */ - AM_RANGE(0x148000, 0x14800f) AM_DEVICE8("irq", deco_irq_device, map, 0x000000ff) - AM_RANGE(0x160000, 0x167fff) AM_RAM /* Extra work RAM */ - AM_RANGE(0x168000, 0x168003) AM_READ(captaven_soundcpu_r) - - AM_RANGE(0x178000, 0x178003) AM_WRITE(pri_w) - - - AM_RANGE(0x180000, 0x18001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - AM_RANGE(0x190000, 0x191fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x192000, 0x193fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) /* Mirror address - bug in program code */ - AM_RANGE(0x194000, 0x195fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x1a0000, 0x1a3fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x1a4000, 0x1a5fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - - AM_RANGE(0x1c0000, 0x1c001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - AM_RANGE(0x1d0000, 0x1d1fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x1d4000, 0x1d5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) // unused - AM_RANGE(0x1e0000, 0x1e3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x1e4000, 0x1e5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") // unused -ADDRESS_MAP_END + const uint8_t *SRC_RAM = memregion("gfx1")->base(); + uint8_t *DST_RAM = memregion("gfx2")->base(); + deco74_decrypt_gfx(machine(), "gfx1"); + deco74_decrypt_gfx(machine(), "gfx2"); + deco74_decrypt_gfx(machine(), "gfx3"); -READ32_MEMBER( deco32_state::fghthist_protection_region_0_146_r ) -{ - uint32_t retdata = 0x0000ffff; + memcpy(DST_RAM+0x80000,SRC_RAM,0x10000); + memcpy(DST_RAM+0x110000,SRC_RAM+0x10000,0x10000); - if (ACCESSING_BITS_16_31) +#if 0 { - mem_mask >>=16; - - 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_t cs = 0; - uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs ); + uint8_t *ROM = memregion("dvi")->base(); + FILE *fp; + char filename[256]; + sprintf(filename,"video.dvi"); + fp=fopen(filename, "w+b"); + if (fp) + { + fwrite(ROM, 0xc00000, 1, fp); + fclose(fp); + } + } +#endif + save_item(NAME(m_lightgun_port)); - retdata |= data << 16; - } - return retdata; + // there are DVI headers at 0x000000, 0x580000, 0x800000, 0xB10000, 0xB80000 +// process_dvi_data(this,memregion("dvi")->base(),0x000000, 0x1000000); +// process_dvi_data(this,memregion("dvi")->base(),0x580000, 0x1000000); +// process_dvi_data(this,memregion("dvi")->base(),0x800000, 0x1000000); +// process_dvi_data(this,memregion("dvi")->base(),0xB10000, 0x1000000); +// process_dvi_data(this,memregion("dvi")->base(),0xB80000, 0x1000000); } -WRITE32_MEMBER( deco32_state::fghthist_protection_region_0_146_w ) +DRIVER_INIT_MEMBER( dragngun_state, dragngun ) { - if (ACCESSING_BITS_16_31) - { - data >>=16; - mem_mask >>=16; + dragngun_init_common(); - 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_t cs = 0; - m_deco146->write_data( space, deco146_addr, data, mem_mask, cs ); - } + uint32_t *ROM = (uint32_t *)memregion("maincpu")->base(); + ROM[0x1b32c/4]=0xe1a00000; // bl $ee000: NOP test switch lock } -WRITE32_MEMBER( deco32_state::vblank_ack_w ) +DRIVER_INIT_MEMBER( dragngun_state, dragngunj ) { - m_maincpu->set_input_line(ARM_IRQ_LINE, CLEAR_LINE); -} - -static ADDRESS_MAP_START( fghthist_map, AS_PROGRAM, 32, deco32_state ) -// AM_RANGE(0x000000, 0x001fff) AM_ROM AM_WRITE(pf1_data_w) // wtf?? - AM_RANGE(0x000000, 0x0fffff) AM_ROM - AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x120020, 0x12002f) AM_READ(fghthist_control_r) - AM_RANGE(0x12002c, 0x12002f) AM_WRITE(fghthist_eeprom_w) - AM_RANGE(0x1201fc, 0x1201ff) AM_WRITE(sound_w) - - AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) - - AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") - AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) - // - AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram_r, spriteram_w) - AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram_w) - - AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - - AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") - AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - - AM_RANGE(0x16c000, 0x16c01f) AM_READNOP - AM_RANGE(0x17c000, 0x17c03f) AM_READNOP - - AM_RANGE(0x200000, 0x207fff) AM_READWRITE(fghthist_protection_region_0_146_r, fghthist_protection_region_0_146_w) AM_SHARE("prot32ram") // only maps on 16-bits - AM_RANGE(0x208800, 0x208803) AM_WRITENOP /* ? */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fghthsta_memmap, AS_PROGRAM, 32, deco32_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM - AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) - AM_RANGE(0x150000, 0x150003) AM_WRITE(fghthist_eeprom_w) /* Volume port/Eprom */ - - AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") - AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) - AM_RANGE(0x16c010, 0x16c013) AM_READNOP - - AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram_r, spriteram_w) - AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram_w) - AM_RANGE(0x17c020, 0x17c023) AM_READNOP - - AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - - AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") - AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - - AM_RANGE(0x200000, 0x207fff) AM_READWRITE(fghthist_protection_region_0_146_r, fghthist_protection_region_0_146_w) AM_SHARE("prot32ram") // only maps on 16-bits -ADDRESS_MAP_END - + dragngun_init_common(); -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_t cs = 0; - uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs ); - return data; + uint32_t *ROM = (uint32_t *)memregion("maincpu")->base(); + ROM[0x1a1b4/4]=0xe1a00000; // bl $ee000: NOP test switch lock } -WRITE16_MEMBER( deco32_state::dg_protection_region_0_146_w ) +DRIVER_INIT_MEMBER( deco32_state, fghthist ) { - 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_t cs = 0; - m_deco146->write_data( space, deco146_addr, data, mem_mask, cs ); + deco56_decrypt_gfx(machine(), "gfx1"); + deco74_decrypt_gfx(machine(), "gfx2"); } -READ32_MEMBER( dragngun_state::unk_video_r) +DRIVER_INIT_MEMBER( dragngun_state, lockload ) { - return machine().rand(); -} - -// 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(0x0000000, 0x00fffff) AM_ROM - AM_RANGE(0x0100000, 0x011ffff) AM_RAM AM_SHARE("ram") -// AM_RANGE(0x0120000, 0x0120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r) - AM_RANGE(0x0120000, 0x0127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) - -// AM_RANGE(0x01204c0, 0x01204c3) AM_WRITE(sound_w) - AM_RANGE(0x0128000, 0x012800f) AM_DEVICE8("irq", deco_irq_device, map, 0x000000ff) - AM_RANGE(0x0130000, 0x0131fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") - AM_RANGE(0x0138000, 0x0138003) AM_NOP /* Palette dma complete in bit 0x8? ack? return 0 else tight loop */ - AM_RANGE(0x0138008, 0x013800b) AM_WRITE(palette_dma_w) - - AM_RANGE(0x0170100, 0x0170103) AM_WRITENOP - AM_RANGE(0x0170038, 0x017003b) AM_WRITENOP - AM_RANGE(0x017002C, 0x017002f) AM_WRITENOP - AM_RANGE(0x0170224, 0x0170227) AM_WRITENOP - - AM_RANGE(0x0180000, 0x018001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - AM_RANGE(0x0190000, 0x0191fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x0194000, 0x0195fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x01a0000, 0x01a3fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x01a4000, 0x01a5fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - - AM_RANGE(0x01c0000, 0x01c001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - AM_RANGE(0x01d0000, 0x01d1fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x01d4000, 0x01d5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) // unused - AM_RANGE(0x01e0000, 0x01e3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x01e4000, 0x01e5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") // unused - - AM_RANGE(0x0204800, 0x0204fff) AM_RAM // ace? 0x10 byte increments only // 13f ff stuff - - - AM_RANGE(0x0208000, 0x0208fff) AM_RAM AM_SHARE("lay0") - AM_RANGE(0x020c000, 0x020cfff) AM_RAM AM_SHARE("lay1") - AM_RANGE(0x0210000, 0x0217fff) AM_RAM AM_SHARE("look0") - AM_RANGE(0x0218000, 0x021ffff) AM_RAM AM_SHARE("look1") - AM_RANGE(0x0220000, 0x0221fff) AM_RAM AM_SHARE("spriteram") /* Main spriteram */ - - AM_RANGE(0x0228000, 0x02283ff) AM_RAM //0x10 byte increments only - - AM_RANGE(0x0230000, 0x0230003) AM_WRITE(spriteram_dma_w) - - AM_RANGE(0x0300000, 0x03fffff) AM_ROM - - AM_RANGE(0x0400000, 0x0400003) AM_DEVREADWRITE8("oki3", okim6295_device, read, write, 0x000000ff) - AM_RANGE(0x0410000, 0x0410003) AM_WRITENOP /* Some kind of serial bit-stream - digital volume control? */ - AM_RANGE(0x0420000, 0x0420003) AM_READWRITE(eeprom_r, eeprom_w) - AM_RANGE(0x0438000, 0x0438003) AM_READ(lightgun_r) - AM_RANGE(0x0430000, 0x043001f) AM_WRITE(lightgun_w) - AM_RANGE(0x0440000, 0x0440003) AM_READ(service_r) - - AM_RANGE(0x0500000, 0x0500003) AM_WRITE(sprite_control_w) - - // this is clearly the dvi video related area - AM_RANGE(0x1000000, 0x1000007) AM_READ(unk_video_r) - AM_RANGE(0x1000100, 0x1007fff) AM_RAM - AM_RANGE(0x10b0000, 0x10b01ff) AM_RAM - AM_RANGE(0x1400000, 0x1ffffff) AM_ROM AM_REGION("dvi", 0x00000) // reads from here during boss battles when the videos should be displayed at the offsets where the DVI headers are - // as a result it ends up writing what looks like pointers to the frame data in the ram area above - -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(sound_w) - AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) - - AM_RANGE(0x128000, 0x12800f) AM_DEVICE8("irq", deco_irq_device, map, 0x000000ff) - - AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") - AM_RANGE(0x138000, 0x138003) AM_READONLY AM_WRITENOP //palette dma complete in bit 0x8? ack? return 0 else tight loop - AM_RANGE(0x138008, 0x13800b) AM_WRITE(palette_dma_w) - - AM_RANGE(0x170000, 0x170007) AM_READ(lockload_gun_mirror_r) /* Not on Dragongun */ - AM_RANGE(0x178008, 0x17800f) AM_WRITE(gun_irq_ack_w) /* Gun read ACK's */ - - AM_RANGE(0x180000, 0x18001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - AM_RANGE(0x190000, 0x191fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x194000, 0x195fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x1a0000, 0x1a3fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x1a4000, 0x1a5fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - - AM_RANGE(0x1c0000, 0x1c001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) - AM_RANGE(0x1d0000, 0x1d1fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x1d4000, 0x1d5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) // unused - AM_RANGE(0x1e0000, 0x1e3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x1e4000, 0x1e5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") // unused - - AM_RANGE(0x204800, 0x204fff) AM_RAM //0x10 byte increments only - AM_RANGE(0x208000, 0x208fff) AM_RAM AM_SHARE("lay0") - AM_RANGE(0x20c000, 0x20cfff) AM_RAM AM_SHARE("lay1") - AM_RANGE(0x210000, 0x217fff) AM_RAM AM_SHARE("look0") - AM_RANGE(0x218000, 0x21ffff) AM_RAM AM_SHARE("look1") - AM_RANGE(0x220000, 0x221fff) AM_RAM AM_SHARE("spriteram") /* Main spriteram */ - - AM_RANGE(0x228000, 0x2283ff) AM_RAM //0x10 byte increments only - AM_RANGE(0x230000, 0x230003) AM_WRITE(spriteram_dma_w) - - AM_RANGE(0x300000, 0x3fffff) AM_ROM - -// AM_RANGE(0x400000, 0x400003) AM_DEVREADWRITE8("oki3", okim6295_device, read, write, 0x000000ff) - AM_RANGE(0x410000, 0x410003) AM_WRITENOP /* Some kind of serial bit-stream - digital volume control? */ - AM_RANGE(0x420000, 0x420003) AM_READWRITE(eeprom_r, eeprom_w) -// AM_RANGE(0x430000, 0x43001f) AM_WRITE(lightgun_w) -// AM_RANGE(0x438000, 0x438003) AM_READ(lightgun_r) - AM_RANGE(0x440000, 0x440003) AM_READ(service_r) - AM_RANGE(0x500000, 0x500003) AM_WRITE(sprite_control_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tattass_map, AS_PROGRAM, 32, deco32_state ) - - AM_RANGE(0x000000, 0x0f7fff) AM_ROM - AM_RANGE(0x0f8000, 0x0fffff) AM_ROM AM_WRITENOP - AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x120000, 0x120003) AM_NOP /* ACIA (unused) */ - AM_RANGE(0x130000, 0x130003) AM_WRITENOP /* Coin port (unused?) */ - AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) - AM_RANGE(0x150000, 0x150003) AM_WRITE(tattass_control_w) /* Volume port/Eprom/Priority */ - - AM_RANGE(0x162000, 0x162fff) AM_RAM /* 'Jack' RAM!? */ - AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(ace_ram_w) AM_SHARE("ace_ram") - AM_RANGE(0x164000, 0x164003) AM_WRITENOP /* Palette control BG2/3 ($1a constant) */ - AM_RANGE(0x164004, 0x164007) AM_WRITENOP /* Palette control Obj1 ($6 constant) */ - AM_RANGE(0x164008, 0x16400b) AM_WRITENOP /* Palette control Obj2 ($5 constant) */ - AM_RANGE(0x16400c, 0x16400f) AM_WRITENOP - AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") - AM_RANGE(0x16c000, 0x16c003) AM_WRITENOP - AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) - - AM_RANGE(0x170000, 0x171fff) AM_READWRITE(spriteram_r, spriteram_w) - AM_RANGE(0x174000, 0x174003) AM_WRITENOP /* Sprite DMA mode (2) */ - AM_RANGE(0x174010, 0x174013) AM_WRITE(buffer_spriteram_w) - AM_RANGE(0x174018, 0x17401b) AM_WRITENOP /* Sprite 'CPU' (unused) */ - - AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram2_r, spriteram2_w) - AM_RANGE(0x17c000, 0x17c003) AM_WRITENOP /* Sprite DMA mode (2) */ - AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram2_w) - AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */ + uint8_t *RAM = memregion("maincpu")->base(); +// uint32_t *ROM = (uint32_t *)memregion("maincpu")->base(); - AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + deco74_decrypt_gfx(machine(), "gfx1"); + deco74_decrypt_gfx(machine(), "gfx2"); + deco74_decrypt_gfx(machine(), "gfx3"); - AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") - AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + memcpy(RAM+0x300000,RAM+0x100000,0x100000); + memset(RAM+0x100000,0,0x100000); - AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(nslasher_protection_region_0_104_r, nslasher_protection_region_0_104_w, 0xffff0000) - AM_RANGE(0x200000, 0x207fff) AM_READ16(nslasher_debug_r, 0x0000ffff) -ADDRESS_MAP_END + save_item(NAME(m_nslasher_sound_irq)); -READ16_MEMBER( deco32_state::nslasher_protection_region_0_104_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_t cs = 0; - uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs ); - return data; +// ROM[0x3fe3c0/4]=0xe1a00000;// NOP test switch lock +// ROM[0x3fe3cc/4]=0xe1a00000;// NOP test switch lock +// ROM[0x3fe40c/4]=0xe1a00000;// NOP test switch lock } -WRITE16_MEMBER( deco32_state::nslasher_protection_region_0_104_w ) +DRIVER_INIT_MEMBER( deco32_state, tattass ) { - 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_t cs = 0; - m_deco104->write_data( space, deco146_addr, data, mem_mask, cs ); -} + uint8_t *RAM = memregion("gfx1")->base(); + std::vector<uint8_t> tmp(0x80000); -READ16_MEMBER( deco32_state::nslasher_debug_r ) -{ - return 0xffff; -} + /* Reorder bitplanes to make decoding easier */ + memcpy(&tmp[0],RAM+0x80000,0x80000); + memcpy(RAM+0x80000,RAM+0x100000,0x80000); + memcpy(RAM+0x100000,&tmp[0],0x80000); + RAM = memregion("gfx2")->base(); + memcpy(&tmp[0],RAM+0x80000,0x80000); + memcpy(RAM+0x80000,RAM+0x100000,0x80000); + memcpy(RAM+0x100000,&tmp[0],0x80000); -static ADDRESS_MAP_START( nslasher_map, AS_PROGRAM, 32, deco32_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM - AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x120000, 0x1200ff) AM_NOP /* ACIA (unused) */ - AM_RANGE(0x140000, 0x140003) AM_WRITE(vblank_ack_w) - AM_RANGE(0x150000, 0x150003) AM_WRITE(nslasher_eeprom_w) /* Volume port/Eprom/Priority */ + deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */ + deco56_decrypt_gfx(machine(), "gfx2"); /* 141 */ - AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(ace_ram_w) AM_SHARE("ace_ram") /* 'Ace' RAM!? */ - AM_RANGE(0x164000, 0x164003) AM_WRITENOP /* Palette control BG2/3 ($1a constant) */ - AM_RANGE(0x164004, 0x164007) AM_WRITENOP /* Palette control Obj1 ($4 constant) */ - AM_RANGE(0x164008, 0x16400b) AM_WRITENOP /* Palette control Obj2 ($6 constant) */ - AM_RANGE(0x16400c, 0x16400f) AM_WRITENOP - AM_RANGE(0x168000, 0x169fff) AM_RAM_WRITE(buffered_palette_w) AM_SHARE("paletteram") - AM_RANGE(0x16c000, 0x16c003) AM_WRITENOP - AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(palette_dma_w) + save_item(NAME(m_tattass_eprom_bit)); + save_item(NAME(m_lastClock)); + save_item(NAME(m_buffer)); + save_item(NAME(m_bufPtr)); + save_item(NAME(m_pendingCommand)); + save_item(NAME(m_readBitCount)); + save_item(NAME(m_byteAddr)); +} - AM_RANGE(0x170000, 0x171fff) AM_READWRITE(spriteram_r, spriteram_w) - AM_RANGE(0x174000, 0x174003) AM_WRITENOP /* Sprite DMA mode (2) */ - AM_RANGE(0x174010, 0x174013) AM_WRITE(buffer_spriteram_w) - AM_RANGE(0x174018, 0x17401b) AM_WRITENOP /* Sprite 'CPU' (unused) */ +DRIVER_INIT_MEMBER( deco32_state, nslasher ) +{ + uint8_t *RAM = memregion("gfx1")->base(); + std::vector<uint8_t> tmp(0x80000); - AM_RANGE(0x178000, 0x179fff) AM_READWRITE(spriteram2_r, spriteram2_w) - AM_RANGE(0x17c000, 0x17c003) AM_WRITENOP /* Sprite DMA mode (2) */ - AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram2_w) - AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */ + /* Reorder bitplanes to make decoding easier */ + memcpy(&tmp[0],RAM+0x80000,0x80000); + memcpy(RAM+0x80000,RAM+0x100000,0x80000); + memcpy(RAM+0x100000,&tmp[0],0x80000); - AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x184000, 0x185fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x192000, 0x193fff) AM_RAM_WRITE(pf1_rowscroll_w) AM_SHARE("pf1_rowscroll32") - AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(pf2_rowscroll_w) AM_SHARE("pf2_rowscroll32") - AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + RAM = memregion("gfx2")->base(); + memcpy(&tmp[0],RAM+0x80000,0x80000); + memcpy(RAM+0x80000,RAM+0x100000,0x80000); + memcpy(RAM+0x100000,&tmp[0],0x80000); - AM_RANGE(0x1c2000, 0x1c3fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf1_data_dword_r, pf1_data_dword_w) - AM_RANGE(0x1c4000, 0x1c5fff) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf2_data_dword_r, pf2_data_dword_w) - AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM_WRITE(pf3_rowscroll_w) AM_SHARE("pf3_rowscroll32") - AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(pf4_rowscroll_w) AM_SHARE("pf4_rowscroll32") - AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) + deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */ + deco74_decrypt_gfx(machine(), "gfx2"); - AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(nslasher_protection_region_0_104_r, nslasher_protection_region_0_104_w, 0xffff0000) - AM_RANGE(0x200000, 0x207fff) AM_READ16(nslasher_debug_r, 0x0000ffff) // seems to be debug switches / code activated by this? -ADDRESS_MAP_END + deco156_decrypt(machine()); -/******************************************************************************/ + m_soundlatch->preset_w(0xff); -static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, deco32_state ) - AM_RANGE(0x000000, 0x00ffff) AM_ROM - AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) - AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write) - AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write) - AM_RANGE(0x140000, 0x140001) AM_DEVREAD("soundlatch", generic_latch_8_device, read) - AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8") - AM_RANGE(0x1fec00, 0x1fec01) AM_DEVWRITE("audiocpu", h6280_device, timer_w) - AM_RANGE(0x1ff400, 0x1ff403) AM_DEVWRITE("audiocpu", h6280_device, irq_status_w) -ADDRESS_MAP_END + save_item(NAME(m_nslasher_sound_irq)); -READ8_MEMBER(deco32_state::latch_r) -{ - /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ - m_nslasher_sound_irq &= ~0x02; - m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); - return m_soundlatch->read(space,0); + /* The board for Night Slashers is very close to the Fighter's History and + Tattoo Assassins boards, but has an encrypted ARM cpu. */ } -static ADDRESS_MAP_START( nslasher_sound, AS_PROGRAM, 8, deco32_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) - AM_RANGE(0xb000, 0xb000) AM_DEVREADWRITE("oki1", okim6295_device, read, write) - AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("oki2", okim6295_device, read, write) - AM_RANGE(0xd000, 0xd000) AM_READ(latch_r) -ADDRESS_MAP_END -static ADDRESS_MAP_START( nslasher_io_sound, AS_IO, 8, deco32_state ) - AM_RANGE(0x0000, 0xffff) AM_ROM AM_REGION("audiocpu", 0) -ADDRESS_MAP_END - - -#if 0 -static ADDRESS_MAP_START( lockload_sound_map, AS_PROGRAM, 8, deco32_state ) - AM_RANGE(0x000000, 0x00ffff) AM_ROM - -ADDRESS_MAP_END -#endif - -/**********************************************************************************/ +//************************************************************************** +// INPUT DEFINITIONS +//************************************************************************** /* Notes (2002.02.05) : @@ -1209,38 +1379,38 @@ COIN1n adds 100 energy points (based on "Coinage") for player n when ingame if e static INPUT_PORTS_START( captaven ) PORT_START("INPUTS") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("DSW") // not dsw but the prot code expects dsw - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -1250,75 +1420,93 @@ static INPUT_PORTS_START( captaven ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN4 ) - - PORT_START("DSW2") /* Dip switch bank 1 */ - PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) - PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) - PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) - PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, "Continue Coin" ) - PORT_DIPSETTING( 0x0080, "1 Start/1 Continue" ) - PORT_DIPSETTING( 0x0000, "2 Start/1 Continue" ) - - /* Dip switch bank 2 */ - PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x0100, "1" ) - PORT_DIPSETTING( 0x0000, "2" ) - PORT_DIPSETTING( 0x0300, "3" ) - PORT_DIPSETTING( 0x0200, "4" ) - PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x1000, 0x1000, "Coin Slots" ) - PORT_DIPSETTING( 0x1000, "Common" ) - PORT_DIPSETTING( 0x0000, "Individual" ) - PORT_DIPNAME( 0x2000, 0x2000, "Play Mode" ) - PORT_DIPSETTING( 0x2000, "2 Player" ) - PORT_DIPSETTING( 0x0000, "4 Player" ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Allow_Continue ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_START("DSW1") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW1:1,2,3") + PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 1C_6C ) ) + PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW1:4,5,6") + PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x18, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x10, DEF_STR( 1C_6C ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSW1:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Continue Coin" ) PORT_DIPLOCATION("DSW1:8") + PORT_DIPSETTING( 0x80, "1 Start/1 Continue" ) + PORT_DIPSETTING( 0x00, "2 Start/1 Continue" ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW2:1,2") + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x00, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x02, "4" ) + PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:3,4") + PORT_DIPSETTING( 0x08, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) + PORT_DIPNAME( 0x10, 0x10, "Coin Slots" ) PORT_DIPLOCATION("DSW2:5") + PORT_DIPSETTING( 0x10, "Common" ) + PORT_DIPSETTING( 0x00, "Individual" ) + PORT_DIPNAME( 0x20, 0x20, "Play Mode" ) PORT_DIPLOCATION("DSW2:6") + PORT_DIPSETTING( 0x20, "2 Player" ) + PORT_DIPSETTING( 0x00, "4 Player" ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("DSW2:7") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + // This one isn't documented in the manual + PORT_START("DSW3") + PORT_DIPUNKNOWN_DIPLOC(0x01, IP_ACTIVE_LOW, "DSW3:1") + PORT_DIPUNKNOWN_DIPLOC(0x02, IP_ACTIVE_LOW, "DSW3:2") + PORT_DIPUNKNOWN_DIPLOC(0x04, IP_ACTIVE_LOW, "DSW3:3") + PORT_DIPUNKNOWN_DIPLOC(0x08, IP_ACTIVE_LOW, "DSW3:4") + PORT_DIPNAME( 0x10, 0x10, "Reset") PORT_DIPLOCATION("DSW3:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On )) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Free_Play )) PORT_DIPLOCATION("DSW3:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On )) + PORT_DIPNAME( 0x40, 0x40, "Stage Select") PORT_DIPLOCATION("DSW3:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On )) + PORT_DIPNAME( 0x80, 0x80, "Debug Mode") PORT_DIPLOCATION("DSW3:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On )) INPUT_PORTS_END static INPUT_PORTS_START( fghthist ) PORT_START("IN0") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("IN1") @@ -1365,7 +1553,6 @@ static INPUT_PORTS_START( dragngun ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) 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 */ PORT_DIPNAME( 0x0100, 0x0000, "Reset" ) /* Behaves like Reset */ @@ -1394,7 +1581,7 @@ static INPUT_PORTS_START( dragngun ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_START("IN2") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") // is this actually vblank? PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_SERVICE( 0x0004, IP_ACTIVE_LOW ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) //check //test BUTTON F2 @@ -1416,15 +1603,6 @@ static INPUT_PORTS_START( dragngun ) PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(2) INPUT_PORTS_END -INPUT_CHANGED_MEMBER(dragngun_state::lockload_gun_trigger) -{ - switch ((uint8_t)(uintptr_t)param) - { - case 0: m_deco_irq->lightgun1_trigger_w(!newval); break; - case 1: m_deco_irq->lightgun2_trigger_w(!newval); break; - } -} - static INPUT_PORTS_START( lockload ) PORT_START("INPUTS") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -1498,21 +1676,21 @@ INPUT_PORTS_END static INPUT_PORTS_START( tattass ) PORT_START("INPUTS") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("DSW") @@ -1536,21 +1714,21 @@ INPUT_PORTS_END static INPUT_PORTS_START( nslasher ) PORT_START("INPUTS") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("DSW") @@ -1562,17 +1740,20 @@ static INPUT_PORTS_START( nslasher ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) /* 'soundmask' */ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START3 ) INPUT_PORTS_END -/**********************************************************************************/ + +//************************************************************************** +// GFXDECODE LAYOUTS +//************************************************************************** static const gfx_layout charlayout = { @@ -1715,54 +1896,10 @@ static GFXDECODE_START( nslasher ) GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 1536, 32 ) /* Sprites 16x16 */ GFXDECODE_END -/**********************************************************************************/ - -WRITE_LINE_MEMBER(deco32_state::sound_irq_nslasher) -{ - /* bit 0 of nslasher_sound_irq specifies IRQ from sound chip */ - if (state) - m_nslasher_sound_irq |= 0x01; - else - m_nslasher_sound_irq &= ~0x01; - m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE8_MEMBER(deco32_state::sound_bankswitch_w) -{ - m_oki1->set_rom_bank((data >> 0) & 1); - m_oki2->set_rom_bank((data >> 1) & 1); -} - -/**********************************************************************************/ - - -DECOSPR_PRIORITY_CB_MEMBER(deco32_state::captaven_pri_callback) -{ - if ((pri & 0x60) == 0x00) - { - return 0; // above everything - } - else if ((pri & 0x60) == 0x20) - { - return 0xfff0; // above the 2nd playfield - } - else if ((pri & 0x60) == 0x40) - { - return 0xfffc; // above the 1st playfield - } - else - { - return 0xfffe; // under everything - } -} - -DECO16IC_BANK_CB_MEMBER(deco32_state::captaven_bank_callback) -{ - bank = bank >> 4; - bank = (bank & 2) >> 1; - return bank * 0x4000; -} +//************************************************************************** +// MACHINE DEFINITIONS +//************************************************************************** static MACHINE_CONFIG_START( captaven ) @@ -1771,7 +1908,7 @@ static MACHINE_CONFIG_START( captaven ) MCFG_CPU_PROGRAM_MAP(captaven_map) MCFG_CPU_ADD("audiocpu", H6280, XTAL_32_22MHz/4/3) /* pin 10 is 32mhz/4, pin 14 is High so internal divisor is 3 (verified on pcb) */ - MCFG_CPU_PROGRAM_MAP(sound_map) + MCFG_CPU_PROGRAM_MAP(h6280_sound_map) MCFG_INPUT_MERGER_ANY_HIGH("irq_merger") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", ARM_IRQ_LINE)) @@ -1787,6 +1924,7 @@ static MACHINE_CONFIG_START( captaven ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", captaven) MCFG_PALETTE_ADD("palette", 2048) + MCFG_PALETTE_FORMAT(XBGR) MCFG_DEVICE_ADD("tilegen1", DECO16IC, 0) MCFG_DECO16IC_SPLIT(0) @@ -1849,24 +1987,14 @@ static MACHINE_CONFIG_START( captaven ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) MACHINE_CONFIG_END - -DECO16IC_BANK_CB_MEMBER(deco32_state::fghthist_bank_callback) -{ - bank = bank >> 4; - bank = (bank & 1) | ((bank & 4) >> 1) | ((bank & 2) << 1); - - return bank * 0x1000; -} - -static MACHINE_CONFIG_START( fghthist ) /* DE-0380-2 PCB */ - - /* basic machine hardware */ +// DE-0380-2 +static MACHINE_CONFIG_START( fghthist ) MCFG_CPU_ADD("maincpu", ARM, XTAL_28MHz / 4) MCFG_CPU_PROGRAM_MAP(fghthist_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", deco32_state, irq0_line_assert) - MCFG_CPU_ADD("audiocpu", H6280, 32220000/8) - MCFG_CPU_PROGRAM_MAP(sound_map) + MCFG_CPU_ADD("audiocpu", H6280, XTAL_32_22MHz / 8) + MCFG_CPU_PROGRAM_MAP(h6280_sound_map) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -1918,8 +2046,7 @@ static MACHINE_CONFIG_START( fghthist ) /* DE-0380-2 PCB */ MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR - - MCFG_VIDEO_START_OVERRIDE(deco32_state,fghthist) + MCFG_VIDEO_START_OVERRIDE(deco32_state, fghthist) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -1928,7 +2055,7 @@ static MACHINE_CONFIG_START( fghthist ) /* DE-0380-2 PCB */ MCFG_YM2151_ADD("ymsnd", 32220000/9) MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 1)) - MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(deco32_state,sound_bankswitch_w)) + MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(deco32_state, sound_bankswitch_w)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.42) MCFG_SOUND_ROUTE(1, "rspeaker", 0.42) @@ -1941,127 +2068,29 @@ static MACHINE_CONFIG_START( fghthist ) /* DE-0380-2 PCB */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( fghthsta ) /* DE-0395-1 PCB */ - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", ARM, XTAL_28MHz / 4) +// DE-0395-1 +static MACHINE_CONFIG_DERIVED( fghthsta, fghthist ) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(fghthsta_memmap) - MCFG_CPU_VBLANK_INT_DRIVER("screen", deco32_state, irq0_line_assert) - - MCFG_CPU_ADD("audiocpu", H6280, 32220000/8) - MCFG_CPU_PROGRAM_MAP(sound_map) - - MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_28MHz / 4, 442, 0, 320, 274, 8, 248) - MCFG_SCREEN_UPDATE_DRIVER(deco32_state, screen_update_fghthist) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", fghthist) - MCFG_PALETTE_ADD("palette", 2048) - - MCFG_DEVICE_ADD("tilegen1", DECO16IC, 0) - MCFG_DECO16IC_SPLIT(0) - MCFG_DECO16IC_WIDTH12(1) - MCFG_DECO16IC_PF1_TRANS_MASK(0x0f) - MCFG_DECO16IC_PF2_TRANS_MASK(0x0f) - MCFG_DECO16IC_PF1_COL_BANK(0x00) - MCFG_DECO16IC_PF2_COL_BANK(0x10) - MCFG_DECO16IC_PF1_COL_MASK(0x0f) - MCFG_DECO16IC_PF2_COL_MASK(0x0f) - MCFG_DECO16IC_BANK1_CB(deco32_state, fghthist_bank_callback) - MCFG_DECO16IC_BANK2_CB(deco32_state, fghthist_bank_callback) - MCFG_DECO16IC_PF12_8X8_BANK(0) - MCFG_DECO16IC_PF12_16X16_BANK(1) - MCFG_DECO16IC_GFXDECODE("gfxdecode") - - MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0) - MCFG_DECO16IC_SPLIT(0) - MCFG_DECO16IC_WIDTH12(1) - MCFG_DECO16IC_PF1_TRANS_MASK(0x0f) - MCFG_DECO16IC_PF2_TRANS_MASK(0x0f) - MCFG_DECO16IC_PF1_COL_BANK(0x20) - MCFG_DECO16IC_PF2_COL_BANK(0x30) - MCFG_DECO16IC_PF1_COL_MASK(0x0f) - MCFG_DECO16IC_PF2_COL_MASK(0x0f) - MCFG_DECO16IC_BANK1_CB(deco32_state, fghthist_bank_callback) - MCFG_DECO16IC_BANK2_CB(deco32_state, fghthist_bank_callback) - MCFG_DECO16IC_PF12_8X8_BANK(0) - MCFG_DECO16IC_PF12_16X16_BANK(2) - MCFG_DECO16IC_GFXDECODE("gfxdecode") - - MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - MCFG_DECO_SPRITE_GFX_REGION(3) - MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - - MCFG_DECO146_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) - MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) - MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR - - MCFG_VIDEO_START_OVERRIDE(deco32_state,fghthist) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - - MCFG_YM2151_ADD("ymsnd", 32220000/9) - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 1)) - MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(deco32_state,sound_bankswitch_w)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.42) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.42) - - MCFG_OKIM6295_ADD("oki1", 32220000/32, PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) - - MCFG_OKIM6295_ADD("oki2", 32220000/16, PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.35) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( fghthistz, fghthsta ) +// DE-0396-0 +static MACHINE_CONFIG_DERIVED( fghthistu, fghthsta ) MCFG_DEVICE_REMOVE("audiocpu") - MCFG_CPU_ADD("audiocpu", Z80, 32220000/9) - MCFG_CPU_PROGRAM_MAP(nslasher_sound) - MCFG_CPU_IO_MAP(nslasher_io_sound) + MCFG_CPU_ADD("audiocpu", Z80, XTAL_32_22MHz / 9) + MCFG_CPU_PROGRAM_MAP(z80_sound_mem) + MCFG_CPU_IO_MAP(z80_sound_io) MCFG_SOUND_MODIFY("ymsnd") //MCFG_YM2151_IRQ_HANDLER(WRITELINE(deco32_state,sound_irq_nslasher)) - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu",0)) + MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) + MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(deco32_state, sound_bankswitch_w)) - MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(deco32_state,sound_bankswitch_w)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.40) MCFG_SOUND_ROUTE(1, "rspeaker", 0.40) - /* - MCFG_DEVICE_REMOVE("ioprot") - MCFG_DECO146_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) - MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) - MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR - MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, nslasher_sound_cb) - */ MACHINE_CONFIG_END -DECO16IC_BANK_CB_MEMBER(dragngun_state::bank_1_callback) -{ - bank = bank >> 4; - return bank * 0x1000; -} - - -DECO16IC_BANK_CB_MEMBER(dragngun_state::bank_2_callback) -{ - bank = bank >> 5; - return bank * 0x1000; -} - static MACHINE_CONFIG_START( dragngun ) /* basic machine hardware */ @@ -2069,7 +2098,7 @@ static MACHINE_CONFIG_START( dragngun ) MCFG_CPU_PROGRAM_MAP(dragngun_map) MCFG_CPU_ADD("audiocpu", H6280, 32220000/8) - MCFG_CPU_PROGRAM_MAP(sound_map) + MCFG_CPU_PROGRAM_MAP(h6280_sound_map) MCFG_INPUT_MERGER_ANY_HIGH("irq_merger") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", ARM_IRQ_LINE)) @@ -2152,11 +2181,30 @@ static MACHINE_CONFIG_START( dragngun ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.35) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) + MCFG_SPEAKER_STANDARD_MONO("gun_speaker") + MCFG_OKIM6295_ADD("oki3", 32220000/32, PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "gun_speaker", 1.0) + + MCFG_LC7535_ADD("vol_main") + MCFG_LC7535_SELECT_CB(VCC) + MCFG_LC7535_VOLUME_CB(dragngun_state, volume_main_changed) + + MCFG_LC7535_ADD("vol_gun") + MCFG_LC7535_SELECT_CB(GND) + MCFG_LC7535_VOLUME_CB(dragngun_state, volume_gun_changed) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( lockloadu, dragngun ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(lockloadu_map) + + MCFG_DEVICE_MODIFY("irq") + MCFG_DECO_IRQ_LIGHTGUN_IRQ_CB(DEVWRITELINE("irq_merger", input_merger_any_high_device, in_w<2>)) + + MCFG_DEVICE_MODIFY("tilegen2") + MCFG_DECO16IC_WIDTH12(0) // lockload definitely wants pf34 half width.. +MACHINE_CONFIG_END static MACHINE_CONFIG_START( lockload ) @@ -2165,8 +2213,8 @@ static MACHINE_CONFIG_START( lockload ) MCFG_CPU_PROGRAM_MAP(lockload_map) MCFG_CPU_ADD("audiocpu", Z80, 32220000/8) - MCFG_CPU_PROGRAM_MAP(nslasher_sound) - MCFG_CPU_IO_MAP(nslasher_io_sound) + MCFG_CPU_PROGRAM_MAP(z80_sound_mem) + MCFG_CPU_IO_MAP(z80_sound_io) MCFG_INPUT_MERGER_ANY_HIGH("irq_merger") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", ARM_IRQ_LINE)) @@ -2252,24 +2300,16 @@ static MACHINE_CONFIG_START( lockload ) MCFG_OKIM6295_ADD("oki2", 32220000/16, PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.35) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( lockloadu, lockload ) - MCFG_CPU_REPLACE("audiocpu", H6280, 32220000/8) - MCFG_CPU_PROGRAM_MAP(sound_map) - MCFG_SOUND_MODIFY("ymsnd") - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 1)) + MCFG_LC7535_ADD("vol_main") + MCFG_LC7535_SELECT_CB(VCC) + MCFG_LC7535_VOLUME_CB(dragngun_state, volume_main_changed) + MCFG_LC7535_ADD("vol_gun") + MCFG_LC7535_SELECT_CB(GND) + MCFG_LC7535_VOLUME_CB(dragngun_state, volume_gun_changed) MACHINE_CONFIG_END - -DECO16IC_BANK_CB_MEMBER(deco32_state::tattass_bank_callback) -{ - bank = bank >> 4; - return bank * 0x1000; -} - static MACHINE_CONFIG_START( tattass ) /* basic machine hardware */ @@ -2345,8 +2385,8 @@ static MACHINE_CONFIG_START( nslasher ) MCFG_CPU_VBLANK_INT_DRIVER("screen", deco32_state, irq0_line_assert) MCFG_CPU_ADD("audiocpu", Z80, 32220000/9) - MCFG_CPU_PROGRAM_MAP(nslasher_sound) - MCFG_CPU_IO_MAP(nslasher_io_sound) + MCFG_CPU_PROGRAM_MAP(z80_sound_mem) + MCFG_CPU_IO_MAP(z80_sound_io) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* to improve main<->audio comms */ @@ -2429,7 +2469,7 @@ MACHINE_CONFIG_END // the US release uses a H6280 instead of a Z80, much like Lock 'n' Loaded static MACHINE_CONFIG_DERIVED( nslasheru, nslasher ) MCFG_CPU_REPLACE("audiocpu", H6280, 32220000/8) - MCFG_CPU_PROGRAM_MAP(sound_map) + MCFG_CPU_PROGRAM_MAP(h6280_sound_map) MCFG_SOUND_MODIFY("ymsnd") MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 1)) @@ -2444,7 +2484,9 @@ static MACHINE_CONFIG_DERIVED( nslasheru, nslasher ) MACHINE_CONFIG_END -/**********************************************************************************/ +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** ROM_START( captaven ) /* DE-0351-x PCB (x=3 or 4) */ ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ @@ -3884,190 +3926,49 @@ ROM_START( nslasheru ) /* DE-0395-1 PCB */ ROM_LOAD( "vm-02.8j", 0x0400, 0x0117, CRC(53692426) SHA1(b8f8cf6b1f6b637fcd1fcd62474e637f5d4a6901) ) ROM_END -DRIVER_INIT_MEMBER(deco32_state,captaven) -{ - deco56_decrypt_gfx(machine(), "gfx1"); - deco56_decrypt_gfx(machine(), "gfx2"); - - save_item(NAME(m_nslasher_sound_irq)); -} - -extern void process_dvi_data(device_t *device,uint8_t* dvi_data, int offset, int regionsize); - -void dragngun_state::dragngun_init_common() -{ - const uint8_t *SRC_RAM = memregion("gfx1")->base(); - uint8_t *DST_RAM = memregion("gfx2")->base(); - - deco74_decrypt_gfx(machine(), "gfx1"); - deco74_decrypt_gfx(machine(), "gfx2"); - deco74_decrypt_gfx(machine(), "gfx3"); - - memcpy(DST_RAM+0x80000,SRC_RAM,0x10000); - memcpy(DST_RAM+0x110000,SRC_RAM+0x10000,0x10000); - -#if 0 - { - uint8_t *ROM = memregion("dvi")->base(); - - FILE *fp; - char filename[256]; - sprintf(filename,"video.dvi"); - fp=fopen(filename, "w+b"); - if (fp) - { - fwrite(ROM, 0xc00000, 1, fp); - fclose(fp); - } - } -#endif - - save_item(NAME(m_lightgun_port)); - - // there are DVI headers at 0x000000, 0x580000, 0x800000, 0xB10000, 0xB80000 -// process_dvi_data(this,memregion("dvi")->base(),0x000000, 0x1000000); -// process_dvi_data(this,memregion("dvi")->base(),0x580000, 0x1000000); -// process_dvi_data(this,memregion("dvi")->base(),0x800000, 0x1000000); -// process_dvi_data(this,memregion("dvi")->base(),0xB10000, 0x1000000); -// process_dvi_data(this,memregion("dvi")->base(),0xB80000, 0x1000000); -} - -DRIVER_INIT_MEMBER(dragngun_state,dragngun) -{ - dragngun_init_common(); - uint32_t *ROM = (uint32_t *)memregion("maincpu")->base(); - ROM[0x1b32c/4]=0xe1a00000; // bl $ee000: NOP test switch lock -} +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** -DRIVER_INIT_MEMBER(dragngun_state,dragngunj) -{ - dragngun_init_common(); - - uint32_t *ROM = (uint32_t *)memregion("maincpu")->base(); - ROM[0x1a1b4/4]=0xe1a00000; // bl $ee000: NOP test switch lock -} - -DRIVER_INIT_MEMBER(deco32_state,fghthist) -{ - deco56_decrypt_gfx(machine(), "gfx1"); - deco74_decrypt_gfx(machine(), "gfx2"); -} - -DRIVER_INIT_MEMBER(dragngun_state,lockload) -{ - uint8_t *RAM = memregion("maincpu")->base(); -// uint32_t *ROM = (uint32_t *)memregion("maincpu")->base(); - - deco74_decrypt_gfx(machine(), "gfx1"); - deco74_decrypt_gfx(machine(), "gfx2"); - deco74_decrypt_gfx(machine(), "gfx3"); - - memcpy(RAM+0x300000,RAM+0x100000,0x100000); - memset(RAM+0x100000,0,0x100000); - - save_item(NAME(m_nslasher_sound_irq)); - -// ROM[0x3fe3c0/4]=0xe1a00000;// NOP test switch lock -// ROM[0x3fe3cc/4]=0xe1a00000;// NOP test switch lock -// ROM[0x3fe40c/4]=0xe1a00000;// NOP test switch lock -} - -DRIVER_INIT_MEMBER(deco32_state,tattass) -{ - uint8_t *RAM = memregion("gfx1")->base(); - std::vector<uint8_t> tmp(0x80000); - - /* Reorder bitplanes to make decoding easier */ - memcpy(&tmp[0],RAM+0x80000,0x80000); - memcpy(RAM+0x80000,RAM+0x100000,0x80000); - memcpy(RAM+0x100000,&tmp[0],0x80000); - - RAM = memregion("gfx2")->base(); - memcpy(&tmp[0],RAM+0x80000,0x80000); - memcpy(RAM+0x80000,RAM+0x100000,0x80000); - memcpy(RAM+0x100000,&tmp[0],0x80000); - - deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */ - deco56_decrypt_gfx(machine(), "gfx2"); /* 141 */ - - save_item(NAME(m_tattass_eprom_bit)); - save_item(NAME(m_lastClock)); - save_item(NAME(m_buffer)); - save_item(NAME(m_bufPtr)); - save_item(NAME(m_pendingCommand)); - save_item(NAME(m_readBitCount)); - save_item(NAME(m_byteAddr)); -} - -DRIVER_INIT_MEMBER(deco32_state,nslasher) -{ - uint8_t *RAM = memregion("gfx1")->base(); - std::vector<uint8_t> tmp(0x80000); - - /* Reorder bitplanes to make decoding easier */ - memcpy(&tmp[0],RAM+0x80000,0x80000); - memcpy(RAM+0x80000,RAM+0x100000,0x80000); - memcpy(RAM+0x100000,&tmp[0],0x80000); - - RAM = memregion("gfx2")->base(); - memcpy(&tmp[0],RAM+0x80000,0x80000); - memcpy(RAM+0x80000,RAM+0x100000,0x80000); - memcpy(RAM+0x100000,&tmp[0],0x80000); - - deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */ - deco74_decrypt_gfx(machine(), "gfx2"); - - deco156_decrypt(machine()); - - m_soundlatch->preset_w(0xff); - - save_item(NAME(m_nslasher_sound_irq)); - - /* The board for Night Slashers is very close to the Fighter's History and - Tattoo Assassins boards, but has an encrypted ARM cpu. */ -} - -/**********************************************************************************/ - -GAME( 1991, captaven, 0, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Asia Rev 1.4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, captavena, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Asia Rev 1.0)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, captavene, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (UK Rev 1.4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, captavenu, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.9)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, captavenuu, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.6)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, captavenua, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, captavenj, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Japan Rev 0.2)", MACHINE_SUPPORTS_SAVE ) +// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROT COMPANY FULLNAME FLAGS +GAME( 1991, captaven, 0, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Asia Rev 1.4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, captavena, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Asia Rev 1.0)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, captavene, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (UK Rev 1.4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, captavenu, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.9)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, captavenuu, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.6)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, captavenua, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, captavenj, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Japan Rev 0.2)", MACHINE_SUPPORTS_SAVE ) // DE-0396-0 PCB sets (Z80 for sound) -GAME( 1993, fghthistu, fghthist, fghthistz,fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-09, DE-0396-0 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistu, fghthist, fghthistu, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-09, DE-0396-0 PCB)", MACHINE_SUPPORTS_SAVE ) // DE-0395-1 PCB sets (HuC6280 for sound) -GAME( 1993, fghthist, 0 , fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-09, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistua, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-06, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistub, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-05, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistj, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-07, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthist, 0 , fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-09, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistua, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-06, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistub, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-05, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistj, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-07, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) // DE-0380-2 PCB sets (HuC6280 for sound) -GAME( 1993, fghthista, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-07, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistb, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistuc, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-03, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistja, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthista, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-07, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistb, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistuc, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-03, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistja, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) // DE-0380-1 PCB sets (HuC6280 for sound) -GAME( 1993, fghthistjb, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-04, DE-0380-1 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistjb, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-04, DE-0380-1 PCB)", MACHINE_SUPPORTS_SAVE ) // DE-0397-0 PCB sets (Z80 for sound) -GAME( 1994, nslasher, 0, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Korea Rev 1.3, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, nslasherj, nslasher, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Japan Rev 1.2, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, nslashers, nslasher, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Over Sea Rev 1.2, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, nslasher, 0, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Korea Rev 1.3, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, nslasherj, nslasher, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Japan Rev 1.2, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, nslashers, nslasher, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Over Sea Rev 1.2, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // DE-0395-1 PCB sets (HuC6280 for sound) -GAME( 1994, nslasheru, nslasher, nslasheru,nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (US Rev 1.2, DE-0395-1 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) - -GAME( 1994, tattass, 0, tattass, tattass, deco32_state, tattass, ROT0, "Data East Pinball", "Tattoo Assassins (US prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, tattassa, tattass, tattass, tattass, deco32_state, tattass, ROT0, "Data East Pinball", "Tattoo Assassins (Asia prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, nslasheru, nslasher, nslasheru, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (US Rev 1.2, DE-0395-1 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, tattass, 0, tattass, tattass, deco32_state, tattass, ROT0, "Data East Pinball", "Tattoo Assassins (US prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, tattassa, tattass, tattass, tattass, deco32_state, tattass, ROT0, "Data East Pinball", "Tattoo Assassins (Asia prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // Dragon Gun / Lock 'n' Loaded have very different sprite hardware -GAME( 1993, dragngun, 0, dragngun, dragngun, dragngun_state, dragngun, ROT0, "Data East Corporation", "Dragon Gun (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1993, dragngunj, dragngun, dragngun, dragngun, dragngun_state, dragngunj, ROT0, "Data East Corporation", "Dragon Gun (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1993, dragngun, 0, dragngun, dragngun, dragngun_state, dragngun, ROT0, "Data East Corporation", "Dragon Gun (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1993, dragngunj, dragngun, dragngun, dragngun, dragngun_state, dragngunj, ROT0, "Data East Corporation", "Dragon Gun (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, lockload, 0, lockload, lockload, dragngun_state, lockload, ROT0, "Data East Corporation", "Locked 'n Loaded (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, gunhard, lockload, lockload, lockload, dragngun_state, lockload, ROT0, "Data East Corporation", "Gun Hard (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1994, lockloadu, lockload, lockloadu,lockload, dragngun_state, lockload, ROT0, "Data East Corporation", "Locked 'n Loaded (US, Dragon Gun conversion)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // HuC6280 Sound CPU +GAME( 1994, lockload, 0, lockload, lockload, dragngun_state, lockload, ROT0, "Data East Corporation", "Locked 'n Loaded (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, gunhard, lockload, lockload, lockload, dragngun_state, lockload, ROT0, "Data East Corporation", "Gun Hard (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1994, lockloadu, lockload, lockloadu, lockload, dragngun_state, lockload, ROT0, "Data East Corporation", "Locked 'n Loaded (US, Dragon Gun conversion)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/deco32.h b/src/mame/includes/deco32.h index 9da0559f7eb..66f8940eb99 100644 --- a/src/mame/includes/deco32.h +++ b/src/mame/includes/deco32.h @@ -7,6 +7,7 @@ #include "machine/deco_irq.h" #include "machine/eepromser.h" #include "machine/gen_latch.h" +#include "sound/lc7535.h" #include "sound/okim6295.h" #include "sound/ym2151.h" #include "machine/deco146.h" @@ -77,7 +78,7 @@ public: required_shared_ptr<uint32_t> m_pf2_rowscroll32; required_shared_ptr<uint32_t> m_pf3_rowscroll32; required_shared_ptr<uint32_t> m_pf4_rowscroll32; - required_shared_ptr<uint32_t> m_generic_paletteram_32; + optional_shared_ptr<uint32_t> m_generic_paletteram_32; optional_shared_ptr<uint32_t> m_ace_ram; uint8_t m_nslasher_sound_irq; // nslasher and lockload @@ -103,6 +104,15 @@ public: uint16_t m_pf4_rowscroll[0x1000]; // common // common + DECLARE_READ16_MEMBER(deco_104_r); + DECLARE_WRITE16_MEMBER(deco_104_w); + DECLARE_READ16_MEMBER(deco_146_r); + DECLARE_WRITE16_MEMBER(deco_146_w); + DECLARE_READ8_MEMBER(eeprom_r); + DECLARE_WRITE8_MEMBER(eeprom_w); + DECLARE_WRITE8_MEMBER(volume_w); + DECLARE_WRITE32_MEMBER(vblank_ack_w); + DECLARE_WRITE32_MEMBER(pf1_rowscroll_w); DECLARE_WRITE32_MEMBER(pf2_rowscroll_w); DECLARE_WRITE32_MEMBER(pf3_rowscroll_w); @@ -111,19 +121,15 @@ public: // captaven DECLARE_READ32_MEMBER(_71_r); - DECLARE_READ32_MEMBER(captaven_soundcpu_r); - DECLARE_WRITE32_MEMBER(nonbuffered_palette_w); + DECLARE_READ8_MEMBER(captaven_dsw1_r); + DECLARE_READ8_MEMBER(captaven_dsw2_r); + DECLARE_READ8_MEMBER(captaven_dsw3_r); + DECLARE_READ8_MEMBER(captaven_soundcpu_status_r); // fghthist DECLARE_WRITE32_MEMBER(sound_w); - DECLARE_READ32_MEMBER(fghthist_control_r); - DECLARE_WRITE32_MEMBER(fghthist_eeprom_w); - DECLARE_READ32_MEMBER(fghthist_protection_region_0_146_r); - DECLARE_WRITE32_MEMBER(fghthist_protection_region_0_146_w); - DECLARE_WRITE32_MEMBER(vblank_ack_w); - - // nslasher - DECLARE_WRITE32_MEMBER(nslasher_eeprom_w); + DECLARE_READ16_MEMBER(fghthist_in0_r); + DECLARE_READ16_MEMBER(fghthist_in1_r); // tattass DECLARE_WRITE32_MEMBER(tattass_control_w); @@ -133,8 +139,6 @@ public: DECLARE_READ8_MEMBER(latch_r); // nslasher and tattass - DECLARE_READ16_MEMBER(nslasher_protection_region_0_104_r); - DECLARE_WRITE16_MEMBER(nslasher_protection_region_0_104_w); DECLARE_READ16_MEMBER(nslasher_debug_r); DECLARE_READ32_MEMBER(spriteram2_r); DECLARE_WRITE32_MEMBER(spriteram2_w); @@ -151,11 +155,6 @@ public: DECLARE_WRITE32_MEMBER(buffered_palette_w); DECLARE_WRITE32_MEMBER(palette_dma_w); - // captaven, dragongun and lockload - DECLARE_READ16_MEMBER(dg_protection_region_0_146_r); - DECLARE_WRITE16_MEMBER(dg_protection_region_0_146_w); - - virtual void video_start() override; DECLARE_DRIVER_INIT(tattass); DECLARE_DRIVER_INIT(nslasher); DECLARE_DRIVER_INIT(captaven); @@ -175,12 +174,15 @@ public: void nslasher_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ); DECLARE_READ16_MEMBER(port_b_tattass); void tattass_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ); - void deco32_set_audio_output(uint8_t raw_data); DECO16IC_BANK_CB_MEMBER(fghthist_bank_callback); DECO16IC_BANK_CB_MEMBER(captaven_bank_callback); DECO16IC_BANK_CB_MEMBER(tattass_bank_callback); DECOSPR_PRIORITY_CB_MEMBER(captaven_pri_callback); + +protected: + virtual void video_start() override; + }; class dragngun_state : public deco32_state @@ -191,13 +193,20 @@ public: m_sprite_layout_0_ram(*this, "lay0"), m_sprite_layout_1_ram(*this, "lay1"), m_sprite_lookup_0_ram(*this, "look0"), - m_sprite_lookup_1_ram(*this, "look1") + m_sprite_lookup_1_ram(*this, "look1"), + m_oki3(*this, "oki3"), + m_vol_main(*this, "vol_main"), + m_vol_gun(*this, "vol_gun"), + m_gun_speaker_disabled(true) { } required_shared_ptr<uint32_t> m_sprite_layout_0_ram; required_shared_ptr<uint32_t> m_sprite_layout_1_ram; required_shared_ptr<uint32_t> m_sprite_lookup_0_ram; required_shared_ptr<uint32_t> m_sprite_lookup_1_ram; + optional_device<okim6295_device> m_oki3; + required_device<lc7535_device> m_vol_main; + required_device<lc7535_device> m_vol_gun; uint32_t m_sprite_ctrl; int m_lightgun_port; @@ -209,11 +218,14 @@ public: DECLARE_WRITE32_MEMBER(spriteram_dma_w); DECLARE_WRITE32_MEMBER(gun_irq_ack_w); DECLARE_READ32_MEMBER(unk_video_r); - DECLARE_READ32_MEMBER(service_r); - DECLARE_READ32_MEMBER(eeprom_r); - DECLARE_WRITE32_MEMBER(eeprom_w); + DECLARE_WRITE8_MEMBER(eeprom_w); DECLARE_READ32_MEMBER(lockload_gun_mirror_r); + DECLARE_WRITE32_MEMBER(volume_w); + DECLARE_WRITE32_MEMBER(speaker_switch_w); + LC7535_VOLUME_CHANGED(volume_main_changed); + LC7535_VOLUME_CHANGED(volume_gun_changed); + virtual void video_start() override; DECLARE_DRIVER_INIT(dragngun); DECLARE_DRIVER_INIT(dragngunj); @@ -227,4 +239,7 @@ public: DECO16IC_BANK_CB_MEMBER(bank_1_callback); DECO16IC_BANK_CB_MEMBER(bank_2_callback); + +private: + bool m_gun_speaker_disabled; }; diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index beea4ddaa30..89147d51a97 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -98,19 +98,6 @@ void deco32_state::updateAceRam() /* Later games have double buffered paletteram - the real palette ram is only updated on a DMA call */ -WRITE32_MEMBER(deco32_state::nonbuffered_palette_w) -{ - int r,g,b; - - COMBINE_DATA(&m_generic_paletteram_32[offset]); - - b = (m_generic_paletteram_32[offset] >>16) & 0xff; - g = (m_generic_paletteram_32[offset] >> 8) & 0xff; - r = (m_generic_paletteram_32[offset] >> 0) & 0xff; - - m_palette->set_pen_color(offset,rgb_t(r,g,b)); -} - WRITE32_MEMBER(deco32_state::buffered_palette_w) { COMBINE_DATA(&m_generic_paletteram_32[offset]); |