1 // license:BSD-3-Clause
2 // copyright-holders:Mike Balfour, Zsolt Vasvari
3 #ifndef MAME_INCLUDES_BKING_H
4 #define MAME_INCLUDES_BKING_H
5 
6 #pragma once
7 
8 #include "machine/taito68705interface.h"
9 #include "machine/gen_latch.h"
10 #include "machine/input_merger.h"
11 #include "emupal.h"
12 #include "screen.h"
13 #include "tilemap.h"
14 
15 class bking_state : public driver_device
16 {
17 public:
bking_state(const machine_config & mconfig,device_type type,const char * tag)18 	bking_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_playfield_ram(*this, "playfield_ram"),
21 		m_audiocpu(*this, "audiocpu"),
22 		m_bmcu(*this, "bmcu"),
23 		m_gfxdecode(*this, "gfxdecode"),
24 		m_screen(*this, "screen"),
25 		m_palette(*this, "palette"),
26 		m_soundlatch(*this, "soundlatch"),
27 		m_soundnmi(*this, "soundnmi")
28 	{
29 	}
30 
31 	/* memory pointers */
32 	required_shared_ptr<uint8_t> m_playfield_ram;
33 
34 	/* video-related */
35 	bitmap_ind16    m_colmap_bg;
36 	bitmap_ind16    m_colmap_ball;
37 	tilemap_t     *m_bg_tilemap;
38 	int         m_pc3259_output[4];
39 	int         m_pc3259_mask;
40 	uint8_t       m_xld1;
41 	uint8_t       m_xld2;
42 	uint8_t       m_xld3;
43 	uint8_t       m_yld1;
44 	uint8_t       m_yld2;
45 	uint8_t       m_yld3;
46 	int         m_ball1_pic;
47 	int         m_ball2_pic;
48 	int         m_crow_pic;
49 	int         m_crow_flip;
50 	int         m_palette_bank;
51 	int         m_controller;
52 	int         m_hit;
53 
54 	/* misc */
55 	int         m_addr_h;
56 	int         m_addr_l;
57 
58 	/* devices */
59 	required_device<cpu_device> m_audiocpu;
60 	optional_device<taito68705_mcu_device> m_bmcu;
61 	required_device<gfxdecode_device> m_gfxdecode;
62 	required_device<screen_device> m_screen;
63 	required_device<palette_device> m_palette;
64 	required_device<generic_latch_8_device> m_soundlatch;
65 	required_device<input_merger_device> m_soundnmi;
66 
67 	uint8_t bking_sndnmi_disable_r();
68 	void bking_sndnmi_enable_w(uint8_t data);
69 	void bking_soundlatch_w(uint8_t data);
70 	void bking3_addr_l_w(uint8_t data);
71 	void bking3_addr_h_w(uint8_t data);
72 	uint8_t bking3_extrarom_r();
73 	uint8_t bking3_ext_check_r();
74 	uint8_t bking3_mcu_status_r();
75 	void bking_xld1_w(uint8_t data);
76 	void bking_yld1_w(uint8_t data);
77 	void bking_xld2_w(uint8_t data);
78 	void bking_yld2_w(uint8_t data);
79 	void bking_xld3_w(uint8_t data);
80 	void bking_yld3_w(uint8_t data);
81 	void bking_cont1_w(uint8_t data);
82 	void bking_cont2_w(uint8_t data);
83 	void bking_cont3_w(uint8_t data);
84 	void bking_msk_w(uint8_t data);
85 	void bking_hitclr_w(uint8_t data);
86 	void bking_playfield_w(offs_t offset, uint8_t data);
87 	uint8_t bking_input_port_5_r();
88 	uint8_t bking_input_port_6_r();
89 	uint8_t bking_pos_r(offs_t offset);
90 	void unk_w(uint8_t data);
91 	void port_b_w(uint8_t data);
92 	TILE_GET_INFO_MEMBER(get_tile_info);
93 	virtual void machine_start() override;
94 	virtual void machine_reset() override;
95 	virtual void video_start() override;
96 	void bking_palette(palette_device &palette) const;
97 	DECLARE_MACHINE_START(bking3);
98 	DECLARE_MACHINE_RESET(bking3);
99 	DECLARE_MACHINE_RESET(common);
100 	uint32_t screen_update_bking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101 	DECLARE_WRITE_LINE_MEMBER(screen_vblank_bking);
102 	void bking(machine_config &config);
103 	void bking3(machine_config &config);
104 	void bking3_io_map(address_map &map);
105 	void bking_audio_map(address_map &map);
106 	void bking_io_map(address_map &map);
107 	void bking_map(address_map &map);
108 };
109 
110 #endif // MAME_INCLUDES_BKING_H
111