1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria, Manuel Abadia
3 /*************************************************************************
4 
5     Chequered Flag
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CHQFLAG_H
9 #define MAME_INCLUDES_CHQFLAG_H
10 
11 #pragma once
12 
13 #include "machine/bankdev.h"
14 #include "sound/k007232.h"
15 #include "video/k051960.h"
16 #include "video/k051316.h"
17 #include "video/k051733.h"
18 #include "video/konami_helper.h"
19 #include "emupal.h"
20 
21 class chqflag_state : public driver_device
22 {
23 public:
chqflag_state(const machine_config & mconfig,device_type type,const char * tag)24 	chqflag_state(const machine_config &mconfig, device_type type, const char *tag)
25 		: driver_device(mconfig, type, tag)
26 		, m_maincpu(*this, "maincpu")
27 		, m_audiocpu(*this, "audiocpu")
28 		, m_bank1000(*this, "bank1000")
29 		, m_k007232(*this, "k007232_%u", 1)
30 		, m_k051960(*this, "k051960")
31 		, m_k051316(*this, "k051316_%u", 1)
32 		, m_palette(*this, "palette")
33 		, m_rombank(*this, "rombank")
34 	{
35 	}
36 
37 	template<int Chip> uint8_t k051316_ramrom_r(offs_t offset);
38 	void chqflag_bankswitch_w(uint8_t data);
39 	void chqflag_vreg_w(uint8_t data);
40 	void select_analog_ctrl_w(uint8_t data);
41 	uint8_t analog_read_r();
42 	void k007232_bankswitch_w(uint8_t data);
43 	void k007232_extvolume_w(uint8_t data);
44 	void volume_callback0(uint8_t data);
45 	void volume_callback1(uint8_t data);
46 	DECLARE_WRITE_LINE_MEMBER(background_brt_w);
47 	K051316_CB_MEMBER(zoom_callback_1);
48 	K051316_CB_MEMBER(zoom_callback_2);
49 	K051960_CB_MEMBER(sprite_callback);
50 	uint32_t screen_update_chqflag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
51 	void chqflag(machine_config &config);
52 	void bank1000_map(address_map &map);
53 	void chqflag_map(address_map &map);
54 	void chqflag_sound_map(address_map &map);
55 protected:
56 	virtual void machine_start() override;
57 	virtual void machine_reset() override;
58 private:
59 	/* misc */
60 	int        m_k051316_readroms;
61 	int        m_last_vreg;
62 	int        m_analog_ctrl;
63 	int        m_accel;
64 	int        m_wheel;
65 
66 	/* devices */
67 	required_device<cpu_device> m_maincpu;
68 	required_device<cpu_device> m_audiocpu;
69 	required_device<address_map_bank_device> m_bank1000;
70 	required_device_array<k007232_device, 2> m_k007232;
71 	required_device<k051960_device> m_k051960;
72 	required_device_array<k051316_device, 2> m_k051316;
73 	required_device<palette_device> m_palette;
74 
75 	/* memory pointers */
76 	required_memory_bank m_rombank;
77 	void update_background_shadows(uint8_t data);
78 };
79 
80 #endif // MAME_INCLUDES_CHQFLAG_H
81