1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /*************************************************************************
4 
5     Kitco Crowns Golf hardware
6 
7 **************************************************************************/
8 #ifndef MAME_INCLUDES_CRGOLF_H
9 #define MAME_INCLUDES_CRGOLF_H
10 
11 #pragma once
12 
13 #include "sound/msm5205.h"
14 #include "machine/bankdev.h"
15 #include "emupal.h"
16 
17 #define MASTER_CLOCK        XTAL(18'432'000)
18 
19 
20 class crgolf_state : public driver_device
21 {
22 public:
crgolf_state(const machine_config & mconfig,device_type type,const char * tag)23 	crgolf_state(const machine_config &mconfig, device_type type, const char *tag) :
24 		driver_device(mconfig, type, tag),
25 
26 		m_videoram_a(*this, "vrama"),
27 		m_videoram_b(*this, "vramb"),
28 
29 		m_vrambank(*this, "vrambank"),
30 		m_maincpu(*this, "maincpu"),
31 		m_audiocpu(*this, "audiocpu"),
32 		m_msm(*this, "msm"),
33 		m_palette(*this, "palette")
34 	{ }
35 
36 
37 
38 	/* memory pointers */
39 	required_shared_ptr<uint8_t> m_videoram_a;
40 	required_shared_ptr<uint8_t> m_videoram_b;
41 
42 	bool m_color_select;
43 	bool m_screen_flip;
44 	bool m_screena_enable;
45 	bool m_screenb_enable;
46 
47 	/* misc */
48 	uint8_t    m_port_select;
49 	uint16_t   m_sample_offset;
50 	uint8_t    m_sample_count;
51 
52 	/* devices */
53 	required_device<address_map_bank_device> m_vrambank;
54 	required_device<cpu_device> m_maincpu;
55 	required_device<cpu_device> m_audiocpu;
56 	optional_device<msm5205_device> m_msm;
57 	required_device<palette_device> m_palette;
58 	void rom_bank_select_w(uint8_t data);
59 	uint8_t switch_input_r();
60 	uint8_t analog_input_r();
61 	void switch_input_select_w(uint8_t data);
62 	void unknown_w(uint8_t data);
63 	DECLARE_WRITE_LINE_MEMBER(color_select_w);
64 	DECLARE_WRITE_LINE_MEMBER(screen_flip_w);
65 	DECLARE_WRITE_LINE_MEMBER(screen_select_w);
66 	DECLARE_WRITE_LINE_MEMBER(screena_enable_w);
67 	DECLARE_WRITE_LINE_MEMBER(screenb_enable_w);
68 	void crgolfhi_sample_w(offs_t offset, uint8_t data);
69 	uint8_t unk_sub_02_r();
70 	uint8_t unk_sub_05_r();
71 	uint8_t unk_sub_07_r();
72 	void unk_sub_0c_w(uint8_t data);
73 	void init_crgolfhi();
74 	virtual void machine_start() override;
75 	virtual void machine_reset() override;
76 	void crgolf_palette(palette_device &palette) const;
77 	void mastrglf_palette(palette_device &palette) const;
78 	uint32_t screen_update_crgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79 	void get_pens( pen_t *pens );
80 	DECLARE_WRITE_LINE_MEMBER(vck_callback);
81 	void crgolfhi(machine_config &config);
82 	void crgolf(machine_config &config);
83 	void crgolf_video(machine_config &config);
84 	void mastrglf(machine_config &config);
85 	void main_map(address_map &map);
86 	void mastrglf_io(address_map &map);
87 	void mastrglf_map(address_map &map);
88 	void mastrglf_subio(address_map &map);
89 	void mastrglf_submap(address_map &map);
90 	void sound_map(address_map &map);
91 	void vrambank_map(address_map &map);
92 };
93 
94 #endif // MAME_INCLUDES_CRGOLF_H
95