1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari
3 /*************************************************************************
4 
5     Coors Light Bowling/Bowl-O-Rama hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CAPBOWL_H
9 #define MAME_INCLUDES_CAPBOWL_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "machine/nvram.h"
15 #include "machine/watchdog.h"
16 #include "video/tms34061.h"
17 #include "screen.h"
18 
19 class capbowl_state : public driver_device
20 {
21 public:
22 	enum
23 	{
24 		TIMER_UPDATE
25 	};
26 
capbowl_state(const machine_config & mconfig,device_type type,const char * tag)27 	capbowl_state(const machine_config &mconfig, device_type type, const char *tag) :
28 		driver_device(mconfig, type, tag),
29 		m_maincpu(*this, "maincpu"),
30 		m_watchdog(*this, "watchdog"),
31 		m_audiocpu(*this, "audiocpu"),
32 		m_tms34061(*this, "tms34061"),
33 		m_screen(*this, "screen"),
34 		m_soundlatch(*this, "soundlatch"),
35 		m_rowaddress(*this, "rowaddress")
36 	{ }
37 
38 	/* devices */
39 	required_device<cpu_device> m_maincpu;
40 	required_device<watchdog_timer_device> m_watchdog;
41 	required_device<cpu_device> m_audiocpu;
42 	required_device<tms34061_device> m_tms34061;
43 	required_device<screen_device> m_screen;
44 	required_device<generic_latch_8_device> m_soundlatch;
45 
46 	/* memory pointers */
47 	required_shared_ptr<uint8_t> m_rowaddress;
48 
49 	/* video-related */
50 	offs_t m_blitter_addr;
51 
52 	/* input-related */
53 	uint8_t m_last_trackball_val[2];
54 
55 	emu_timer *m_update_timer;
56 
57 	// common
58 	uint8_t track_0_r();
59 	uint8_t track_1_r();
60 	void track_reset_w(uint8_t data);
61 	void sndcmd_w(uint8_t data);
62 	void tms34061_w(offs_t offset, uint8_t data);
63 	uint8_t tms34061_r(offs_t offset);
64 
65 	// capbowl specific
66 	void capbowl_rom_select_w(uint8_t data);
67 
68 	// bowlrama specific
69 	void bowlrama_blitter_w(offs_t offset, uint8_t data);
70 	uint8_t bowlrama_blitter_r(offs_t offset);
71 
72 	void init_capbowl();
73 	virtual void machine_start() override;
74 	virtual void machine_reset() override;
75 
76 	INTERRUPT_GEN_MEMBER(interrupt);
77 	TIMER_CALLBACK_MEMBER(update);
78 
79 	uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
80 	inline rgb_t pen_for_pixel( uint8_t const *src, uint8_t pix );
81 
82 	void bowlrama(machine_config &config);
83 	void capbowl(machine_config &config);
84 	void bowlrama_map(address_map &map);
85 	void capbowl_map(address_map &map);
86 	void sound_map(address_map &map);
87 protected:
88 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
89 };
90 
91 #endif // MAME_INCLUDES_CAPBOWL_H
92