summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/namcos86.h
blob: eadebf47826895cc226fc35eaf8c111042e6ef62 (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
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
#ifndef MAME_INCLUDES_NAMCOS86_H
#define MAME_INCLUDES_NAMCOS86_H

#pragma once

#include "cpu/m6800/m6801.h"
#include "machine/watchdog.h"
#include "sound/n63701x.h"
#include "sound/namco.h"
#include "emupal.h"
#include "tilemap.h"

class namcos86_state : public driver_device
{
public:
	namcos86_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_cpu1(*this, "cpu1")
		, m_cpu2(*this, "cpu2")
		, m_mcu(*this, "mcu")
		, m_watchdog(*this, "watchdog")
		, m_cus30(*this, "namco")
		, m_gfxdecode(*this, "gfxdecode")
		, m_palette(*this, "palette")
		, m_63701x(*this, "namco2")
		, m_rthunder_videoram1(*this, "videoram1")
		, m_rthunder_videoram2(*this, "videoram2")
		, m_rthunder_spriteram(*this, "spriteram")
		, m_user1_ptr(*this, "user1")
		, m_leds(*this, "led%u", 0U)
	{ }

	void genpeitd(machine_config &config);
	void wndrmomo(machine_config &config);
	void roishtar(machine_config &config);
	void rthunder(machine_config &config);
	void hopmappy(machine_config &config);

	void init_namco86();

private:
	void bankswitch1_w(uint8_t data);
	void bankswitch1_ext_w(uint8_t data);
	void bankswitch2_w(uint8_t data);
	uint8_t dsw0_r();
	uint8_t dsw1_r();
	void int_ack1_w(uint8_t data);
	void int_ack2_w(uint8_t data);
	void watchdog1_w(uint8_t data);
	void watchdog2_w(uint8_t data);
	void coin_w(uint8_t data);
	void led_w(uint8_t data);
	void cus115_w(offs_t offset, uint8_t data);
	void videoram1_w(offs_t offset, uint8_t data);;
	void videoram2_w(offs_t offset, uint8_t data);;
	void tilebank_select_w(offs_t offset, uint8_t data);;
	void scroll0_w(offs_t offset, uint8_t data);;
	void scroll1_w(offs_t offset, uint8_t data);;
	void scroll2_w(offs_t offset, uint8_t data);;
	void scroll3_w(offs_t offset, uint8_t data);;
	void backcolor_w(uint8_t data);;
	void spriteram_w(offs_t offset, uint8_t data);;

	TILE_GET_INFO_MEMBER(get_tile_info0);
	TILE_GET_INFO_MEMBER(get_tile_info1);
	TILE_GET_INFO_MEMBER(get_tile_info2);
	TILE_GET_INFO_MEMBER(get_tile_info3);

	void namcos86_palette(palette_device &palette);

	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	DECLARE_WRITE_LINE_MEMBER(screen_vblank);
	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	void scroll_w(offs_t offset, int data, int layer);

	void common_mcu_map(address_map &map);
	void cpu1_map(address_map &map);
	void genpeitd_cpu2_map(address_map &map);
	void genpeitd_mcu_map(address_map &map);
	void hopmappy_cpu2_map(address_map &map);
	void hopmappy_mcu_map(address_map &map);
	void roishtar_cpu2_map(address_map &map);
	void roishtar_mcu_map(address_map &map);
	void rthunder_cpu2_map(address_map &map);
	void rthunder_mcu_map(address_map &map);
	void wndrmomo_cpu2_map(address_map &map);
	void wndrmomo_mcu_map(address_map &map);

	virtual void machine_start() override;
	virtual void video_start() override;

	required_device<cpu_device> m_cpu1;
	required_device<cpu_device> m_cpu2;
	required_device<hd63701v0_cpu_device> m_mcu;
	required_device<watchdog_timer_device> m_watchdog;
	required_device<namco_cus30_device> m_cus30;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<palette_device> m_palette;
	optional_device<namco_63701x_device> m_63701x;
	required_shared_ptr<uint8_t> m_rthunder_videoram1;
	required_shared_ptr<uint8_t> m_rthunder_videoram2;
	required_shared_ptr<uint8_t> m_rthunder_spriteram;
	optional_region_ptr<uint8_t> m_user1_ptr;
	output_finder<2> m_leds;

	uint8_t *m_spriteram;
	int m_wdog;
	int m_tilebank;
	int m_xscroll[4];
	int m_yscroll[4];
	tilemap_t *m_bg_tilemap[4];
	int m_backcolor;
	const uint8_t *m_tile_address_prom;
	int m_copy_sprites;

	inline void get_tile_info(tile_data &tileinfo,int tile_index,int layer,uint8_t *vram);
	void set_scroll(int layer);
};

#endif // MAME_INCLUDES_NAMCOS86_H