mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
m72: use the upd71059c instead of hacking the irq vectors for different games
This commit is contained in:
parent
2b5b0b048d
commit
1c835a7462
@ -209,7 +209,6 @@ TIMER_CALLBACK_MEMBER(m72_state::synch_callback)
|
||||
|
||||
void m72_state::machine_reset()
|
||||
{
|
||||
m_irq_base = 0x20;
|
||||
m_mcu_sample_addr = 0;
|
||||
m_mcu_snd_cmd_latch = 0;
|
||||
|
||||
@ -220,7 +219,6 @@ void m72_state::machine_reset()
|
||||
MACHINE_RESET_MEMBER(m72_state,xmultipl)
|
||||
{
|
||||
m72_state::machine_reset();
|
||||
m_irq_base = 0x08;
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(m72_state,kengo)
|
||||
@ -236,15 +234,19 @@ TIMER_CALLBACK_MEMBER(m72_state::scanline_interrupt)
|
||||
if (scanline < 256 && scanline == m_raster_irq_position - 128)
|
||||
{
|
||||
m_screen->update_partial(scanline);
|
||||
m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_base + 2);
|
||||
m_upd71059c->ir2_w(1);
|
||||
}
|
||||
else
|
||||
m_upd71059c->ir2_w(0);
|
||||
|
||||
/* VBLANK interrupt */
|
||||
else if (scanline == 256)
|
||||
if (scanline == 256)
|
||||
{
|
||||
m_screen->update_partial(scanline);
|
||||
m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_base + 0);
|
||||
m_upd71059c->ir0_w(1);
|
||||
}
|
||||
else
|
||||
m_upd71059c->ir0_w(0);
|
||||
|
||||
/* adjust for next scanline */
|
||||
if (++scanline >= m_screen->height())
|
||||
@ -1007,7 +1009,7 @@ static ADDRESS_MAP_START( m72_portmap, AS_IO, 16, m72_state )
|
||||
AM_RANGE(0x02, 0x03) AM_WRITE(port02_w) /* coin counters, reset sound cpu, other stuff? */
|
||||
AM_RANGE(0x04, 0x05) AM_WRITE(dmaon_w)
|
||||
AM_RANGE(0x06, 0x07) AM_WRITE(irq_line_w)
|
||||
//AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
|
||||
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
|
||||
AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w)
|
||||
AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w)
|
||||
@ -1021,7 +1023,7 @@ static ADDRESS_MAP_START( rtype2_portmap, AS_IO, 16, m72_state )
|
||||
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
|
||||
AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
|
||||
AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
|
||||
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
|
||||
AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w)
|
||||
AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w)
|
||||
@ -1034,7 +1036,7 @@ static ADDRESS_MAP_START( poundfor_portmap, AS_IO, 16, m72_state )
|
||||
AM_RANGE(0x08, 0x0f) AM_READ(poundfor_trackball_r)
|
||||
AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
|
||||
AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
|
||||
AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
|
||||
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
|
||||
AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w)
|
||||
AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w)
|
||||
@ -1047,7 +1049,7 @@ static ADDRESS_MAP_START( majtitle_portmap, AS_IO, 16, m72_state )
|
||||
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
|
||||
AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
|
||||
AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
|
||||
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
|
||||
AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w)
|
||||
AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w)
|
||||
@ -1063,7 +1065,7 @@ static ADDRESS_MAP_START( m81_portmap, AS_IO, 16, m72_state )
|
||||
AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) /* coin counters, reset sound cpu, other stuff? */
|
||||
AM_RANGE(0x04, 0x05) AM_WRITE(dmaon_w)
|
||||
AM_RANGE(0x06, 0x07) AM_WRITE(irq_line_w)
|
||||
AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
|
||||
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
|
||||
AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w)
|
||||
AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w)
|
||||
@ -1864,11 +1866,13 @@ static MACHINE_CONFIG_START( m72_base, m72_state )
|
||||
MCFG_CPU_ADD("maincpu",V30,MASTER_CLOCK/2/2) /* 16 MHz external freq (8MHz internal) */
|
||||
MCFG_CPU_PROGRAM_MAP(m72_map)
|
||||
MCFG_CPU_IO_MAP(m72_portmap)
|
||||
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("upd71059c", pic8259_device, inta_cb)
|
||||
|
||||
MCFG_CPU_ADD("soundcpu",Z80, SOUND_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(sound_ram_map)
|
||||
MCFG_CPU_IO_MAP(sound_portmap)
|
||||
|
||||
MCFG_PIC8259_ADD( "upd71059c", INPUTLINE("maincpu", 0), VCC, NULL)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", m72)
|
||||
@ -1981,6 +1985,7 @@ static MACHINE_CONFIG_START( rtype2, m72_state )
|
||||
MCFG_CPU_ADD("maincpu", V30,MASTER_CLOCK/2/2) /* 16 MHz external freq (8MHz internal) */
|
||||
MCFG_CPU_PROGRAM_MAP(rtype2_map)
|
||||
MCFG_CPU_IO_MAP(rtype2_portmap)
|
||||
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("upd71059c", pic8259_device, inta_cb)
|
||||
|
||||
MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(sound_rom_map)
|
||||
@ -1988,6 +1993,8 @@ static MACHINE_CONFIG_START( rtype2, m72_state )
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(m72_state, nmi_line_pulse, 128*55) /* clocked by V1? (Vigilante) */
|
||||
/* IRQs are generated by main Z80 and YM2151 */
|
||||
|
||||
MCFG_PIC8259_ADD( "upd71059c", INPUTLINE("maincpu", 0), VCC, NULL)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rtype2)
|
||||
MCFG_PALETTE_ADD("palette", 512)
|
||||
@ -2028,6 +2035,7 @@ static MACHINE_CONFIG_START( m82_large, m72_state )
|
||||
MCFG_CPU_ADD("maincpu", V30,MASTER_CLOCK/2/2) /* 16 MHz external freq (8MHz internal) */
|
||||
MCFG_CPU_PROGRAM_MAP(majtitle_map)
|
||||
MCFG_CPU_IO_MAP(majtitle_portmap)
|
||||
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("upd71059c", pic8259_device, inta_cb)
|
||||
|
||||
MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(sound_rom_map)
|
||||
@ -2035,6 +2043,8 @@ static MACHINE_CONFIG_START( m82_large, m72_state )
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(m72_state, nmi_line_pulse, 128*55) /* clocked by V1? (Vigilante) */
|
||||
/* IRQs are generated by main Z80 and YM2151 */
|
||||
|
||||
MCFG_PIC8259_ADD( "upd71059c", INPUTLINE("maincpu", 0), VCC, NULL)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", majtitle)
|
||||
MCFG_PALETTE_ADD("palette", 512)
|
||||
@ -2056,13 +2066,16 @@ MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
||||
// M84?
|
||||
// M84
|
||||
|
||||
// is the upd71059c present and unused, or has it been removed from the PCB? it isn't needed beacuse the V35 has it's own IRQ controller.
|
||||
static MACHINE_CONFIG_START( cosmccop, m72_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", V35,MASTER_CLOCK/2)
|
||||
MCFG_CPU_PROGRAM_MAP(kengo_map)
|
||||
MCFG_CPU_IO_MAP(kengo_portmap)
|
||||
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("upd71059c", pic8259_device, inta_cb)
|
||||
|
||||
MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(sound_rom_map)
|
||||
@ -2070,6 +2083,8 @@ static MACHINE_CONFIG_START( cosmccop, m72_state )
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(m72_state, nmi_line_pulse, 128*55) /* clocked by V1? (Vigilante) */
|
||||
/* IRQs are generated by main Z80 and YM2151 */
|
||||
|
||||
MCFG_PIC8259_ADD( "upd71059c", INPUTLINE("maincpu", 0), VCC, NULL)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(m72_state,kengo)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(m72_state,kengo)
|
||||
|
||||
@ -2105,6 +2120,7 @@ static MACHINE_CONFIG_START( poundfor, m72_state )
|
||||
MCFG_CPU_ADD("maincpu", V30,MASTER_CLOCK/2/2) /* 16 MHz external freq (8MHz internal) */
|
||||
MCFG_CPU_PROGRAM_MAP(rtype2_map)
|
||||
MCFG_CPU_IO_MAP(poundfor_portmap)
|
||||
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("upd71059c", pic8259_device, inta_cb)
|
||||
|
||||
MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(sound_rom_map)
|
||||
@ -2112,6 +2128,8 @@ static MACHINE_CONFIG_START( poundfor, m72_state )
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(m72_state, fake_nmi, 128*55) /* clocked by V1? (Vigilante) */
|
||||
/* IRQs are generated by main Z80 and YM2151 */
|
||||
|
||||
MCFG_PIC8259_ADD( "upd71059c", INPUTLINE("maincpu", 0), VCC, NULL)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rtype2)
|
||||
MCFG_PALETTE_ADD("palette", 512)
|
||||
|
@ -7,6 +7,7 @@
|
||||
*************************************************************************/
|
||||
#include "audio/m72.h"
|
||||
#include "sound/dac.h"
|
||||
#include "machine/pic8259.h"
|
||||
|
||||
class m72_state : public driver_device
|
||||
{
|
||||
@ -28,7 +29,9 @@ public:
|
||||
m_spriteram2(*this, "spriteram2"),
|
||||
m_soundram(*this, "soundram"),
|
||||
m_generic_paletteram_16(*this, "paletteram"),
|
||||
m_generic_paletteram2_16(*this, "paletteram2") { }
|
||||
m_generic_paletteram2_16(*this, "paletteram2"),
|
||||
m_upd71059c(*this, "upd71059c")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_soundcpu;
|
||||
@ -47,10 +50,10 @@ public:
|
||||
optional_shared_ptr<UINT8> m_soundram;
|
||||
required_shared_ptr<UINT16> m_generic_paletteram_16;
|
||||
required_shared_ptr<UINT16> m_generic_paletteram2_16;
|
||||
optional_device<pic8259_device> m_upd71059c;
|
||||
|
||||
UINT16 *m_protection_ram;
|
||||
emu_timer *m_scanline_timer;
|
||||
UINT8 m_irq_base;
|
||||
const UINT8 *m_protection_code;
|
||||
const UINT8 *m_protection_crc;
|
||||
UINT32 m_raster_irq_position;
|
||||
|
Loading…
Reference in New Issue
Block a user