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

    uPD7227 Intelligent Dot-Matrix LCD Controller/Driver emulation

    Copyright MESS Team.
    Visit http://mamedev.org for licensing and usage restrictions.

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

#pragma once

#ifndef __UPD7227__
#define __UPD7227__

#include "emu.h"



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

#define MCFG_UPD7227_ADD(_tag, _sx, _sy) \
	MCFG_DEVICE_ADD(_tag, UPD7227, 0) \
	upd7227_device::static_set_config(*device, _sx, _sy);



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

// ======================> upd7227_device

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

	// inline configuration helpers
	static void static_set_config(device_t &device, int sx, int sy);

	DECLARE_WRITE_LINE_MEMBER( cs_w );
	DECLARE_WRITE_LINE_MEMBER( cd_w );
	DECLARE_WRITE_LINE_MEMBER( sck_w );
	DECLARE_WRITE_LINE_MEMBER( si_w );
	DECLARE_READ_LINE_MEMBER( so_r );

	UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

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

	// device_memory_interface overrides
	virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;

	address_space_config        m_space_config;

private:
	enum
	{
		CMD_SMM 		= 0x18,
		CMD_SFF 		= 0x10,
		CMD_LDPI 		= 0x80,
		CMD_SWM 		= 0x64,
		CMD_SRM 		= 0x60,
		CMD_SANDM 		= 0x6c,
		CMD_SORM 		= 0x68,
		CMD_SCM 		= 0x72,
		CMD_BSET 		= 0x40,
		CMD_BRESET 		= 0x20,
		CMD_DISP_ON 	= 0x09,
		CMD_DISP_OFF 	= 0x08
	};

	int m_sx;
	int m_sy;

	int m_cs;
	int m_cd;
	int m_sck;
	int m_si;
	int m_so;
};


// device type definition
extern const device_type UPD7227;



#endif