1 // license:GPL-2.0+
2 // copyright-holders:Jarek Burczynski, Tomasz Slanina
3 #include "sound/msm5232.h"
4 #include "machine/gen_latch.h"
5 #include "machine/taito68705interface.h"
6 #include "emupal.h"
7 #include "screen.h"
8 
9 class bigevglf_state : public driver_device
10 {
11 public:
bigevglf_state(const machine_config & mconfig,device_type type,const char * tag)12 	bigevglf_state(const machine_config &mconfig, device_type type, const char *tag)
13 		: driver_device(mconfig, type, tag),
14 		m_paletteram(*this, "paletteram"),
15 		m_spriteram1(*this, "spriteram1"),
16 		m_spriteram2(*this, "spriteram2"),
17 		m_audiocpu(*this, "audiocpu"),
18 		m_bmcu(*this, "bmcu"),
19 		m_maincpu(*this, "maincpu"),
20 		m_msm(*this, "msm"),
21 		m_soundlatch(*this, "soundlatch%u", 1),
22 		m_gfxdecode(*this, "gfxdecode"),
23 		m_screen(*this, "screen"),
24 		m_palette(*this, "palette") { }
25 
26 	/* memory pointers */
27 	required_shared_ptr<uint8_t> m_paletteram;
28 	required_shared_ptr<uint8_t> m_spriteram1;
29 	required_shared_ptr<uint8_t> m_spriteram2;
30 
31 	/* video-related */
32 	bitmap_ind16 m_tmp_bitmap[4];
33 	std::unique_ptr<uint8_t[]>    m_vidram;
34 	uint32_t   m_vidram_bank;
35 	uint32_t   m_plane_selected;
36 	uint32_t   m_plane_visible;
37 
38 	/* MCU related */
39 	int      m_mcu_coin_bit5;
40 
41 	/* misc */
42 	uint32_t   m_beg_bank;
43 	uint8_t    m_beg13_ls74[2];
44 	uint8_t    m_port_select;     /* for muxed controls */
45 
46 	/* devices */
47 	required_device<cpu_device> m_audiocpu;
48 	optional_device<taito68705_mcu_device> m_bmcu;
49 	void beg_banking_w(uint8_t data);
50 	uint8_t soundstate_r();
51 	void beg13_a_clr_w(uint8_t data);
52 	void beg13_b_clr_w(uint8_t data);
53 	void beg13_a_set_w(uint8_t data);
54 	void beg13_b_set_w(uint8_t data);
55 	uint8_t beg_status_r();
56 	uint8_t beg_trackball_x_r();
57 	uint8_t beg_trackball_y_r();
58 	void beg_port08_w(uint8_t data);
59 	uint8_t sub_cpu_mcu_coin_port_r();
60 	void bigevglf_palette_w(offs_t offset, uint8_t data);
61 	void bigevglf_gfxcontrol_w(uint8_t data);
62 	void bigevglf_vidram_addr_w(uint8_t data);
63 	void bigevglf_vidram_w(offs_t offset, uint8_t data);
64 	uint8_t bigevglf_vidram_r(offs_t offset);
65 	void init_bigevglf();
66 	virtual void machine_start() override;
67 	virtual void machine_reset() override;
68 	virtual void video_start() override;
69 	uint32_t screen_update_bigevglf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
70 	TIMER_CALLBACK_MEMBER(deferred_ls74_w);
71 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
72 	required_device<cpu_device> m_maincpu;
73 	required_device<msm5232_device> m_msm;
74 	required_device_array<generic_latch_8_device, 2> m_soundlatch;
75 	required_device<gfxdecode_device> m_gfxdecode;
76 	required_device<screen_device> m_screen;
77 	required_device<palette_device> m_palette;
78 	void bigevglf(machine_config &config);
79 	void bigevglf_portmap(address_map &map);
80 	void bigevglf_sub_portmap(address_map &map);
81 	void main_map(address_map &map);
82 	void sound_map(address_map &map);
83 	void sub_map(address_map &map);
84 };
85