mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
ddragon3.cpp: Soundlatch modernization; use explicit buffering trigger in ctribe and ddragon3b (nw)
This commit is contained in:
parent
1dc732f5a5
commit
88f433d96e
@ -205,48 +205,28 @@ WRITE8_MEMBER(ddragon3_state::oki_bankswitch_w)
|
||||
|
||||
WRITE16_MEMBER(wwfwfest_state::wwfwfest_soundwrite)
|
||||
{
|
||||
m_soundlatch->write(space,1,data & 0xff);
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
|
||||
// upper byte is always set to 0x31 for some reason
|
||||
m_soundlatch->write(space, 0, data & 0xff);
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(ddragon3_state::ddragon3_io_w)
|
||||
WRITE16_MEMBER(ddragon3_state::ddragon3_vreg_w)
|
||||
{
|
||||
COMBINE_DATA(&m_io_reg[offset]);
|
||||
COMBINE_DATA(&m_vreg);
|
||||
}
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
m_vreg = m_io_reg[0];
|
||||
break;
|
||||
|
||||
case 1: /* soundlatch write */
|
||||
m_soundlatch->write(space, 1, m_io_reg[1] & 0xff);
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
|
||||
break;
|
||||
WRITE16_MEMBER(ddragon3_state::irq6_ack_w)
|
||||
{
|
||||
// this gets written to on startup and at the end of IRQ6
|
||||
m_maincpu->set_input_line(6, CLEAR_LINE);
|
||||
}
|
||||
|
||||
case 2:
|
||||
/* this gets written to on startup and at the end of IRQ6
|
||||
** possibly trigger IRQ on sound CPU
|
||||
*/
|
||||
m_maincpu->set_input_line(6, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* this gets written to on startup,
|
||||
** and at the end of IRQ5 (input port read) */
|
||||
m_maincpu->set_input_line(5, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/* this gets written to at the end of IRQ6 only */
|
||||
m_maincpu->set_input_line(6, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
default:
|
||||
logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset, (unsigned)data, space.device().safe_pc() );
|
||||
break;
|
||||
}
|
||||
WRITE16_MEMBER(ddragon3_state::irq5_ack_w)
|
||||
{
|
||||
// this gets written to on startup and at the end of IRQ5 (input port read)
|
||||
m_maincpu->set_input_line(5, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -312,6 +292,7 @@ CUSTOM_INPUT_MEMBER(wwfwfest_state::dsw_c0_r)
|
||||
|
||||
static ADDRESS_MAP_START( ddragon3_map, AS_PROGRAM, 16, ddragon3_state )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x000004, 0x000007) AM_WRITENOP
|
||||
AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(ddragon3_fg_videoram_w) AM_SHARE("fg_videoram") /* Foreground (32x32 Tiles - 4 by per tile) */
|
||||
AM_RANGE(0x082000, 0x0827ff) AM_RAM_WRITE(ddragon3_bg_videoram_w) AM_SHARE("bg_videoram") /* Background (32x32 Tiles - 2 by per tile) */
|
||||
AM_RANGE(0x0c0000, 0x0c000f) AM_WRITE(ddragon3_scroll_w)
|
||||
@ -319,7 +300,10 @@ static ADDRESS_MAP_START( ddragon3_map, AS_PROGRAM, 16, ddragon3_state )
|
||||
AM_RANGE(0x100002, 0x100003) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0x100004, 0x100005) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x100006, 0x100007) AM_READ_PORT("P3")
|
||||
AM_RANGE(0x100000, 0x10000f) AM_WRITE(ddragon3_io_w)
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(ddragon3_vreg_w)
|
||||
AM_RANGE(0x100002, 0x100003) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
|
||||
AM_RANGE(0x100004, 0x100005) AM_WRITE(irq6_ack_w)
|
||||
AM_RANGE(0x100006, 0x100007) AM_WRITE(irq5_ack_w)
|
||||
AM_RANGE(0x140000, 0x1405ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* Palette RAM */
|
||||
AM_RANGE(0x180000, 0x180fff) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM /* working RAM */
|
||||
@ -332,7 +316,11 @@ static ADDRESS_MAP_START( dd3b_map, AS_PROGRAM, 16, ddragon3_state )
|
||||
AM_RANGE(0x082000, 0x0827ff) AM_RAM_WRITE(ddragon3_bg_videoram_w) AM_SHARE("bg_videoram") /* Background (32x32 Tiles - 2 by per tile) */
|
||||
AM_RANGE(0x0c0000, 0x0c000f) AM_WRITE(ddragon3_scroll_w)
|
||||
AM_RANGE(0x100000, 0x1005ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* Palette RAM */
|
||||
AM_RANGE(0x140000, 0x14000f) AM_WRITE(ddragon3_io_w)
|
||||
AM_RANGE(0x140000, 0x140001) AM_WRITE(ddragon3_vreg_w)
|
||||
AM_RANGE(0x140002, 0x140003) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
|
||||
AM_RANGE(0x140004, 0x140005) AM_WRITE(irq6_ack_w)
|
||||
AM_RANGE(0x140006, 0x140007) AM_WRITE(irq5_ack_w)
|
||||
AM_RANGE(0x140008, 0x140009) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write)
|
||||
AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x180002, 0x180003) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x180004, 0x180005) AM_READ_PORT("IN2")
|
||||
@ -348,7 +336,11 @@ static ADDRESS_MAP_START( ctribe_map, AS_PROGRAM, 16, ddragon3_state )
|
||||
AM_RANGE(0x082800, 0x082fff) AM_RAM
|
||||
AM_RANGE(0x0c0000, 0x0c000f) AM_READWRITE(ddragon3_scroll_r, ddragon3_scroll_w)
|
||||
AM_RANGE(0x100000, 0x1005ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* Palette RAM */
|
||||
AM_RANGE(0x140000, 0x14000f) AM_WRITE(ddragon3_io_w)
|
||||
AM_RANGE(0x140000, 0x140001) AM_WRITE(ddragon3_vreg_w)
|
||||
AM_RANGE(0x140002, 0x140003) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
|
||||
AM_RANGE(0x140004, 0x140005) AM_WRITE(irq6_ack_w)
|
||||
AM_RANGE(0x140006, 0x140007) AM_WRITE(irq5_ack_w)
|
||||
AM_RANGE(0x140008, 0x140009) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write)
|
||||
AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x180002, 0x180003) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x180004, 0x180005) AM_READ_PORT("IN2")
|
||||
@ -810,22 +802,16 @@ void ddragon3_state::machine_start()
|
||||
save_item(NAME(m_fg_scrollx));
|
||||
save_item(NAME(m_fg_scrolly));
|
||||
save_item(NAME(m_bg_tilebase));
|
||||
save_item(NAME(m_io_reg));
|
||||
}
|
||||
|
||||
void ddragon3_state::machine_reset()
|
||||
{
|
||||
int i;
|
||||
|
||||
m_vreg = 0;
|
||||
m_bg_scrollx = 0;
|
||||
m_bg_scrolly = 0;
|
||||
m_fg_scrollx = 0;
|
||||
m_fg_scrolly = 0;
|
||||
m_bg_tilebase = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
m_io_reg[i] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( ddragon3 )
|
||||
@ -855,6 +841,7 @@ static MACHINE_CONFIG_START( ddragon3 )
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
|
||||
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI))
|
||||
|
||||
MCFG_YM2151_ADD("ym2151", XTAL_3_579545MHz)
|
||||
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
|
||||
@ -870,6 +857,9 @@ static MACHINE_CONFIG_DERIVED( ddragon3b, ddragon3 )
|
||||
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_PROGRAM_MAP(dd3b_map)
|
||||
|
||||
MCFG_SCREEN_MODIFY("screen")
|
||||
MCFG_SCREEN_VBLANK_CALLBACK(NOOP)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( ctribe, ddragon3 )
|
||||
@ -885,6 +875,7 @@ static MACHINE_CONFIG_DERIVED( ctribe, ddragon3 )
|
||||
|
||||
MCFG_SCREEN_MODIFY("screen")
|
||||
MCFG_SCREEN_UPDATE_DRIVER(ddragon3_state, screen_update_ctribe)
|
||||
MCFG_SCREEN_VBLANK_CALLBACK(NOOP)
|
||||
|
||||
MCFG_SOUND_MODIFY("ym2151")
|
||||
MCFG_SOUND_ROUTES_RESET()
|
||||
@ -925,6 +916,7 @@ static MACHINE_CONFIG_START( wwfwfest )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
|
||||
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI))
|
||||
|
||||
MCFG_YM2151_ADD("ym2151", XTAL_3_579545MHz)
|
||||
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
|
||||
|
@ -54,7 +54,6 @@ public:
|
||||
uint16_t m_bg1_dx[2];
|
||||
|
||||
/* misc */
|
||||
uint16_t m_io_reg[8];
|
||||
uint8_t m_pri;
|
||||
|
||||
/* devices */
|
||||
@ -66,7 +65,9 @@ public:
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<generic_latch_8_device> m_soundlatch;
|
||||
|
||||
DECLARE_WRITE16_MEMBER(ddragon3_io_w);
|
||||
DECLARE_WRITE16_MEMBER(ddragon3_vreg_w);
|
||||
DECLARE_WRITE16_MEMBER(irq6_ack_w);
|
||||
DECLARE_WRITE16_MEMBER(irq5_ack_w);
|
||||
DECLARE_WRITE16_MEMBER(ddragon3_scroll_w);
|
||||
DECLARE_READ16_MEMBER(ddragon3_scroll_r);
|
||||
DECLARE_WRITE16_MEMBER(ddragon3_bg_videoram_w);
|
||||
|
Loading…
Reference in New Issue
Block a user