beathead.cpp, foodf.cpp, relief.cpp: Disentangle drivers from atarigen_state (nw)

This commit is contained in:
AJR 2018-11-29 17:15:57 -05:00
parent 7bce596ee9
commit 236dd85f8e
10 changed files with 77 additions and 51 deletions

View File

@ -142,9 +142,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(beathead_state::scanline_callback)
void beathead_state::machine_reset()
{
/* reset the common subsystems */
atarigen_state::machine_reset();
/* the code is temporarily mapped at 0 at startup */
/* just copying the first 0x40 bytes is sufficient */
memcpy(m_ram_base, m_rom_base, 0x40);

View File

@ -79,7 +79,6 @@
#include "includes/foodf.h"
#include "cpu/m68000/m68000.h"
#include "machine/adc0808.h"
#include "machine/atarigen.h"
#include "machine/watchdog.h"
#include "sound/pokey.h"
#include "speaker.h"
@ -127,7 +126,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(foodf_state::scanline_update_timer)
mystery yet */
/* INT 1 is on 32V */
scanline_int_gen(*m_maincpu);
m_scanline_int_state = true;
update_interrupts();
/* advance to the next interrupt */
scanline += 64;
@ -139,9 +139,24 @@ TIMER_DEVICE_CALLBACK_MEMBER(foodf_state::scanline_update_timer)
}
WRITE_LINE_MEMBER(foodf_state::video_int_write_line)
{
if (state)
{
m_video_int_state = true;
update_interrupts();
}
}
void foodf_state::machine_start()
{
atarigen_state::machine_start();
m_scanline_int_state = false;
m_video_int_state = false;
save_item(NAME(m_scanline_int_state));
save_item(NAME(m_video_int_state));
save_item(NAME(m_playfield_flip));
m_leds.resolve();
}
@ -165,10 +180,16 @@ WRITE8_MEMBER(foodf_state::digital_w)
m_nvram->store(data & 0x02);
if (!(data & 0x04))
scanline_int_ack_w(space,0,0);
if (!(data & 0x08))
video_int_ack_w(space,0,0);
if (!BIT(data, 2))
{
m_scanline_int_state = false;
update_interrupts();
}
if (!BIT(data, 3))
{
m_video_int_state = false;
update_interrupts();
}
m_leds[0] = BIT(data, 4);
m_leds[1] = BIT(data, 5);

View File

@ -27,22 +27,10 @@
#include "machine/watchdog.h"
#include "sound/okim6295.h"
#include "sound/ym2413.h"
#include "emupal.h"
#include "speaker.h"
/*************************************
*
* Interrupt handling
*
*************************************/
void relief_state::update_interrupts()
{
m_maincpu->set_input_line(4, m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE);
}
/*************************************
*
* Initialization
@ -51,8 +39,6 @@ void relief_state::update_interrupts()
void relief_state::machine_reset()
{
atarigen_state::machine_reset();
m_adpcm_bank = 0;
m_okibank->set_entry(m_adpcm_bank);
m_ym2413_volume = 15;
@ -70,7 +56,7 @@ void relief_state::machine_reset()
READ16_MEMBER(relief_state::special_port2_r)
{
int result = ioport("260010")->read();
if (!(result & 0x0080) || get_hblank(*m_screen)) result ^= 0x0001;
if (!(result & 0x0080) || m_screen->hblank()) result ^= 0x0001;
return result;
}
@ -136,7 +122,7 @@ void relief_state::main_map(address_map &map)
map(0x260010, 0x260011).r(FUNC(relief_state::special_port2_r));
map(0x260012, 0x260013).portr("260012");
map(0x2a0000, 0x2a0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
map(0x3e0000, 0x3e0fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x3e0000, 0x3e0fff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
map(0x3effc0, 0x3effff).rw(m_vad, FUNC(atari_vad_device::control_read), FUNC(atari_vad_device::control_write));
map(0x3f0000, 0x3f1fff).ram().w(m_vad, FUNC(atari_vad_device::playfield2_latched_msb_w)).share("vad:playfield2");
map(0x3f2000, 0x3f3fff).ram().w(m_vad, FUNC(atari_vad_device::playfield_latched_lsb_w)).share("vad:playfield");
@ -272,7 +258,7 @@ GFXDECODE_END
MACHINE_CONFIG_START(relief_state::relief)
/* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2)
MCFG_DEVICE_ADD("maincpu", M68000, 14.318181_MHz_XTAL/2)
MCFG_DEVICE_PROGRAM_MAP(main_map)
EEPROM_2816(config, "eeprom").lock_after_write(true);
@ -284,7 +270,7 @@ MACHINE_CONFIG_START(relief_state::relief)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
MCFG_ATARI_VAD_ADD("vad", "screen", WRITELINE(*this, relief_state, scanline_int_write_line))
MCFG_ATARI_VAD_ADD("vad", "screen", INPUTLINE("maincpu", M68K_IRQ_4))
MCFG_ATARI_VAD_PLAYFIELD(relief_state, "gfxdecode", get_playfield_tile_info)
MCFG_ATARI_VAD_PLAYFIELD2(relief_state, "gfxdecode", get_playfield2_tile_info)
MCFG_ATARI_VAD_MOB(relief_state::s_mob_config, "gfxdecode")
@ -293,18 +279,18 @@ MACHINE_CONFIG_START(relief_state::relief)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
/* note: these parameters are from published specs, not derived */
/* the board uses a VAD chip to generate video signals */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_RAW_PARAMS(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(relief_state, screen_update_relief)
MCFG_SCREEN_PALETTE("palette")
/* sound hardware */
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, ATARI_CLOCK_14MHz/4/3, okim6295_device::PIN7_LOW)
MCFG_DEVICE_ADD("oki", OKIM6295, 14.318181_MHz_XTAL/4/3, okim6295_device::PIN7_LOW)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADDRESS_MAP(0, oki_map)
MCFG_DEVICE_ADD("ymsnd", YM2413, ATARI_CLOCK_14MHz/4)
MCFG_DEVICE_ADD("ymsnd", YM2413, 14.318181_MHz_XTAL/4)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END

View File

@ -10,16 +10,20 @@
#pragma once
#include "machine/atarigen.h"
#include "machine/timer.h"
#include "cpu/asap/asap.h"
#include "audio/atarijsa.h"
#include "emupal.h"
#include "screen.h"
class beathead_state : public atarigen_state
class beathead_state : public driver_device
{
public:
beathead_state(const machine_config &mconfig, device_type type, const char *tag) :
atarigen_state(mconfig, type, tag),
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"),
m_screen(*this, "screen"),
m_jsa(*this, "jsa"),
m_scan_timer(*this, "scan_timer"),
m_videoram(*this, "videoram"),
@ -33,7 +37,7 @@ public:
protected:
// in drivers/beathead.c
virtual void update_interrupts() override;
void update_interrupts();
DECLARE_WRITE32_MEMBER( interrupt_control_w );
DECLARE_READ32_MEMBER( interrupt_control_r );
DECLARE_WRITE32_MEMBER( sound_reset_w );
@ -58,6 +62,10 @@ protected:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
private:
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
required_device<atari_jsa_iii_device> m_jsa;
required_device<timer_device> m_scan_timer;
@ -81,8 +89,6 @@ private:
uint8_t m_irq_line_state;
uint8_t m_irq_enable[3];
uint8_t m_irq_state[3];
uint8_t m_eeprom_enabled;
};
#endif // MAME_INCLUDES_BEATHEAD_H

View File

@ -10,16 +10,22 @@
#pragma once
#include "machine/atarigen.h"
#include "machine/timer.h"
#include "machine/x2212.h"
#include "emupal.h"
#include "screen.h"
class foodf_state : public atarigen_state
class foodf_state : public driver_device
{
public:
foodf_state(const machine_config &mconfig, device_type type, const char *tag) :
atarigen_state(mconfig, type, tag),
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nvram(*this, "nvram"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_paletteram(*this, "paletteram"),
m_gfxdecode(*this, "gfxdecode"),
m_playfield_tilemap(*this, "playfield"),
m_scan_timer(*this, "scan_timer"),
m_spriteram(*this, "spriteram"),
@ -32,7 +38,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
virtual void update_interrupts() override;
void update_interrupts();
DECLARE_WRITE16_MEMBER(nvram_recall_w);
DECLARE_WRITE8_MEMBER(digital_w);
DECLARE_WRITE16_MEMBER(foodf_paletteram_w);
@ -41,10 +47,19 @@ private:
TILE_GET_INFO_MEMBER(get_playfield_tile_info);
uint32_t screen_update_foodf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline_update_timer);
DECLARE_WRITE_LINE_MEMBER(video_int_write_line);
void main_map(address_map &map);
bool m_scanline_int_state;
bool m_video_int_state;
required_device<cpu_device> m_maincpu;
required_device<x2212_device> m_nvram;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<uint16_t> m_paletteram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<tilemap_device> m_playfield_tilemap;
required_device<timer_device> m_scan_timer;

View File

@ -10,18 +10,20 @@
#pragma once
#include "machine/atarigen.h"
#include "sound/okim6295.h"
#include "sound/ym2413.h"
#include "video/atarimo.h"
#include "video/atarivad.h"
#include "screen.h"
class relief_state : public atarigen_state
class relief_state : public driver_device
{
public:
relief_state(const machine_config &mconfig, device_type type, const char *tag) :
atarigen_state(mconfig, type, tag),
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_vad(*this, "vad"),
m_oki(*this, "oki"),
m_ym2413(*this, "ymsnd"),
@ -35,7 +37,6 @@ public:
private:
virtual void machine_reset() override;
virtual void video_start() override;
virtual void update_interrupts() override;
DECLARE_READ16_MEMBER(special_port2_r);
DECLARE_WRITE16_MEMBER(audio_control_w);
DECLARE_WRITE16_MEMBER(audio_volume_w);
@ -46,6 +47,9 @@ private:
void main_map(address_map &map);
void oki_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<atari_vad_device> m_vad;
required_device<okim6295_device> m_oki;
required_device<ym2413_device> m_ym2413;

View File

@ -77,8 +77,8 @@ WRITE16_MEMBER(foodf_state::foodf_paletteram_w)
{
int newword, r, g, b, bit0, bit1, bit2;
COMBINE_DATA(&m_generic_paletteram_16[offset]);
newword = m_generic_paletteram_16[offset];
COMBINE_DATA(&m_paletteram[offset]);
newword = m_paletteram[offset];
/* only the bottom 8 bits are used */
/* red component */

View File

@ -137,7 +137,6 @@
****************************************************************************/
#include "emu.h"
#include "machine/atarigen.h"
#include "cpu/mips/mips1.h"
#include "cpu/m68000/m68000.h"
#include "includes/jaguar.h"

View File

@ -7,7 +7,6 @@
****************************************************************************/
#include "emu.h"
#include "machine/atarigen.h"
#include "includes/relief.h"

View File

@ -7,7 +7,6 @@
****************************************************************************/
#include "emu.h"
#include "machine/atarigen.h"
#include "includes/thunderj.h"