1 // license:BSD-3-Clause
2 // copyright-holders:Luca Elia
3 /*************************************************************************
4 
5     Ginga NinkyouDen
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_GINGANIN_H
9 #define MAME_INCLUDES_GINGANIN_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 class ginganin_state : public driver_device
18 {
19 public:
ginganin_state(const machine_config & mconfig,device_type type,const char * tag)20 	ginganin_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_txtram(*this, "txtram"),
23 		m_spriteram(*this, "spriteram"),
24 		m_vregs(*this, "vregs"),
25 		m_fgram(*this, "fgram"),
26 		m_bgrom(*this, "bgrom"),
27 		m_maincpu(*this, "maincpu"),
28 		m_audiocpu(*this, "audiocpu"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_palette(*this, "palette"),
31 		m_soundlatch(*this, "soundlatch")
32 	{ }
33 
34 	void ginganin(machine_config &config);
35 
36 	void init_ginganin();
37 
38 private:
39 	/* memory pointers */
40 	required_shared_ptr<u16> m_txtram;
41 	required_shared_ptr<u16> m_spriteram;
42 	required_shared_ptr<u16> m_vregs;
43 	required_shared_ptr<u16> m_fgram;
44 
45 	required_region_ptr<u8> m_bgrom;
46 
47 	/* video-related */
48 	tilemap_t     *m_bg_tilemap;
49 	tilemap_t     *m_fg_tilemap;
50 	tilemap_t     *m_tx_tilemap;
51 	int           m_layers_ctrl;
52 	int           m_flipscreen;
53 #ifdef MAME_DEBUG
54 	int           m_posx;
55 	int           m_posy;
56 #endif
57 
58 	/* devices */
59 	required_device<cpu_device> m_maincpu;
60 	required_device<cpu_device> m_audiocpu;
61 	required_device<gfxdecode_device> m_gfxdecode;
62 	required_device<palette_device> m_palette;
63 	required_device<generic_latch_8_device> m_soundlatch;
64 
65 	void fgram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
66 	void txtram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
67 	void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
68 	DECLARE_WRITE_LINE_MEMBER(ptm_irq);
69 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
70 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
71 	TILE_GET_INFO_MEMBER(get_txt_tile_info);
72 	virtual void machine_start() override;
73 	virtual void machine_reset() override;
74 	virtual void video_start() override;
75 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
76 	void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
77 	void main_map(address_map &map);
78 	void sound_map(address_map &map);
79 };
80 
81 #endif // MAME_INCLUDES_GINGANIN_H
82