summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/divebomb.h
blob: 930b9a0dcbbc2d293e06a9cc0ff9e5e4be3b3be8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// license:BSD-3-Clause
// copyright-holders:David Haywood, Phil Bennett
/*************************************************************************

    Kyuukoukabakugekitai - Dive Bomber Squad

*************************************************************************/

#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "machine/input_merger.h"
#include "sound/sn76496.h"
#include "video/k051316.h"

#define XTAL1 XTAL(24'000'000)

class divebomb_state : public driver_device
{
public:
	divebomb_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_spritecpu(*this, "spritecpu")
		, m_fgcpu(*this, "fgcpu")
		, m_rozcpucpu(*this, "rozcpu")
		, m_rozbank(*this, "rozbank")
		, m_fgram(*this, "fgram")
		, m_spriteram(*this, "spriteram")
		, m_gfxdecode(*this, "gfxdecode")
		, m_palette(*this, "palette")
		, m_k051316(*this, "k051316_%u", 1)
		, m_fgcpu_irq(*this, "fgcpu_irq")
		, m_spr2fg_latch(*this, "spr2fg")
		, m_roz2fg_latch(*this, "roz2fg")
	{
	}

	required_device<cpu_device> m_spritecpu;
	required_device<cpu_device> m_fgcpu;
	required_device<cpu_device> m_rozcpucpu;
	required_memory_bank m_rozbank;
	required_shared_ptr<uint8_t> m_fgram;
	required_shared_ptr<uint8_t> m_spriteram;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<palette_device> m_palette;
	required_device_array<k051316_device, 2> m_k051316;
	required_device<input_merger_any_high_device> m_fgcpu_irq;
	required_device<generic_latch_8_device> m_spr2fg_latch;
	required_device<generic_latch_8_device> m_roz2fg_latch;

	tilemap_t *m_fg_tilemap;

	uint8_t m_roz_pal;
	bool m_roz_enable[2];

	void machine_reset_divebomb();
	void machine_start_divebomb() ATTR_COLD;
	void video_start_divebomb() ATTR_COLD;
	DECLARE_PALETTE_INIT(divebomb);

	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
	void decode_proms(const uint8_t* rgn, int size, int index, bool inv);
	uint32_t screen_update_divebomb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	K051316_CB_MEMBER(zoom_callback_1);
	K051316_CB_MEMBER(zoom_callback_2);

	TILE_GET_INFO_MEMBER(get_fg_tile_info);

	DECLARE_READ8_MEMBER(fgcpu_comm_flags_r);
	DECLARE_WRITE8_MEMBER(fgram_w);

	DECLARE_WRITE8_MEMBER(spritecpu_port00_w);

	DECLARE_WRITE8_MEMBER(rozcpu_bank_w);
	template<int Chip> DECLARE_WRITE8_MEMBER(rozcpu_wrap_enable_w);
	template<int Chip> DECLARE_WRITE8_MEMBER(rozcpu_enable_w);
	DECLARE_WRITE8_MEMBER(rozcpu_pal_w);
	void divebomb(machine_config &config);
	void divebomb_fgcpu_iomap(address_map &map);
	void divebomb_fgcpu_map(address_map &map);
	void divebomb_rozcpu_iomap(address_map &map);
	void divebomb_rozcpu_map(address_map &map);
	void divebomb_spritecpu_iomap(address_map &map);
	void divebomb_spritecpu_map(address_map &map);
};