summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/newport.h
blob: 46774652a0b60540f5400850969c287345562d94 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
/*
    SGI "Newport" graphics board used in the Indy and some Indigo2s

*/

#ifndef MAME_VIDEO_NEWPORT_H
#define MAME_VIDEO_NEWPORT_H

#pragma once

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


	DECLARE_READ32_MEMBER( rex3_r );
	DECLARE_WRITE32_MEMBER( rex3_w );

	uint32_t screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect);

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

private:
	struct VC2_t
	{
		uint16_t nRegister[0x21];
		uint16_t nRAM[0x8000];
		uint8_t nRegIdx;
		uint16_t nRegData;
	};


	struct XMAP_t
	{
		uint32_t nRegister[0x08];
		uint32_t nModeTable[0x20];
	};

	struct REX3_t
	{
		uint32_t nDrawMode1;
		uint32_t nDrawMode0;
		uint32_t nLSMode;
		uint32_t nLSPattern;
		uint32_t nLSPatSave;
		uint32_t nZPattern;
		uint32_t nColorBack;
		uint32_t nColorVRAM;
		uint32_t nAlphaRef;
		//uint32_t nStall0;
		uint32_t nSMask0X;
		uint32_t nSMask0Y;
		uint32_t nSetup;
		uint32_t nStepZ;
		uint32_t nXStart;
		uint32_t nYStart;
		uint32_t nXEnd;
		uint32_t nYEnd;
		uint32_t nXSave;
		uint32_t nXYMove;
		uint32_t nBresD;
		uint32_t nBresS1;
		uint32_t nBresOctInc1;
		uint32_t nBresRndInc2;
		uint32_t nBresE1;
		uint32_t nBresS2;
		uint32_t nAWeight0;
		uint32_t nAWeight1;
		uint32_t nXStartF;
		uint32_t nYStartF;
		uint32_t nXEndF;
		uint32_t nYEndF;
		uint32_t nXStartI;
		//uint32_t nYEndF1;
		uint32_t nXYStartI;
		uint32_t nXYEndI;
		uint32_t nXStartEndI;
		uint32_t nColorRed;
		uint32_t nColorAlpha;
		uint32_t nColorGreen;
		uint32_t nColorBlue;
		uint32_t nSlopeRed;
		uint32_t nSlopeAlpha;
		uint32_t nSlopeGreen;
		uint32_t nSlopeBlue;
		uint32_t nWriteMask;
		uint32_t nZeroFract;
		uint32_t nZeroOverflow;
		//uint32_t nColorIndex;
		uint32_t nHostDataPortMSW;
		uint32_t nHostDataPortLSW;
		uint32_t nDCBMode;
		uint32_t nDCBRegSelect;
		uint32_t nDCBSlvSelect;
		uint32_t nDCBDataMSW;
		uint32_t nDCBDataLSW;
		uint32_t nSMask1X;
		uint32_t nSMask1Y;
		uint32_t nSMask2X;
		uint32_t nSMask2Y;
		uint32_t nSMask3X;
		uint32_t nSMask3Y;
		uint32_t nSMask4X;
		uint32_t nSMask4Y;
		uint32_t nTopScanline;
		uint32_t nXYWin;
		uint32_t nClipMode;
		uint32_t nConfig;
		uint32_t nStatus;
		uint8_t nXFerWidth;
#if 0
		uint32_t nCurrentX;
		uint32_t nCurrentY;
#endif
		uint32_t nKludge_SkipLine;
	};


	struct CMAP_t
	{
		uint16_t nPaletteIndex;
		uint32_t nPalette[0x10000];
	};


	// internal state

	DECLARE_READ32_MEMBER( cmap0_r );
	DECLARE_WRITE32_MEMBER( cmap0_w );
	DECLARE_READ32_MEMBER( cmap1_r );
	DECLARE_READ32_MEMBER( xmap0_r );
	DECLARE_WRITE32_MEMBER( xmap0_w );
	DECLARE_READ32_MEMBER( xmap1_r );
	DECLARE_WRITE32_MEMBER( xmap1_w );
	DECLARE_READ32_MEMBER( vc2_r );
	DECLARE_WRITE32_MEMBER( vc2_w );
	void DoREX3Command();

	VC2_t  m_VC2;
	XMAP_t m_XMAP0;
	XMAP_t m_XMAP1;
	REX3_t m_REX3;
	std::unique_ptr<uint32_t[]> m_base;
	uint8_t  m_nDrawGreen;
	CMAP_t m_CMAP0;
};



#define MCFG_NEWPORT_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, NEWPORT_VIDEO, 0)


DECLARE_DEVICE_TYPE(NEWPORT_VIDEO, newport_video_device)


#endif // MAME_VIDEO_NEWPORT_H