summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/c45.h
blob: eef339bbe89c26eba548039a0176ff140e135ec8 (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
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino, Aaron Giles, Alex W. Jackson
#ifndef MAME_VIDEO_C45_H
#define MAME_VIDEO_C45_H

#pragma once


//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_NAMCO_C45_ROAD_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, NAMCO_C45_ROAD, 0)


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************


// ======================> namco_c45_road_device

class namco_c45_road_device : public device_t, public device_gfx_interface, public device_memory_interface
{
public:
	// construction/destruction
	namco_c45_road_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	void map(address_map &map);

	// read/write handlers
	DECLARE_READ16_MEMBER( read );
	DECLARE_WRITE16_MEMBER( write );

	// C45 Land (Road) Emulation
	void set_transparent_color(pen_t pen) { m_transparent_color = pen; }
	void draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri);

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual space_config_vector memory_space_config() const override;

private:
	// constants
	static constexpr int ROAD_COLS = 64;
	static constexpr int ROAD_ROWS = 512;
	static constexpr int ROAD_TILE_SIZE = 16;
	static constexpr int ROAD_TILEMAP_WIDTH = ROAD_TILE_SIZE * ROAD_COLS;
	static constexpr int ROAD_TILEMAP_HEIGHT = ROAD_TILE_SIZE * ROAD_ROWS;
	static constexpr int WORDS_PER_ROAD_TILE = 0x40/2;
	static const gfx_layout tilelayout;

	// internal helpers
	DECLARE_GFXDECODE_MEMBER(gfxinfo);
	DECLARE_WRITE16_MEMBER( tilemap_w );
	DECLARE_WRITE16_MEMBER( tileram_w );
	TILE_GET_INFO_MEMBER( get_road_info );

	// internal state
	address_space_config        m_space_config;
	required_shared_ptr<uint16_t> m_tmapram;
	required_shared_ptr<uint16_t> m_tileram;
	required_shared_ptr<uint16_t> m_lineram;
	uint8_t *                     m_clut;
	tilemap_t *                 m_tilemap;
	pen_t                       m_transparent_color;
};


// device type definition
DECLARE_DEVICE_TYPE(NAMCO_C45_ROAD, namco_c45_road_device)

#endif // MAME_VIDEO_C45_H