1 // license:BSD-3-Clause
2 // copyright-holders:Angelo Salese, Pierpaolo Prazzoli, Bryan McPhail
3 /*************************************************************************
4 
5     Competition Golf Final Round
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_COMPGOLF_H
9 #define MAME_INCLUDES_COMPGOLF_H
10 
11 #pragma once
12 
13 #include "emupal.h"
14 #include "tilemap.h"
15 
16 class compgolf_state : public driver_device
17 {
18 public:
compgolf_state(const machine_config & mconfig,device_type type,const char * tag)19 	compgolf_state(const machine_config &mconfig, device_type type, const char *tag) :
20 		driver_device(mconfig, type, tag),
21 		m_videoram(*this, "videoram"),
22 		m_bg_ram(*this, "bg_ram"),
23 		m_spriteram(*this, "spriteram"),
24 		m_maincpu(*this, "maincpu"),
25 		m_gfxdecode(*this, "gfxdecode"),
26 		m_palette(*this, "palette")
27 	{ }
28 
29 	/* memory pointers */
30 	required_shared_ptr<uint8_t> m_videoram;
31 	required_shared_ptr<uint8_t> m_bg_ram;
32 	required_shared_ptr<uint8_t> m_spriteram;
33 
34 	/* video-related */
35 	tilemap_t        *m_text_tilemap;
36 	tilemap_t        *m_bg_tilemap;
37 	int            m_scrollx_lo;
38 	int            m_scrollx_hi;
39 	int            m_scrolly_lo;
40 	int            m_scrolly_hi;
41 
42 	/* misc */
43 	int            m_bank;
44 	void compgolf_ctrl_w(uint8_t data);
45 	void compgolf_video_w(offs_t offset, uint8_t data);
46 	void compgolf_back_w(offs_t offset, uint8_t data);
47 	void compgolf_scrollx_lo_w(uint8_t data);
48 	void compgolf_scrolly_lo_w(uint8_t data);
49 	void init_compgolf();
50 	TILE_GET_INFO_MEMBER(get_text_info);
51 	TILEMAP_MAPPER_MEMBER(back_scan);
52 	TILE_GET_INFO_MEMBER(get_back_info);
53 	virtual void machine_start() override;
54 	virtual void machine_reset() override;
55 	virtual void video_start() override;
56 	void compgolf_palette(palette_device &palette) const;
57 	uint32_t screen_update_compgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
58 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
59 	void compgolf_expand_bg();
60 	required_device<cpu_device> m_maincpu;
61 	required_device<gfxdecode_device> m_gfxdecode;
62 	required_device<palette_device> m_palette;
63 	void compgolf(machine_config &config);
64 	void compgolf_map(address_map &map);
65 };
66 
67 #endif // MAME_INCLUDES_COMPGOLF_H
68