mirror of
https://github.com/holub/mame
synced 2025-04-21 16:01:56 +03:00
antic: Remove hardcoded input port name and make it a GTIA callback instead
This commit is contained in:
parent
fd5c5e6949
commit
bf66c4305c
@ -303,7 +303,6 @@ antic_device::antic_device(const machine_config &mconfig, const char *tag, devic
|
||||
device_video_interface(mconfig, *this),
|
||||
m_gtia(*this, finder_base::DUMMY_TAG),
|
||||
m_maincpu(*this, ":maincpu"),
|
||||
m_djoy_b(*this, ":djoy_b"),
|
||||
m_artifacts(*this, ":artifacts"),
|
||||
m_tv_artifacts(0),
|
||||
m_render1(0),
|
||||
@ -2303,7 +2302,7 @@ void antic_device::generic_interrupt(int button_count)
|
||||
if( m_scanline == VBL_START )
|
||||
{
|
||||
/* specify buttons relevant to this Atari variant */
|
||||
m_gtia->button_interrupt(button_count, m_djoy_b.read_safe(0));
|
||||
m_gtia->button_interrupt(button_count);
|
||||
|
||||
/* do nothing new for the rest of the frame */
|
||||
m_modelines = screen().height() - VBL_START;
|
||||
|
@ -109,7 +109,6 @@ private:
|
||||
|
||||
required_device<gtia_device> m_gtia;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_ioport m_djoy_b;
|
||||
optional_ioport m_artifacts;
|
||||
|
||||
uint32_t m_tv_artifacts;
|
||||
|
@ -2239,6 +2239,7 @@ void a400_state::atari_common(machine_config &config)
|
||||
ATARI_GTIA(config, m_gtia, 0);
|
||||
m_gtia->read_callback().set_ioport("console");
|
||||
m_gtia->write_callback().set(FUNC(a400_state::gtia_cb));
|
||||
m_gtia->trigger_callback().set_ioport("djoy_b");
|
||||
|
||||
ATARI_ANTIC(config, m_antic, 0);
|
||||
m_antic->set_gtia_tag(m_gtia);
|
||||
@ -2453,6 +2454,7 @@ void a400_state::a5200(machine_config &config)
|
||||
|
||||
ATARI_GTIA(config, m_gtia, 0);
|
||||
// m_gtia->set_region(GTIA_NTSC);
|
||||
m_gtia->trigger_callback().set_ioport("djoy_b");
|
||||
|
||||
ATARI_ANTIC(config, m_antic, 0);
|
||||
m_antic->set_gtia_tag(m_gtia);
|
||||
|
@ -137,6 +137,7 @@ void bartop52_state::a5200(machine_config &config)
|
||||
|
||||
ATARI_GTIA(config, m_gtia, 0);
|
||||
m_gtia->set_region(GTIA_NTSC);
|
||||
m_gtia->trigger_callback().set_ioport("djoy_b");
|
||||
|
||||
ATARI_ANTIC(config, m_antic, 0);
|
||||
m_antic->set_gtia_tag(m_gtia);
|
||||
|
@ -125,6 +125,7 @@ gtia_device::gtia_device(const machine_config &mconfig, const char *tag, device_
|
||||
, m_region(GTIA_NTSC)
|
||||
, m_read_cb(*this)
|
||||
, m_write_cb(*this)
|
||||
, m_trigger_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -137,6 +138,7 @@ void gtia_device::device_start()
|
||||
{
|
||||
m_read_cb.resolve();
|
||||
m_write_cb.resolve();
|
||||
m_trigger_cb.resolve_safe(0xf);
|
||||
|
||||
save_item(NAME(m_r.m0pf));
|
||||
save_item(NAME(m_r.m1pf));
|
||||
@ -302,8 +304,10 @@ int gtia_device::is_ntsc()
|
||||
return m_region == GTIA_NTSC;
|
||||
}
|
||||
|
||||
void gtia_device::button_interrupt(int button_count, uint8_t button_port)
|
||||
void gtia_device::button_interrupt(int button_count)
|
||||
{
|
||||
uint8_t button_port = m_trigger_cb();
|
||||
|
||||
/* specify buttons relevant to this Atari variant */
|
||||
for (int i = 0; i < button_count; i++)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
void set_region(gtia_region region) { m_region = region; }
|
||||
auto read_callback() { return m_read_cb.bind(); }
|
||||
auto write_callback() { return m_write_cb.bind(); }
|
||||
auto trigger_callback() { return m_trigger_cb.bind(); }
|
||||
|
||||
uint8_t read(offs_t offset);
|
||||
void write(offs_t offset, uint8_t data);
|
||||
@ -45,7 +46,7 @@ public:
|
||||
uint8_t get_w_colpf2() { return m_w.colpf2; }
|
||||
uint8_t get_w_prior() { return m_w.prior; }
|
||||
void count_hitclr_frames() { m_h.hitclr_frames++; }
|
||||
void button_interrupt(int button_count, uint8_t button_port);
|
||||
void button_interrupt(int button_count);
|
||||
|
||||
void render(uint8_t *src, uint8_t *dst, uint8_t *pmbits, uint8_t *prio);
|
||||
|
||||
@ -182,6 +183,7 @@ private:
|
||||
|
||||
devcb_read8 m_read_cb;
|
||||
devcb_write8 m_write_cb;
|
||||
devcb_read8 m_trigger_cb;
|
||||
};
|
||||
|
||||
|
||||
|
@ -343,6 +343,7 @@ void maxaflex_state::maxaflex(machine_config &config)
|
||||
ATARI_GTIA(config, m_gtia, 0);
|
||||
m_gtia->set_region(GTIA_NTSC);
|
||||
m_gtia->read_callback().set_ioport("console");
|
||||
m_gtia->trigger_callback().set_ioport("djoy_b");
|
||||
|
||||
ATARI_ANTIC(config, m_antic, 0);
|
||||
m_antic->set_gtia_tag(m_gtia);
|
||||
|
Loading…
Reference in New Issue
Block a user