1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 #ifndef MAME_INCLUDES_TECMO_H
4 #define MAME_INCLUDES_TECMO_H
5 
6 #pragma once
7 
8 #include "sound/msm5205.h"
9 #include "video/tecmo_spr.h"
10 #include "emupal.h"
11 #include "screen.h"
12 #include "tilemap.h"
13 
14 class tecmo_state : public driver_device
15 {
16 public:
tecmo_state(const machine_config & mconfig,device_type type,const char * tag)17 	tecmo_state(const machine_config &mconfig, device_type type, const char *tag) :
18 		driver_device(mconfig, type, tag),
19 		m_maincpu(*this, "maincpu"),
20 		m_soundcpu(*this, "soundcpu"),
21 		m_msm(*this, "msm"),
22 		m_screen(*this, "screen"),
23 		m_gfxdecode(*this, "gfxdecode"),
24 		m_palette(*this, "palette"),
25 		m_sprgen(*this, "spritegen"),
26 		m_txvideoram(*this, "txvideoram"),
27 		m_fgvideoram(*this, "fgvideoram"),
28 		m_bgvideoram(*this, "bgvideoram"),
29 		m_spriteram(*this, "spriteram"),
30 		m_fgscroll(*this, "fgscroll"),
31 		m_bgscroll(*this, "bgscroll"),
32 		m_adpcm_rom(*this, "adpcm"),
33 		m_mainbank(*this, "mainbank")
34 	{ }
35 
36 	void geminib(machine_config &config);
37 	void backfirt(machine_config &config);
38 	void silkworm(machine_config &config);
39 	void gemini(machine_config &config);
40 	void rygar(machine_config &config);
41 	void silkwormp(machine_config &config);
42 
43 	void init_silkworm();
44 	void init_rygar();
45 	void init_gemini();
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_soundcpu;
55 	optional_device<msm5205_device> m_msm;
56 	required_device<screen_device> m_screen;
57 	required_device<gfxdecode_device> m_gfxdecode;
58 	required_device<palette_device> m_palette;
59 	required_device<tecmo_spr_device> m_sprgen;
60 
61 	required_shared_ptr<uint8_t> m_txvideoram;
62 	required_shared_ptr<uint8_t> m_fgvideoram;
63 	required_shared_ptr<uint8_t> m_bgvideoram;
64 	required_shared_ptr<uint8_t> m_spriteram;
65 	required_shared_ptr<uint8_t> m_fgscroll;
66 	required_shared_ptr<uint8_t> m_bgscroll;
67 
68 	optional_region_ptr<uint8_t> m_adpcm_rom;
69 	required_memory_bank m_mainbank;
70 
71 	tilemap_t *m_tx_tilemap;
72 	tilemap_t *m_fg_tilemap;
73 	tilemap_t *m_bg_tilemap;
74 	int m_adpcm_pos;
75 	int m_adpcm_end;
76 	int m_adpcm_data;
77 	int m_video_type;
78 
79 	void bankswitch_w(uint8_t data);
80 	void adpcm_end_w(uint8_t data);
81 	uint8_t dswa_l_r();
82 	uint8_t dswa_h_r();
83 	uint8_t dswb_l_r();
84 	uint8_t dswb_h_r();
85 	void txvideoram_w(offs_t offset, uint8_t data);
86 	void fgvideoram_w(offs_t offset, uint8_t data);
87 	void bgvideoram_w(offs_t offset, uint8_t data);
88 	void fgscroll_w(offs_t offset, uint8_t data);
89 	void bgscroll_w(offs_t offset, uint8_t data);
90 	void flipscreen_w(uint8_t data);
91 	void adpcm_start_w(uint8_t data);
92 	void adpcm_vol_w(uint8_t data);
93 	DECLARE_WRITE_LINE_MEMBER(adpcm_int);
94 
95 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
96 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
97 	TILE_GET_INFO_MEMBER(gemini_get_bg_tile_info);
98 	TILE_GET_INFO_MEMBER(gemini_get_fg_tile_info);
99 	TILE_GET_INFO_MEMBER(get_tx_tile_info);
100 
101 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102 
103 	void gemini_map(address_map &map);
104 	void rygar_map(address_map &map);
105 	void rygar_sound_map(address_map &map);
106 	void silkworm_map(address_map &map);
107 	void tecmo_sound_map(address_map &map);
108 	void silkwormp_sound_map(address_map &map);
109 	void backfirt_sound_map(address_map &map);
110 };
111 
112 #endif // MAME_INCLUDES_TECMO_H
113