1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 #ifndef MAME_INCLUDES_AQUARIUM_H
4 #define MAME_INCLUDES_AQUARIUM_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "machine/mb3773.h"
10 #include "sound/okim6295.h"
11 #include "video/excellent_spr.h"
12 #include "emupal.h"
13 #include "screen.h"
14 #include "tilemap.h"
15 
16 class aquarium_state : public driver_device
17 {
18 public:
aquarium_state(const machine_config & mconfig,device_type type,const char * tag)19 	aquarium_state(const machine_config &mconfig, device_type type, const char *tag) :
20 		driver_device(mconfig, type, tag),
21 		m_mid_videoram(*this, "mid_videoram"),
22 		m_bak_videoram(*this, "bak_videoram"),
23 		m_txt_videoram(*this, "txt_videoram"),
24 		m_scroll(*this, "scroll"),
25 		m_audiobank(*this, "bank1"),
26 		m_maincpu(*this, "maincpu"),
27 		m_audiocpu(*this, "audiocpu"),
28 		m_oki(*this, "oki"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_palette(*this, "palette"),
31 		m_sprgen(*this, "spritegen"),
32 		m_screen(*this, "screen"),
33 		m_soundlatch(*this, "soundlatch"),
34 		m_watchdog(*this, "watchdog")
35 	{ }
36 
37 	void init_aquarium();
38 
39 	void aquarium(machine_config &config);
40 
41 protected:
42 	virtual void video_start() override;
43 
44 private:
45 	/* memory pointers */
46 	required_shared_ptr<u16> m_mid_videoram;
47 	required_shared_ptr<u16> m_bak_videoram;
48 	required_shared_ptr<u16> m_txt_videoram;
49 	required_shared_ptr<u16> m_scroll;
50 	required_memory_bank m_audiobank;
51 
52 	/* video-related */
53 	tilemap_t  *m_txt_tilemap;
54 	tilemap_t  *m_mid_tilemap;
55 	tilemap_t  *m_bak_tilemap;
56 
57 	/* devices */
58 	required_device<cpu_device> m_maincpu;
59 	required_device<cpu_device> m_audiocpu;
60 	required_device<okim6295_device> m_oki;
61 	required_device<gfxdecode_device> m_gfxdecode;
62 	required_device<palette_device> m_palette;
63 	required_device<excellent_spr_device> m_sprgen;
64 	required_device<screen_device> m_screen;
65 	required_device<generic_latch_8_device> m_soundlatch;
66 	required_device<mb3773_device> m_watchdog;
67 
68 	void watchdog_w(u8 data);
69 	void z80_bank_w(u8 data);
70 	u8 oki_r();
71 	void oki_w(u8 data);
72 
73 	void expand_gfx(int low, int hi);
74 	void txt_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
75 	void mid_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
76 	void bak_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
77 	TILE_GET_INFO_MEMBER(get_txt_tile_info);
78 	TILE_GET_INFO_MEMBER(get_mid_tile_info);
79 	TILE_GET_INFO_MEMBER(get_bak_tile_info);
80 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
81 	u8 snd_bitswap(u8 scrambled_data);
82 	void aquarium_colpri_cb(u32 &colour, u32 &pri_mask);
83 
84 	void main_map(address_map &map);
85 	void snd_map(address_map &map);
86 	void snd_portmap(address_map &map);
87 };
88 
89 #endif // MAME_INCLUDES_AQUARIUM_H
90