1 // license:BSD-3-Clause
2 // copyright-holders:Takahiro Nogi, David Haywood
3 #ifndef MAME_INCLUDES_GOMOKU_H
4 #define MAME_INCLUDES_GOMOKU_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "screen.h"
10 #include "tilemap.h"
11 
12 class gomoku_state : public driver_device
13 {
14 public:
gomoku_state(const machine_config & mconfig,device_type type,const char * tag)15 	gomoku_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_videoram(*this, "videoram"),
18 		m_colorram(*this, "colorram"),
19 		m_bgram(*this, "bgram"),
20 		m_inputs(*this, {"IN0", "IN1", "DSW", "UNUSED0", "UNUSED1", "UNUSED2", "UNUSED3", "UNUSED4"}),
21 		m_maincpu(*this, "maincpu"),
22 		m_gfxdecode(*this, "gfxdecode"),
23 		m_screen(*this, "screen"),
24 		m_bg_x(*this, "bg_x"),
25 		m_bg_y(*this, "bg_y"),
26 		m_bg_d(*this, "bg_d")
27 	{ }
28 
29 	void gomoku(machine_config &config);
30 
31 protected:
32 	virtual void video_start() override;
33 
34 private:
35 	required_shared_ptr<uint8_t> m_videoram;
36 	required_shared_ptr<uint8_t> m_colorram;
37 	required_shared_ptr<uint8_t> m_bgram;
38 	optional_ioport_array<8> m_inputs;
39 	required_device<cpu_device> m_maincpu;
40 	required_device<gfxdecode_device> m_gfxdecode;
41 	required_device<screen_device> m_screen;
42 	required_region_ptr<uint8_t> m_bg_x;
43 	required_region_ptr<uint8_t> m_bg_y;
44 	required_region_ptr<uint8_t> m_bg_d;
45 
46 	bool m_flipscreen;
47 	bool m_bg_dispsw;
48 	tilemap_t *m_fg_tilemap;
49 	bitmap_ind16 m_bg_bitmap;
50 
51 	uint8_t input_port_r(offs_t offset);
52 	void videoram_w(offs_t offset, uint8_t data);
53 	void colorram_w(offs_t offset, uint8_t data);
54 	void flipscreen_w(int state);
55 	void bg_dispsw_w(int state);
56 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
57 	void palette(palette_device &palette) const;
58 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
59 	void prg_map(address_map &map);
60 };
61 
62 #endif // MAME_INCLUDES_GOMOKU_H
63