summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video/m50458.h
blob: 0574a4153ff380b37ceee64e5ca1ff7a3fc80fb7 (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
/***************************************************************************

Mitsubishi M50458 OSD chip

***************************************************************************/

#pragma once

#ifndef __M50458DEV_H__
#define __M50458DEV_H__



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

#define MCFG_M50458_ADD(_tag,_freq,_screen) \
	MCFG_DEVICE_ADD(_tag, M50458,_freq) \
	MCFG_VIDEO_SET_SCREEN(_screen)


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

enum m50458_state_t
{
	OSD_SET_ADDRESS = 0,
	OSD_SET_DATA
};

// ======================> m50458_device

class m50458_device :   public device_t,
						public device_memory_interface,
						public device_video_interface
{
public:
	// construction/destruction
	m50458_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	// I/O operations
	DECLARE_WRITE_LINE_MEMBER( write_bit );
	DECLARE_WRITE_LINE_MEMBER( set_cs_line );
	DECLARE_WRITE_LINE_MEMBER( set_clock_line );
	DECLARE_WRITE16_MEMBER(vreg_120_w);
	DECLARE_WRITE16_MEMBER(vreg_121_w);
	DECLARE_WRITE16_MEMBER(vreg_122_w);
	DECLARE_WRITE16_MEMBER(vreg_123_w);
	DECLARE_WRITE16_MEMBER(vreg_124_w);
	DECLARE_WRITE16_MEMBER(vreg_125_w);
	DECLARE_WRITE16_MEMBER(vreg_126_w);
	DECLARE_WRITE16_MEMBER(vreg_127_w);

	UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	virtual const rom_entry *device_rom_region() const;

protected:
	// device-level overrides
	virtual void device_validity_check(validity_checker &valid) const;
	virtual void device_start();
	virtual void device_reset();
	virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;

	int m_latch;
	int m_reset_line;
	int m_clock_line;
	UINT16 m_current_cmd;
	int m_cmd_stream_pos;
	UINT16 m_osd_addr;
	UINT8 *m_shadow_gfx;

	UINT8 m_bg_pen;
	UINT8 m_phase;
	UINT8 m_scrf,m_scrr;
	UINT8 m_space;
	UINT8 m_hsz1,m_hsz2,m_hsz3;
	UINT8 m_vsz1,m_vsz2,m_vsz3;
	UINT8 m_blink;

	m50458_state_t m_osd_state;

private:
	inline UINT16 read_word(offs_t address);
	inline void write_word(offs_t address, UINT16 data);

	const address_space_config      m_space_config;
};


// device type definition
extern const device_type M50458;



//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************



#endif