summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/k001604.h
blob: 8ff317f50081cf0f15c7b0bb84b90bd9d8c67cd0 (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:David Haywood
#ifndef MAME_VIDEO_K001604_H
#define MAME_VIDEO_K001604_H

#pragma once


class k001604_device : public device_t, public device_gfx_interface
{
public:
	k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// configuration
	void set_layer_size(int size) { m_layer_size = size; }
	void set_roz_size(int size) { m_roz_size = size; }
	void set_txt_mem_offset(int offs) { m_txt_mem_offset = offs; }
	void set_roz_mem_offset(int offs) { m_roz_mem_offset = offs; }

	void draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cliprect );
	void draw_front_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect );
	DECLARE_WRITE32_MEMBER( tile_w );
	DECLARE_READ32_MEMBER( tile_r );
	DECLARE_WRITE32_MEMBER( char_w );
	DECLARE_READ32_MEMBER( char_r );
	DECLARE_WRITE32_MEMBER( reg_w );
	DECLARE_READ32_MEMBER( reg_r );

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;
private:
	// internal state
	int            m_layer_size;        // 0 -> width = 128 tiles, 1 -> width = 256 tiles
	int            m_roz_size;          // 0 -> 8x8, 1 -> 16x16
	int            m_txt_mem_offset;
	int            m_roz_mem_offset;

	tilemap_t      *m_layer_8x8[2];
	tilemap_t      *m_layer_roz;

	std::unique_ptr<uint32_t[]>       m_tile_ram;
	std::unique_ptr<uint32_t[]>       m_char_ram;
	std::unique_ptr<uint32_t[]>       m_reg;

	TILEMAP_MAPPER_MEMBER(scan_layer_8x8_0_size0);
	TILEMAP_MAPPER_MEMBER(scan_layer_8x8_0_size1);
	TILEMAP_MAPPER_MEMBER(scan_layer_8x8_1_size0);
	TILEMAP_MAPPER_MEMBER(scan_layer_8x8_1_size1);
	TILEMAP_MAPPER_MEMBER(scan_layer_roz_256);
	TILEMAP_MAPPER_MEMBER(scan_layer_roz_128);
	TILE_GET_INFO_MEMBER(tile_info_layer_8x8);
	TILE_GET_INFO_MEMBER(tile_info_layer_roz);
};

DECLARE_DEVICE_TYPE(K001604, k001604_device)


#define MCFG_K001604_LAYER_SIZE(_size) \
	downcast<k001604_device &>(*device).set_layer_size(_size);

#define MCFG_K001604_ROZ_SIZE(_size) \
	downcast<k001604_device &>(*device).set_roz_size(_size);

#define MCFG_K001604_TXT_OFFSET(_offs) \
	downcast<k001604_device &>(*device).set_txt_mem_offset(_offs);

#define MCFG_K001604_ROZ_OFFSET(_offs) \
	downcast<k001604_device &>(*device).set_roz_mem_offset(_offs);

#define MCFG_K001604_PALETTE(_palette_tag) \
	MCFG_GFX_PALETTE(_palette_tag)

#endif // MAME_VIDEO_K001604_H