1 // license:BSD-3-Clause
2 // copyright-holders:Philip Bennett
3 /*************************************************************************
4 
5     Super Dead Heat hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_SPDHEAT_H
9 #define MAME_INCLUDES_SPDHEAT_H
10 
11 #pragma once
12 
13 #include "emupal.h"
14 #include "screen.h"
15 #include "tilemap.h"
16 #include "machine/input_merger.h"
17 #include "sound/dac.h"
18 
19 
20 /*************************************
21  *
22  *  Machine class
23  *
24  *************************************/
25 
26 class spdheat_state : public driver_device
27 {
28 public:
spdheat_state(const machine_config & mconfig,device_type type,const char * tag)29 	spdheat_state(const machine_config &mconfig, device_type type, const char *tag) :
30 	driver_device(mconfig, type, tag),
31 	m_maincpu(*this, "maincpu"),
32 	m_subcpu(*this, "subcpu"),
33 	m_audiocpu(*this, "audiocpu"),
34 	m_audio_irq(*this, "audio_irq"),
35 	m_fg_ram(*this, "fg_ram%u", 0U),
36 	m_spriteram(*this, "spriteram"),
37 	m_gfxdecode(*this, "gfxdecode"),
38 	m_palette0(*this, "palette0"),
39 	m_palette1(*this, "palette1"),
40 	m_palette2(*this, "palette2"),
41 	m_palette3(*this, "palette3"),
42 	m_dac(*this, "dac")
43 	{ }
44 
45 	void spdheat(machine_config &config);
46 
47 protected:
48 	virtual void machine_start() override;
49 	virtual void machine_reset() override;
50 	virtual void video_start() override;
51 
52 private:
53 	required_device<cpu_device> m_maincpu;
54 	required_device<cpu_device> m_subcpu;
55 	required_device<cpu_device> m_audiocpu;
56 	required_device<input_merger_any_high_device> m_audio_irq;
57 	required_shared_ptr_array<uint16_t, 4> m_fg_ram;
58 	required_shared_ptr<uint16_t> m_spriteram;
59 	tilemap_t *m_fg_tilemap[4];
60 
61 	required_device<gfxdecode_device> m_gfxdecode;
62 	required_device<palette_device> m_palette0;
63 	required_device<palette_device> m_palette1;
64 	required_device<palette_device> m_palette2;
65 	required_device<palette_device> m_palette3;
66 	required_device<dac_byte_interface> m_dac;
67 
68 	uint32_t m_sound_data[4];
69 	uint32_t m_sound_status;
70 	uint32_t m_sub_data;
71 	uint32_t m_sub_status;
72 
73 	void main_map(address_map &map);
74 	void sub_map(address_map &map);
75 	void sub_io_map(address_map &map);
76 	void sound_map(address_map &map);
77 
78 	uint8_t sub_r();
79 	void sub_dac_w(uint8_t data);
80 	void sub_nmi_w(uint8_t data);
81 	void sub_status_w(uint8_t data);
82 	uint8_t sub_snd_r();
83 	uint8_t soundstatus_r();
84 	uint8_t sub_status_r();
85 	uint16_t sound_status_r();
86 	template<int screen> void sound_w(uint16_t data);
87 	template<int screen> uint8_t sndcpu_sound_r();
88 	void ym1_port_a_w(uint8_t data);
89 	void ym1_port_b_w(uint8_t data);
90 	void ym2_port_a_w(uint8_t data);
91 	void ym2_port_b_w(uint8_t data);
92 	void ym3_port_a_w(uint8_t data);
93 	void ym3_port_b_w(uint8_t data);
94 	void ym4_port_a_w(uint8_t data);
95 	void ym4_port_b_w(uint8_t data);
96 
97 	template<int screen> void text_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
98 	template<int screen> TILE_GET_INFO_MEMBER(get_fg_tile_info);
99 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t xo, uint32_t yo);
100 	template<int which> uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101 };
102 
103 #endif // MAME_INCLUDES_SPDHEAT_H
104