1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /*************************************************************************
4 
5     Atari Gauntlet hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_GAUNTLET_H
9 #define MAME_INCLUDES_GAUNTLET_H
10 
11 #pragma once
12 
13 #include "machine/74259.h"
14 #include "machine/gen_latch.h"
15 #include "machine/slapstic.h"
16 #include "machine/timer.h"
17 #include "video/atarimo.h"
18 #include "sound/ym2151.h"
19 #include "sound/pokey.h"
20 #include "sound/tms5220.h"
21 #include "screen.h"
22 #include "tilemap.h"
23 
24 class gauntlet_state : public driver_device
25 {
26 public:
gauntlet_state(const machine_config & mconfig,device_type type,const char * tag)27 	gauntlet_state(const machine_config &mconfig, device_type type, const char *tag) :
28 		driver_device(mconfig, type, tag),
29 		m_maincpu(*this, "maincpu"),
30 		m_audiocpu(*this, "audiocpu"),
31 		m_soundlatch(*this, "soundlatch"),
32 		m_mainlatch(*this, "mainlatch"),
33 		m_ym2151(*this, "ymsnd"),
34 		m_pokey(*this, "pokey"),
35 		m_tms5220(*this, "tms"),
36 		m_soundctl(*this, "soundctl"),
37 		m_slapstic(*this, "slapstic"),
38 		m_gfxdecode(*this, "gfxdecode"),
39 		m_screen(*this, "screen"),
40 		m_playfield_tilemap(*this, "playfield"),
41 		m_alpha_tilemap(*this, "alpha"),
42 		m_xscroll(*this, "xscroll"),
43 		m_yscroll(*this, "yscroll"),
44 		m_mob(*this, "mob")
45 	{ }
46 
47 	void init_gauntlet();
48 	void init_vindctr2();
49 	void vindctr2(machine_config &config);
50 	void gauntlet(machine_config &config);
51 	void gaunt2p(machine_config &config);
52 	void gauntlet2(machine_config &config);
53 
54 protected:
55 	virtual void video_start() override;
56 
57 private:
58 	void video_int_ack_w(uint16_t data = 0);
59 	TIMER_DEVICE_CALLBACK_MEMBER(scanline_update);
60 	uint8_t sound_irq_ack_r();
61 	void sound_irq_ack_w(uint8_t data);
62 	DECLARE_WRITE_LINE_MEMBER(sound_reset_w);
63 	uint8_t switch_6502_r();
64 	DECLARE_WRITE_LINE_MEMBER(speech_squeak_w);
65 	DECLARE_WRITE_LINE_MEMBER(coin_counter_left_w);
66 	DECLARE_WRITE_LINE_MEMBER(coin_counter_right_w);
67 	void mixer_w(uint8_t data);
68 	void swap_memory(void *ptr1, void *ptr2, int bytes);
69 	void common_init(int vindctr2);
70 	TILE_GET_INFO_MEMBER(get_alpha_tile_info);
71 	TILE_GET_INFO_MEMBER(get_playfield_tile_info);
72 	uint32_t screen_update_gauntlet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
73 	void gauntlet_xscroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
74 	void gauntlet_yscroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
75 
76 	void gauntlet_base(machine_config &config);
77 	void main_map(address_map &map);
78 	void sound_map(address_map &map);
79 
80 	required_device<cpu_device> m_maincpu;
81 	required_device<cpu_device> m_audiocpu;
82 	required_device<generic_latch_8_device> m_soundlatch;
83 	required_device<generic_latch_8_device> m_mainlatch;
84 	required_device<ym2151_device> m_ym2151;
85 	required_device<pokey_device> m_pokey;
86 	required_device<tms5220_device> m_tms5220;
87 	required_device<ls259_device> m_soundctl;
88 	required_device<atari_slapstic_device> m_slapstic;
89 
90 	required_device<gfxdecode_device> m_gfxdecode;
91 	required_device<screen_device> m_screen;
92 	required_device<tilemap_device> m_playfield_tilemap;
93 	required_device<tilemap_device> m_alpha_tilemap;
94 	required_shared_ptr<uint16_t> m_xscroll;
95 	required_shared_ptr<uint16_t> m_yscroll;
96 	required_device<atari_motion_objects_device> m_mob;
97 
98 	uint16_t          m_sound_reset_val;
99 	uint8_t           m_vindctr2_screen_refresh;
100 	uint8_t           m_playfield_tile_bank;
101 	uint8_t           m_playfield_color_bank;
102 
103 	static const atari_motion_objects_config s_mob_config;
104 };
105 
106 #endif // MAME_INCLUDES_GAUNTLET_H
107