mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
spiders.cpp: Use required_device_array for PIAs and input merger for IRQ (nw)
This commit is contained in:
parent
250ffdd580
commit
2a4a7e4465
@ -178,9 +178,8 @@ DISCRETE_SOUND_END
|
||||
|
||||
WRITE8_MEMBER(spiders_state::spiders_audio_command_w)
|
||||
{
|
||||
pia6821_device *pia = downcast<pia6821_device *>(machine().device("pia4"));
|
||||
pia->porta_w(data & 0xf8);
|
||||
pia->ca1_w(data & 0x80 ? 1 : 0);
|
||||
m_pia[3]->porta_w(data & 0xf8);
|
||||
m_pia[3]->ca1_w(data & 0x80 ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,8 +194,8 @@
|
||||
|
||||
#include "cpu/m6800/m6800.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "machine/6821pia.h"
|
||||
#include "machine/74123.h"
|
||||
#include "machine/input_merger.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "machine/rescap.h"
|
||||
#include "video/mc6845.h"
|
||||
@ -219,26 +219,6 @@
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt generation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE_LINE_MEMBER(spiders_state::main_cpu_irq)
|
||||
{
|
||||
pia6821_device *pia1 = machine().device<pia6821_device>("pia1");
|
||||
pia6821_device *pia2 = machine().device<pia6821_device>("pia2");
|
||||
pia6821_device *pia3 = machine().device<pia6821_device>("pia3");
|
||||
int combined_state = pia1->irq_a_state() | pia1->irq_b_state() |
|
||||
pia2->irq_b_state() |
|
||||
pia3->irq_a_state() | pia3->irq_b_state();
|
||||
|
||||
m_maincpu->set_input_line(M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* PIA1 - Main CPU
|
||||
@ -247,17 +227,16 @@ WRITE_LINE_MEMBER(spiders_state::main_cpu_irq)
|
||||
|
||||
INTERRUPT_GEN_MEMBER(spiders_state::update_pia_1)
|
||||
{
|
||||
pia6821_device *pia1 = machine().device<pia6821_device>("pia1");
|
||||
/* update the different PIA pins from the input ports */
|
||||
|
||||
/* CA1 - copy of PA1 (COIN1) */
|
||||
pia1->ca1_w(ioport("IN0")->read() & 0x02);
|
||||
m_pia[0]->ca1_w(ioport("IN0")->read() & 0x02);
|
||||
|
||||
/* CA2 - copy of PA0 (SERVICE1) */
|
||||
pia1->ca2_w(ioport("IN0")->read() & 0x01);
|
||||
m_pia[0]->ca2_w(ioport("IN0")->read() & 0x01);
|
||||
|
||||
/* CB1 - (crosshatch) */
|
||||
pia1->cb1_w(ioport("XHATCH")->read());
|
||||
m_pia[0]->cb1_w(ioport("XHATCH")->read());
|
||||
|
||||
/* CB2 - NOT CONNECTED */
|
||||
}
|
||||
@ -278,8 +257,7 @@ INTERRUPT_GEN_MEMBER(spiders_state::update_pia_1)
|
||||
|
||||
WRITE_LINE_MEMBER(spiders_state::ic60_74123_output_changed)
|
||||
{
|
||||
pia6821_device *pia2 = machine().device<pia6821_device>("pia2");
|
||||
pia2->ca1_w(state);
|
||||
m_pia[1]->ca1_w(state);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
@ -568,21 +546,24 @@ MACHINE_CONFIG_START(spiders_state::spiders)
|
||||
MCFG_DEVICE_ADD("pia1", PIA6821, 0)
|
||||
MCFG_PIA_READPA_HANDLER(IOPORT("IN0"))
|
||||
MCFG_PIA_READPB_HANDLER(IOPORT("IN1"))
|
||||
MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, spiders_state,main_cpu_irq))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, spiders_state,main_cpu_irq))
|
||||
MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<0>))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>))
|
||||
|
||||
MCFG_DEVICE_ADD("pia2", PIA6821, 0)
|
||||
MCFG_PIA_READPA_HANDLER(READ8(*this, spiders_state,gfx_rom_r))
|
||||
MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, spiders_state,gfx_rom_intf_w))
|
||||
MCFG_PIA_CB2_HANDLER(WRITELINE(*this, spiders_state,flipscreen_w))
|
||||
MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, spiders_state,main_cpu_irq))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<2>))
|
||||
|
||||
MCFG_DEVICE_ADD("pia3", PIA6821, 0)
|
||||
MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, spiders_state, spiders_audio_ctrl_w))
|
||||
MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, spiders_state, spiders_audio_command_w))
|
||||
MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, spiders_state,main_cpu_irq))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, spiders_state,main_cpu_irq))
|
||||
MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<3>))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<4>))
|
||||
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("mainirq")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE))
|
||||
|
||||
MCFG_DEVICE_ADD("pia4", PIA6821, 0)
|
||||
MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, spiders_state, spiders_audio_a_w))
|
||||
|
@ -5,6 +5,8 @@
|
||||
Sigma Spiders hardware
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "machine/6821pia.h"
|
||||
#include "sound/discrete.h"
|
||||
#include "video/mc6845.h"
|
||||
|
||||
@ -12,22 +14,18 @@ class spiders_state : public driver_device
|
||||
{
|
||||
public:
|
||||
spiders_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_ram(*this, "ram"),
|
||||
m_discrete(*this, "discrete"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_palette(*this, "palette"),
|
||||
m_audiocpu(*this, "audiocpu") { }
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_ram(*this, "ram")
|
||||
, m_discrete(*this, "discrete")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_palette(*this, "palette")
|
||||
, m_audiocpu(*this, "audiocpu")
|
||||
, m_pia(*this, "pia%u", 1U)
|
||||
{ }
|
||||
|
||||
required_shared_ptr<uint8_t> m_ram;
|
||||
required_device<discrete_device> m_discrete;
|
||||
uint8_t m_flipscreen;
|
||||
uint16_t m_gfx_rom_address;
|
||||
uint8_t m_gfx_rom_ctrl_mode;
|
||||
uint8_t m_gfx_rom_ctrl_latch;
|
||||
uint8_t m_gfx_rom_ctrl_data;
|
||||
void spiders(machine_config &config);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(main_cpu_irq);
|
||||
private:
|
||||
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
|
||||
DECLARE_WRITE8_MEMBER(gfx_rom_intf_w);
|
||||
DECLARE_READ8_MEMBER(gfx_rom_r);
|
||||
@ -41,11 +39,20 @@ public:
|
||||
|
||||
MC6845_UPDATE_ROW(crtc_update_row);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
void spiders(machine_config &config);
|
||||
void spiders_audio(machine_config &config);
|
||||
void spiders_audio_map(address_map &map);
|
||||
void spiders_main_map(address_map &map);
|
||||
|
||||
required_shared_ptr<uint8_t> m_ram;
|
||||
required_device<discrete_device> m_discrete;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device_array<pia6821_device, 4> m_pia;
|
||||
|
||||
uint8_t m_flipscreen;
|
||||
uint16_t m_gfx_rom_address;
|
||||
uint8_t m_gfx_rom_ctrl_mode;
|
||||
uint8_t m_gfx_rom_ctrl_latch;
|
||||
uint8_t m_gfx_rom_ctrl_data;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user