1 // license:BSD-3-Clause
2 // copyright-holders:David Graves, R. Belmont
3 #ifndef MAME_INCLUDES_GCPINBAL_H
4 #define MAME_INCLUDES_GCPINBAL_H
5 
6 #pragma once
7 
8 #include "machine/eepromser.h"
9 #include "machine/mb3773.h"
10 #include "sound/es8712.h"
11 #include "sound/okim6295.h"
12 #include "video/excellent_spr.h"
13 #include "emupal.h"
14 #include "machine/timer.h"
15 #include "screen.h"
16 #include "tilemap.h"
17 
18 class gcpinbal_state : public driver_device
19 {
20 public:
gcpinbal_state(const machine_config & mconfig,device_type type,const char * tag)21 	gcpinbal_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: driver_device(mconfig, type, tag)
23 		, m_tilemapram(*this, "tilemapram")
24 		, m_d80010_ram(*this, "d80010")
25 		, m_d80060_ram(*this, "d80060")
26 		, m_maincpu(*this, "maincpu")
27 		, m_eeprom(*this, "eeprom")
28 		, m_watchdog(*this, "watchdog")
29 		, m_oki(*this, "oki")
30 		, m_essnd(*this, "essnd")
31 		, m_sprgen(*this, "spritegen")
32 		, m_screen(*this, "screen")
33 		, m_gfxdecode(*this, "gfxdecode")
34 		, m_palette(*this, "palette")
35 	{ }
36 
37 	void gcpinbal(machine_config &config);
38 
39 protected:
40 	virtual void machine_start() override;
41 	virtual void machine_reset() override;
42 	virtual void video_start() override;
43 
44 private:
45 	/* memory pointers */
46 	required_shared_ptr<u16> m_tilemapram;
47 	required_shared_ptr<u16> m_d80010_ram;
48 	required_shared_ptr<u16> m_d80060_ram;
49 
50 	/* video-related */
51 	tilemap_t     *m_tilemap[3];
52 	u16      m_scrollx[3];
53 	u16      m_scrolly[3];
54 	u16      m_bg0_gfxset;
55 	u16      m_bg1_gfxset;
56 #ifdef MAME_DEBUG
57 	uint8_t       m_dislayer[4];
58 #endif
59 
60 	/* sound-related */
61 	uint32_t      m_msm_bank;
62 
63 	/* devices */
64 	required_device<cpu_device> m_maincpu;
65 	required_device<eeprom_serial_93cxx_device> m_eeprom;
66 	required_device<mb3773_device> m_watchdog;
67 	required_device<okim6295_device> m_oki;
68 	required_device<es8712_device> m_essnd;
69 	required_device<excellent_spr_device> m_sprgen;
70 	required_device<screen_device> m_screen;
71 	required_device<gfxdecode_device> m_gfxdecode;
72 	required_device<palette_device> m_palette;
73 
74 	void d80010_w(offs_t offset, u16 data, u16 mem_mask = ~0);
75 	void d80040_w(offs_t offset, u8 data);
76 	void d80060_w(offs_t offset, u16 data, u16 mem_mask = ~0);
77 	void bank_w(u8 data);
78 	void eeprom_w(u8 data);
79 	void es8712_reset_w(u8 data);
80 	void tilemaps_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
81 
82 	TILE_GET_INFO_MEMBER(get_bg0_tile_info);
83 	TILE_GET_INFO_MEMBER(get_bg1_tile_info);
84 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
85 
86 	void gcpinbal_colpri_cb(u32 &colour, u32 &pri_mask);
87 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
88 	TIMER_DEVICE_CALLBACK_MEMBER(scanline_cb);
89 
90 	void gcpinbal_map(address_map &map);
91 };
92 
93 #endif // MAME_INCLUDES_GCPINBAL_H
94