summaryrefslogtreecommitdiffstats
path: root/src/mame/includes/marineb.h
blob: 1fb9c1715930f9cdbf9ad0602f65a53200268fc6 (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
86
87
88
89
90
91
// license:BSD-3-Clause
// copyright-holders:Zsolt Vasvari
#ifndef MAME_INCLUDES_MARINEB_H
#define MAME_INCLUDES_MARINEB_H

#pragma once

#include "machine/74259.h"
#include "machine/watchdog.h"
#include "emupal.h"
#include "tilemap.h"

class marineb_state : public driver_device
{
public:
	marineb_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_videoram(*this, "videoram"),
		m_spriteram(*this, "spriteram"),
		m_colorram(*this, "colorram"),
		m_system(*this, "SYSTEM"),
		m_maincpu(*this, "maincpu"),
		m_audiocpu(*this, "audiocpu"),
		m_gfxdecode(*this, "gfxdecode"),
		m_palette(*this, "palette"),
		m_outlatch(*this, "outlatch"),
		m_watchdog(*this, "watchdog")
	{ }

	void springer(machine_config &config);
	void wanted(machine_config &config);
	void hopprobo(machine_config &config);
	void marineb(machine_config &config);
	void bcruzm12(machine_config &config);
	void hoccer(machine_config &config);
	void changes(machine_config &config);

private:
	required_shared_ptr<uint8_t> m_videoram;
	required_shared_ptr<uint8_t> m_spriteram;
	required_shared_ptr<uint8_t> m_colorram;
	required_ioport m_system;

	/* video-related */
	tilemap_t   *m_bg_tilemap = nullptr;
	tilemap_t   *m_fg_tilemap = nullptr;
	uint8_t     m_palette_bank = 0;
	uint8_t     m_column_scroll = 0;
	uint8_t     m_flipscreen_x = 0;
	uint8_t     m_flipscreen_y = 0;

	/* devices */
	required_device<cpu_device> m_maincpu;
	optional_device<cpu_device> m_audiocpu;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<palette_device> m_palette;
	required_device<ls259_device> m_outlatch;
	required_device<watchdog_timer_device> m_watchdog;

	bool     m_irq_mask = false;
	DECLARE_WRITE_LINE_MEMBER(irq_mask_w);
	DECLARE_WRITE_LINE_MEMBER(nmi_mask_w);
	void marineb_videoram_w(offs_t offset, uint8_t data);
	void marineb_colorram_w(offs_t offset, uint8_t data);
	void marineb_column_scroll_w(uint8_t data);
	void marineb_palette_bank_0_w(uint8_t data);
	void marineb_palette_bank_1_w(uint8_t data);
	DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w);
	DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w);
	uint8_t system_watchdog_r();
	TILE_GET_INFO_MEMBER(get_tile_info);
	virtual void machine_start() override;
	virtual void machine_reset() override;
	virtual void video_start() override;
	void marineb_palette(palette_device &palette) const;
	uint32_t screen_update_marineb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_changes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_springer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_hoccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	DECLARE_WRITE_LINE_MEMBER(marineb_vblank_irq);
	DECLARE_WRITE_LINE_MEMBER(wanted_vblank_irq);
	void set_tilemap_scrolly( int cols );

	void marineb_map(address_map &map);
	void marineb_io_map(address_map &map);
	void wanted_map(address_map &map);
	void wanted_io_map(address_map &map);
};

#endif // MAME_INCLUDES_MARINEB_H