1 // license:BSD-3-Clause
2 // copyright-holders:Chris Hardy
3 #ifndef MAME_INCLUDES_HYPERSPT_H
4 #define MAME_INCLUDES_HYPERSPT_H
5 
6 #pragma once
7 
8 #include "audio/trackfld.h"
9 #include "sound/dac.h"
10 #include "sound/sn76496.h"
11 #include "sound/vlm5030.h"
12 
13 #include "emupal.h"
14 #include "screen.h"
15 #include "tilemap.h"
16 
17 class hyperspt_state : public driver_device
18 {
19 public:
hyperspt_state(const machine_config & mconfig,device_type type,const char * tag)20 	hyperspt_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_spriteram(*this, "spriteram"),
23 		m_scroll(*this, "scroll"),
24 		m_videoram(*this, "videoram"),
25 		m_colorram(*this, "colorram"),
26 		m_maincpu(*this, "maincpu"),
27 		m_audiocpu(*this, "audiocpu"),
28 		m_soundbrd(*this, "trackfld_audio"),
29 		m_dac(*this, "dac"),
30 		m_sn(*this, "snsnd"),
31 		m_vlm(*this, "vlm"),
32 		m_screen(*this, "screen"),
33 		m_gfxdecode(*this, "gfxdecode"),
34 		m_palette(*this, "palette")
35 	{ }
36 
37 	void hyperspt(machine_config &config);
38 	void roadf(machine_config &config);
39 	void roadfu(machine_config &config);
40 	void hypersptb(machine_config &config);
41 
42 private:
43 	/* memory pointers */
44 	required_shared_ptr<uint8_t> m_spriteram;
45 	required_shared_ptr<uint8_t> m_scroll;
46 	required_shared_ptr<uint8_t> m_videoram;
47 	required_shared_ptr<uint8_t> m_colorram;
48 
49 	/* devices */
50 	required_device<cpu_device> m_maincpu;
51 	required_device<cpu_device> m_audiocpu;
52 	optional_device<trackfld_audio_device> m_soundbrd;
53 	required_device<dac_8bit_r2r_device> m_dac;
54 	optional_device<sn76496_device> m_sn;
55 	optional_device<vlm5030_device> m_vlm;
56 	required_device<screen_device> m_screen;
57 	required_device<gfxdecode_device> m_gfxdecode;
58 	required_device<palette_device> m_palette;
59 
60 	/* video-related */
61 	tilemap_t *m_bg_tilemap;
62 
63 	uint8_t m_irq_mask;
64 	uint8_t m_SN76496_latch;
65 
66 	DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
67 	DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
68 	DECLARE_WRITE_LINE_MEMBER(irq_mask_w);
69 	void videoram_w(offs_t offset, uint8_t data);
70 	void colorram_w(offs_t offset, uint8_t data);
71 	DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
konami_SN76496_latch_w(uint8_t data)72 	void konami_SN76496_latch_w(uint8_t data) { m_SN76496_latch = data; };
konami_SN76496_w(uint8_t data)73 	void konami_SN76496_w(uint8_t data) { m_sn->write(m_SN76496_latch); };
74 
75 	virtual void machine_start() override;
76 	virtual void video_start() override;
77 	void hyperspt_palette(palette_device &palette) const;
78 	DECLARE_VIDEO_START(roadf);
79 
80 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
81 	TILE_GET_INFO_MEMBER(roadf_get_bg_tile_info);
82 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
83 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
84 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
85 	void common_map(address_map &map);
86 	void common_sound_map(address_map &map);
87 	void hyperspt_map(address_map &map);
88 	void hyperspt_sound_map(address_map &map);
89 	void roadf_map(address_map &map);
90 	void roadf_sound_map(address_map &map);
91 	void soundb_map(address_map &map);
92 	void hyprolyb_adpcm_map(address_map &map);
93 };
94 
95 #endif // MAME_INCLUDES_HYPERSPT_H
96