summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/segaic16_road.h
blob: 7e50223e8a75bd790104b37604a76be62f5338cf (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
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/* Sega Road Generators */
#ifndef MAME_VIDEO_SEGAIC16_ROAD_H
#define MAME_VIDEO_SEGAIC16_ROAD_H

#pragma once



class segaic16_road_device : public device_t
{
public:
	/* road systems */
	static constexpr unsigned MAX_ROADS          = 1;

	static constexpr unsigned ROAD_HANGON        = 0;
	static constexpr unsigned ROAD_SHARRIER      = 1;
	static constexpr unsigned ROAD_OUTRUN        = 2;
	static constexpr unsigned ROAD_XBOARD        = 3;

	static constexpr unsigned ROAD_BACKGROUND    = 0;
	static constexpr unsigned ROAD_FOREGROUND    = 1;



	struct road_info
	{
		uint8_t           index;                          /* index of this structure */
		uint8_t           type;                           /* type of road system (see segaic16.h for details) */
		uint8_t           control;                        /* control register value */
		uint16_t          colorbase1;                     /* color base for road ROM data */
		uint16_t          colorbase2;                     /* color base for road background data */
		uint16_t          colorbase3;                     /* color base for sky data */
		int32_t           xoffs;                          /* X scroll offset */
		void            (*draw)(struct road_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
		uint16_t *        roadram;                        /* pointer to roadram pointer */
		std::unique_ptr<uint16_t[]>        buffer;                         /* buffered roadram pointer */
		std::unique_ptr<uint8_t[]>          gfx;                            /* expanded road graphics */
	};



	segaic16_road_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	uint16_t *segaic16_roadram_0;
	void segaic16_road_hangon_decode(running_machine &machine, struct road_info *info);
	void segaic16_road_outrun_decode(running_machine &machine, struct road_info *info);

	struct road_info segaic16_road[MAX_ROADS];
	void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs);

	void segaic16_road_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);

	DECLARE_READ16_MEMBER( segaic16_road_control_0_r );
	DECLARE_WRITE16_MEMBER( segaic16_road_control_0_w );


protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;

private:
	// internal state
};

DECLARE_DEVICE_TYPE(SEGAIC16_ROAD, segaic16_road_device)

#endif // MAME_VIDEO_SEGAIC16_ROAD_H