1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 #ifndef MAME_INCLUDES_TBOWL_H
4 #define MAME_INCLUDES_TBOWL_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "sound/msm5205.h"
10 #include "video/tecmo_spr.h"
11 #include "emupal.h"
12 #include "tilemap.h"
13 
14 class tbowl_state : public driver_device
15 {
16 public:
tbowl_state(const machine_config & mconfig,device_type type,const char * tag)17 	tbowl_state(const machine_config &mconfig, device_type type, const char *tag) :
18 		driver_device(mconfig, type, tag),
19 		m_maincpu(*this, "maincpu"),
20 		m_audiocpu(*this, "audiocpu"),
21 		m_msm1(*this, "msm1"),
22 		m_msm2(*this, "msm2"),
23 		m_gfxdecode(*this, "gfxdecode"),
24 		m_palette(*this, "palette"),
25 		m_sprgen(*this, "spritegen"),
26 		m_soundlatch(*this, "soundlatch"),
27 		m_txvideoram(*this, "txvideoram"),
28 		m_bgvideoram(*this, "bgvideoram"),
29 		m_bg2videoram(*this, "bg2videoram"),
30 		m_spriteram(*this, "spriteram")
31 	{ }
32 
33 	void tbowl(machine_config &config);
34 
35 protected:
36 	virtual void machine_start() override;
37 	virtual void machine_reset() override;
38 	virtual void video_start() override;
39 
40 private:
41 	required_device<cpu_device> m_maincpu;
42 	required_device<cpu_device> m_audiocpu;
43 	required_device<msm5205_device> m_msm1;
44 	required_device<msm5205_device> m_msm2;
45 	required_device<gfxdecode_device> m_gfxdecode;
46 	required_device<palette_device> m_palette;
47 	required_device<tecmo_spr_device> m_sprgen;
48 	required_device<generic_latch_8_device> m_soundlatch;
49 
50 	required_shared_ptr<uint8_t> m_txvideoram;
51 	required_shared_ptr<uint8_t> m_bgvideoram;
52 	required_shared_ptr<uint8_t> m_bg2videoram;
53 	required_shared_ptr<uint8_t> m_spriteram;
54 
55 	tilemap_t *m_tx_tilemap;
56 	tilemap_t *m_bg_tilemap;
57 	tilemap_t *m_bg2_tilemap;
58 	uint16_t m_xscroll;
59 	uint16_t m_yscroll;
60 	uint16_t m_bg2xscroll;
61 	uint16_t m_bg2yscroll;
62 	int m_adpcm_pos[2];
63 	int m_adpcm_end[2];
64 	int m_adpcm_data[2];
65 
66 	void coincounter_w(uint8_t data);
67 	void boardb_bankswitch_w(uint8_t data);
68 	void boardc_bankswitch_w(uint8_t data);
69 	void trigger_nmi(uint8_t data);
70 	void adpcm_start_w(offs_t offset, uint8_t data);
71 	void adpcm_end_w(offs_t offset, uint8_t data);
72 	void adpcm_vol_w(offs_t offset, uint8_t data);
73 	void txvideoram_w(offs_t offset, uint8_t data);
74 	void bg2videoram_w(offs_t offset, uint8_t data);
75 	void bgxscroll_lo(uint8_t data);
76 	void bgxscroll_hi(uint8_t data);
77 	void bgyscroll_lo(uint8_t data);
78 	void bgyscroll_hi(uint8_t data);
79 	void bgvideoram_w(offs_t offset, uint8_t data);
80 	void bg2xscroll_lo(uint8_t data);
81 	void bg2xscroll_hi(uint8_t data);
82 	void bg2yscroll_lo(uint8_t data);
83 	void bg2yscroll_hi(uint8_t data);
84 
85 	TILE_GET_INFO_MEMBER(get_tx_tile_info);
86 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
87 	TILE_GET_INFO_MEMBER(get_bg2_tile_info);
88 
89 	uint32_t screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
90 	uint32_t screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
91 
92 	void adpcm_int(msm5205_device *device, int chip);
93 	DECLARE_WRITE_LINE_MEMBER(adpcm_int_1);
94 	DECLARE_WRITE_LINE_MEMBER(adpcm_int_2);
95 
96 	void _6206A_map(address_map &map);
97 	void _6206B_map(address_map &map);
98 	void _6206C_map(address_map &map);
99 };
100 
101 #endif // MAME_INCLUDES_TBOWL_H
102