1 // license:BSD-3-Clause
2 // copyright-holders:Brad Oliver, Bernd Wiebelt, Allard van der Bas
3 
4 #ifndef MAME_INCLUDES_BWIDOW_H
5 #define MAME_INCLUDES_BWIDOW_H
6 
7 #include "machine/er2055.h"
8 
9 #define MASTER_CLOCK (XTAL(12'096'000))
10 #define CLOCK_3KHZ   (MASTER_CLOCK / 4096)
11 
12 
13 class bwidow_state : public driver_device
14 {
15 public:
bwidow_state(const machine_config & mconfig,device_type type,const char * tag)16 	bwidow_state(const machine_config &mconfig, device_type type, const char *tag)
17 		: driver_device(mconfig, type, tag)
18 		, m_maincpu(*this, "maincpu")
19 		, m_earom(*this, "earom")
20 		, m_in3(*this, "IN3")
21 		, m_in4(*this, "IN4")
22 		, m_dsw2(*this, "DSW2")
23 		, m_leds(*this, "led%u", 0U)
24 	{ }
25 
26 	void spacduel(machine_config &config);
27 	void gravitar(machine_config &config);
28 	void bwidowp(machine_config &config);
29 	void bwidow(machine_config &config);
30 	void lunarbat(machine_config &config);
31 	void bwidow_audio(machine_config &config);
32 	void gravitar_audio(machine_config &config);
33 
34 	DECLARE_READ_LINE_MEMBER(clock_r);
35 
36 protected:
37 	uint8_t spacduel_IN3_r(offs_t offset);
38 	uint8_t bwidowp_in_r();
39 	void bwidow_misc_w(uint8_t data);
40 	void spacduel_coin_counter_w(uint8_t data);
41 	void irq_ack_w(uint8_t data);
42 	uint8_t earom_read();
43 	void earom_write(offs_t offset, uint8_t data);
44 	void earom_control_w(uint8_t data);
45 
46 	void bwidow_map(address_map &map);
47 	void bwidowp_map(address_map &map);
48 	void spacduel_map(address_map &map);
49 
machine_start()50 	virtual void machine_start() override { m_leds.resolve(); }
51 	virtual void machine_reset() override;
52 
53 	int m_lastdata;
54 	required_device<cpu_device> m_maincpu;
55 	required_device<er2055_device> m_earom;
56 	optional_ioport m_in3;
57 	optional_ioport m_in4;
58 	optional_ioport m_dsw2;
59 	output_finder<2> m_leds;
60 };
61 
62 #endif // MAME_INCLUDES_BWIDOW_H
63