1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Farfetch'd
3 #ifndef MAME_INCLUDES_SPEEDSPN_H
4 #define MAME_INCLUDES_SPEEDSPN_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "sound/okim6295.h"
10 #include "emupal.h"
11 #include "tilemap.h"
12 
13 class speedspn_state : public driver_device
14 {
15 public:
speedspn_state(const machine_config & mconfig,device_type type,const char * tag)16 	speedspn_state(const machine_config &mconfig, device_type type, const char *tag) :
17 		driver_device(mconfig, type, tag),
18 		m_maincpu(*this, "maincpu"),
19 		m_audiocpu(*this, "audiocpu"),
20 		m_oki(*this, "oki"),
21 		m_gfxdecode(*this, "gfxdecode"),
22 		m_palette(*this, "palette"),
23 		m_soundlatch(*this, "soundlatch"),
24 		m_prgbank(*this, "prgbank"),
25 		m_okibank(*this, "okibank"),
26 		m_attram(*this, "attram")
27 	{ }
28 
29 	void speedspn(machine_config &config);
30 
31 protected:
32 	virtual void machine_start() override;
33 	virtual void video_start() override;
34 
35 private:
36 	required_device<cpu_device> m_maincpu;
37 	required_device<cpu_device> m_audiocpu;
38 	required_device<okim6295_device> m_oki;
39 	required_device<gfxdecode_device> m_gfxdecode;
40 	required_device<palette_device> m_palette;
41 	required_device<generic_latch_8_device> m_soundlatch;
42 
43 	required_memory_bank m_prgbank;
44 	required_memory_bank m_okibank;
45 	required_shared_ptr<uint8_t> m_attram;
46 
47 	tilemap_t *m_tilemap;
48 	bool m_display_disable;
49 	uint32_t m_bank_vidram;
50 	std::vector<uint8_t> m_vidram;
51 	uint8_t irq_ack_r();
52 	void rombank_w(uint8_t data);
53 	void sound_w(uint8_t data);
54 	void vidram_w(offs_t offset, uint8_t data);
55 	void attram_w(offs_t offset, uint8_t data);
56 	uint8_t vidram_r(offs_t offset);
57 	void vidram_bank_w(uint8_t data);
58 	void display_disable_w(uint8_t data);
59 	void okibank_w(uint8_t data);
60 	TILE_GET_INFO_MEMBER(get_tile_info);
61 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
62 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
63 
64 	void io_map(address_map &map);
65 	void oki_map(address_map &map);
66 	void program_map(address_map &map);
67 	void sound_map(address_map &map);
68 };
69 
70 #endif // MAME_INCLUDES_SPEEDSPN_H
71