1 // license:BSD-3-Clause
2 // copyright-holders:Hau, Nicola Salmoria
3 #ifndef MAME_INCLUDES_TECMO16_H
4 #define MAME_INCLUDES_TECMO16_H
5 
6 #pragma once
7 
8 #include "video/bufsprite.h"
9 #include "video/tecmo_spr.h"
10 #include "video/tecmo_mix.h"
11 #include "emupal.h"
12 #include "screen.h"
13 #include "tilemap.h"
14 
15 class tecmo16_state : public driver_device
16 {
17 public:
tecmo16_state(const machine_config & mconfig,device_type type,const char * tag)18 	tecmo16_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_maincpu(*this, "maincpu"),
21 		m_audiocpu(*this, "audiocpu"),
22 		m_gfxdecode(*this, "gfxdecode"),
23 		m_screen(*this, "screen"),
24 		m_palette(*this, "palette"),
25 		m_sprgen(*this, "spritegen"),
26 		m_mixer(*this, "mixer"),
27 		m_videoram(*this, "videoram"),
28 		m_colorram(*this, "colorram"),
29 		m_videoram2(*this, "videoram2"),
30 		m_colorram2(*this, "colorram2"),
31 		m_charram(*this, "charram"),
32 		m_spriteram(*this, "spriteram")
33 	{ }
34 
35 	void ginkun(machine_config &config);
36 	void fstarfrc(machine_config &config);
37 	void riot(machine_config &config);
38 
39 private:
40 	required_device<cpu_device> m_maincpu;
41 	required_device<cpu_device> m_audiocpu;
42 	required_device<gfxdecode_device> m_gfxdecode;
43 	required_device<screen_device> m_screen;
44 	required_device<palette_device> m_palette;
45 	required_device<tecmo_spr_device> m_sprgen;
46 	required_device<tecmo_mix_device> m_mixer;
47 
48 	required_shared_ptr<uint16_t> m_videoram;
49 	required_shared_ptr<uint16_t> m_colorram;
50 	required_shared_ptr<uint16_t> m_videoram2;
51 	required_shared_ptr<uint16_t> m_colorram2;
52 	required_shared_ptr<uint16_t> m_charram;
53 	required_device<buffered_spriteram16_device> m_spriteram;
54 
55 	tilemap_t *m_fg_tilemap;
56 	tilemap_t *m_bg_tilemap;
57 	tilemap_t *m_tx_tilemap;
58 	bitmap_ind16 m_sprite_bitmap;
59 	bitmap_ind16 m_tile_bitmap_bg;
60 	bitmap_ind16 m_tile_bitmap_fg;
61 	bitmap_ind16 m_tile_bitmap_tx;
62 	int m_flipscreen;
63 	int m_game_is_riot;
64 	uint16_t m_scroll_x_w;
65 	uint16_t m_scroll_y_w;
66 	uint16_t m_scroll2_x_w;
67 	uint16_t m_scroll2_y_w;
68 	uint16_t m_scroll_char_x_w;
69 	uint16_t m_scroll_char_y_w;
70 
71 	void videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
72 	void colorram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
73 	void videoram2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
74 	void colorram2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
75 	void charram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
76 	void flipscreen_w(uint16_t data);
77 	void scroll_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
78 	void scroll_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
79 	void scroll2_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
80 	void scroll2_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
81 	void scroll_char_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
82 	void scroll_char_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
83 
84 	TILE_GET_INFO_MEMBER(fg_get_tile_info);
85 	TILE_GET_INFO_MEMBER(bg_get_tile_info);
86 	TILE_GET_INFO_MEMBER(tx_get_tile_info);
87 
88 	virtual void video_start() override;
89 	DECLARE_VIDEO_START(ginkun);
90 	DECLARE_VIDEO_START(riot);
91 
92 	uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
93 	DECLARE_WRITE_LINE_MEMBER(screen_vblank);
94 
95 	void save_state();
96 
97 	void fstarfrc_map(address_map &map);
98 	void ginkun_map(address_map &map);
99 	void sound_map(address_map &map);
100 };
101 
102 #endif // MAME_INCLUDES_TECMO16_H
103