summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/m62.h
blob: 4f9d75e1fe1b2ac36482e37888c7ee9815a9007c (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// license:BSD-3-Clause
// copyright-holders:smf, David Haywood

#include "audio/irem.h"

class m62_state : public driver_device
{
public:
	m62_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
		m_spriteram(*this, "spriteram"),
		m_m62_tileram(*this, "m62_tileram"),
		m_m62_textram(*this, "m62_textram"),
		m_scrollram(*this, "scrollram"),
		m_sprite_height_prom(*this, "spr_height_prom"),
		m_sprite_color_proms(*this, "spr_color_proms"),
		m_chr_color_proms(*this, "chr_color_proms"),
		m_fg_color_proms(*this, "fg_color_proms"),
		m_maincpu(*this, "maincpu"),
		m_fg_decode(*this, "fg_decode"),
		m_spr_decode(*this, "spr_decode"),
		m_chr_decode(*this, "chr_decode"),
		m_fg_palette(*this, "fg_palette"),
		m_spr_palette(*this, "spr_palette"),
		m_chr_palette(*this, "chr_palette"),
		m_audio(*this, "irem_audio")
	{ }

	/* memory pointers */
	required_shared_ptr<uint8_t> m_spriteram;

	required_shared_ptr<uint8_t> m_m62_tileram;
	optional_shared_ptr<uint8_t> m_m62_textram;
	optional_shared_ptr<uint8_t> m_scrollram;

	/* video-related */
	tilemap_t*             m_bg_tilemap;
	tilemap_t*             m_fg_tilemap;
	int                  m_flipscreen;
	required_region_ptr<uint8_t> m_sprite_height_prom;
	required_region_ptr<uint8_t> m_sprite_color_proms;
	required_region_ptr<uint8_t> m_chr_color_proms;
	optional_region_ptr<uint8_t> m_fg_color_proms;
	int32_t                m_m62_background_hscroll;
	int32_t                m_m62_background_vscroll;
	uint8_t                m_kidniki_background_bank;
	int32_t                m_kidniki_text_vscroll;
	int                  m_ldrun3_topbottom_mask;
	int32_t                m_spelunkr_palbank;

	/* misc */
	int                 m_ldrun2_bankswap;  //ldrun2
	int                 m_bankcontrol[2];   //ldrun2
	DECLARE_READ8_MEMBER(ldrun2_bankswitch_r);
	DECLARE_WRITE8_MEMBER(ldrun2_bankswitch_w);
	DECLARE_READ8_MEMBER(ldrun3_prot_5_r);
	DECLARE_READ8_MEMBER(ldrun3_prot_7_r);
	DECLARE_WRITE8_MEMBER(ldrun4_bankswitch_w);
	DECLARE_WRITE8_MEMBER(kidniki_bankswitch_w);
	DECLARE_WRITE8_MEMBER(spelunkr_bankswitch_w);
	DECLARE_WRITE8_MEMBER(spelunk2_bankswitch_w);
	DECLARE_WRITE8_MEMBER(youjyudn_bankswitch_w);
	DECLARE_WRITE8_MEMBER(m62_flipscreen_w);
	DECLARE_WRITE8_MEMBER(m62_hscroll_low_w);
	DECLARE_WRITE8_MEMBER(m62_hscroll_high_w);
	DECLARE_WRITE8_MEMBER(m62_vscroll_low_w);
	DECLARE_WRITE8_MEMBER(m62_vscroll_high_w);
	DECLARE_WRITE8_MEMBER(m62_tileram_w);
	DECLARE_WRITE8_MEMBER(m62_textram_w);
	DECLARE_WRITE8_MEMBER(kungfum_tileram_w);
	DECLARE_WRITE8_MEMBER(ldrun3_topbottom_mask_w);
	DECLARE_WRITE8_MEMBER(kidniki_text_vscroll_low_w);
	DECLARE_WRITE8_MEMBER(kidniki_text_vscroll_high_w);
	DECLARE_WRITE8_MEMBER(kidniki_background_bank_w);
	DECLARE_WRITE8_MEMBER(spelunkr_palbank_w);
	DECLARE_WRITE8_MEMBER(spelunk2_gfxport_w);
	DECLARE_WRITE8_MEMBER(horizon_scrollram_w);
	void init_youjyudn();
	void init_spelunkr();
	void init_ldrun2();
	void init_ldrun4();
	void init_spelunk2();
	void init_kidniki();
	void init_battroad();
	TILE_GET_INFO_MEMBER(get_kungfum_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_ldrun_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_ldrun2_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_battroad_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_battroad_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_ldrun4_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_lotlot_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_lotlot_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_kidniki_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_kidniki_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_spelunkr_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_spelunkr_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_spelunk2_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_youjyudn_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_youjyudn_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_horizon_bg_tile_info);
	void machine_start_battroad() ATTR_COLD;
	void machine_init_save();
	virtual void machine_start() override;
	virtual void machine_reset() override;
	virtual void video_start() override;
	DECLARE_PALETTE_INIT(m62_spr);
	DECLARE_PALETTE_INIT(m62_chr);
	DECLARE_PALETTE_INIT(m62_lotlot_fg);
	DECLARE_PALETTE_INIT(m62_battroad_fg);
	void video_start_kungfum()  ATTR_COLD;
	void video_start_battroad() ATTR_COLD;
	void video_start_ldrun2()   ATTR_COLD;
	void video_start_ldrun4()   ATTR_COLD;
	void video_start_lotlot()   ATTR_COLD;
	void video_start_kidniki()  ATTR_COLD;
	void video_start_spelunkr() ATTR_COLD;
	void video_start_spelunk2() ATTR_COLD;
	DECLARE_PALETTE_INIT(spelunk2);
	void video_start_youjyudn() ATTR_COLD;
	void video_start_horizon()  ATTR_COLD;
	uint32_t screen_update_ldrun(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_kungfum(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_battroad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_ldrun3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_ldrun4(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_lotlot(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_kidniki(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_spelunkr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_spelunk2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_youjyudn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_horizon(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	void m62_amplify_contrast(bool include_fg);
	void register_savestate(  );
	void draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, int colormask, int prioritymask, int priority );
	void m62_start( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 );
	void m62_textlayer( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 );
	required_device<cpu_device> m_maincpu;
	optional_device<gfxdecode_device> m_fg_decode;
	required_device<gfxdecode_device> m_spr_decode;
	required_device<gfxdecode_device> m_chr_decode;
	optional_device<palette_device> m_fg_palette;
	required_device<palette_device> m_spr_palette;
	required_device<palette_device> m_chr_palette;
	required_device<irem_audio_device> m_audio;
	void ldrun2(machine_config &config);
	void lotlot(machine_config &config);
	void ldrun3(machine_config &config);
	void battroad(machine_config &config);
	void horizon(machine_config &config);
	void ldrun4(machine_config &config);
	void spelunk2(machine_config &config);
	void youjyudn(machine_config &config);
	void kungfum(machine_config &config);
	void spelunkr(machine_config &config);
	void ldrun(machine_config &config);
	void kidniki(machine_config &config);
	void battroad_io_map(address_map &map);
	void battroad_map(address_map &map);
	void horizon_map(address_map &map);
	void kidniki_io_map(address_map &map);
	void kidniki_map(address_map &map);
	void kungfum_io_map(address_map &map);
	void kungfum_map(address_map &map);
	void ldrun2_io_map(address_map &map);
	void ldrun2_map(address_map &map);
	void ldrun3_io_map(address_map &map);
	void ldrun3_map(address_map &map);
	void ldrun4_io_map(address_map &map);
	void ldrun4_map(address_map &map);
	void ldrun_map(address_map &map);
	void lotlot_map(address_map &map);
	void spelunk2_map(address_map &map);
	void spelunkr_map(address_map &map);
	void youjyudn_io_map(address_map &map);
	void youjyudn_map(address_map &map);
};