DB019-B ViRGE Integrated 3D Accelerator Aug1996
DB019-B ViRGE Integrated 3D Accelerator Aug1996
DB019-B ViRGE Integrated 3D Accelerator Aug1996
ViRGE
Integrated
3D Accelerator
August 1996
S3 Incorporated
P.O. Box 58058
Santa Clara, CA 95052-8058
ViRGE Integrated 3D Accelerator
NOTATIONAL CONVENTIONS
Signal names are shown in all uppercase letters. For example, XD.
A bar over a signal name indicates an active low signal. For example, OE.
n-m indicates a bit field from bit n to bit m. For example, 7-0 specifies bits 7 through 0, inclusive.
n:m indicates a signal (pin) range from n to m. For example D[7:0] specifies data lines 7 through 0, inclusive
Use of a trailing letter H indicates a hexadecimal number. For example, 7AH is a hexadecimal number.
Use of a trailing letter b indicates a binary number. For example, 010b is a binary number.
When K or M are used, they refer to binary rather than decimal form. Thus, for example, 1 KByte would be equivalent to 1024, not 1,000
bytes.
NOTICES
© Copyright 1995, 1996 S3 Incorporated. All rights reserved. If you have received this document from S3 Incorporated in electric form,
you are permitted to make the following copies for business use related to products of S3 Incorporated: one copy onto your computer
for the purpose of on-line viewing, and one printed copy. With respect to all documents, whether received in hard copy or electronic
form, other use, copying or storage, in whole or in part, by any means electronic, mechanical, photocopying or otherwise, is permitted
without the prior written consent of S3 Incorporated, P.O. Box 58058., Santa Clara CA 95052-8058. S3 and True Acceleration are registered
trademarks of S3 Incorporated. The S3 Corporate Logo, S3 on Board, S3 on Board design, S3d design, Vision968, Trio, Trio64, Trio64V+,
Trio64UV+, Trio64V2/DX, Trio64V2/GX, ViRGE, ViRGE/VX, S3d, Scenic, Scenic/MX2, Scenic Highway, Sonic, Sonic/AD, Aurora64V+,
DuoView, Cooperative Accelerator Architecture, Streams Processor, MIC, Galileo, Native-MPEG, No Compromise Integration, No
Compromise Acceleration and Innovations in Acceleration are trademarks of S3 Incorporated. Other trademarks referenced in this
document are owned by their respective companies. The material in this document is for information only and is subject to change
without notice. S3 Incorporated reserves the right to make changes in the product design without reservation and without notice to its
users.
Table of Contents
iii
ViRGE Integrated 3D Accelerator
10.1.3 Packed True Color . . . . . . . 10-2 13.2.1 Unlocking the S3 Registers . 13-1
10.1.4 Hardware Cursor Generation . 10-3 13.2.2 Locking the S3 Registers . . . 13-4
10.1.5 Frame Buffer Organization/ 13.3 TESTING FOR THE PRESENCE OF
Double Buffering . . . . . . . . 10-3 A ViRGE CHIP . . . . . . . . . . . 13-4
10.2 INPUT PROCESSING . . . . . . . . 10-5 13.4 GRAPHICS MODE SETUP . . . . 13-4
10.2.1 Primary Stream Processing . . 10-5
10.2.2 Secondary Stream Processing . 10-5
10.3 COMPOSITION/OUTPUT . . . . . . 10-6
Section 14: VGA Compatibility
10.3.1 Opaque Rectangular Support . . . . . . . . . . . . . 14-1
Overlaying . . . . . . . . . . . 10-7 14.1 VGA COMPATIBILITY . . . . . . . 14-1
10.3.2 Blending . . . . . . . . . . . . 10-7 14.2 VESA SUPER VGA SUPPORT . . 14-2
10.3.3 Color/Chroma Keying . . . . . 10-8
10.3.4 Window Location . . . . . . . . 10-8 Section 15: Enhanced
10.4 STREAMS FIFO CONTROL . . . . . 10-8
Programming . . . . . . . . . . . 15-1
15.1 MEMORY-MAPPED I/O . . . . . . 15-1
Section 11: Local Peripheral 15.1.1 Old MMIO . . . . . . . . . . . 15-1
Bus . . . . . . . . . . . . . . . . 11-1 15.1.2 New MMIO . . . . . . . . . . 15-2
11.1 Scenic/MX2 INTERFACE . . . . . . 11-2 15.2 DIRECT BITMAP ACCESSING—
11.1.1 Scenic/MX2 Register/Memory LINEAR ADDRESSING . . . . . . 15-3
Access . . . . . . . . . . . . . . 11-2 15.2.1 Old Linear Addressing . . . . 15-3
11.1.2 Scenic/MX2 Compressed Data 15.2.2 New Linear Addressing . . . 15-3
Transfer . . . . . . . . . . . . . 11-4 15.3 READ AND WRITE ORDERING . . 15-4
11.1.3 Scenic/MX2 Video Capture . . 11-5 15.4 S3d ENGINE PROGRAMMING . . 15-5
11.2 DIGITIZER INTERFACE . . . . . . . 11-7 15.4.1 Notational Conventions . . . 15-5
11.2.1 I2C Register Interface . . . . . . 11-7 15.4.2 Initial Setup . . . . . . . . . . 15-6
11.2.2 SAA7110 Video Input . . . . . 11-8 15.4.3 Autoexecute . . . . . . . . . . 15-6
11.3 HOST PASS-THROUGH . . . . . . 11-9 15.4.4 2D Programming Examples . 15-6
11.4 LPB-ENABLED PIN 15.4.4.1 BitBLT . . . . . . . . . . . 15-7
ASSIGNMENTS . . . . . . . . . . . 11-9 15.4.4.2 Rectangle Fill . . . . . . . 15-17
15.4.4.3 2D Line Draw . . . . . . . 15-18
15.4.4.4 2D Polygon Fill . . . . . . . 15-21
Section 12: Miscellaneous 15.4.5 3D Graphics Drawing . . . . . 15-23
Functions . . . . . . . . . . . . . 12-1 15.4.5.1 3D Line Drawing . . . . . . 15-23
12.1 VIDEO BIOS ROM INTERFACE . . . 12-1 15.4.5.2 3D Triangle Drawing . . . 15-23
12.1.1 Disabling BIOS ROM Accesses 12-1 15.4.6 Z-Buffering . . . . . . . . . . 15-25
12.1.2 BIOS ROM Hardware Interface 12-1 15.4.7 MUX Buffering . . . . . . . . 15-26
12.1.3 BIOS ROM Read Functional 15.4.8 3D Pixel Color Generation . . 15-26
Timing . . . . . . . . . . . . . . 12-2 15.4.8.1 Texture Filtering . . . . . . 15-27
12.1.4 BIOS ROM Address Mapping . 12-2 15.4.8.2 Generation . . . . . . . . . 15-29
12.2 GREEN PC SUPPORT . . . . . . . . 12-4 15.4.8.3 Lighting . . . . . . . . . . 15-29
12.3 GENERAL INPUT PORT . . . . . . 12-4 15.4.8.4 Fogging . . . . . . . . . . 15-30
12.4 GENERAL OUTPUT PORT . . . . . 12-5 15.4.8.5 Alpha Blending . . . . . . 15-30
12.5 FEATURE CONNECTOR 15.5 PROGRAMMABLE HARDWARE
INTERFACE . . . . . . . . . . . . . 12-7 CURSOR . . . . . . . . . . . . . . 15-31
12.6 SERIAL COMMUNICATIONS 15.6 BUS MASTER DMA . . . . . . . 15-33
PORT . . . . . . . . . . . . . . . . 12-9 15.6.1 Video/Graphics DMA
12.7 INTERRUPT GENERATION . . . . . 12-9 Transfers . . . . . . . . . . . 15-33
15.6.2 S3d Engine Command/
Parameter/Image Data DMA
Section 13: Basic Software Transfers . . . . . . . . . . . 15-33
Functions . . . . . . . . . . . . . 13-1
13.1 CHIP WAKEUP . . . . . . . . . . . 13-1
13.2 REGISTER ACCESS . . . . . . . . . 13-1
iv
ViRGE Integrated 3D Accelerator
v
ViRGE Integrated 3D Accelerator
List of Figures
vi
List of Tables
Section 1: Introduction
INTRODUCTION 1-1
ViRGE Integrated 3D Accelerator
Green PC/Monitor Plug and Play Support The Streams Processor provides the stretching
and YUV color space conversion features re-
• Full hardware and BIOS support for quired for full screen video playback with both
VESA Display Power Management Sig- software CODECs and hardware MPEG-1
naling (DPMS) monitor power savings sources.
modes
• DDC monitor communications The Streams Processor allows simultaneous dis-
play of graphics and video of different color
Extensive Static/Dynamic Power Management depths. For example, it is possible to display 24
bpp-equivalent video on top of an 8-bit graphics
Industry-Standard 208-pin PQFP package background. This saves memory bandwidth and
storage capacity while permitting higher frame
rates.
1.1 OVERVIEW
1-2 INTRODUCTION
ViRGE Integrated 3D Accelerator
2 MBs 4 MBs
Resolution DRAM DRAM
640x480x4 ✔ ✔
640x480x8 ✔ ✔
640x480x16 ✔ ✔
640x480x24 ✔ ✔
800x600x4* ✔ ✔
800x600x8 ✔ ✔
800x600x16 ✔ ✔
800x600x24 ✔ ✔
1024x768x4* ✔ ✔
1024x768x8 ✔ ✔
1024x768x16 ✔ ✔
1024x768x24 (IL) ✔
1152x864x8 ✔ ✔
1280x1024x4* ✔ ✔
1280x1024x8 ✔ ✔
1280x1024x16 (IL) ✔
1600x1200x4* ✔ ✔
1600x1200x8 (IL) ✔ ✔
INTRODUCTION 1-3
ViRGE Integrated 3D Accelerator
ViRGE Integrated 3D Accelerator
ViRGE comes in a 208-pin PQFP package. The mechanical dimensions are given in Figure 2-1.
105
104
157
208
53
1
52
LINEAR DIMENSIONS
0° - 7°
ARE IN MILLIMETERS
0.60 +0.15
0.25 MIN
-0.10
1.30 REF
MECHDIM
Section 3: Pins
ViRGE comes in a 208-pin PQFP package. The pinout for a PCI configuration is shown in Figure 3-1.
The pinout a VL-Bus configuration is shown in Figure 3-2.
PINS 3-1
ViRGE Integrated 3D Accelerator
ENFEAT/GOP0
LCLK/VCLK
PD15/GA15
LD3/PA3
LD2/PA2
LD1/PA1
LD0/PA0
ROMEN
HSYNC
VSYNC
PD47
PD32
PD46
PD33
PD45
PD34
PD44
PD35
PD43
PD36
PD42
PD37
PD41
PD38
PD40
PD39
PD63
PD48
PD62
PD49
PD61
PD50
PD60
PD51
PD59
PD52
PD58
PD53
PD57
PD54
PD56
PD55
INTA
VDD
VSS
VSS
VSS
OE0
VSS
VSS
XIN
WE
XOUT PD0/GA0
154
153
152
151
150
149
148
147
146
145
144
143
142
141
140
139
138
137
136
135
134
133
132
131
130
129
128
127
126
125
124
123
122
121
120
119
118
117
116
115
114
113
112
111
110
109
108
107
CLKAVDD1 PD14/GA14
AVSS 159 102 PD1/GA1
CLKAVDD2 160 101 PD13/GA13
AVSS 161 100 PD2/GA2
VREF 162 99 VSS
VSS 163 98 PD12/GA12
AVDD 164 97 PD3/GA3
PDOWN 165 96 VDD
RSET 166 95 PD11/GA11
AVSS 167 94 PD4/GA4
AR 168 93 PD10/GA10
AVDD 169 92 PD5/GA5
AVDD 170 91 PD9/GA9
AG 171 90 PD6/GA6
AB 172 89 PD8/GA8
AVSS 173 88 PD7/GA7
LD4/PA4 174 87 VSS
LD5/PA5 175 86 CAS0
N/C 176 85 CAS1
N/C 177 84 RAS0
N/C 178 83 CAS2
N/C 179 82 CAS3
N/C
N/C
180
181
ViRGE (PCI) 81
80
VDD
MA8
N/C
ESYNC
182
183 TOP VIEW 79
78
MA0
MA7
LD6/PA6 184 77 MA1
LD8/PA8 185 76 MA6
LD9/PA9 186 75 MA2
LD10/PA10 187 74 MA5
LD11/PA11 188 73 MA3
LD12/PA12 189 72 MA4
STWR/GOP1 190 71 VSS
BLANK 191 70 PD31
VDD 192 69 PD16/GD0
RESET 193 68 PD30
SCLK 194 67 PD17/GD1
VSS 195 66 PD29
VCLKI 196 65 PD18/GD2
GNT 197 64 PD28
REQ 198 63 PD19/GD3
LD13/PA13 199 62 VDD
LD14/PA14 200 61 PD27
LD15/PA15 201 60 VSS
LD7/PA7 202 59 PD20/GD4
VREQ/VRDY/HS/EVIDEO 203 58 PD26
CREQ/CRDY/VS/EVCLK 204 57 PD21/GD5
SPCLK 205 56 PD25
SPD 206 55 PD22/GD6
AD31 PD24
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
3
4
5
6
7
8
9
AD30 PD23/GD7
VIRPCIPN
TRDY
RAS1/OE1
AD29
AD28
AD27
AD26
AD25
AD24
C/BE3
IDSEL
AD23
AD22
AD21
AD20
AD19
AD18
AD17
AD16
C/BE2
FRAME
C/BE1
AD15
AD14
AD13
AD12
AD11
AD10
C/BE0
CAS4
CAS5
CAS6
CAS7
VSS
VDD
IRDY
DEVSEL
VSS
STOP
PAR
VSS
AD9
AD8
VDD
AD7
AD6
AD5
AD4
AD3
AD2
AD1
AD0
VSS
3-2 PINS
ViRGE Integrated 3D Accelerator
ENFEAT/GPIOSTR/GOP0
ROMCS/GOP1
LCLK/VCLK
LD3/PA3
LD2/PA2
LD1/PA1
LD0/PA0
HSYNC
VSYNC
SINTR
PD47
PD32
PD46
PD33
PD45
PD34
PD44
PD35
PD43
PD36
PD42
PD37
PD41
PD38
PD40
PD39
PD63
PD48
PD62
PD49
PD61
PD50
PD60
PD51
PD59
PD52
PD58
PD53
PD57
PD54
PD56
PD55
PD15
VDD
VSS
VSS
VSS
OE0
VSS
VSS
XIN
WE
XOUT
154
153
152
151
150
149
148
147
146
145
144
143
142
141
140
139
138
137
136
135
134
133
132
131
130
129
128
127
126
125
124
123
122
121
120
119
118
117
116
115
114
113
112
111
110
109
108
107
PD0
CLKAVDD1 PD14
AVSS 159 102 PD1
CLKAVDD2 160 101 PD13
AVSS 161 100 PD2
VREF 162 99 VSS
VSS 163 98 PD12
AVDD 164 97 PD3
PDOWN 165 96 VDD
RSET 166 95 PD11
AVSS 167 94 PD4
AR 168 93 PD10
AVDD 169 92 PD5
AVDD 170 91 PD9
AG 171 90 PD6
AB 172 89 PD8
AVSS 173 88 PD7
LD4/PA4 174 87 VSS
LD5/PA5 175 86 CAS0
SA2 176 85 CAS1
SA3 177 84 RAS0
SA4 178 83 CAS2
SA5 179 82 CAS3
SA6
SA7
180
181
ViRGE (VL-BUS) 81
80
VDD
MA8
SA8
SA9
182
183 TOP VIEW 79
78
MA0
MA7
LD6/PA6 184 77 MA1
SA10 185 76 MA6
SA11 186 75 MA2
SA12 187 74 MA5
SA13 188 73 MA3
SA14 189 72 MA4
SA15 190 71 VSS
SA16 191 70 PD31
VDD 192 69 PD16
SRESET 193 68 PD30
SCLK 194 67 PD17
VSS 195 66 PD29
SA17 196 65 PD18
SA18 197 64 PD28
SA19 198 63 PD19
SA20 199 62 VDD
SA21 200 61 PD27
SA22 201 60 VSS
LD7/PA7 202 59 PD20
VREQ/VRDY/HS/EVIDEO 203 58 PD26
CREQ/CRDY/VS/EVCLK 204 57 PD21
SPCLK/ESYNC 205 56 PD25
SPD/BLANK 206 55 PD22
SD31 PD24
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
3
4
5
6
7
8
9
SD30 PD23
VIRVLPIN
SM/IO
RDYIN
SW/R
LOCA
SD29
SD28
SD27
SD26
SD25
SD24
SBE3
SD23
SD22
VDD
SD21
SD20
SD19
SD18
SD17
SD16
SBE2
SADS
SRDY
SAUP1
SBE1
SD15
SD14
SD13
SD12
SD11
SD10
CAS4
CAS5
VDD
SBE0
SAUP2
CAS6
CAS7
VSS
VSS
VSS
SD9
SD8
SD7
SD6
SD5
SD4
SD3
SD2
SD1
SD0
VSS
PINS 3-3
ViRGE Integrated 3D Accelerator
The following table provides a brief description of each pin on ViRGE for its PCI bus and VL-Bus
configurations. The following abbreviations are used for pin types.
I - Input signal
O - Output signal
B - Bidirectional signal
Some pins have multiple names. This either reflects the different functions performed by those pins
depending on the bus configuration selected by power-on-strapping or multiplexed pins whose
functions are selected via a register bit setting. The pin definitions and functions are given for each
possible case.
3-4 PINS
ViRGE Integrated 3D Accelerator
PINS 3-5
ViRGE Integrated 3D Accelerator
3-6 PINS
ViRGE Integrated 3D Accelerator
PINS 3-7
ViRGE Integrated 3D Accelerator
3-8 PINS
ViRGE Integrated 3D Accelerator
ROMCS O 153 (VL) ROM Chip Select. This signal provides the chip
output enable for BIOS ROM reads. It is output when
bits 1-0 of SR1C are any value except 11b.
GPIOSTR O 151 (VL) General Input/Output Port Write Strobe. If
SR1C_1-0 are 01b, this is asserted whenever a
General Input Port access (CR55_2 is set to 1 and the
3C8H port is read) or a General Output Port access
(write to CR5C) is made.
GOP[1:0] O 190, 151 (PCI) General Output Port Bits 1-0. If SR1C_1 is set to
1, the value of CR5C_0 is output on pin 151 (GOP0)
and the value of CR5C_1 is output on pin 190 (GOP1).
GOP[1:0] O 153, 151 (VL) General Output Port Bits 1-0. If bit 1 of SR1C is
set to 1, the value of CR5C_0 is output on pin 151
(GOP0). If SR1C_1-0 are 11b, the value of CR5C_1 is
output on pin 153 (GOP1)
PINS 3-9
ViRGE Integrated 3D Accelerator
3-10 PINS
ViRGE Integrated 3D Accelerator
PINS 3-11
ViRGE Integrated 3D Accelerator
Table 3-2 lists all pins alphabetically. The pin number(s) corresponding to each pin name are given in
the appropriate mode/bus interface type column. Table 3-3 lists all pins in numerical order. The
corresponding pin name/pin number is given in the appropriate mode/bus interface column.
3-12 PINS
ViRGE Integrated 3D Accelerator
PIN(S)
Name PCI VL
PA[15:8] 201-199, 189-185, 134, 132, 130, 128
PAR 26
PD[63:0] 122, 120, 118, 116, 113, 111, 109, 107, 122, 120, 118, 116, 113, 111, 109, 107,
106, 108, 110, 112, 115, 117, 119, 121, 106, 108, 110, 112, 115, 117, 119, 121,
144, 142, 140, 138, 134, 132, 130, 128, 144, 142, 140, 138, 134, 132, 130, 128,
134, 132, 130, 128, 127, 129, 131, 133, 134, 132, 130, 128, 127, 129, 131, 133,
136, 139, 141, 143, 70, 68, 66, 64, 61, 136, 139, 141, 143, 70, 68, 66, 64, 61,
58, 56, 54, 53, 55, 58, 56, 54, 53, 55, 58, 56, 54, 53, 55, 58, 56, 54, 53, 55,
57, 59, 63, 65, 67, 69, 105, 103, 101, 57, 59, 63, 65, 67, 69, 105, 103, 101,
98, 95, 93, 91, 89, 88, 90, 92, 94, 97, 98, 95, 93, 91, 89, 88, 90, 92, 94, 97,
100, 102, 104 100, 102, 104
PDOWN 165 165
RAS0 50 50
RAS1 84
REQ 198
RESET 193
RDYIN 21
ROMEN 153
ROMCS 153
RSET 166 166
SA[22:2] 201-196, 191-185, 183-176
SADS 20
SAUP1 25
SAUP2 50
SBE[3:0] 7, 19, 27, 38
SCLK 194 194
SD[31:0] 207-208, 1-6, 10-11, 13-18, 28-31, 33-36,
39-46
SINTR 152
SM/IO 8
SPCLK 205 205
SPD 206 206
SRDY 23
SRESET 193
STOP 25
STWR 190
SW/R 26
TRDY 23
PINS 3-13
ViRGE Integrated 3D Accelerator
PIN(S)
Name PCI VL
VCLKI 106 106
VDD 12, 37, 62, 81, 96, 137, 192 12, 37, 62, 81, 96, 137, 192
VREQ/VRDY 203 203
VREF 162 162
VS 204 204
VSS 9, 22, 32, 47, 60, 71, 87, 114, 123, 9, 22, 32, 47, 60, 71, 87, 114, 123,
126, 135, 145, 163, 195 126, 135, 145, 163, 195
VSYNC 150 150
WE 125 125
XIN 156 156
XOUT 157 157
3-14 PINS
ViRGE Integrated 3D Accelerator
PINS 3-15
ViRGE Integrated 3D Accelerator
3-16 PINS
ViRGE Integrated 3D Accelerator
PINS 3-17
ViRGE Integrated 3D Accelerator
3-18 PINS
ViRGE Integrated 3D Accelerator
PINS 3-19
ViRGE Integrated 3D Accelerator
ViRGE Integrated 3D Accelerator
4.2 DC SPECIFICATIONS
Note: In all cases below, digital VDD = 5V ± 5% and the operating temperature is 0° C to 70° C.
Notes
1. IOL1, IOH1 for pins ROMEN, INTA, STWR, HSYNC, VSYNC, VCLK, BLANK, ENFEAT,
MA[8:0], CAS[7:0], PD[63:0], AD[31:0], LD[7:0], VREQ/VRDY, SPCLK, SPD, REQ
2. IOL2, IOH2 for pins OE[1:0], WE, RAS[1:0]3
3. IOL3, IOH3 for pins PAR, STOP, DEVSEL, TRDY
4. ICC measured for a resolution of 1024x768x8 with a 75 MHz DCLK and a 50 MHz MCLK at 25°C
and 5V.
5. The pin names used in these notes are the primary ones for PCI configurations. An output
signal multiplexed on one of these pins has the same drive level, as does a VL-Bus output for
the same pin.
4.3 AC SPECIFICATIONS
Notes
1. Measured from the 50% point of VCLK to the 50% point of full scale transition
2. Measured from 10% to 90% full scale
3 With DAC outputs equally loaded
Note
1. Condition for VOUT is a 75 Ohm doubly terminated load, RSET = 147 Ohms and use of internal
VREF.
THIGH
2.4V
1.5V
0.8V
TLOW
TCYC DCLKTIME
Notes
CLOCK 1.5 V
TSU TH
PCI Bus
Symbol Parameter Min Units
TSU AD[31:0], C/BE[3:0], FRAME, IRDY, IDSEL setup 7 ns
TH AD[31:0] hold 1 ns
TH C/BE[3:0], FRAME, IRDY, IDSEL hold 1 ns
TSU GNT setup 10 ns
TH GNT hold 0 ns
VL-Bus
Symbol Parameter Min Units
TSU AD[31:2], BE[3:0], SM/IO, SW/R, SADS (address 12 ns
phase) setup
TH AD[31:2], BE[3:0], SM/IO, SW/R, SADS (address 1 ns
phase) hold
TSU AD[31:2], BE[3:0], D1, D0, SADS (data phase) 4 ns
setup
TH AD[31:2], BE[3:0], D1, D0, SADS (data phase) 1 ns
hold
TSU RDYIN setup 6 ns
TH RDYIN hold 1 ns
Miscellaneous
Symbol Parameter Min Units
TSU ROM data GD[7:0] setup (PCI) 5 ns
TH ROM data GD[7:0] hold (PCI) 7 ns
TSU General Input Port GD[7:0] setup 5 ns
TH General Input Port GD[7:0] hold 7 ns
Scenic/MX2 Interface
Symbol Parameter Min Units
TSU LD[7:0] setup 10 ns
TH LD[7:0] hold 9 ns
TSU CREQ/CRDY 6 ns
TH CREQ/CRDY 8 ns
SAA7110 Interface
Symbol Parameter Min Units
TSU LD[7:0] setup (also LD[15:8] for 16-bit interface) 6 ns
TH LD[7:0] hold (also LD[15:8] for 16-bit interface) 8 ns
TSU HS setup 6 ns
TH HS hold 7 ns
TSU VS setup 6 ns
TH VS hold 7 ns
Note
1. The timing reference in each of the two cases above is to the event that causes the latching
of the read data. The MCLK used to latch 2-cycle EDO data is an internal signal that cannot be
directly observed. The CAS signals used to latch read data in 1-cycle EDO mode are derived
from the internal MCLK.
CLOCK 1.5 V
MAX
MIN
Note: All output timings are based on an 60 pF test load. For each additional 10 pF load, add 0.94 ns
to the maximum value and add 0.4 ns to the minimum value.
PCI Bus
Parameter Min Max Units Notes
AD[31:0] valid delay 2 16 ns 1
DEVSEL, PAR delay 2 11 ns Medium DEVSEL
timing used
STOP delay 2 11 ns
TRDY delay 2 11 ns
INTA delay 2 11 ns
REQ delay 2 10 ns
VL-Bus
Parameter Min Max Units Notes
AD[31:2], D1, D0 valid delay 7 16 ns
SINTR delay 5 30 ns
SRDY delay 5 11 ns
LOCA active delay 5 15 ns
LOCA inactive delay 5 20 ns
Miscellaneous
Parameter Min Max Units Notes
STRD delay 3 15 ns
ROMEN (PCI) delay 4 10
ROM address valid delay (PCI) 5 30 ns
AD[7:0] ROM data valid delay (PCI) 5 30 ns
Note
1. Due to the timing for TRDY for read cycles, data is not sampled on the clock edge immediately
following its becoming valid. This guarantees the PCI 2.1 specification time of 11 ns.
Scenic/MX2 Interface
Parameter Min Max Units Notes
VREQ/VRDY active delay 6 18 ns
LD[7:0] valid delay 7 19 ns
LD[7:0] tri-state from LCLK 7 15 ns
Note
Table 4-14. Feature Connector Timing - Output from ViRGE to Feature Connector
Table 4-15. Feature Connector Timing - Output from Feature Connector to ViRGE
Notes
1. Pixel data is clocked into the internal RAMDAC using VCLK for a pass-through feature
connector and VCLKI for a VAFC configuration.
2. This corresponds to the VESA VAFC specification of a maximum clock of 37.5 MHz.
TLOW
SRESET, RESET
TH
SYSTEM
CONFIGURATION
DATA
RESETTM
TSU
Figure 4-4. Reset Timing
Table 5-1. Definition of PD[28:0] at the Rising Edge of the Reset Signal
Table 5-1. Definition of PD[28:0] at the Rising Edge of the Reset Signal (Continued)
ViRGE interfaces to either a PCI bus or a VESA via CR66_3 and CR66_7. The RAMDAC snoop
local bus (VL-Bus). This section describes the method is selected via CR34_0. PCI master abort
connections and functional characteristics of handling during RAMDAC snooping can be dis-
these interfaces. abled via CR34_1. PCI retry handling during RAM-
DAC snooping can be disabled via CR34_2. PCI
read burst cycles can be disabled via CR3A_7.
6.1 PCI BUS INTERFACE
ViRGE provides a complete bus master PCI inter- 6.2 VL-BUS INTERFACE
face. Power-on strapping bits 1-0 must be set to
10b to enable this interface. The pinout and other Power-on strapping bits 1-0 must be set to 01b to
specifications are in conformance with Revision enable VL-Bus operation. Only SA[22:2] are di-
2.1 of the the PCI specification. No glue logic is rectly decoded. Two inputs (SAUP1, SAUP2) are
required. provided to allow decoding of the upper address
lines for ViRGE address space accesses. The
meanings of SAUP1 and SAUP2 are defined by
6.1.1 PCI Configuration the following truth table.
The Vendor ID register (Index 00H) in the PCI Table 4-1. VL-Bus Upper Address Decoding
Configuration space is hardwired to 5333H to
specify S3 Incorporated as the vendor. The SAUP2 SAUP1 EFFECT
Device ID register is hardwired to 5631H. The
0 0 Ignored
Revision ID will vary by stepping.
0 1 Decode Access to
Bits 10-9 of the Status register (Index 06H) are register/port address
hardwired to 01b to specify medium DEVSEL space
timing. The Class Code register (Index 08H) is 1 0 Decode Access to linear
hardwired to 30000xxH to specify that ViRGE is a addressing address
VGA compatible device. Bits 3-0 of the Base Ad- space (video memory)
dress 0 register (Index 10H) are hardwired to 00H. 1 1 Ignored
This indicates that the "prefetchable" bit is
cleared to 0, the base register can be located There are many ways to generate these inputs,
anywhere in a 32-bit address space and the base depending on the system design. If response to
register is located in memory space. a single linear addressing window above 4 MBy-
tes is required, a PLD can be used to decode the
appropriate address space.
6.1.2 PCI Controls
T1 T2 T3 T4 T5
SCLK
SADS
NOTE 1
SA[31:2]
M/IO
W/R
SAUP
LOCA
SD[31:0] VALID
SRDY
RDYIN NOTE 2
KVLREAD
Notes
1. For one decode wait state (bit 4 of CR40 set to 1), the address is latched on the first clock edge in-
dicated here if bit 3 of CR58 is set to 1. If this bit is cleared to 0, the address is latched on the
second clock edge indicated. The address is always latched on the first clock edge if bit 4 of
CR40 is cleared to 0.
2. The system chip set can delay the RDYIN input by 1 or more cycles. This example assumes a 1
cycle delay, as indicated by the solid line. Note that read data is held valid an extra cycle.
T1 T2 T2 T1
SCLK
SD[31:0] VALID
SADS
NOTE 1
SA[31:2]
M/IO
W/R
SAUP
LOCA
NOTE 2
SRDY
RDYIN NOTE 3
KVLWRITE
Notes
1. For one decode wait state (bit 4 of CR40 set to 1), the address is latched on the first clock edge in-
dicated here if bit 3 of CR58 is set to 1. If this bit is cleared to 0, the address is latched on the
second clock edge indicated. The address is always latched on the first clock edge if bit 4 of
CR40 is cleared to 0.
2. The wait-state is inserted by setting bit 4 of CR40 to 1 to delay SRDY assertion by 1 cycle from
the assertion of SADS. This is the default value.
3. Data is latched on the rising SCLK edge following assertion of RDYIN.
ViRGE supports a DRAM-based video frame buff- 7.2 DISPLAY MEMORY REFRESH
er. This section describes the various configura-
tions supported, the functional timing for
ViRGE uses the standard CAS before RAS DRAM
memory accesses and the operation of various
refresh method. The functional timing for this can
register bits that affect memory timing and op-
be found in any standard DRAM data book.
eration. It also describes how access to display
memory is controlled to maximize graphics per-
The number of refresh cycles performed per hori-
formance.
zontal line is determined by bit 6 of CR11. If bit 2
of CR3A is set to 1, the number of refresh cycles
7.1 DISPLAY MEMORY per horizontal line is determined by the setting of
CONFIGURATIONS bits 1-0 of CR3A. Refreshes are performed during
the horizontal blanking period.
ViRGE uses extended data out (EDO) DRAMs for
its frame buffer, which can be either 2 or 4 MBytes 7.3 2-Cycle EDO DRAM SUPPORT
in size. DRAMs can be configured as 256Kx8 or
256Kx16. A Tech Note lists recommended Figure 7-2 shows the functional timing for a 2-cy-
DRAMs. cle EDO mode read cycle. This also shows how
certain parameters for various control signals
For loading reasons, a maximum of 8 DRAM can be adjusted to meet the access time require-
chips can be used for the frame buffer. Table 7-1 ments of a variety of DRAMs. Power-on strapping
shows the supported memory size/chip count sets CR68_1-0 to allow adjustment of the CAS
configurations. and OE signals. MM8204_7 = 0 delays the trailing
edges by the amount indicated by CR68_1-0.
Table 7-1 Memory Size/Chip Count MM8204_7 = 1 delays the entire CAS/OE active
Configurations pulses by the amount indicated in CR68_1-0.
MA[8:0]
ViRGE
T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
MCLK
RAS0
CAS
SEE NOTE 3
Notes
1. The RAS precharge time can be adjusted via CR68_3, MM8204_1 and CR58_7.
2. The RAS low time for a single column access is adjustable via CR68_2, MM8204_2 and CR58_7.
(The dashed line shows the RAS signal if the second page mode cycle were to be eliminated.)
3. The CAS and OE edges can be adjusted via CR68_1-0 and MM8204_7. CAS and OE edges move
together, but either the trailing edges or entire pulses can be delayed.
T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
MCLK
RAS
CAS
SEE NOTE 3
WE
SEE NOTE 3
Notes
1. The minimum RAS precharge time can be adjusted from 2.5 to 3.5 MCLKs via CR68_3, to 1.5
MCLKs via MM81EC_16, and reduced by 0.5 MCLK via CR58_7.
2. This figure shows a RAS low time for a single column access of 3.5 MCLKs. (The dashed line
shows the RAS signal if the second page mode cycle were to be eliminated.) This RAS active
time can be changed to 4.5 MCLKs via CR68_2 or to 2.5 MCLKs via MM81EC_15 and increased
by 0.5 MCLK via CR58_7.
3. The CAS active (low) time can be stretched via bits 1-0 of CR68 and the WE active time delayed
via bits 4-3 of CR6F.
T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
MCLK
RAS
CAS
OE
WE
MCLKs, the actual minimum for a single EDO DRAM turn-off time guarantees that valid data is
read cycle will be 4.5 MCLKs. latched.
Read data is latched on the rising edge of CAS. Figure 7-3 shows the functional timing for a 2-cy-
An internal CAS is used for this purpose. The cle EDO mode write cycle. The RAS and CAS
internal OE signal rises at the same time, but signals can be adjusted as explained for the read
because of propagation delays, the DRAM will cycle above. Power-on strapping sets CR6F_4-3
not see this edge immediately. This plus the to allow the WE signal to be delayed. MM8204_8
= 0 delays the trailing edge by the amount indi- 7.4 1-CYCLE EDO DRAM SUPPORT
cated by CR6F_4-3. MM8204_8 = 1 delays the
entire active pulse by the amount indicated by
Bits 3-2 of CR36 are cleared to 00b to indicate that
CR6F_4-3.
1-cycle EDO DRAM operation is being used. This
is the normal mode of operation for ViRGE.
Figure 7-4 shows the functional timing for an
EDO write following a read cycle. This is a 1- wait
The functional timing for 1-cycle EDO reads and
state cycle.
writes is provided by Figure 7-5. The DRAM
drives valid read data after the CAS falling edge
at T5. The chip latches the data on the next falling
CAS edge. Note that a dummy cycle is required
T1 T2 T3 T4 T5 T6 T7 T8 T9
MCLK
RAS
CAS
MA[8:0]
MB[8:0] ROW COL 1 COL 2 COL 3 DUMMY
OE
PD[63:0] RD 1 RD 2 RD 3
WE
PD[63:0] WR 1 WR 2 WR 3
SCEDORW
at the end to latch the last read. Write data is CPU (i.e., linear addressing) access to memory
latched by the DRAM on the falling edge of CAS. and hardware cursor fetch are not supported with
No dummy cycle is required, so RAS rises one 1-cycle EDO. 2-cycle EDO operation will automat-
cycle earlier than shown in Figure 7-7 and the last ically be used for these functions.
CAS shown in the figure does not occur.
T1 T2 T3 T4 T5 T6 T7 T8 T9
MCLK
RAS
CAS
MA[8:0]
MB[8:0] ROW COL RD COL WR
OE
WE
7.5 DISPLAY MEMORY ACCESS address line order is sequential, producing the
widest page size. Other orderings may be se-
CONTROL lected to generate a narrower (and deeper) page
size. This can be used to minimize page breaks
A number of processes compete for access to when memory accesses are confined to a small
display memory. These competing processes are region of memory, such as to draw a triangle.
(in decreasing order of access priority):
For 8 bits/pixel modes, the ViRGE internal 24-bit 8.1 OPERATING MODES
RAMDAC provides three 256 6-bit word color
look-up table (LUT) RAMs feeding three 8-bit
Depending on the setting of CR67_3-2, the follow-
DACs. A clock doubled mode is also provided for
ing operating modes are available:
8 bits/pixel modes. A 24-bit LUT bypass is pro-
vided for 15/16- and 24-bit color modes. The
• Streams Processor Off
block diagram for the internal RAMDAC is shown
in Figure 8-1. • Streams Processor On
• Streams Processor On - secondary
The method of operation depends on whether or stream overlaid on VGA Mode 13 back-
not the Streams Processor is active and the color ground
mode.
With the Streams Processor off (CR67-3-1 = 00b),
data from the video FIFO (memory) is processed
by another ViRGE module and then passed di-
rectly to the RAMDAC. (Figure 8-1 shows the data
VREF RSET
SP
OFF INTERNAL VREF DAC CONTROL
PA[15:8]
HIGH- AND TRUE-COLOR BYPASS
8 RED
24 AR
24 DAC
FIFO 8 GREEN
R LUT 6 MUX AG
DAC
8 B 256X6 8
U ADDRESS 18 BLUE
STREAMS 6 AB
F AND 8 G LUT DAC
PROCESSOR F MASK 256X6
24 8 REG'S
E B LUT 6 COMPARATOR
PA[7:0] R 256X6
INTERNAL RAMDAC BLOCK
18 SENSE
ViRGE
DACBLK
going through the Streams Processor, but all Each of the 5 color modes is listed in Table 8-1.
Streams Processor functions are bypassed.) This The desired mode is selected by programming
mode is used for those video modes not sup- bits 7-4 of CR67.
ported by the Streams Processor. This includes
all VGA modes except modes D, E, 10, 12 and 13,
all interlaced modes and the clock-doubled 8 8.2.1 8 Bits/Pixel - Mode 0
bits/pixel mode.
Mode 0 is selected by setting bits 7-4 of CR67 to
With the Streams Processor on (CR67_3-2 = 11b), 0000b. In this mode, the low 8 internal pixel
memory data is passed directly to the Streams address bus bits are ANDed with the contents of
Processor. 8 bits/pixel (palettized) data is passed the Pixel Read Mask register (3C6H). The result
directly to the RAMDAC, where it is interpreted of the AND operation selects one of 256 LUT
by the color look-up table and returned to the locations. This results in the output of 6 bits of
Streams Processor as RGB666. This and other color information to each of the DACs.
input data types are converted to RGB888 (if
required) and then sent to the RAMDAC via the
high and true color bypass. 8.2.2 Output-doubled 8 Bits/Pixel -
Mode 8
8.2 COLOR MODES
This mode is selected by setting bits 7-4 of CR67
to 0001b. In this mode, latching of pixel data from
ViRGE internal RAMDAC provides 5 color modes the lower two bytes of the internal pixel data bus
of the following 3 primary types: is based on the pixel clock (VCLK) and output of
pixel data from the latches to the DACs is based
1. 8 bits (low byte of the internal pixel address on an internal clock running at twice the VCLK
bus) are latched each pixel clock and are rate. Either bit 4 or bit 6 of SR15 must be set to 1
used to select a LUT location. when this mode is selected and bit 7 of SR18
2. 16 bits (low two bytes of the internal pixel must also be set to 1.
address bus) are latched each pixel clock.
These select two consecutive LUT loca- This mode processes two pixels per VCLK with a
tions, the data from which is clocked out maximum VCLK rate of 67.5 MHz. This results in
to the DACs at twice the pixel clock rate. an effective pixel output clock rate of 135 MHz.
3. 15 or 16 bits (lower two bytes of the inter-
nal pixel address bus) or 24 bits (all three The internal pixel bus bits are ANDed with the
bytes of the internal address bus) are contents of the Pixel Read Mask register. The
transferred directly to the DACs each pixel result of the AND operation selects one of 256
clock. LUT locations. This results in the output of 6 bits
of color information to each of the DACs.
8.2.3 15/16-Bits/Pixel - Modes 9 and SRDY are not generated by ViRGE for RAMDAC
write accesses. ViRGE generates write cycles to
10 the local RAMDAC and the ISA controller also
generates cycles to an off-board RAMDAC (mir-
These modes are selected by setting bits [7:4] of roring). RAMDAC reads are always from the local
CR67 to 0011b (15 bits/pixel) or 0101b (16 RAMDAC.
bits/pixel). In either case, one pixel is transferred
on the lower two bytes of the internal pixel bus If bit 7 of CR37 is set to 1, ViRGE claims all
each VCLK cycle. This data is sent directly to the RAMDAC read and write cycles (LOCA and SRDY
DACs via the LUT bypass. are generated).
1. (The following two steps must take Bit 7 of each Q value is generated by the following
place during the blanking period. Using logic:
the VSYNC period is safe and this is easier
to detect. The test could also be run be- Q n e x t [ 7 ] = X N O R( XN O R ( I N [ 0 ] , Q[0]),
tween HSYNCs, but these are harder to de- XNOR(IN[3], Q[3]))
tect.)
3. Reset the signature register by toggling Signature output = NOT Q (for the final Q byte)
SR18_1 from low to high to low.
4. Set SR18_0 to 1 to enable clocking of the
signature register.
5. Generate a known and repeatable se-
quence of pixels to the RAMDAC during
the next non-blanking period. Each pixel is
logically mixed with the current signature
register contents and the result is left in
the signature register.
6. Wait for the next VSYNC active, then clear
SR18_0 to 0 to disable clocking of the sig-
nature register.
7. Toggle SR18_2 from low to high to low to
read out red signature data, then read this
data from CR6E.
8. Toggle SR18_3 from low to high to low to
read out green signature data, then read
this data from CR6E.
9. Toggle SR18_4 from low to high to low to
read out blue signature data, then read
this data from CR6E.
ViRGE contains two phase-locked loop (PLL) fre- On power-up, the CLK1 frequency is 44.606 MHz.
quency synthesizers. These generate the DCLK This can be reprogrammed in exactly the same
(video clock) and MCLK (memory clock) signals manner as explained above for the CLK0 frequen-
for the graphics controller block. The DCLK signal cies.
is converted to the VCLK signal by the graphics
controller block. This signal latches pixel data to The PLL M value can be programmed with any
the RAMDAC. integer value from 1 to 127. The binary equivalent
of this value is programmed in bits 6-0 of SR11
for the MCLK and in bits 6-0 of SR13 for the DCLK.
9.1 CLOCK SYNTHESIS The PLL feedback loop frequency from the volt-
age controlled oscillator stage is scaled by divid-
Each PLL scales a single reference frequency ing that frequency by (M+2).
input on the XIN pin. By placing a parallel-reso-
nant crystal between the XOUT output pin and The PLL N value can be programmed with any
the XIN pin, the reference frequency is generated integer value from 1 to 31. The binary equivalent
by an internal oscillator. Alternately, a CMOS- of this value is programmed in bits 15-11 of SR10
compatible clock input can be connected to XIN for the MCLK and in bits 15-11 of SR12 for the
to provide the reference frequency. DCLK. The reference frequency is divided by
(N+2) before being fed to the phase detector
The frequency synthesized by each PLL is deter- stage of the PLL.
mined by the following equation:
The PLL R value is a 2-bit range value that can be
(M+2) programmed with any integer value from 0 to 3.
fOUT = × fREF The R value is programmed in bits 6-5 of SR 10
(N+2)×2R
for MCLK and bits 6-5 of SR12 for DCLK. This
where R = 0, 1, 2 or 3 value codes the selection of a frequency divider
for the PLL output. This is shown Table 9-1.
Programmed PLL M and PLL N values should be
consistent with the following constraints: Table 9-1. PLL R Parameter Decoding
1
(M+2) KPLLBLK
The following sequence may be followed to ar- ways. If bit 5 of SR15 is cleared to 0, the new DCLK
rive at M and N values for any mode. frequency is loaded by setting bit 1 of SR15 to 1
and then setting bits 3-2 of 3C2H to 11 (if they are
1. Calculate an R which does not violate the not already programmed to this value). Bit 1 of
following constrains: SR15 should be left at a value of 1. Actual loading
will be delayed for a short but variable period of
135MHz < 2R×fOUT ≤ 270MHz time.
2. Start with N1 = 1 and calculate:
The alternate approach to loading the new DCLK
R
frequency is to program bits 3-2 of 3C2 to 11 (if
fOUT × (N+2) ×2 they are not already programmed to this value).
M=[ ]−2
fREF Next, program SR12 and SR13 and then toggle
3. Determine if the following constraint is met: bit 5 of SR15 by programming it to a 1 and then
a 0. This immediately loads the DCLK and MCLK
(M+2) fREF frequencies (no variable delay). For example,
0.995 fOUT < < 1.005 fOUT pseudocode to change DCLK to the frequency
(N+2) 2R specified by PLL parameter values of 34H and
4. If the constraint in step 3 is met, the M and 56H is:
N values used will generate the desired
frequency (within the specified tolerance). 3C2 ⇐ 6FH ; DCLK specified by
If the constrain is not met, repeat steps 2 ; SR12 and SR13
and 3 with N increased by 1 each time un- 3C4 ⇐ 12H ; SR12 index
til the constraint in step 3 is met. Note that 3C5 ⇐ 34H ; SR12 PLL value
multiple combinations of M and N are pos-
3C4 ⇐ 13H ; SR13 index
sible for a given output frequency.
3C5 ⇐ 56H ; SR13 PLL value
3C4 ⇐ 15H ; SR15 index
9.2 CLOCK REPROGRAMMING 3C5 ⇐ RMW ; Use read/modify/write to
; set bit 5 to 1 and leave
ViRGE powers up with a DCLK frequency of ; other bits unchanged
25.175 MHz (standard VGA) and an MCLK fre- 3C5 ⇐ RMW ; Use read/modify/write to
quency of 45 MHz. The DCLK frequency can be ; clear bit 5 to 0 and
changed to 28.322 MHz by setting bits 3-2 of 3C2H ; leave other bits
to 01b and can be changed back to 25.125 MHz ; unchanged
by setting bits 3-2 of 3C2H to 00b. The loading of
the DCLK frequency values requires that bit 1 of Either loading approach should work. The sec-
SR15 be set to 1. ond (immediate loading) approach helps with
system testing since the timing of the load is
All other DCLK frequencies must be generated by predictable. The first approach (via bit 1 of SR15)
re-programming SR12 and SR13. The new PLL has the advantage of separating the loading of
parameter values can be loaded in one of two DCLK from that of MCLK.
After power-up, all MCLK frequency changes 1. Program SR10/SR11 (MCLK) or SR12/SR13
must be made by re-programming SR10 and (DCLK) to generate the desired frequency.
SR11. If bit 5 of SR15 is cleared to 0, the new 2. Select either MCLK or DCLK for testing via
frequency does not take effect until a 1 has been SR14_3. If DCLK is selected, also ensure
written to bit 0 of SR15. This bit must then be that 3C2_3-2 = 11b to select SR12/SR13 as
cleared to 0 to prevent repeated loading. Actual the source of the DCLK PLL parameters.
loading will be delayed for a short but variable
period of time. 3. Clear the clock synthesizer counter by tog-
gling SR14_4.
As explained above for DCLK, toggling bit 5 of 4. Set SR14_2 = 1 for some exact amount of
SR15 (0,1,0) immediately loads both the DCLK time (∆t).
values in SR12 and SR13 and the MCLK values in 5. Read SR16 (most significant byte) and
SR10 and SR11. SR17 (least significant byte). This is the bi-
nary count of the number of clock cycles
9.3 DCLK CONTROL actually executed.
6. Calculate the expected result (∆t/clock pe-
DCLK is generated by the internal clock synthe- riod) and compare it with the value read in
sizer. VCLK is the signal used to clock pixel data the previous step. The two should agree
into the internal RAMDAC. For most modes of within 2 or 3 counts.
operation, VCLK is generated directly from DCLK
and has the same frequency and phase (neglect-
ing internal gate delays). Bit 0 of CR67 provides
the option to invert DCLK before it becomes
VCLK.
The S3 Streams Processor processes data from 2. Secondary Stream - RGB or YUV/YCbCr
the graphics frame buffer, composes it and out- (video) data from another region within
puts the result to the internal DACs for generation the frame buffer
of the analog RGB outputs to the monitor. The 3. Hardware Cursor - 64x64x2 cursor, either
general data flow is shown in Figure 10-1. Note Microsoft or X-11 definition
that the DAC shown in this figure is inside ViRGE.
Regardless of the input formats, the Streams
10.1 INPUT STREAMS Processor creates a composite RGB-24 (8.8.8)
output to the DACs. This means that, for exam-
ple, RGB-8 pseudo-color graphics data can be
The processor can compose data from up to 3 overlaid with true-color-equivalent (24 bits/pixel)
independent streams as shown in Figure 10-1: video data. The result is improved video quality
and/or reduced memory bandwidth require-
ments as compared with systems that require
1. Primary Stream - RGB graphics data both graphics and video to be stored in the same
frame buffer format. In certain modes, the
GRAPHICS
FRAME BUFFER
GRAPHICS BUFFER 0
B
S K
L
C E
E D
GRAPHICS BUFFER 1 A Y
N A MONITOR
L I
D C
I N
I
SPRITE/VIDEO 0 N G
N
G
G
SPRITE/VIDEO 1
STREAMS PROCESSOR
OFF SCREEN/
HARDWARE CURSOR
STREAMS
Streams Processor also saves memory band- also be RGB, YUV or YCbCr data written to the
width by eliminating the need to save and restore frame buffer by some video source (CPU, de-
the overlay background since the background coder, digitizer). The format for this data can be
(primary stream) is never overwritten in the any of the following as selected via bits 26-24 of
frame buffer. MM8190.
Streams Processor support is not available for • YCbCr-16 (4.2.2), 16 to 240 input range
clock-doubled 8 bits/pixel modes, interlaced • YUV-16 (4.2.2), -128 to 127 input range
graphics modes and standard VGA modes except
for modes D, E, 10, 12 and 13. • KRGB-16 (1.5.5.5) - The K bit is the color
key.
Bits 3-2 of CR67 specify the Streams Processor • YUV (2.1.1)
mode of operation. If they are cleared to 00b, • RGB-16 (5.6.5)
Streams Processor operation is disabled. They
are programmed to 01b when the primary stream • RGB-24 (8.8.8)
is VGA mode D, E, 10, 12 or 13 (the only sup- • XRGB-32 (X.8.8.8) - X is the ignored up-
ported modes). A secondary stream can be over- per byte.
laid on the primary stream. CR67_3-2 are set to
11b to support an Enhanced mode primary The data can be passed through unscaled or
stream and a secondary stream. scaled up horizontally and vertically by an arbi-
trary amount. YCbCr/YUV data is color space
converted and all data is converted to RGB-24
10.1.1 Primary Stream Input (8.8.8) format.
Table 10-1. Register Fields Used For Specifying Frame Buffer Organization and Double Buffering
Table 10-1. Register Fields Used For Specifying Frame Buffer Organization and Double Buffering
(continued)
Register Field Description
MM81CC_2-1 Secondary Stream Buffer Select
00 = Secondary frame buffer starting address 0 (MM81D0_21-0) used for the
secondary stream
01 = Secondary frame buffer starting address 1 (MM81D4_21-0) used for the
secondary stream
10 = Secondary frame buffer starting address 0 (MM81D0_21-0) used for the
secondary stream and LPB frame buffer starting address 0 (MMFF0C_21-0)
used for the LPB input stream OR secondary frame buffer starting address
1 (MM81D4_21-0) used for the secondary stream and LPB frame buffer
starting address 1 (MMFF10_21-0) used for the LPB input stream. Which
alternative applies is determined by LPB starting address register selected
by bit 4 of this register.
11 = Secondary frame buffer starting address 0 (MM81D0_21-0) used for the
secondary stream and LPB frame buffer starting address 1 (MMFF0C_21-0)
used for the LPB input stream OR secondary frame buffer starting address
1 (MM81D4_21-0) used for the secondary stream and LPB frame buffer
starting address 0 (MMFF10_21-0) used for the LPB input stream. Which
alternative applies is determined by the LPB starting address register
selected by bit 4 of this register.
MM81CC_4 LPB Input Buffer Select
0 = LPB frame buffer starting address 0 (MMFF0C_21-0) used for LPB input
1 = LPB frame buffer starting address 1 (MMFF10_21-0) used for LPB input
MM81CC_5 LPB Input Buffer Select Loading
0 = The value programmed in bit 4 of this register takes effect immediately
1 = The value programmed in bit 4 of this register takes effect at the end of the
next frame (completion of writing all the data for a frame into the frame
buffer)
MM81CC_6 LPB Input Buffer Select Toggle
0 = End of frame (completion of writing all the data fro a from into the frame
buffer) has no effect on the setting of bit 4 of this register
1 = End of frame causes the setting of bit 4 of this register to toggle
MM81D0_21-0 Secondary Display Buffer Address 0. This is the starting address (offset) in the
frame buffer for 1 secondary graphics or video image.
MM81D4_21-0 Secondary Display Buffer Address 1. This is the starting address (offset) in the
frame buffer for a second secondary graphics or video image.
MM81D8_11-0 Secondary Stream Stride. This is the byte offset in the frame buffer from a
pixel in a given secondary image display line to the pixel directly below it on
the next display line. The stride must be the same for both secondary buffers.
MMFF0C_21-0 LPB Frame Buffer Address 0. This is the starting address (offset) in the frame
buffer for one image buffer into which is written data from the LPB. The
secondary stream can be generated from this buffer.
MMFF10_21-0 LPB Frame Buffer Address 1. This is the starting address (offset) in the frame
buffer for a second image buffer into which is written data from the LPB. The
secondary stream can be generated from this buffer.
MM81CC_6 LPB Input Buffer Select Toggle
0 = End of frame (completion of writing all the data fro a from into the frame
buffer) has no effect on the setting of bit 4 of this register
1 = End of frame causes the setting of bit 4 of this register to toggle
used. The various LPB control bits described in and uses line replication. The 2x scaling allows a
Table 10-1 allow complete hardware control of 320x240 image (as used by many games) to be
the capture and display of video data using either displayed at a full-screen 640x480 resolution.
single or double buffering.
SCREEN START X0
(MM81F0_26-16)
WINDOW START X1
(MM81F8_26-16)
WINDOW HEIGHT H0
SCALING (MM81FC_10-0)
X1-X0
WINDOW WIDTH W0
BEFORE SCALING
SPWINDEF
Table 10-2. Register Fields Used For Scaling Up the Secondary Stream
zontal accumulator initial value is 2 (10-1) - (25-1) ple, for a video window overlaying the
= -6. The K1 horizontal factor is 10-1 = 9. The K2 graphics screen. Note that this mode will
horizontal factor is 10-25 = -15. Programming not work for the case where the user
these parameters with these values results in a needs to pull down a graphics window
2.5x horizontal stretch for the secondary stream over the video since the graphics window
window. is defined as being under the video win-
dow. Color keying (number 5 in this list)
must be used for this purpose.
10.3 COMPOSITION/OUTPUT
2. MM81A0_26-24 = 001b - Primary stream
overlaid on the secondary stream in an
A variety of output types can be composed from opaque rectangular window. This could
the streams described above. The compose be used, for example, to provide graphics
modes are: captions for a video window. The video is
not visible behind the rectangular graph-
1. MM81A0_26-24 = 000b - Secondary stream ics window.
overlaid on the primary stream in an
opaque rectangular window. This is the 3. MM81A0_26-24 = 010b - Secondary stream
default mode and can be used, for exam- blended with the primary stream on a
pixel by pixel basis within the secondary
stream window. This is used to provide a integer to ensure that the first pixel not fetched
dissolve between two scenes. in inside the opaque overlay window. Note that
4. MM81A0_26-24 = 011b - Secondary stream if the secondary stream is in the background,
blended with the primary stream on a then the value is (X0 - X1) x bytes per pixel/8,
pixel by pixel basis within the secondary again rounded up.
stream window. This is used to provide a
fade between two scenes. Pixel fetching must start again before or at the
last pixel position of the opaque overlay window.
5. MM81A0_26-24 = 101b - Secondary stream Using the terms in Figure 10-2, this position is (X1
overlaid on the primary stream in an ir- - X0) + W1, with W1 programmed in MM81FC_26-
regular window. This requires a color key. 16 (secondary stream is on top). Converting to
This would be used, for example, for quadwords, the value is [(X1 - X0) + W1] x bytes
game sprites. Only the graphics area be- per pixel/8. If the result is a fraction, the result is
hind the sprite shape would be covered truncated to the next lowest integer (minus 1)
up. and programmed in MM81DC_28-19. Note that if
6. MM81A0_26-24 = 110b - Primary stream the secondary stream is in the background, then
overlaid on the secondary stream in an ir- (X0 - X1) is used and W1 is the value in
regular window. This requires a MM81F4_26-16 (primary stream is on top).
color/chroma key. This case allows, for ex-
ample, graphics text to overlay video with Opaque overlay control cannot be used with key-
the video appearing around and even in- ing or blending and should never be enabled
side of the text characters. when one of these modes is being used.
stream is displayed. As Kp is increased, more of the most significant bit of each pixel value is used
the pixel color from the primary stream is as a color key as long as MM8184_28 is cleared
blended into output. At the maximum (Kp = 7 or to 0. When the most significant pixel bit is a 0, the
111b), 7/8ths of the color will be due to the pri- other stream pixel is displayed.
mary stream and 1/8th will be due to the secon-
dary stream. Therefore, by starting with the For other RGB input types (as specified by
primary stream only, then overlaying the secon- MM8180_26-24), a color key must be defined.
dary stream with Kp values decreasing from 7 to This is done by programming MM8184_23-0 with
0, the overlay window can be dissolved gradually a specific RGB 8.8.8 color value. MM8184_28
from primary stream to secondary stream. Note must be set to 1 to enable use of this value. The
that when the Kp value is reprogrammed, its new number of bits to compare for each color is
value does not take effect until the next VSYNC, specified in MM8184_26-24. If there is a color
so it can be reprogrammed during frame display match with the keyed stream pixel, the corre-
without disruptive effects. sponding other stream pixel is displayed.
When fade is chosen, the output pixels are gen- If the secondary stream input format is YUV or
erated using the following equation: YCbCr, the chroma key is specified as a range of
color values. The lower bound value is defined in
[Pp x Kp + Ps x Ks]/8, where Kp + Ks must be ≤ 8. MM8184_23-0. The upper bound value is defined
in MM8194_23-0. If the secondary stream pixel
Ks is the secondary stream weighting factor. It is color value falls within this range (inclusive of the
a 3-bit value programmed in MM81A0_4-2. This lower and upper bounds), the Streams Processor
weight value is applied to each of the three color displays the corresponding pixel from the pri-
values for the pixel. Note that when fading is mary stream. If the secondary stream pixel color
selected, the default values for Kp and Ks (both is outside this range, the secondary stream pixel
0) result in a color value of 0. As with Kp, when is displayed.
the Ks value is reprogrammed, its new value
does not take effect until the next VSYNC.
10.3.4 Window Location
10.3.3 Color/Chroma Keying The starting X,Y coordinates and window size for
the primary stream are specified in MM81F0 and
These modes are items 5 and 6 in the compose MM81F4 respectively. The starting X,Y coordi-
modes list. Keying is a way of selecting on a pixel nates and window size for the secondary stream
by pixel basis which stream will be displayed. are specified in MM81F8 and MM81FC respec-
Color keying is used when the stream source is tively.
in RGB format (graphics). This is always the case
for the primary stream. Chroma keying is used
when the stream source is YUV or YCbCr (video). 10.4 STREAMS FIFO CONTROL
The secondary stream source can be either
graphics or video, so either color or chroma key- The streams FIFO can be reconfigured to opti-
ing might be used. If 81A0_26-24 (compose mize performance for various operating modes.
mode) = 101b and MM8184_28 = 1, the color key The FIFO is 24 8-byte slots deep. By program-
is compared with the primary stream pixel. If ming MM8200_4-0, the FIFO can be reconfigured
there is a match, the corresponding secondary to assign all 24 slots to either the primary or
stream pixel is displayed. If 81A0_26-24 = 110b secondary stream. Allocations of 16-8 and 12-12
and MM8184_28 = 1, the color or chroma key is slots between the two streams are also possible.
compared with the secondary stream pixel. If As an example, if only a primary stream is being
there is a match, the corresponding primary displayed, optimal performance is generated by
stream pixel is displayed. assigning all 24 FIFO slots to the primary stream.
If the input format is KRGB-16 (1.5.5.5), selected No matter what the allocation, FIFO thresholds
when MM8180_26-24 or MM8190_26_24 = 011b, must be specified for the primary and secondary
LPB operation is enabled when bit 0 of MMFF00 • Host Video Data Pass-through. This al-
is set to 1. LPB clocking with LCLK must also be lows decimation of 32-bit CPU data be-
enabled by setting bit 24 of MMFF00 to 1. The LPB ing written to the frame buffer.)
function provides the following: • LPB Feature Connector (glueless 8-bit bi-
directional or 16-bit VAFC)
• S3 Scenic Highway interface to the
Scenic/MX2 MPEG Audio/Video Decoder • 4-bit General Input Port and 4-bit Gen-
(glueless, bi-directional) eral Output Port
• Scenic Highway interface to the Philips® The LPB mode also provides the support required
video digitizers (glue logic is required to for DDC2 monitor communications. This, the fea-
convert 16-bit output to 8-bit ViRGE in- ture connector interfaces and the General In-
put for VL-Bus configurations. However, put/Output Port are described in Section 12.
the Scenic/MX2 has a glueless SAA7100
interface which can be used to provide The internal block diagram for the LPB is shown
the 16- to 8-bit conversion). A 16-bit data in Figure 11-1.
interface is available on ViRGE for PCI
configurations.
LPB
LPB DATA/ADDRESS 8
HOST REGISTERS
32 PORT
32 8 8 (VL)
LPB 8x32 EXTERNAL
OUTPUT FIFO 16 (PCI) DEVICE
32
TO MEMORY 8x32
INTERFACE 32/64
8x32
DECIMATION
11.1 Scenic/MX2 INTERFACE 0 for a memory access. Bits 3-0 are bits 19-16 of
the address. The second byte is bits 15-8 of
MMFF14 and the third byte is bits 7-0. The data
The hardware interface to the Scenic/MX2 is
immediately follows in four byte writes. Data is
shown in Figure 11-2.
written in the opposite byte order to that for the
address, i.e., least significant byte (bits 7-0) first
The Scenic/MX2 interface is selected by setting
and most significant byte (bits 31-24) last. ViRGE
MMFF00_3-1 to 000b. This interface is fully bi-di-
then deasserts VREQ/VRDY. The Host repeats the
rectional. Scenic/MX2 registers can be accessed,
above sequence for another write if required.
compressed data sent and decompressed video
data received.
If the Scenic/MX2 is not ready to receive data, it
drives its CREQ/CRDY signal low during the A0-0
11.1.1 Scenic/MX2 Register/Memory byte (LSB) of the address phase. ViRGE then
delays sending the data until the Scenic/MX2
Access raises CREQ/CRDY. This is depicted in Figure
11-4.
To read/write a Scenic/MX2 register or private
memory location (other than to transfer com- Figure 11-5 shows a Scenic/MX2 register/mem-
pressed data), the LPB Direct Read/Write Address ory read when the Scenic/MX2 is ready to pro-
register (MMFF14) is written. The new regis- vide data. This is indicated by the Scenic/MX2
ter/memory data is then written to MMFF18. For holding the CREQ/CRDY high throughout the cy-
a write access, this write triggers the sequence cle. The three upper bits of the first address byte
shown in Figure 11-3 if the Scenic/MX2 is ready are 001 to define a read.
to receive the data (CREQ/CRDY remains high).
One cycle after ViRGE asserts its VREQ/VRDY If the Scenic/MX2 is not ready to provide data, it
signal, it sends the address in three byte writes. drives its CREQ/CRDY signal low during the ad-
The first byte is composed of bits 23-16 of dress phase. ViRGE then waits until the Sce-
MMFF14. The three upper bits are 000b to define
this as a write. Bit 4 is 1 for a register access and
Scenic/MX2 ViRGE
LCLK LCLK
LD[7:0] LD[7:0]
VREQ/VRDY VREQ/VRDY
CREQ/CRDY CREQ/CRDY
ENABLE ENFEAT
VVCTOK
LCLK
CREQ/CRDY
VREQ/VRDY
LCLK
CREQ/CRDY
VREQ/VRDY
LCLK
CREQ/CRDY
VREQ/VRDY
LCLK
CREQ/CRDY
VREQ/VRDY
nic/MX2 raises CREQ/CRDY and provides register provided for this FIFO. Writes to any of these
data. This is depicted in Figure 11-6. addresses are directed to the FIFO.
To prevent data starvation and deal with request MMFF00_17-16 are programmed to specify the
contention, the following protocol is followed. number of doublewords of data to burst to the
Scenic/MX2. A write to the output FIFO then
• No transaction can be initiated if the bus initiates a compressed data write to the Sce-
is active nic/MX2. This is depicted in Figure 11-7 for a
• There is one dead cycle on the bus fol- burst count of 2 (MMFF00_17-16 = 01b) for the
lowing all transactions case where the Scenic/MX2 is ready to receive
the data. The address and first doubleword are
• One device may not initiate a transac- transferred exactly as for a register/memory
tion until the second cycle following the write. Following doublewords in the burst are
completion of a transaction initiated by each separated by one dead cycle. The address
the other device has no meaning except for the upper three bits,
• Neither device may initiate a transaction which are forced to 110b by hardware to specify
until the third cycle following the com- a compressed data transfer. Note that burst
pletion of a transaction initiated by itself writes that end because the FIFO is empty (as
• If CREQ/CRDY and VREQ/VRDY are both opposed to the maximum burst count being
driven low on the same cycle (request reached) hold VREQ/VRDY low for one more cy-
contention), CREQ/CRDY (the Sce- cle than is shown in Figure 11-7.
nic/MX2) wins.
The Scenic/MX2 cannot accept a burst larger than
eight doublewords. If MMFF00_17-16 are pro-
11.1.2 Scenic/MX2 Compressed Data grammed to 11b (burst all) and eight double-
Transfer words are loaded into the FIFO, software must
ensure that the FIFO is empty before loading
more data into the FIFO.
ViRGE has an output FIFO for handling the trans-
fer of compressed video data from the Host to the A compressed data transfer when the Sce-
Scenic/MX2 (see Figure 11-1). The Host must first
nic/MX2 is not ready to receive data is almost the
check the number of empty slots (MMFF04_3-0), same as a register write for the same circum-
then send no more than this many doublewords stances (see Figure 11-4). The only difference is
(32 bits) of compressed data to the FIFO. An eight
that after the Scenic/MX2 returns its CRDY signal,
doubleword address range (FF40H - FF5CH) is
LCLK
CREQ/CRDY
VREQ/VRDY
LD[7:0] A0-2 A0-1 A0-0 D0-0 D0-1 D0-2 D0-3 D1-0 D1-1 D1-2 D1-3
CPDTDY
LCLK
CREQ/CRDY
VREQ/VRDY
LCLK
CREQ/CRDY
signal low such as to initiate a register access or shown in Figure 11-10. ViRGE assumes data has
to indicate an LPB video FIFO full state. The begun any time CREQ/CRDY is held low for more
Scenic/MX2 responds by sending a VSYNC than two cycles. When the Scenic/MX2 is sending
(CREQ/CRDY low for one cycle) followed by an the last byte, it drives CREQ/CRDY high. The
HSYNC (CREQ/CRDY low for two cycles). This is Scenic/MX2 must always send data in 4-byte
shown in Figure 11-9. As indicated in the figure, packets. If it has fewer to send for the last packet,
the time between VSYNC and HSYNC is variable. it must pad the transmission with dummy writes
The HSYNC sequence occurs after each line, but to create a 4-byte packet.
may not occur before the first line, depending on
how the Scenic/MX2 is programmed. Figure 11-10 shows what happens when ViRGE
is ready to receive all the data. If ViRGE cannot
After the VSYNC/HSYNC sequence, the Sce- accept more data, such as when its LPB video
nic/MX2 can pull CREQ/CRDY low at any time and FIFO is full, it drives its VREQ/VRDY signal low
begin sending data three clocks later. This is during the first byte phase of a 4-byte packet. All
LCLK
CREQ/CRDY
VREQ/VRDY
CPVCAP
LCLK
CREQ/CRDY
VREQ/VRDY
bytes starting with this one are rejected by ViRGE The functional timing for converting the
and must be resent by the Scenic/MX2 after SAA7110 16-bit video output to the 8-bit input
ViRGE drives its VREQ/VRDY signal high again. required by the LPB in a VL-Bus configuration is
This is depicted in Figure 11-11, where the Dn0 shown in Figure 11-13.
byte, which is the first byte of the nth 4-byte
packet, is rejected. When ViRGE can accept more In Video 16 mode (MMFF00_3-1 = 001b), which is
data, it drives VREQ/VRDY high. The Scenic/MX2 available only for PCI configurations, no data
drives CREQ/CRDY high (two cycles later) and conversion is required. Y[7:0} connects to LD[7:0]
then drives it low when it is ready to resend the and UV[7:0] connects to LD[15:8]. LLC2 connects
data. The resend of Dn0 and subsequent bytes to LCLK and LLC is not connected.
starts two cycles later.
As an alternative, the Scenic/MX2 provides a
When ViRGE receives an HSYNC from the Sce- glueless interface to the SAA7110. In this case,
nic/MX2, it adds the line offset (MMFF34_10-0) to the Scenic/MX2 handles the 16-bit to 8-bit con-
the previous line starting address and starts writ- version and also provides the I2C interface to the
ing the next data at that location. In this way, for SAA7110. ViRGE then receives the video data,
example, it can transfer 640-byte lines into a clock and controls from the Scenic/MX2. The
frame buffer configured for 1024-byte lines. If Scenic/MX2 documentation describes this inter-
HSYNCs are not sent, memory will be written in face.
a contiguous manner.
SAA7110 ViRGE
Y[7:0]
LD[7:0]
UV[7:0]
LLC2
LLC LCLK
HS HS
VS VS
SDA SPD
SCK SPCLK
VVDTOK
Y[7:0] Y0 Y1 Y2
11.2.2 SAA7110 Video Input • The correct vertical and horizontal sync
polarities are specified (MMFF00_9, 10).
The following setup is done for SAA7110 video • One or two frame buffer starting ad-
input: dresses are defined (MMFF0C,
MMFF10). One is required. The second
• ViRGE is placed in Video 8 In mode is required for double buffering.
(MMFF00_3-1 = 010) or Video 16 mode • The horizontal and vertical decimation
(MMFF00_3-1 = 001b) for PCI configura- registers are programmed (MMFF2C,
tions. MMFF30). This is optional.
• Byte swapping is disabled by setting • The video input window size (height in
MMFF00_6 to 1. lines and width in pixels) is pro-
grammed in MMFF24.
LCLK
VS
HS
SKIPPED LINE HO LW
W h e n p a ss - t h r o u g h m o d e i s e n a bl e d
(MMFF00_3-1 = 100b), the CPU can write 32-bit
data to the output FIFO and have this data passed
directly to the decimation block (bypassing the
LPB bus). The data are sent exactly as for com-
pressed video data to an MPEG decoder. The
data will then be decimated according to the
programming of MMFF2C (horizontal) and
MMFF30 (vertical) and then passed to the video
FIFO to be written to display memory. This path
is shown in Figure 11-1.
Video 16 or 8 In
Scenic/MX2 MMFF00_3-1 = 001
Pin # MMFF00_3-1 = 000 MMFF00_3-1 = 010
146 LD0 LD0
147 LD1 LD1
148 LCLK LCLK
154 LD2 LD2
155 LD3 LD3
174 LD4 LD4
175 LD5 LD5
176(PCI) NO FUNCTION NO FUNCTION
177(PCI) NO FUNCTION NO FUNCTION
178(PCI) NO FUNCTION NO FUNCTION
179(PCI) NO FUNCTION NO FUNCTION
180(PCI) NO FUNCTION NO FUNCTION
181(PCI) NO FUNCTION NO FUNCTION
182(PCI) NO FUNCTION NO FUNCTION
184 LD6 LD6
185 (PCI) NO FUNCTION LD8 (Video 16)
186 (PCI) NO FUNCTION LD9 (Video 16)
187 (PCI) NO FUNCTION LD10 (Video 16)
188 (PCI) NO FUNCTION LD11 (Video 16)
189 (PCI) NO FUNCTION LD12 (Video 16)
199 (PCI) NO FUNCTION LD13 (Video 16)
200 (PCI) NO FUNCTION LD14 (Video 16)
201 (PCI) NO FUNCTION LD15 (Video 16)
202 LD7 LD7
203 VREQ/VRDY HS
204 CREQ/CRDY VS
This section explains how ViRGE interfaces to the strapping bit 4 (CR36, bit 4) must be pulled low
video BIOS ROM and feature connector. Green to disable BIOS accesses. For this configuration,
PC support, the General I/O Ports, the serial com- ROMCS is not required. Bits 1-0 of SR1C can be
munications port and interrupt generation are set to 11, making pin 153 function as a second
also described. General Output Port bit instead of as ROMCS. For
PCI configurations, bit 0 of the BIOS ROM Base
Address register (Index 30H) is cleared to 0 to
12.1 VIDEO BIOS ROM INTERFACE disable BIOS accesses.
GD[7:0] D[7:0]
GA[15:0] A[15:0]
ROMEN OE
CE
VPCIROM
VESA
LOCAL BUS
SA[31:2]
ViRGE
ADDRESS
BIOS ROMCS
ROM
D[7:0]
OE CE
OE0
74ALS244
OE1
SA[15:0] SMEMR
ISA BUS VVLROMIF
The implementation for a VL-Bus configuration matically increments the lower address three
is shown in Figure 12-2. The ROM is accessed via times and generates the remaining three bytes of
the ISA bus. This allows a shadowed BIOS to be read data. In both cases, TRDY is delayed until all
accessed by a CPU memory read without also the required data is available on the AD bus. For
generating data directly from the physical ROM. 16-, 24- or 32- bit accesses, the ROM access time
Only 8-bit ROMs are supported. must be 10 SCLKs or less, as opposed to the 14
SCLKs shown in Figure 12.3 for an 8-bit access.
12.1.3 BIOS ROM Read Functional For a VL-Bus configuration, a BIOS ROM read is
Timing a standard ISA bus read cycle with ViRGE provid-
ing its ROMCS output as the ROM chip and buffer
Figure 12-3 depicts the PCI configuration func- enable (see Figure 12-2). ROMCS is asserted dur-
tional timing for reading one byte from the ROM. ing the time the ROM address is valid and there-
ROMEN is asserted to drive the byte of read data fore will be active when the chipset asserts the
at the address on GA[15:0] to the General Data ISA SMEMR signal.
Bus. ViRGE latches the data one clock before
deassertion of ROMEN and then drives this data
onto the AD bus.
12.1.4 BIOS ROM Address Mapping
ViRGE also supports 16- and 32-bit ROM reads, ViRGE maps the CPU memory address spaces for
as defined by the states of the byte enables. For the video BIOS ROM into physical ROM ad-
a 16-bit read, ViRGE automatically increments dresses. If implemented separately for a VL-Bus
the lower address once and generates the second system, the video BIOS normally uses the stand-
byte of read data. For a 32-bit read, ViRGE auto- ard address range C0000H–C7FFFH (32 KBytes).
FRAME
IRDY
TRDY
DEVSEL
14 SCLKs MIN
ROMEN
GA[15:0]
If power-on strapping bit 10 (CR37, bit 2) is 1. Disable all other LPB uses.
strapped low or if bit 2 of CR37 is cleared to 0 in 2. Enable sensing of the desired input data on
a VL-Bus system, the video BIOS address range LD[7:4].
becomes C0000H-CFFFFH (64 KBytes). PCI sys-
tems support a relocatable 64-KByte video BIOS 3. If the LPB General Output Port function is
address range via the BIOS ROM Base Address also in use, ensure that the correct output
configuration register (Index 30H). data is programmed in MMFF1C_3-0.
4. Program SR1C_1-0 to 01b.
12.2 GREEN PC SUPPORT 5. Write (anything) to CR5C. The data on
LD[7:4] are latched 2 DCLKs later into
MMFF1C_7-4. (This also drives the con-
ViRGE provides support for the VESA Display tents of MMFF1C_3-0 onto LD[3:0] and
Power Management Signaling (DPMS) protocol generates the STWR pulse on pin 190. The
by allowing independent control of the HSYNC input data is latched on the rising edge of
and VSYNC signals. To use this capability, the bit STWR. See Figure 12-6)
pattern xxxx0110b must be written to the SR8
register to unlock access to the SRD register. Bits 6. Disable sensing of input data on LD[7:4].
5-4 of SRD then control the state of HSYNC and
bits 7-6 of SRD control the state of VSYNC. ViRGE provides an 8-bit GIP for VL-Bus configu-
rations. The block diagram for this configuration
Driving pin 165 (PDOWN) low turns off the RGB is shown in Figure 12-4. The following steps
analog outputs of the internal DACs. implement the GIP function.
VESA
LOCAL BUS
SD[31:0]
SD[7:0]
ViRGE
Q[7:0]
GENERAL
INPUT OE
PORT
BUFFER GPIOSTR
D[7:0]
OEM
DEFINABLE
DATA VVLGIP
T1 T2 T3 T4 T5 T6 T7
SCLK
GPIOSTR
SD[7:0]
VGIPVL
When GPIOSTR is asserted, the data is immedi- 1. Disable all other LPB uses.
ately placed on SD[7:0]. The functional timing for 2. Program the desired output in MMFF1C_3-0.
this operation is shown in Figure 12-5. The entire
cycle from assertion of SADS to data being avail- 4. Program SR1C_1-0 to 01b to enable output
able on SD[7:0] takes approximately 18-20 of STWR on pin 190.
SCLKs. 5. Write (anything) to CR5C. The data in
MMFF1C_3-0 are immediately driven onto
LD[3:0] and the STWR pulse is generated.
12.4 GENERAL OUTPUT PORT The rising edge of STWR (2 DCLKs after it
is asserted) can be used to latch the data
ViRGE provides a 4-bit General Output Port (GOP) into an external device. The data is held
for PCI configurations as part of its LPB function. valid for 1/2 DCLK after this edge. See Fig-
To implement this: ure 12-6.
T1 T2 T3
DCLK
STWR LATCH
LD[3:0]
VLPBGOP
ViRGE also provides a 2-bit GOP on dedicated ViRGE provides an 8-bit GOP for VL-Bus configu-
pins for PCI configurations. To implement this: rations. The block diagram for this configuration
is shown in Figure 12-7. Whatever is pro-
1. Set SR1C_1 to 1. grammed to CR5C_7-0 is immediately provided
2. Program the desired output in CR5C_1-0. to the latch via SD[15:8]. The functional timing for
This statically drives the state of CR5C_0 this is shown in Figure 12-8. Note that the data
onto pin 151 and the state of CR5C_1 onto can be latched on either the rising or falling edge
pin 190. These pin will continue to reflect of GPIOSTR. The entire cycle from assertion of
the register bit states as long as SR1C_1 SADS to latching of data in the GOP buffer takes
=1. The values in CR5C_1-0 can be repro- approximately 6-8 SCLKs.
grammed at any time.
VESA
LOCAL BUS
SD[31:0]
SD[15:8]
ViRGE
D[7:0]
GENERAL
OUTPUT G
PORT
LATCH GPIOSTR
Q[7:0]
VVLGOP
T1 T2 T3 T4 T5
DCLK
STWR
SD[7:0]
VGOPVL
If both an 8-bit GIP and an 8-bit GOP are required, When a VL-Bus configuration powers up with a
the GPIOSTR enable input must be qualified with default value of 00b for bits 1-0, both pin 151 and
the SR/W signal. Additional discrete logic is re- pin 153 will be driven high (logic 1). Pins 151 and
quired to ensure that only the GOP latch is en- 190 are driven high on power-up for PCI configu-
abled for writes and only the GIP buffer is rations. Thus, external devices with active low
enabled for reads. enables will not be enabled when connected to
these pins.
ViRGE also provides a 2-bit GOP on dedicated
pins for VL-Bus configurations. To implement
this: 12.5 FEATURE CONNECTOR
INTERFACE
1. Set SR1C_1-0 to 11b.
2. Program the desired output in CR5C_1-0. Setting SRD_1 to 1 selects LPB feature connector
This statically drives the state of CR5C_0 operation. This configuration provides an inter-
onto pin 151 and the state of CR5C_1 onto face to either a baseline VESA Advanced Feature
pin 153. These pin will continue to reflect Connector (VAFC) or pass-through bidirectional
the register bit states as long as SR1C_1-0 feature connector. In all cases, SRD_0 must be set
=11b. The values in CR5C_1-0 can be re- to 1 to enable feature connector operation and
programmed at any time. SR1C_1-0 must be 00b to enable ENFEAT on pin
151. In addition, LPB operation must be disabled,
The 2-bit GOP is only useful for cases where the (MMFF00_0 = 0) and Streams Processor opera-
video BIOS is part of the system BIOS (mother- tion must be disabled (CR67_3-2 = 00b) before
board implementations) and the ROMCS signal feature connector operation is enabled.
is not needed. If ROMCS is required, a 1-bit GOP
is available by programming SR1C_1-0 to 10b. LPB feature connector operation provides an 8-
Whatever is programmed to CR5C_0 is reflected bit bi-directional feature connector for VL-Bus
on pin 151. configurations. The pins used to provide this type
of operation are listed in Table 12-2. The interface
is shown in Figure 12-9.
ViRGE PASS-
THROUGH
PA[7:0] PA[7:0]
ENFEAT N/C
VCLK VCLK
HSYNC HSYNC
VSYNC VSYNC
BLANK BLANK
EVIDEO EVIDEO
ESYNC ESYNC
EVCLK EVCLK
VPASCON1
Table 12-2 LPB Feature Connector Configura- Table 12-3 LPB Feature Connector Configura-
tion (VL-Bus) tion (PCI)
ViRGE VAFC
PA[15:0] PA[15:0]
ENFEAT N/C
VCLKI VCLK
VCLK DCLK
HSYNC HSYNC
VSYNC VSYNC
BLANK BLANK
EVIDEO EVIDEO
ESYNC GRDY
EVCLK
+5V
+5V +5V
+5V VVAFC1
12.6 SERIAL COMMUNICATIONS For PCI LPB configurations, SPCLK and SPD are
not multiplexed. This reduces the isolation re-
PORT quirements.
A serial communications port is implemented in If PD26 is strapped low at reset, strapping of PD25
the MMFF20 register. Bit 4 is set to 1 to enable selects either E2H (PD25 pulled high) or E8H
the interface. The clock is written to bit 0 (= 0) and (PD25 pulled low) as the I/O port address for the
data to bit 1 (= 0), driving the SPCLK and SPD pins serial port register MMFF20. This allows the ports
low respectively. The state of the SPCLK pin can to be used for serial communications, typically
be read via bit 2 and the state of the SPD pin can I2C, when ViRGE is not enabled. If analog
be read via bit 3. The SPCLK and SPD pins are switches are used for isolation as explained in the
tri-stated when their corresponding control bits previous paragraph, designers must ensure that
are reset to 0, allowing other devices to drive the the I2C function is enabled by default on reset. If
serial bus. I/O access is desired after ViRGE has been en-
abled and then disabled, programmers must en-
Typical uses for the serial port are for DDC moni- sure that the I2C function is selected before ViRGE
tor communications and I2C interfacing. When is disabled because the General Output Port may
SPCLK and SPD are tri-stated, ViRGE can detect not be available to change the selection.
an I2C start condition (SPD driven low while
SPCLK is not driven low). This condition is gen-
erated by another I2C master that wants control 12.7 INTERRUPT GENERATION
of the I2C bus. If bit 19 of MMFF08 is set to 1,
detection of a start condition generates an inter- For a PCI configuration, pin 152 is pulled low to
rupt and sets bit 3 of MMFF08 to 1. If bit 24 of signal an interrupt (INTA). For a VL-Bus configu-
MMFF08 is set to 1, ViRGE drives SPCLK low to ration, pin 152 is pulled high to signal an interrupt
generate I2C wait states until the Host can clear (SINTR).
the interrupt and service the I2C bus.
Whatever the mode of operation (VGA or En-
The SPCLK and SPD signals are multiplexed with hanced), bit 4 of CR32 must be set to 1 to enable
the ESYNC and BLANK feature connector signals interrupt generation.
on pins 205 and 206 for VL-Bus configurations. If
DDC, I2C and/or feature connector operation are When ViRGE is being operated in VGA mode
required, the lines from pins 205 and 206 must (CR66_0 = 0), only a vertical retrace can generate
be multiplexed to separate pairs of lines for each an interrupt. This is enabled when bit 5 of CR11
operation to provide the necessary signal isola- is cleared to 0 and a 1 has been programmed into
tion. The ENFEAT signal should be used to en- bit 4 of CR11. When an interrupt occurs, it is
able ESYNC and BLANK onto one pair of lines to cleared by writing a 0 to bit 4 of CR11. The
the feature connector. When ENFEAT is high, one interrupt must then be re-enabled by writing a 1
bit of the General Output Port can be used to to the same bit. Note that the BIOS clears both bit
select between I2C and DDC operation, with a 1 4 and bit 5 of CR11 to 0 during power-on, a mode
enabling output on one pair of lines and a 0 set or a reset. Thus, interrupt generation is dis-
enabling output on another. abled until bit 4 is set to 1.
The National Semiconductor CD4052B Dual 4- When ViRGE is being operated in Enhanced
Channel Analog Multiplexer/Demultiplexer pro- mode (CR66_0 = 1), interrupts can be generated
vides the capability to channel two lines to one by a vertical retrace, S3D Engine busy, S3D En-
of four pairs of lines based on two select signals. gine done, Host DMA done, Command DMA
Each side can act as either an input or output. A done, S3D FIFO empty, command FIFO overflow
set of schematics showing the use of this part is and command FIFO empty. These interrupts are
available. enabled and cleared and their status reported via
MM8504.
S3 has added a number of graphics registers to the standard VGA set. These can be locked when not
in use to prevent accidental access and unlocked when access is requires. This section explains how
this is done.
The S3 registers (CR30 and higher plus the Enhanced Commands registers) must be unlocked before
they can be accessed by the CPU. The code to do this is:
Note: Byte operations are used in the following examples for clarity. Word operations, e.g..,
should be used for efficiency instead of the operations used in the first example below.
Relocking the S3 registers is done by repeating the code used to unlock the registers except:
1. The values written to the SR8, CR38 and CR39 registers must change at least one of the signifi-
cant bits in the valid code pattern. For example, 00h will always accomplish this.
2. After first verifying that the S3D Engine is not busy (bit 9 of 9AE8H is 0), bit 0 of CR40 must be
cleared to 0. A read-modify-write cycle must be used instead of the code used above to prevent
overwriting of any changes made to bits 7-1 in CR40 since reset.
Some programs may require a graphics mode other than that provided by standard operation. For
example, a DOS game may require a resolution of 640x400x8 (VESA mode 100) instead of the standard
DOS mode, e.g., mode 03. The following code fragment shows how this is done.
This section describes ViRGE support for standard VGA and VESA Super VGA graphics standards.
ViRGE is compatible with the VGA standard. These modes are not accelerated using the S3D Engine.
However, other design features provide excellent VGA performance.
Several of the standard VGA registers have been modified or extended in ViRGE. Table 14-1 describes
these changes.
CR10 In addition to the standard VGA extensions (bit 8 is bit 2 of CR7, bit 9 is bit 7 of
CR7), bit 10 is bit 4 of CR5E. Bit 4 of CR35 controls access to this register.
CR11 Bit 4 of CR35 controls access to bits 3-0 of this register. Bit 6 (3/5 refresh cycles
per line) can be overridden by CR3A_2-0. Setting bit 1 of CR33 to 1 disables the
write protect effect of bit 7 of this register on bits 1 and 6 of CR7.
CR12 In addition to the standard VGA extensions (bit 8 is bit 1 of CR7, bit 9 is bit 6 of
CR7), bit 10 is bit 1 of CR5E.
CR13 Bit 2 of CR43 is the old extension bit (bit 8) of this register. Bits 5-4 of CR51 are
the new extension bits (bits 9-8) of this register.
CR15 In addition to the standard VGA extensions (bit 8 is bit 3 of CR7, bit 9 is bit 5 of
CR9), bit 10 is bit 2 of CR5E. Bit 4 of CR35 controls access to this register.
CR16 Bit 4 of CR35 controls access to this register.
CR17 Bit 5 of CR35 controls access to bit 2 of this register.
CR18 In addition to the standard VGA extensions (bit 8 is bit 4 of CR7, bit 9 is bit 6 of
CR9), bit 10 is bit 6 of CR5E.
AR00-AR0F Bit 6 of CR33 controls access to these registers.
3C6H-3C9H Bit 4 of CR33 controls writes to these registers.
For a detailed discussion of VGA programming, see Programmer’s Guide to the EGA, VGA and Super
VGA Cards, 3rd Edition by Richard F. Ferraro (Addison-Wesley Publishing Company, Inc).
ViRGE supports the extended (Super) VGA modes defined by VESA. All modes are accelerated by the
S3d Engine except for the planar (4 bits/pixel) ones.
Enhanced mode provides a level of performance far beyond what is possible with the VGA architecture.
Hardware BitBLTs (with 256 ROPs), 2D and 3D line drawing, 2D polygon fills and 3D triangle drawing
are implemented. Hardware cursor support and clipping are also supported. While in Enhanced mode,
the display memory bit map can be updated in two ways. One is to have the CPU issue commands
and send data to the S3d Engine, which then controls pixel updating. The other is to have the CPU
write directly to memory. (This is also possible in non-Enhanced modes via paging.) This section
explains these two methods and provides a set of Enhanced mode 2D programming examples and
explains the basic elements of 3D drawing.
ViRGE provides two memory-mapped I/O (MMIO) methods. For the "old" method, the base address is
A000H (or B800H), allowing use during DOS and real mode operation. This is available for both VL-Bus
and PCI configurations. For the "new" method, the base address is the linear addressing (or PCI) base
address and requires protected mode. In addition, address space is provided for linear addressing and
big endian addressing. The new method can only be used with PCI configurations. Each of these MMIO
methods is described below.
Setting bits 4-3 of CR53 to 10b enables the old MMIO function. A setting of 11b enables both the old
and new MMIO methods simultaneously. When the old MMIO is enabled, CR53_5 selects the base
address. CR53_5 = 0 places the MMIO window at A0000H - AFFFFH. CR53_5 =1 places the MMIO window
at B8000H - BFFFFH. The latter setting leaves A0000H - B7FFFH free for VGA memory and other uses.
In either case, all the ViRGE registers are accessible via either window at the variable offsets shown in
Table 15-1. For example, the PCI configuration space registers are found starting at A8000H (or B8000H,
depending on the setting of CR53_5).
With old MMIO enabled and CR53_5 =0, image writes are made by accessing any memory location in
the 32-KByte address space from A0000H to A7FFFH. This allows efficient use of the MOVSW and
MOVSD assembly language commands. Accesses must be to doubleword addresses. Software must
not make image writes beyond the A7FFFH range. If CR53_5 = 1, image writes cannot be made as the
A0000H - A7FFFH range is reserved.
When MMIO is enabled (old or new), clearing bit 7 of SR9 to 0 allows both programmed I/O (IN, OUT)
access and MMIO (MOV) access. Setting this bit to 1 disables programmed I/O access, allowing only
MMIO access. The latter is required for plug and play operation.
The new MMIO method for ViRGE provides a 64-MByte addressing window starting at the base address
specified in CR59-5A or the PCI base address register. This space is divided into a 32-MByte space for
little endian (Intel-style) addressing and a 32-MByte space for big endian (Power PC-style) addressing.
All registers and data transfer locations are mapped into this area as shown in Table 7-1.
The new MMIO (only) is enabled by setting bits 4-3 of CR53 to 01b. This is the default for a PCI bus
configuration, allowing PCI software immediate access to all registers and the ability to relocate the
address space. The new MMIO is also enabled in conjunction with the old MMIO method when bits
4-3 of CR53 are set to 11b. VL-Bus configurations power up with bits 4-3 of CR53 cleared to 00b, disabling
both old and new MMIO operation.
When MMIO is enabled (old or new), clearing bit 7 of SR9 to 0 allows both programmed I/O (IN, OUT)
access and MMIO (MOV) access. Setting this bit to 1 disables programmed I/O access, allowing only
MMIO access. The latter is required for plug and play operation.
Values in the gaps between the memory ranges shown in Table 15-1 are reserved.
For big endian addressing, add 2 to the most significant hex digit shown in Table 15-1, i.e.,
0xx xxxx becomes 2xx xxxx and 1xx xxxx becomes 3xx xxxx. Thus, the total address space decoded
by ViRGE is 64 MBytes.
Linear addressing is useful when software requires direct access to display memory. ViRGE provides
two linear addressing schemes. The old method can be used when MMIO is disabled or with the old
MMIO method. The second is used in conjunction with the new MMIO method.
Enhanced mode operation must be enabled before linear addressing is enabled. This means that bit
0 of CR66 is set to 1 to enable Enhanced mode functions and bit 3 of CR31 is set to 1 to specify Enhanced
mode memory mapping.
ViRGE provides linear addressing of up to 4 MBytes of display memory. Linear addressing of more
than 64 KBytes requires that the CPU be operated in protected mode.
The S3d Engine busy flag, bit 13 of MM8504 (read), should be verified to be 0 (not busy) before linear
addressing is enabled by setting bit 4 of CR58 to 1. The size of the linear address window is set via bits
1-0 of CR58. The base address for the linear addressing window is set via CR59 and CR5A (or via the
Base Address 0 (Index 10H) PCI configuration register for PCI systems).
For operation in real mode, the linear addressing window size can be set to 64 KBytes. The base address
for the window is set to A0000H by programming bits 31-16 of the window position in CR59-CR5A to
000AH. If bit 0 of CR31 is set to 1, the memory page offset (64K bank) specified in bits 5-0 of CR6A is
added to the linear addressing window position base address, allowing access to up to 4 MBytes of
display memory through a 64-KByte window.
With the new MMIO enabled (CR53_4-3 = 01b or 11b), the first 16 MBytes of each 32M address space
(big and little endian) are dedicated to linear addressing. A maximum of 4 MBytes of each address
space (starting at the lowest address of the space) is usable with ViRGE. The base address is taken
from bits 31-26 of the linear address window position (bits 7-2 of CR59 or the high order 6 bits of the
the PCI Base Address 0). This is concatenated with the display memory address specified by the
programmer.
In addition to enabling the new MMIO, the programmer must also enable linear addressing and specify
the window size exactly as required for the old linear addressing. Note that since only bits 31-26 are
used to specify the base address, A0000H cannot be specified and the 64K banking scheme possible
with the old linear addressing cannot be used with the new linear addressing.
When big endian addressing is used, the required byte swapping for linear addressing is specified by
bits 2-1 of CR53. This applies to both reads and writes.
An overview of the ViRGE internal organization is shown in Figure 15-1. Note that there are three
independent and concurrent paths for communications between the CPU and ViRGE registers and
memory. The time required for any given read or write to complete (latency) varies by path. This can
have important implications for the programmer.
First is the issue of write ordering. For example, a linear addressing write to memory uses the command
FIFO path, while an image write to memory uses the S3d FIFO path. If the programmer issues a linear
addressing command and then an image write command before the linear address command
completes (or vise versa), there is no guarantee which will complete first. For total safety from
prematurely overwriting memory data, the programmer must check that the S3d FIFO is empty before
doing linear addressing updating or for command FIFO empty before doing an image transfer.
Similarly, if correct operation of any command is dependent on operation using another FIFO path
(such as a VGA register update before an S3d command), the programmer must ensure that the relevant
FIFO is empty before issuing the dependent command.
Reads through the LPB and VGA paths bypass the respective FIFOs. However, they will be held until
the relevant FIFO is empty before completing. For PCI systems, this will generate a disconnect (if bit
3 of CR66 is set to 1). This hold guarantees that a read of a register following a write will yield the
correct data. Reads of S3d registers go through the S3d FIFO. However, any read with the S3d FIFO
not empty or with the S3d Engine busy will yield undefined results.
STREAMS PROCESSOR
REGISTER READ/WRITE
MMIO Format:
Enable MMIO
Point ES to A000H (old MMIO) or base address (new MMIO)
Load the x and y values into EAX (y value in the low word and x value in the high word), I.e.,
EAX ⇐ x,y
The MMIO scheme is the most efficient and is used where appropriate in the programming examples
provided later in this section. All assume that the ES register points to A000H is the old MMIO is being
used or the base address if the new MMIO is being used.
The following provides examples of the conventions used in the programming examples. Text
following a ‘;’ is a comment.
MMXXXX identifies the memory-mapped register, with XXXX being the variable part of the address
offset. Thus MMA504 identifies the register at offset 100 A504H. BN1 (bh-bl) represents a bit mne-
monic followed by the bit location(s). Thus, SRC_X (26-16) indicates that the Source X value is pro-
grammed into bits 26-16.
The complete binary programming of the Command Set register is provided. For example,
ES:[MM????] ⇐ XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX Where:
???? = appropriate variable offset value for the Command Set register, e.g., A500 for BitBLTs.
X = 0; bit value = 0
X = 1; bit value = 1
X = S; this bit value must be specified, but can vary for this command
Image transfers (CPU pixel data writes to the frame buffer) are notated as follows:
COUNT
IMAGEDATA ⇐ RECT_DATA
The COUNT is the number of CPU writes. IMAGEDATA means the 32K Image Data Transfer mem-
ory space at the memory-mapped location shown in Table 15-1.
If bit 1 of the Command Set register is set to 1, all bitmap updates are affected by the settings in the
clipping registers (MMxxDC, MMxxE0).
15.4.3 Autoexecute
When bit 0 of the Command Set register is cleared to 0, the command is executed when the Command
Set register is written. If this bit is set to 1, the command is not executed until the register with the
highest address for that command type (BitBLT, Line Draw, etc.) is written. This allows multiple
executions of a given command using different parameters without re-programming the Command
Set register. Full programming examples for autoexecute on are provided for each command type.
This section provides programming examples for the following Enhanced mode 2D drawing opera-
tions:
• BitBLT
• Rectangle Fill
• 2D Line Draw
• 2D Polygon Fill
15.4.4.1 BitBLT
The BitBLT function provides a full implementation of the 256 raster operations as defined by Microsoft
for Windows. A listing and explanation of these is provided in Appendix A.
Each raster op has three operands: Source, Pattern and Destination. The Source pixel can be from the
screen (current bitmap) or from the CPU (image transfer). When the source is the screen, the pixel
depth is always the same for both the source and destination (8, 16, 24 bits/pixel). When the source is
the CPU, the pixel can be either color (same source and destination pixel depth) or mono (1 bit/pixel).
The Pattern is an 8x8 array of pixels. A mono pattern is specified in the Mono Pattern 0 and 1 registers.
The Pattern Foreground and Background Color registers define the pixel colors. A color pattern is
specified in a set of registers starting at offset 100 A100H. The number of registers required depends
on the color depth.
The Destination pixel is always the screen (current bitmap) and is always color (multi bits/pixel). This
is the pixel that will be overwritten or left unchanged by the result of the operation.
Color Pattern
Mono Pattern
When the source and destination are overlapping rectangles on the screen , care must be taken so that
the source data is not overwritten before it is moved. This issue is explained next, followed by
programming examples for each of these above cases.
Figure 15-2 shows the 4 cases for overlapping rectangles. Table 15-2 gives the proper programming
parameters for each case. The direction indicates the order in which the pixels are moved, from left to
right (X+) or right to left (X-) and top to bottom (Y+) or bottom to top (Y-). These are specified via bits
25 and 26 of the Command Set register. The source and destination coordinates are specified via the
Rectangle Source XY and Rectangle Destination XY registers. x1,Y1 is the pixel position of the upper
left hand corner of the source rectangle. x2,Y2 is the pixel position of the upper left hand corner of the
destination rectangle. The width of the rectangle is W (in pixels) and the height is H (in lines). As
indicated in the figure, you always start with the source corner inside the overlap and move that pixel
to the corresponding corner for the destination pixel.
The basic algorithm is if the drawing direction is negative, add [rectangle dimension -1] in that direction
to the normal source/destination location. If the drawing direction is positive, use the original
source/destination location.
S D S D BLTCASES
This command copies a source rectangular area in display memory to another location in display
memory. The 8x8 pixel pattern is programmed in the color pattern registers. For this example, assume
x1,y1 is the top left corner of the source rectangle in display memory and x2,y2 is the top left corner
of the destination rectangle. The rectangles can be overlapping or disjoint. See Table 15-2 for the source
and destination coordinate parameter values for overlapping cases. The height and width (in pixels)
of the rectangle being copied are H and W. The color depth is assumed to be 8 bits/pixel.
Autoexecute Off:
ES:[MMA100] ⇐ P3 (31-24), P2 (23-16), P1 (15-8), P0 (7-0) ; Pixels 3-0 of the color pattern
.
.
.
ES:[MMA13C] ⇐ P63 (31-24), P62 (23-16), P61 (15-8), P60 (7-0) ; pixels 63-60 of the color pattern
ES:[MMA504] ⇐ W-1 (26-16), H (10-0) ; rectangle width and height
ES:[MMA508] ⇐ SRC_X (26-16), SRC_Y (10-0) ; source x and y start coordinates
ES:[MMA50C] ⇐ DEST_X (26-16), DEST_Y (10-0) ; destination x and y start coord.
ES:[MMA500] ⇐ 0000 0SSS SSSS SSS0 0000 0000 0010 00S0 ; Command Set register
The following must be specified: Y direction (bit 26), X direction (bit 25), ROP (bits 24-17), clipping
enable (bit 1). Bits 4-2 will be different for other color depths.
Autoexecute On:
ES:[MMA100] ⇐ P3 (31-24), P2 (23-16), P1 (15-8), P0 (7-0) ; pixels 3-0 of the color pattern
.
.
.
ES:[MMA13C] ⇐ P63 (31-24), P62 (23-16), P61 (15-8), P60 (7-0) ; pixels 63-60 of the color pattern
ES:[MMA500] ⇐ 0000 0SSS SSSS SSS0 0000 0000 0010 00S1 ; bit 0 = 1 for autoexecute
ES:[MMA504] ⇐ W-1 (26-16), H (10-0) ; rectangle width and height
ES:[MMA508] ⇐ SRC_X (26-16), SRC_Y (10-0) ; source x and y start coordinates
ES:[MMA50C] ⇐ DEST_X (26-16), DEST_Y (10-0) ; destination x and y start coord.
The command is executed when MMA50C is programmed. The order of programming the other
registers is not important. With autoexecute on, additional BitBLTs can be performed by reprogram-
ming only the parameter registers (not the Command Set register), always ending with the Rectangle
Destination XY register (MMA50C).
This command transfers a rectangular color image provided by the CPU to a location in display
memory. The 8x8 pixel pattern is programmed in the color pattern registers. For this example, assume
the height and width (in pixels) of the rectangle being copied are H and W. The color depth is assumed
to be 8 bits/pixel.
Autoexecute Off:
ES:[MMA100] ⇐ P3 (31-24), P2 (23-16), P1 (15-8), P0 (7-0) ; pixels 3-0 of the color pattern
.
.
.
ES:[MMA13C] ⇐ P63 (31-24), P62 (23-16), P61 (15-8), P60 (7-0) ; pixels 63-60 of the color pattern
ES:[MMA504] ⇐ W-1 (26-16), H (10-0) ; rectangle width and height
ES:[MMA50C] ⇐ DEST_X (26-16), DEST_Y (10-0) ; destination x and y start coord.
ES:[MMA500] ⇐ 0000 000S SSSS SSS0 00SS SS00 1010 00S0 ; Command Set register
The following must be specified: ROP (bits 24-17), first dword offset (bits 13-12), image transfer
alignment (bits 11-10), clipping enable (bit 1). Bits 4-2 will be different for other color depths.
Autoexecute On:
Note
If the CPU obtains the image data from a source bitmap written to system memory by the application,
the application passes the origin of this bitmap, its width, height and color depth. Some or all of this
bitmap can then be blitted to display memory (screen). The method of transfer varies depending on
whether or not the entire bitmap or a partial bitmap is transferred.
For source bitmaps from an application, each line is required by specification to be word aligned, i.e.,
data for a new line begins with the next word after the last word containing valid data for the previous
line. Therefore, to transfer a complete source bitmap, the driver does the following:
1. All image transfers must be doubleword aligned. Therefore, bits 13-12 of the Command Set
register must be programmed to properly reflect the alignment of the first pixel of the source
bitmap. For example, if the first pixel of the source bitmap starts with the third byte of the first
doubleword-aligned read, bits 13-12 of the Command Set register must be programmed to
10b to tell the Engine to ignore the first two bytes.
2. Word alignment must be specified by programming bits 11-10 of the Command Set register to
01b. This tells the Engine that the data for the next line starts at the next word after the data
ending the line. In some cases, doubleword alignment is appropriate (bits 11-10 of the Com-
mand set register = 10b). This is more efficient, but is a special case. Word alignment always
works.
3. To determine the number of doublewords to transfer, calculate (for the source bitmap):
4. The image transfer area in memory is 32K (offset 100 0000H - 100 7FFFH). The driver must moni-
tor the addresses for image writes and reset the address pointer back to the start before any
writes are made beyond the 32K area.
If the application requests that only a rectangular subsection of the source bitmap be transferred to
display memory, the driver has multiple choices of how to do this.
1. The driver can transfer the entire source bitmap and use the clipping registers to eliminate the
unwanted pixels.
2. The driver can transfer only the requested pixels, but it must do this one line at time. If the start
of each line is not doubleword aligned, the driver must determine the doubleword address
containing the first data for the first line and the number of doublewords required to send the
whole line. It must then issue the command to blit this line, with bits 13-12 of the Command
Set register set to ignore the appropriate number of bytes at the start of the line. The driver
must then change the address to the start of the next line and repeat the above process, in-
cluding specification of a new destination start address. The result is that one command is
executed for each line.
Note that if the lines for the requested pixels happen to start at doubleword addresses, the en-
tire rectangle can be blitted with a single command because no data needs to be ignored at
the start of each line. The driver still needs to keep track of the line length and increment the
address by the stride at the end of each line.
3. The driver can transfer the requested pixels as described in 2 above and use the clipping
registers to eliminate any extra pixels at the start of each line.
This command transfers a rectangular mono image provided by the CPU to a location in display
memory. The mono image is converted to the screen color depth based on the the pattern color
(potentially) mixed with the screen (destination) color. The 8x8 pixel pattern is programmed in the
color pattern registers. For this example, assume the height and width (in pixels) of the rectangle being
copied are H and W. The screen color depth is assumed to be 8 bits/pixel.
Autoexecute Off:
ES:[MMA100] ⇐ P3 (31-24), P2 (23-16), P1 (15-8), P0 (7-0) ; pixels 3-0 of the color pattern
.
.
.
ES:[MMA13C] ⇐ P63 (31-24), P62 (23-16), P61 (15-8), P60 (7-0) ; pixels 63-60 of the color pattern
ES:[MMA504] ⇐ W-1 (26-16), H (10-0) ; rectangle width and height
ES:[MMA50C] ⇐ DEST_X (26-16), DEST_Y (10-0) ; destination x and y start coord.
ES:[MMA500] ⇐ 0000 000S SSSS SSS0 00SS SS00 1110 00S0 ; Command Set register
The following must be specified: ROP (bits 24-17), first dword offset (bits 13-12), image transfer
alignment (bits 11-10), clipping enable (bit 1). Bits 4-2 will be different for other color depths.
Autoexecute On:
Note
If the source bitmap is provided by the application, then the entire Note for the previous color pixels
case also applies to this mono pixel case because each line is required to be word aligned. If the
source bitmap is provided by the driver, e.g., font data, the driver should byte align the data and
program bits 11-10 of the Command Set register to 00b to specify byte alignment to the Engine.
This command copies a source rectangular area in display memory to another location in display
memory. It is identical to the Color Pattern Case 1 except that the 8x8 pixel pattern is programmed in
the mono pattern registers and the pattern color is taken from the pattern foreground and background
registers. For this example, assume x1,y1 is the top left corner of the source rectangle in display
memory and x2,y2 is the top left corner of the destination rectangle. The rectangles can be overlapping
or disjoint. See Table 15-2 for the source and destination coordinate parameter values for overlapping
cases. The height and width (in pixels) of the rectangle being copied are H and W. The screen color
depth is assumed to be 8 bits/pixel.
Autoexecute Off:
The following must be specified: Y direction (bit 26), X direction (bit 25), ROP (bits 24-17), clipping
enable (bit 1). Bits 4-2 and the fields programmed for the background and foreground colors will be
different for other color depths.
Autoexecute On:
This command transfers a rectangular color image provided by the CPU to a location in display
memory. It is identical to the Color Pattern Case 1 described earlier except that the 8x8 pixel pattern
is programmed in the mono pattern registers and the pattern color is taken from the pattern fore-
ground and background registers. For this example, assume the height and width (in pixels) of the
rectangle being copied are H and W. The screen color depth is assumed to be 8 bits/pixel.
Autoexecute Off:
The following must be specified: ROP (bits 24-17), first dword offset (bits 13-12), image transfer
alignment (bits 11-10), clipping enable (bit 1). Bits 4-2 will be different for other color depths.
Autoexecute On:
Autoexecute On:
Note
If the CPU obtains the image data from a source bitmap written to system memory by the application,
the application passes the origin of this bitmap, its width, height and color depth. Some or all of this
bitmap can then be blitted to display memory (screen). The method of transfer varies depending on
whether or not the entire bitmap or a partial bitmap is transferred.
For source bitmaps from an application, each line is required by specification to be word aligned, i.e.,
data for a new line begins with the next word after the last word containing valid data for the previous
line. Therefore, to transfer a complete source bitmap, the driver does the following:
1. All image transfers must be doubleword aligned. Therefore, bits 13-12 of the Command Set
register must be programmed to properly reflect the alignment of the first pixel of the source
bitmap. For example, if the first pixel of the source bitmap starts with the third byte of the first
doubleword-aligned read, bits 13-12 of the Command Set register must be programmed to
10b to tell the Engine to ignore the first two bytes.
2. Word alignment must be specified by programming bits 11-10 of the Command Set register to
01b. This tells the Engine that the data for the next line starts at the next word after the data
ending the line. In some cases, doubleword alignment is appropriate (bits 11-10 of the Com-
mand set register = 10b). This is more efficient, but is a special case. Word alignment always
works.
3. To determine the number of doublewords to transfer, calculate (for the source bitmap):
If the application requests that only a rectangular subsection of the source bitmap be transferred to
display memory, the driver has multiple choices of how to do this.
1. The driver can transfer the entire source bitmap and use the clipping registers to eliminate the
unwanted pixels.
2. The driver can transfer only the requested pixels, but it must do this one line at time. If the start
of each line is not doubleword aligned, the driver must determine the doubleword address
containing the first data for the first line and the number of doublewords required to send the
whole line. It must then issue the command to blit this line, with bits 13-12 of the Command
Set register set to ignore the appropriate number of bytes at the start of the line. The driver
must then change the address to the start of the next line and repeat the above process, in-
cluding specification of a new destination start address. The result is that one command is
executed for each line.
Note that if the lines for the requested pixels happen to start at doubleword addresses, the en-
tire rectangle can be blitted with a single command because no data needs to be ignored at
the start of each line. The driver still needs to keep track of the line length and increment the
address by the stride at the end of each line.
3. The driver can transfer the requested pixels as described in 2 above and use the clipping
registers to eliminate any extra pixels at the start of each line.
This command transfers a rectangular mono image provided by the CPU to a location in display
memory. The mono image is converted to the screen color depth based on the the pattern color
(potentially) mixed with the screen (destination) color. It is identical to the Color Pattern Case 3
described earlier except that the 8x8 pixel pattern is programmed in the mono pattern registers and
the pattern color is taken from the pattern foreground and background registers. For this example,
assume the height and width (in pixels) of the rectangle being copied are H and W. The screen color
depth is assumed to be 8 bits/pixel.
Autoexecute Off:
The following must be specified: ROP (bits 24-17), first dword offset (bits 13-12), image transfer
alignment (bits 11-10), clipping enable (bit 1). Bits 4-2 will be different for other color depths.
Autoexecute On:
Note
If the source bitmap is provided by the application, then the entire Note for the previous color pixels
case also applies to this mono pixel case because each line is required to be word aligned. If the source
bitmap is provided by the driver, e.g., font data, the driver should byte align the data and program bits
11-10 of the Command Set register to 00b to specify byte alignment to the Engine.
This command draws a filled rectangle on the screen. Only ROPs that do not contain a source can be
used. If the ROP contains a pattern, the pattern specification will be ignored. Instead, the pattern value
is forced to a 1 by the hardware, selecting the pattern foreground color. ROPs specifying only the
destination (screen) and optionally a logical operation (e.g., NOT D) can be used. In this case, the
rectangle color will depend only on the current screen color. For this example, assume the height and
width (in pixels) of the rectangle being drawn are H and W. The screen color depth is assumed to be
8 bits/pixel.
Autoexecute Off:
The following must be specified: ROP (bits 24-17), clipping enable (bit 1). Bits 4-2 will be different
for other color depths. Bit 8 must be set to 1 to specify a mono pattern.
Autoexecute On:
This command draws a two-dimensional line on the screen. Only ROPs that do not contain a source
can be used. If the ROP contains a pattern, the pattern specification will be ignored. Instead, the pattern
value is forced to a 1 by the hardware, selecting the pattern foreground color. ROPs specifying only
the destination (screen) and optionally a logical operation (e.g., NOT D) can be used. In this case, the
line color will depend only on the current screen color. Assume x1,y1 are the starting coordinates of
the requested line and x2,y2 are the ending coordinates. x1 and x2 are pixel coordinates, with 0 being
the x coordinate of the first (leftmost) pixel on each line. y1 and y2 are line coordinates, with 0 being
the coordinate of the first (topmost) line.
The S3d Engine draws 2D lines from the bottom up, regardless of the requested drawing direction.
Figure 15-3 shows four cases of requested lines (shown by the arrows on the grids). In Case 1, the
requested drawing direction is the same as is used by the S3d Engine, so the x1,y1 coordinates are
used to determine the starting coordinates (XSTART, YSTART). In Case 2, the line will be drawn by the
S3d Engine exactly reversed from that requested, so x2,y2 are used to determine the starting
coordinates. In these and the other two cases, the small arrows outside the grid point to the starting
coordinates used by the S3d Engine. The programmer must always use the end with the largest y value
as the starting point.
Another complexity is illustrated by Case 1. If the line is X MAJOR (i.e., for a given movement along
the line, the x value increases faster than the y value), the starting x value must be adjusted to the point
indicated by the intersection of the dashed lines. This is a 1/2 pixel (x direction) extension from the first
pixel to be drawn. For Y MAJOR lines (Case 4), this adjustment is not required.
The parameters required to draw a line must be calculated by software and programmed into the
appropriate registers. The first values that must be calculated are:
∆X = x2 - x1 or x1 - x2
∆Y = y2 - y1 or y1 - y2
The important point is that if x2 - x1 is used for ∆X, then y2 - y1 must be used for ∆Y and vice versa.
Y+ Y+ Y+ Y+
2DLINE
This is value is programmed in MMA970 with bit 31 as the sign bit (0 = positive)
X START = (xSTART << 20) + (X DELTA/2) for X MAJOR lines and positive X DELTA
X START = (xSTART << 20) + (X DELTA/2) + ((1 << 20) - 1) for X MAJOR lines and negative X DELTA
X START = (xSTART << 20) for Y MAJOR lines
This value is programmed in MMA974 with bits 31 and 30 as sign bits. The preceding discussion
describes how to determine xSTART.
Y START = ySTART
This value is programmed in MMA978_10-0. It is the y value of the first scan line and is always the
largest requested y.
The horizontal drawing direction is specified in MMA97C_31 (0 = right to left; 1 = left to right)
The final parameters to be specified are used primarily for the case where the programmer is drawing
a polyline (connected line segments) and specifies "last pixel not drawn" for one segment. This is done
so that the last pixel of one segment is not drawn a second time as the first pixel of the next segment.
The parameters are:
END1 = x coordinate for the last pixel to be drawn for the line (MMA96C_15-0)
END0 = x coordinate for the first pixel to be drawn for the line (MMA96C_31-0)
The both cases, the 5 most significant bits are sign bits and must be 0’s to indicate a positive value.
The complication here is again that the S3d Engine drawing direction may not be the same as the
requested direction. In Case 1 of Figure 15-3, the two directions are the same. If "last pixel off" is
specified, then END0 is programmed with the x1 (requested starting x) value and END1 with x2 -1 (one
X+
0,0
Y+ POLYLINE
less than the requested ending x value to stop the line one pixel short). In Case 2, the directions are
opposite. END0 is programmed with x2 +1 and END1 with x1. Thus, the S3d Engine (which starts at
the requested ending x position so it can draw upward) skips the first pixel and draws the last to
accommodate the reversed drawing direction. In a similar fashion, is is easy to see that for Case 3,
END0 is x2 - 1 and END1 is x1. For Case 4, END0 is x1 and END1 is x2 +1.
If "last pixel off" is not requested, the END0 and END1 values are the same as described above except
that 1 is not added or subtracted as appropriate. Thus, the full x values of both ends of the line are
specified. This allows a horizontal line to be drawn. Normally, the X DELTA value for a horizontal line
would be infinity (∆Y = 0). For this case, the programmer can specify an X DELTA of 0 and the S3d
engine will use the endpoint parameters to draw the correct line.
The following programming example is for a polyline as shown in Figure 15-4. The first requested
segment goes up to the right with the last pixel not drawn. The second segment goes down to the right
with all pixels drawn. This first segment must be drawn first since it has the largest y value. It is drawn
as described for Case 1 in Figure 15-3 except the line is X MAJOR. The second line segment is drawn
as described for Case 3. This line is neither X MAJOR or Y MAJOR, so the Y MAJOR assumption should
be used because it is simpler to calculate X START. Autoexecute is used so that the Command Set
register does not need to be re-programmed.
Note that with autoexecute on (bit 0 of the Command Set register set to 1), a line is drawn every time
MMA97C is programmed. Also note that the Command Set register has a unique address for each
command type, e.g., it is at offset A900 for 2D lines while it is at A500 for BitBLTs and rectangle fills.
Only the ROP (bits 24-17) and clipping (bit 1) are optionally specified for line draws.
To draw a disconnected line after drawing a polyline, autoexecute must first be turned off. This is done
by writing to the Command Set register with bit 0 cleared to 0 and the command (bits 30-27) specified
as 1111b (NOP).
This command is used to generate a filled polygon. Any number of edges can be drawn, but the shape
must be such that any horizontal line must intersect the polygon edges in no more than two places.
The exception is that any edge can be horizontal. Only ROPs that do not contain a source can be used.
If the ROP contains a pattern, the pattern specification will be taken from the appropriate color or mono
pattern registers. ROPs specifying only the destination (screen) and optionally a logical operation (e.g.,
NOT D) can be used. In this case, the pixel color will depend only on the current screen color for the
destination pixel.
For polygon fills, the end points of each edge segment are not explicitly specified and cannot be
optionally drawn or not drawn. Drawing of the overlapping pixels is handled automatically. Also,
instead of specifying the direction of line drawing, the edge or edges to be updated are specified via
bits 28 and 29 of MMAD7C. Otherwise, the parameters for each line are calculated exactly as for 2D
lines.
∆X = x2 - x1 or x1 - x2
∆Y = y2 - y1 or y1 - y2
The important point is that if x2 - x1 is used for ∆X, then y2 - y1 must be used for ∆Y and vice versa.
X DELTA = - (∆X << 20)/∆Y (integer divide) - right and left edges
These values are programmed in MMAD68 and MMAD70 with bit 31 as the sign bit (0 = positive)
X START = (xSTART << 20) + (X DELTA/2) + (1 << 19) for X MAJOR lines - right and left edges
X START = (xSTART << 20) + (1 << 19) for Y MAJOR lines - right and left edges
These values are programmed in MMAD6C and MMAD74 with bits 31 and 30 as sign bits. The line
draw discussion describes how to determine xSTART.
Y START = ySTART
POLYFILL
Figure 15-5. Polygon Fill Example
This value is programmed in MMA978_10-0. It is the y value of the first scan line and is always the
largest requested y.
This value is programmed in MMAD78_10-0. It is the number of scanlines to draw for each edge
segment.
The S3d Engine draws polygons from the bottom up as shown in the example in Figure 15-5. In the
first iteration, the programmer specifies line parameters for the left and right edges and specifies that
they both be updated. The first iteration also specifies the number of scan lines up to the first vertex,
which is on the left edge in this example. This results in the trapezoid shown in the leftmost example.
The second iteration only specifies the second segment of the left edge, resulting in the middle
example. Since the right edge does not change slope, it should not be re-specified or updated
(MMAD7C_28 = 0). This speeds the drawing by eliminating the need for a recalculation for that edge.
The third iteration draws the third segment of the left edge, which joins the right edge to complete the
polygon as shown by the right hand example. Again, the right edge should not be re-specified or
updated.
As with the bottom edge shown in the example, if the top edge is a horizontal line, that line does not
have to be drawn to close the polygon.
; 1st iteration
ES:[MMAD68] ⇐ RIGHT EDGE X DELTA ; right edge x direction gradient
ES:[MMAD6C] ⇐ RIGHT EDGE X START ; right edge starting x coord.
ES:[MMAD70] ⇐ LEFT EDGE X DELTA ; left edge x direction gradient
ES:[MMAD74] ⇐ LEFT EDGE X START ; left edge starting x coord.
ES:[MMAD78] ⇐ Y START (10-0) ; bottommost y value
ES:[MMAD00] ⇐ 0010 100S SSSS SSS0 0000 0000 0010 00S1 ; Command Set (autoexecute)
ES:[MMAD7C] ⇐ Update Lft (29), Update Rgt (28), Y COUNT (10-0) ; update edge and # of scanlines
; 2nd iteration
ES:[MMAD70] ⇐ LEFT EDGE X DELTA ; left edge x direction gradient
ES:[MMAD74] ⇐ LEFT EDGE X START ; left edge starting x coord.
ES:[MMAD7C] ⇐ Update Lft (29), Update Rgt (28), Y COUNT (10-0) ; update edge(s) and # of scanli-
nes
; 3rd iteration
ES:[MMAD70] ⇐ LEFT EDGE X DELTA ; left edge x direction gradient
ES:[MMAD74] ⇐ LEFT EDGE X START ; left edge starting x coord.
ES:[MMAD7C] ⇐ Update Lft (29), Update Rgt (28), Y COUNT (10-0) ; update edge and # of scanlines
Note that with autoexecute on (bit 0 of the Command Set register set to 1), a trapezoid fill is executed
every time MMAD7C is programmed. Also note that the Command Set register has a unique address
for each command type, e.g., it is at offset AD00 for 2D polygon fills while it is at A500 for BitBLTs and
rectangle fills and A900 for 2D lines. Only the ROP (bits 24-17) and clipping (bit 1) are optionally specified
for polygon fills.
The S3d Engine accelerates the drawing of 3D lines and triangles. Texturing of 3D triangles and fogging
and alpha blending of both 3D lines and 3D triangles is also supported. This section describes the basic
3D drawing capabilities and the register values required to generate the desired image. Programming
code is quite complex for 3D operations and will be provided by S3 to customers desiring to create
custom drivers.
• There is a third (Z) dimension, with increasing values going away from the viewer (into the
screen). Like the X value, this is specified in fractional coordinates. (The Y value is always an
integer number of scan lines.) The registers associated with this dimension are 3dZ and
3ZStart and are used only when Z-buffering is desired.
• There are 4 color coordinates for the start of the line and associated color deltas. The color
values are Alpha (transparency/opacity factor), Red, Green and Blue. These are all expressed
as fractional values. The registers associated with these colors are 3dGdY_dBdY and
3dAdY_dRdY (deltas) and 3GS_BS and 3AS_RS (starts).
Figure 15-6 represents a typical triangle drawn into the frame buffer. The grid represents pixel
coordinates, i.e., each intersection is the location of one pixel. The origin of the grid is at the top left
(0,0), with the X dimension increasing to the right and the Y dimension increasing downward. The
specified triangle does not have to start or end on a pixel coordinate, as illustrated in the figure.
Vertices 0 through 2 of the triangle to be drawn are numbered by decreasing Y value, i.e., from bottom
to top. The triangle is always rendered from bottom to top, starting at the first scan line at or above
the starting (bottom) vertex and ending at the last scan line at or below the ending (top) vertex. The
location of the 02 side (largest Y dimension) determines the horizontal rendering direction. For a
triangle as shown in Figure 15-6, with the 02 side on the left, rendering must be done from left to right.
This is specified by setting bit 31 of MMB517C to 1. If the triangle in Figure 15-6 is flipped horizontally
so the 02 side is on the right, the rendering direction must be specified as from right to left. This is
done by clearing bit 31 of MMB51C to 0.
As many as 43 registers may be required to completely specify the rendering of one 3D triangle with
texturing applied. These registers are described in Section 19. Figure 15-6 helps to explain the relevance
of most of these registers.
X
0,0
Y
2
Y12
E
B
1
A Y01
3DTRGLE
C D
Figure 15-6. 3D Triangle Example
The following registers are associated with the Y axis and side 02. Note that the Y component of side
02 (B in Figure 15-6), always determines the number of scan lines required to render the triangle.
The following registers are associated with the X axis and side 01. Note that the X component of side
01 (D in Figure 15-6), is always the maximum width of the rendered triangle.
The TbU and TbV registers contain the common offset values for the U and V texture dimensions, i.e.,
these values are added to all U and V specifications.
Triangles can be drawn with perspective correction (bits 30-27 of the Command Set register = 0101 or
0110). Perspective correction uses the W parameters. In addition, the U and V parameters have different
bit codings when perspective correction is specified than when it is not. These are explained in the
register descriptions. Using automatic perspective correction will normally cause some decrease in
performance, but can in some circumstances provide dramatic increases in picture quality.
15.4.6 Z-Buffering
Z-buffering allows the programmer to eliminate rendering of hidden lines and surfaces. It is enabled
when bits 25-24 of the Command Set register are 00b and bits 22-20 of the Command Set register are
not 000b. Use of z-buffering requires that space be allocated in video memory for the z-buffer. The
starting location is specified in the Z_BASE register. For each graphics pixel, the z-buffer contains a
corresponding 16 bits of depth information. Bits 22-20 of the Command Set register specify the
relational operator used to compare the z value of the source pixel with its corresponding z-buffer
value, as follow:
For example, a setting of 110 means that the source pixel will replace the current pixel in video memory
only if its source z value is less than the corresponding z-buffer value. This is the normal comparison,
as it allows the pixel closer to the viewer to be drawn. If bit 23 of the Command Set register is set to
1, the source pixel z value will replace the current z-buffer value. If bit 23 of the Command Set register
is cleared to 0, the z-buffer value remains unchanged.
The z-buffer comparison occurs before any of the pixel coloring operations described below. If the z
comparison fails, no further coloring operations will be done on that pixel. Similarly, if the operator is
set to never pass, z-buffering is effectively disabled. This can improve performance.
Z-buffering requires 16 bits of video memory storage for each displayable pixel. If insufficient memory
is available, MUX buffering may allow z-buffering to be performed. With MUX buffering, the active
frame buffer area (draw buffer) is alternately programmed with z-buffer values and pixel colors. This
requires that all the primitives (lines and triangles) of the scene be rendered twice, which decreases
performance. Otherwise, MUX buffering produces the effects as normal z-buffering.
MUX buffering can only be used when the destination format is 16 bits/pixel and no alpha blending is
to be performed (bit 19 of the Command Set register = 0). When the destination format is 16 bits/pixel,
bit 15 = 1 indicates the word contains a z value and bit 15 = 0 indicates the word contains an RGB555
value.
With MUX buffering, double buffering should be used so that the z-buffering can be done in the inactive
(back) buffer. See the Streams Processor section for an explanation of double buffering. Z-buffering is
enabled as explained in the previous section except that bit 23 of the Command Set register must be
set to 1 so that the source pixel z value will replace the current z-buffer value. As a final setup step, the
entire buffer must be written with either a solid color or a prerendered bitmap. This sets the z bit of
each word to 0, indicating that colors are stored.
On the first pass, bits 25-24 of the Command Set register are programmed to 01b to specify the z-buffer
pass. The S3d Engine interpolates only the z values of the the source primitive (line or triangle). For
each source pixel, if the corresponding destination pixel is a color (bit 15 = 0), the source z value replaces
the destination color. For the first primitive to be drawn for the scene, the source pixels (z values) will
replace all the corresponding destination pixels (colors) because of the initialization to colors. For
subsequent primitives for the scene, the source pixel may or may not replace the destination pixel. It
will always replace it if the destination is a color, but if the destination is a z-value, it will only replace
it if the z comparison passes. At the end of this pass, all pixels corresponding to primitives are set to
z values. All other pixels retain the initialization color values.
For the second pass, bits 25-24 of the Command Set register are programmed to 10b to specify the
draw buffer pass. The S3d Engine again interpolates the z values for all source primitives. If the
destination pixel is a color, that pixel color is left unchanged. If the destination pixel is a z value, the
source z value is compared with the destination z value. If they are equal, the source color is computed
and that color value replaces the destination z value. At the end of this pass, all pixels in the buffer
contain color values. The buffer is then switched to the front (active) and is used for the next screen
refresh.
Pixel color generation for 3D drawing occurs in a series of steps as depicted in Figure 15-7. The first of
these, calculate the source pixel color, has been explained in the 3D line and triangle drawing sections
above. The remaining steps are:
1. Filter - If texturing is enabled for a 3D triangle, two, four or eight texels (texture pixel) from the
texture map can be filtered (interpolated) to generate a texture color to be mixed with the
source color in step 3 or a code to be used in the next step.
2. Generate - For certain applications, textures can be stored in a compact colorless mode (Blend4).
This step generates a texture color based on the compact coding, which may or may not be
the output of filtering from the previous step. This color is used in the next step.
3. Light - If a lit texture triangle is specified, the source pixel color is mixed with the texel color to
generate a color which can optionally be fogged or alpha blended.
4. Fog - Also called depth cueing. As shown in Figure 15-7, the input can either be the source pixel
color or the result of the filter/generate steps.
5. Alpha Blend - The source pixel color or the output of the fogging step (which may be disabled)
is blended with the destination pixel color in video memory. This can produce a transparency
effect.
Textures are stored in off-screen video memory at a location specified in MMB4EC. The integer
components of the U and V parameters generate the memory addresses for each texture element,
which is called a texel. The fractional part of the U and V parameters are used in the filter stage for
interpolation between texel colors. The texture color format is specified in bits 7-5 of the Command
Set register and can be one of the following:
GENERATE
LIGHT
FOG
ALPHA
BLEND
DRAW
PIXCOLOR
BUFFER
The texture can be a single rectangular pattern or a mipmap. A mipmap contains multiple versions of
the same texture, each at successively lower resolutions (1/2, 1/4, 1/8, etc.). The size of the largest
mipmap level (level 0) must be specified via bits 11-8 of the Command Set register. The integer part
of the D parameter points to the mipmap level to be used for the texture. The fractional part of the D
parameter is used for filtering of colors between mipmap levels.
A variety of filter modes are provided via bits 14-12 of the Command Set register, as follows:
Modes starting with M are mipmapped. Those without have a single texture level. XTPP means X texels
are interpolated per source pixel. Figure 15-8 demonstrates the effect of the 011 setting (M8TPP). The
U,V and D parameters point to the texture map location indicated by the black dot at F. To generate
the color for this location, the four nearest pixels in mipmap level D (1 - 4) are interpolated to generate
the color indicated by the top medium gray dot (I1). The four nearest pixels in mipmap level D + 1 (5 -
8) are interpolated to generate the color indicated by the bottom medium gray dot (I2). The colors at
I1 and I2 are then interpolated to produce the final color at F.
If M1TPP or 1TPP is selected, the texel nearest to the programmed texture location is chosen to provide
the texture color. For M2TPP, the color is interpolated between the nearest texels from 2 mipmap levels
(e.g., texels 1 and 5 in Figure 15-8). For M4TPP or 4TPP, texels 1, 2 , 3 and 4 are interpolated. For V2TPP,
which is used only for YUV data, texels 1 and 3 are interpolated.
V MIPMAP LEVEL D
1 2
I1
3 4
U F
6
5
I2
PTEX
7 8
MIPMAP LEVEL D + 1
Filtering of 8 bits/pixel palettized data produces uncertain results. Palettized texel colors can be used
if the filter mode is M1TPP or 1TPP (only one texel is used to generate the color) and the texture blending
mode (lighting) is specified as decal. This means the texel color replaces the source pixel color (no
mixing). Because the color is now palettized, it cannot be texture lit, fogged or alpha blended.
15.4.8.2 Generation
ViRGE provides several compact texture storage modes, called Blend4 (high and low nibble) and
Alpha4/Blend4. Blend4 uses 4 bits to define the color for each texel. These bits can be in either the high
or low nibble of each byte, allowing the programmer to locate texels from two different textures in a
single byte. Alpha4/Blend4 has 4 bits of Alpha coding and 4 bits of RGB color coding in each byte.
Blend4 is useful for textures with a narrow range of colors, such as grass. The 4-bit value is an
interpolation factor between two RGB colors defined in the Color 0 (MMB4F8) and Color1 (MMB4FC)
registers.
Alpha4/Blend4 is useful for textures with a limited range of colors and transparency, such as a cloudy
sky. In this case, there are a few shades of blue-white, with whiter clouds being more opaque than
bluer sky. Alpha blending is explained below.
Generation of colors for Blend4 modes occurs after the filter phase. Therefore it is possible to filter
multiple Blend4 texels to produce a composite color interpolation factor to be used in the generate
phase. The results of this might be hard to predict. The filter phase can be bypassed by selecting a
1TPP filter mode.
15.4.8.3 Lighting
Lighting is the blending of the texel color with the source pixel color. As seen in Figure 15-7, it is used
only when a lit triangle is specified in bits 30-27 of the Command Set register. Bits 16-15 of the
Command Set register specify the blending modes as follows:
00 = Complex reflection
01 = Modulate
10 = Decal
11 = Reserved
Complex reflection adds the (normalized, 0 = black and 1 = white) texel and pixel colors, with a
maximum value of 1. This lightens the pixel.
Modulate multiplies the normalized color values. This results in a smaller value (darker pixel). The
programmer may need to compensate for this darkening effect.
Decal replaces the source pixel color with the texel color, essentially overlaying the texture on the
scene. This is the only mode that can be used with palettized data.
If the texture map is smaller than the area to be textured, texture wrapping can be turned on via bit 26
of the Command Set register. This allows the texture to be tiled across the scene. If texture wrapping
is disabled and and the texture map is smaller than the area to be textured, the texel color is taken
from the Texture Border Color register (MMB4F0) for all pixels beyond the texture.
15.4.8.4 Fogging
Fogging is enabled via bit 17 of the Command Set register. This operation uses the pixel’s alpha value
to interpolate between the pixel color at this stage of the coloring process (see Figure 15-7) and a fog
color specified in MMB(0/4)F4. If the alpha value corresponds to the distance from the viewer, this is
called depth cueing. If fogging is being done, source alpha cannot be specified for alpha blending (i.e.,
bits 19-18 of the Command set register cannot be 11b).
Alpha blending blends the pixel color at this stage of coloring (see Figure 15-7) with the color of the
corresponding pixel in the draw buffer. It is enabled via bits 19-18 of the Command Set register. If these
bits are 10b, the texture alpha is used for the interpolation factor. The texture alpha is actually the alpha
for the pixel at this stage of the coloring and not a texel alpha. If bits 19-18 are 11b, the source alpha
is used for the interpolation factor. This is the original pixel alpha before texturing.
Alpha blending is used for transparency effects. The smaller the value of alpha, the more the destination
color will dominate the final color (or higher transparency). To be effective with Z-buffering enabled,
all opaque objects must be drawn first. Then all transparent objects are drawn with z-update disabled
(MMB500_23 = 0). To be effective with Z-buffering disabled, objects must be drawn back to front.
A programmable cursor is supported which is compatible with the Microsoft Windows (bit 4 of CR55
= 0) and X11 (bit 4 of CR55 = 1) cursor definitions. The cursor size is 64 pixels wide by 64 pixels high,
with the cursor pattern stored in an off-screen area of display memory. Two monochrome images 64
bits wide by 64 bits high (512 bytes per image) define the cursor shape. The first bit image is an AND
mask and the second bit image is an XOR mask. The following is the truth table for the cursor display
logic.
The hardware cursor color is taken from the Hardware Graphics Cursor Foreground Stack (CR4A) and
the Hardware Graphics Cursor Background Stack (CR4B) registers. Each of these is a stack of three 8-bit
registers. The stack pointers are reset to 0 by reading the Hardware Graphics Cursor Mode register
(CR45). The color value is then programmed by consecutive writes (low byte, second byte, third byte)
to the appropriate (foreground or background) register.
The hardware cursor is disabled when a VGA-compatible mode is in use. It can be enabled or disabled
when in Enhanced mode (bit 0 of MM8508 = 1), as follows.
The cursor can be positioned at any point on the display, with the X,Y coordinates ranging from 0 to
2047. This enables the full cursor images to be displayed on the screen and partial cursor images to
be displayed at the right edge and the bottom edge of the screen. The cursor offset OX,OY has to be
set to 0,0 for a 1024x768 resolution. If X is > (1024 – 64) or Y is > (768 – 64), then a partial cursor is
visible at the right edge or top edge of the screen respectively. Note that if Y ≥ 768 then the cursor is
not visible; it is residing in the off-screen area.
A partial cursor image can be displayed at the left edge or the top edge of the screen. To enable partial
cursor display at the top edge of the screen, Y is set to 0 and the Y offset register is set to OY (range
from 0 to 63). This displays the bottom 64–OY rows of the cursor image at the currently set X position
and the top edge of the screen. Similarly, a partial cursor can be displayed at the left edge of the screen
by setting X to 0 and the X offset register to OX (range from 0 to 63). This displays the right 64–OX
columns of the cursor image at the currently set X and the left edge of the screen. The following
pseudocode illustrates cursor positioning.
The cursor position is updated by the hardware once each frame. Therefore, the programmer should
ensure that the position is re-programmed no more than once for each vertical sync period.
The AND and the XOR cursor image bitmaps are 512 bytes each. These bitmaps are word interleaved
in a contiguous area of display memory, i.e., AND word 0, XOR word 0, AND word 1, XOR word 1 ...
AND word 255, XOR word 255. The starting location must be on a 1024-byte boundary. This location
is programmed into the Hardware Graphics Cursor Start Address registers (CR4C and CR4D) as follows:
The value programmed is the 1024-byte segment of display memory at which the beginning of the
hardware cursor bit pattern is located. For example, for an 800x600x8 mode on a 1 MByte system,
there are 1024 1K segments. Programming CR4C_11-8 with 3H and CR4D with FEH specifies the starting
location as the 1022nd (0-based) 1K segment. The cursor pattern is programmed (using linear
addressing) at FF800H offset from the base address of the frame buffer.
Note
If the cursor is not 64 bits by 64 bits, the given images should be padded to make the cursor image 64
bits by 64 bits. The padded area should be made transparent by padding the extra AND mask bits with
‘1’s and the extra XOR bits by ‘0’s.
For PCI systems, ViRGE provides bus master DMA capabilities. There are two independent DMA
channels. One handles transfers of video data to video memory or an MPEG decoder and from video
memory to system memory. The other is used to transfer command and parameter or image data to
the S3d Engine.
These transfers are enabled by setting MM8588_0 to 1. If MM8580_1 = 1, data is transferred from system
memory to the LPB output FIFO. This can be compressed video data for transfer to an MPEG decoder
or de-compressed software MPEG data to be written to video memory with optional decimation. See
the LPB section for the appropriate register settings for each type of transfer. For either case, the starting
address in system memory for the data to be transferred is programmed in MM8580_31-2 (doubleword
aligned). The number of doublewords to transfer -1 is programmed in MM8584_23-2.
If MM8580_1 = 0, data is transferred from video memory to system memory. The starting address in
video memory is programmed in MM8220_21-3 (quadword aligned). The line width in quadwords is
programmed in MM8224_27-19 and the line stride in quadwords is programmed in MM8224_11-3. The
destination starting address in system memory is programmed in MM8580_31-2 (doubleword aligned).
The number of doublewords to transfer -1 is programmed in MM8584_23-2.
The type of transfer requires establishment of a locked circular buffer in system memory. MM8590_1
defines this buffer as being 4 or 64 KBytes. The base address for the buffer is programmed in
MM8590_31-12 (4K) or 31-16 (64K). S3d Engine DMAs are enabled by setting MM859C_0 to 1.
The DMA write and read pointer registers (MM8594 and MM8598) are initialized to all 0’s. The transfer
sequence begins with the CPU writing some amount of data to the buffer. This data is derived from
the parameter blocks passed to the driver by the application via the programming interface. In general,
the transfer should include one or more complete command/parameter/data blocks. After this data is
written to the buffer, the next offset address in the frame buffer is programmed into the DMA write
pointer field (MM8594_15-0) and MM8594_16 is set to 1 to indicate that the write pointer has been
updated. When the write pointer is ahead of the read pointer (MM8598_15-0), DMA transfers to the
S3d Engine begin. The read pointer field is automatically updated as each doubleword transfer to the
S3d Engine is made. DMA transfers will continue as long as the write pointer is ahead of the read
pointer. They stop when the read pointer equals the write pointer.
Additional data can be written to the buffer at any time, starting at the current write pointer address.
Wrapping of the writes when the end of the buffer is reached is handled by the programmer. Before
writing additional data to the buffer, the programmer must first read the read pointer to determine
how much space is available in the buffer. If this is not done, the write data could wrap and overwrite
good data before it is read from the buffer.
Each update of the circular buffer must start with a doubleword header that defines what is to follow.
The format of this header is:
Bit(s) Description
15-0 Number of doublewords to transfer
29-16 Most significant 14 bits of the least significant 16 bits of the offset of the first S3d register
to be programmed
30 Reserved
31 Data type (0 = register data, 1 = image data)
If image data is being transferred (a BitBLT with the CPU as the source), only bit 31 (=1) and bits 15-0
need be programmed.
This capability allows updating of multiple S3d registers in one DMA operation. For example, defining
a color pattern with an 8 bits/pixel color depth requires that all registers from A100H to A13CH be
programmed. Thus, bits 15-0 would be programmed with 16 (decimal). The most significant 14 bits of
A100H (dropping the two low-order 0’s) are programmed into bits 29-16. Bit 31 is cleared to 0.
The parameter register address ranges for some of the commands contain "holes" (no register). The
programmer can either send a new header for each contiguous register sequence or program garbage
in the doublewords corresponding to the holes. For example, there is a single doubleword gap between
the 3AS_RS parameter register for a 3D line and the 3dZ parameter register. This is probably best
handled by the "garbage" technique.
In the following register descriptions, ‘U’ stands for undefined or unused and ‘R’ stands for reserved
(write = 0, read = U). A question mark in an address stands for a hexadecimal value of either ‘B’ or ‘D’.
If bit 0 of the Miscellaneous Output Register (3C2H, Write) is set to 1, the address is based at 3DxH for
color emulation. If this bit is reset to 0, the address is based at 3BxH for monochrome emulation.
See Appendix A for a table listing each register in this section and its page number.
This section describes general input status and output control registers.
This register controls miscellaneous output signals. A hardware reset sets all bits to zero.
7 6 5 4 3 2 1 0
CLK SEL ENB IOA
VSP HSP PGSL =0 1 0 RAM SEL
A setting of either 00b or 01b causes the appropriate values to be programmed into
the DCLK PLL registers if bit 1 of SR15 is set to 1.
Bit 4 Reserved = 0
7 6 5 4 3 2 1 0
=0 =0 =0 =0 VSSL =0 =0 =0
7 6 5 4 3 2 1 0
CRT MON
INTPE =0 =0 SENS =0 =0 =0 =0
7 6 5 4 3 2 1 0
TST-VDT
=0 =0 1 0 VSY =1 LPF DTM
Bit 1 Reserved = 0
Bit 2 Reserved = 1
7 6 5 4 3 2 1 0
VGA
R R R R R R R ENB
The sequencer registers are located at two-byte address spaces. These registers are accessed by first
writing the data to the index register of the sequencer at I/O address 3C4H and then writing to or reading
from the data register at 3C5H.
This register is loaded with a binary value that indexes the sequencer register for read/write data. This
value is referred to as the “Index Number” of the SR register in this document.
7 6 5 4 3 2 1 0
R R R SEQ ADDRESS
This register is the data port for the sequencer register indexed by the Sequencer Index register (3C4H).
7 6 5 4 3 2 1 0
SEQ DATA
7 6 5 4 3 2 1 0
SYN ASY
=0 =0 =0 =0 =0 =0 RST RST
This bit is for VGA software compatibility only. It has no function for ViRGE.
This bit is for VGA software compatibility only. It has no function for ViRGE.
This register controls the operation mode of dot clock and character clock.
7 6 5 4 3 2 1 0
SCRN SHF DCK SHF
=0 =0 OFF 4 1/2 LD =0 8DC
Bit 1 Reserved = 0
This register selects write protection or write permission for CPU write access into video memory.
7 6 5 4 3 2 1 0
=0 =0 =0 =0 EN.WT.PL.
7 6 5 4 3 2 1 0
SLA SLB SLA SLB
=0 =0 2 2 1 0 1 0
In text modes, bit 3 of the attribute byte normally turns the foreground intensity on or off. This bit can
be redefined to be a switch between two character sets. The switch is enabled when there is a difference
between the value of character font select A and character font select B bits. Memory Mode (SR4)
register bit 1 = 1 (extended memory) enables all bits of this function; otherwise character fonts 0 and
4 are available. 256 KBytes of video memory support 8 character sets. This register is reset to 0
asynchronously during a system reset.
7 6 5 4 3 2 1 0
CHN SEQ EXT
=0 =0 =0 =0 4M MODE MEM =0
Bit 0 Reserved = 0
A1 A0 Plane Selected
0 0 0
0 1 1
1 0 2
1 1 3
The CRT controller registers are located at two locations in I/O address space. These registers are
accessed by first writing to the index register of the CRT controller and then accessing the data register.
The index register is located at I/O address 3?4H and the CRT Controller Data register is at 3?5H. Which
address is used (3BX or 3DX) depends on bit 0 of the Miscellaneous Output register at 3C2H.
This register is loaded with a binary value that indexes the CRT controller register where data is to be
accessed. This value is referred to as the “Index Number” of the CR register (CR00–18). This register
is also used as an index to the S3 VGA registers, the System Control Registers and the System Extension
registers.
7 6 5 4 3 2 1 0
CRTC ADDRESS
This register is the data port for the CRT controller register indexed by the CRT Controller Address
register.
7 6 5 4 3 2 1 0
CRTC DATA
This register defines the number of character clocks from HSYNC going active to the next HSYNC going
active. In other words, it is the total time required for both the displayed and non-displayed portions
of a single scan line. Bit 8 of this value is bit 0 of CR5D.
7 6 5 4 3 2 1 0
HORIZONTAL TOTAL
This register defines the number of character clocks for one line of the active display. Bit 8 of this value
is bit 1 of CR5D.
7 6 5 4 3 2 1 0
HORIZONTAL DISPLAY END
This register specifies the value of the character clock counter at which the BLANK signal is asserted.
Bit 8 of this value is bit 2 of CR5D.
7 6 5 4 3 2 1 0
START HORIZONTAL BLANK
This register determines the pulse width of the BLANK signal and the display enable skew.
7 6 5 4 3 2 1 0
DSP-SKW
R 1 0 END HORIZONTAL BLANK
Bit 7 Reserved
This register is used to adjust the screen center horizontally and to specify the character position at
which HSYNC becomes active. Bit 8 of this value is bit 4 of CR5D.
7 6 5 4 3 2 1 0
START HORIZONTAL SYNC POSITION
This register specifies when the HSYNC signal becomes inactive and the horizontal skew. The HSYNC
pulse defined by this register can be extended by 32 DCLKs via bit 5 of CR5D.
7 6 5 4 3 2 1 0
EHB HOR-SKW
b5 1 0 END HORIZONTAL SYNC POS
Bit 7 EHB b5
End Horizontal Blanking bit 5.
This register specifies the number of scan lines from one VSYNC active to the next VSYNC active.
The scan line counter resets to 0 at this point. Bit 8 is bit 0 of CR7. Bit 9 is bit 5 of CR7. Bit 10 is bit 0
of CR5E.
7 6 5 4 3 2 1 0
VERTICAL TOTAL
7 6 5 4 3 2 1 0
VRS VDE VT LCM SVB VRS VDE VT
9 9 9 8 8 8 8 8
This register is used for the pixel scrolling and panning, and text formatting and vertical scrolling.
7 6 5 4 3 2 1 0
BYTE-PAN
=0 1 0 PRE-SET ROW SCAN COUNT
Bit 7 Reserved = 0
This register specifies the number of scan lines per character row and provides one scanning control
bit and two overflow bits.
7 6 5 4 3 2 1 0
DBL LCM SVB
SCN 9 9 MAX SCAN LINE
Bit 5 SVB 9
Bit 9 of the Start Vertical Blank Register (CR15)
Bit 6 LCM 9
Bit 9 of the Line Compare Register (CR18)
The cursor start register defines the row scan of a character line where the cursor begins.
7 6 5 4 3 2 1 0
CSR
=0 =0 OFF CSR CURSOR START SCAN LINE
This register defines the row scan of a character line where the cursor ends.
7 6 5 4 3 2 1 0
CSR-SKW
=0 1 0 CURSOR END SCAN LINE
Bit 7 Reserved = 0
15 14 13 12 11 10 9 8
DISPLAY START ADDRESS (HIGH)
20-bit Value = the first address after a vertical retrace at which the display on the screen begins on each
screen refresh. These along with bits 3-0 of CR69 are the high order start address bits.
7 6 5 4 3 2 1 0
DISPLAY START ADDRESS (LOW)
Start address (low) contains the 8 low order bits of the address.
15 14 13 12 11 10 9 8
CURSOR LOCATION ADDRESS (HIGH)
20-bit Value = the cursor location address of the video memory where the text cursor is active. This
register along with bits 3-0 of CR69 are the high order bits of the address.
7 6 5 4 3 2 1 0
CURSOR LOCATION ADDRESS (LOW)
Cursor location address (low) contains the 8 low order bits of the address.
7 6 5 4 3 2 1 0
VERTICAL RETRACE START
7 6 5 4 3 2 1 0
LOCK REF DIS CLR
R0-7 3/5 VINT VINT VERTICAL RETRACE END
At the end of active vertical display time, a flip-flop is set for a vertical interrupt. The
output of this flip-flop goes to the system interrupt controller. The CPU has to reset
this flip-flop by writing a logical 0 to this bit while in the interrupt process, then set
the bit to 1 to allow the flip-flop to catch the next interrupt request. Do not change the
other bits in this register. This bit is cleared to 0 by the BIOS during a mode set, a re-
set, or power-on.
The vertical display enable end register defines 8 bits of the 10-bit address of the scan line where the
display on the screen ends. Bit 8 and Bit 9 are bits 1 and 6 of CR7. Bit 10 is bit 1 of CR5E.
7 6 5 4 3 2 1 0
VERTICAL DISPLAY END
This register specifies the logical line width of the screen and is sometimes called the screen pitch. The
starting memory address for the next display row is larger than the current row by two, four or eight
times this amount. Bits 5-4 of CR51 are extension bits 9-8 of this register. If these bits are 00b, bit 2 of
CR43 is extension bit 8 of this register.
7 6 5 4 3 2 1 0
LOGICAL SCREEN WIDTH
This register specifies the horizontal row scan position of underline and display buffer addressing
modes.
7 6 5 4 3 2 1 0
DBWD CNT
=0 MODE BY4 UNDER LINE LOCATION
The CNT BY4 bit is used when double word addresses are used.
Bit 7 Reserved = 0
This register specifies the scan line at which the vertical blanking period begins. Bit 8 is bit 3 of CR7.
Bit 9 is bit 5 of CR9. Bit 10 is bit 2 of CR5E.
7 6 5 4 3 2 1 0
START VERTICAL BLANK
This register specifies the scan line count value when the vertical blank period ends.
7 6 5 4 3 2 1 0
END VERTICAL BLANK
This register is a multifunction control register, with each bit defining a different specification.
7 6 5 4 3 2 1 0
BYTE ADW WRD VT 4BK 2BK
RST MODE 16K =0 MODE X2 HGC CGA
This bit allows memory mapping compatibility with the IBM CGA graphics mode.
The combination of this bit and bit 0 of this register allows compatibility with Hercu-
les HGC graphics memory mapping.
This bit selects horizontal retrace clock or horizontal retrace clock divided by two as
the clock that controls the vertical timing counter. If the vertical retrace counter is
clocked with the horizontal retrace clock divided by 2, then the vertical resolution is
double.
Bit 4 Reserved = 0
This register is used to implement a split screen function. When the scan line counter value is equal
to the content of this register, the memory address counter is cleared to 0. The linear address counter
then sequentially addresses the display buffer starting at address 0. Each subsequent row address is
determined by the addition of the Offset (CR13) register content. Bit 8 is bit 4 of CR7. Bit 9 is bit 6 of
CR9. Bit 10 is bit 6 of CR5E.
7 6 5 4 3 2 1 0
LINE COMPARE POSITION
This register is used to read the CPU latch in the Graphics Controller.
7 6 5 4 3 2 1 0
GRAPHICS CONTROLLER CPU LATCH - N
This register is used to read the value of the Attribute Controller Index register and its associated
internal address flip-flop (AFF). It can be read at either index 24H or 26H.
7 6 5 4 3 2 1 0
AFF =0 ENV ATTRIBUTE CONTROLLER INDEX
Bit 6 Reserved = 0
Bit 7 AFF
Inverted Internal Address flip-flop
The graphics controller registers are located at a two byte I/O address space. These registers are
accessed by first writing an index to the Graphics Address register (at 3CEH) and then accessing the
Data register (at 3CFH).
This register is loaded with a binary index value that determines which graphics controller register will
be accessed. This value is referred to as the “Index Number” of the GR register (GR0–6).
7 6 5 4 3 2 1 0
=0 =0 =0 =0 GR CONT ADDRESS
This register is the data port for the graphics controller register indexed by the Graphics Controller
Index register.
7 6 5 4 3 2 1 0
GRAPHICS CONTROLLER DATA
This register represents the value written to all 8 bits of the respective memory plane when the CPU
executes a memory write in write modes 0 and 3.
7 6 5 4 3 2 1 0
=0 =0 =0 =0 SET/RESET DATA
These bits enable the set/reset data, and affect write mode 0.
7 6 5 4 3 2 1 0
=0 =0 =0 =0 ENB SET/RST DATA
These bits represent a 4-bit color value to be compared. In read mode 1, the CPU executes a memory
read, the read data is compared with this value and returns the results. This register works in
conjunction with the Color Don’t Care register.
7 6 5 4 3 2 1 0
=0 =0 =0 =0 COLOR COMPARE DATA
This register selects a raster operation function and indicates the number of bits the CPU data will be
rotated (right) on the video memory write operation.
7 6 5 4 3 2 1 0
RST-OP
=0 =0 =0 1 0 ROTATE-COUNT
The logical function specified by this register is applied to data being written to mem-
ory while in modes 0, 2 and 3.
7 6 5 4 3 2 1 0
RD-PL-SL
=0 =0 =0 =0 =0 =0 1 0
The contents of this register represent the memory plane from which the CPU reads data in read mode
0. This register has no effect on the color compare read mode (read mode 1). In odd/even mode, bit 0
is ignored. Four memory planes are selected as follows:
7 6 5 4 3 2 1 0
SHF-MODE O/E RD WRT-MD
=0 256 O/E MAP CMP =0 1 0
Bit 2 Reserved = 0
Bit 7 Reserved = 0
7 6 5 4 3 2 1 0
MEM-MAP CHN TXT
=0 =0 =0 =0 1 0 O/E /GR
This register is effective in read mode 1, and controls whether the corresponding bit of the Color
Compare Register is to be ignored or used for color comparison.
7 6 5 4 3 2 1 0
=0 =0 =0 =0 COMPARE PLANE SEL
Any bit programmed to 0 in this register will cause the corresponding bit in each of four memory planes
to be immune to change. The data written into memory in this case is the data which was read in the
previous cycle, and was stored in the processor latches. Any bit programmed to 1 allows unimpeded
writes to the corresponding bits in the plane.
7 6 5 4 3 2 1 0
BIT MASK
The attribute controller registers are located at the same byte I/O address for writing address and data.
An internal address flip-flop (AFF) controls the selection of either the attribute index or data registers.
To initialize the address flip-flop (AFF), an I/O read is issued at address 3BAH or 3DAH. This presets the
address flip-flop to select the index register. After the index register has been loaded by an I/O write
to address 3C0H, AFF toggles and the next I/O write loads the data register. Every I/O write to address
3C0H toggles this address flip-flop. However, it does not toggle for I/O reads at address 3C0H or 3C1H.
The Attribute Controller Index register is read at 3C0H, and the Attribute Controller Data register is read
at address 3C1H.
This register is loaded with a binary index value that determines which attribute controller register will
be accessed. This value is referred to as the “Index Number” of the AR register (AR0–14).
7 6 5 4 3 2 1 0
ENB
R R PLT ATTRIBUTE ADDRESS
This register is the data port for the attribute controller register indexed by the Attribute Controller
Index register.
7 6 5 4 3 2 1 0
ATTRIBUTE DATA
These are 16, 6-bit registers pointed to by the index and color code. They allow a dynamic mapping
between the text attribute or graphics color input and the display color on the CRT screen.
7 6 5 4 3 2 1 0
SECONDARY PRIMARY
=0 =0 SR SG SB R G B
The contents of this register controls the attribute mode of the display function.
7 6 5 4 3 2 1 0
SEL 256 TOP ENB ENB MONO TX /GR
V54 CLR PAN =0 BLNK LGC ATRB
When this bit is set to 1, it forces the ninth dot of a line graphics character to be identi-
cal to the eighth dot of the character. The line graphics character codes are C0H
through DFH. For other characters, the ninth dot is the same as the background.
This bit must also be set to 1 for blinking graphics modes. The blinking counter is op-
erated by the vertical retrace counter (VRTC) input. It divides the VRTC input by 32.
The blinking rates are ON for 16 VRTC clocks and OFF for 16 VRTC clocks. In the
graphics mode, when blink is activated, the most significant color bit (bit 3) for each
dot is inverted alternately, thus allowing two different colors to be displayed for 16
VRTC clocks each.
When the cursor is displayed in the text mode, it is blinked at a rate of ON for 8 VRTC
clocks and OFF for 8 VRTC clocks (period by 16 frames). The displayed characters are
independently blinked at the rate of 32 frames as above.
Bit 4 Reserved = 0
7 6 5 4 3 2 1 0
BORDER COLOR
Bits 7–0 Border Color. This 8-bit register determines the border color displayed on the CRT
screen. The border is an area around the screen display area.
This register is only effective in 8-bit PA modes (CR67_4 = 0). See also CR33_5.
This register enables the respective video memory color plane 3–0 and selects video color outputs to
be read back in the display status.
7 6 5 4 3 2 1 0
VDT-SEL
=0 =0 1 0 DISPLAY PLANE ENBL
This register specifies the number of pixels to shift the display data horizontally to the left. Pixel panning
is available in both text and graphics modes. It is not available with Enhanced mode memory mappings
(CR31_3 = 1).
7 6 5 4 3 2 1 0
=0 =0 =0 =0 NUMBER OF PAN SHIFT
This register specifies the high-order bits of video output when pixel padding is enabled and disabled
in the 256 color mode.
7 6 5 4 3 2 1 0
PIXEL PADDING
=0 =0 =0 =0 V7 V6 V5 V4
All of the RAMDAC registers described in this section are physically located inside ViRGE.
This register is the pixel read mask register to select pixel video output. The CPU can access this register
at any time.
7 6 5 4 3 2 1 0
DAC ADDRESS MASK
This register contains the pointer to one of 256 palette data registers and is used when reading the
color palette.
7 6 5 4 3 2 1 0
DAC READ ADDRESS
1. Write the color code to this register (RAMDAC Read Index) at address 3C7H.
2. The contents of the location in the color look-up table pointed to by the color code
are transferred to the RAMDAC data register at address 3C9H.
3. Three bytes are read back from the RAMDAC data register.
4. The contents of this register auto-increment by one.
5. Go to step 2.
The effects of writing to the RAMDAC data register during a three-byte read cycle or
reading from the RAMDAC data register during a 3-byte write cycle (i.e., interrupting
the sequence) are undefined and may change the look-up table contents.
7 6 5 4 3 2 1 0
=0 =0 =0 =0 =0 =0 DAC-STS
Reads from the RAMDAC Write Index at address 3C8H or the DAC status register at
address 3C7H do not interfere with read or write cycles and may take place at any
time.
7 6 5 4 3 2 1 0
DAC WRITE ADDRESS/GIP READ DATA
1. Write the color code to this register (DAC Write Index) at address 3C8H.
2. Three bytes are written to the DAC Data register at address 3C9H.
3. The contents of the DAC data register are transferred to the location in the color
look-up table pointed to by the color code.
4. The DAC Write Index register auto-increments by 1.
5. Go to step 2.
If bit 2 of the Extended RAMDAC Control register (CR55) is set to 1 to enable the Gen-
eral I/O Port read function, a read of 3C8H retrieves data from an external input buff-
er. The data is transmitted via GD[7:0] to AD[7:0] for a PCI bus configuration and
directly to SD[7:0] for a VL-Bus configuration.
This register is a data port to read or write the contents of the location in the color look-up table pointed
to by the DAC Read Index or the DAC Write Index registers.
7 6 5 4 3 2 1 0
DAC READ/WRITE DATA
The following registers are located in the Sequencer Register address space not used by the standard
VGA. SR8 must be programmed with an appropriate value to unlock access to these registers.
In the following register descriptions, ‘U’ stands for undefined or unused and ‘R’ stands for reserved
(write = 0, read = U).
See Appendix A for a table listing each register in this section and its page number.
Loading xxxx0110b (e.g., 06H) unlocks accessing of all the S3 extensions (SR9 - SR1C) to the standard
VGA Sequencer register set. (x = don’t care).
7 6 5 4 3 2 1 0
R R R R =0 =1 =1 =0
7 6 5 4 3 2 1 0
MMIO-
ONLY R R R R R R R
7 6 5 4 3 2 1 0
2 P50 PD-
MCLK SEL NTRI R R R R R
The default value of 0 reduces power consumption. The pins are enabled for output
only as needed. Note that output pads for PD[63:29] also latch the most recent output
state.
Setting this bit to 1 improves performance for systems using an MCLK less than 57
MHz. For MCLK frequencies between 55 and 57 MHz, bit 7 of SR15 should also be set
to 1 if linear addressing is being used.
7 6 5 4 3 2 1 0
VAFC DOT=
ALT COLOR MODE R R VCLKI VCLKI
Bits 7-4 ALT COLOR MODE - Color Mode for feature connector input
0000 = Mode 0: 8-bit color, 1 pixel/VCLK
0001 = Mode 8: 8-bit color, 2 pixels/VCLK
0011 = Mode 9: 15-bit color, 1 pixel/VCLK
0101 = Mode 10: 16-bit color, 1 pixel/VCLK
All other mode values are reserved. Setting mode 0001 (clock doubled mode) also re-
quires that either bit 4 or bit 6 of SR15 be set to 1 and that bit 7 of SR18 be set to 1.
Clock doubling cannot be used with the Streams Processor active.
This register provides feature connector control and also provides independent control of the
HSYNC and VSYNC signals, therefore supporting the VESA DPMS (Display Power Management Con-
trol) standard.
7 6 5 4 3 2 1 0
VSY-CTL HSY-CTL R R LPB EN-
1 0 1 0 FEAT FEAT
The LPB must be disabled and feature connector operation enabled for this bit to
have an effect. This bit should always be set to 1 before feature connector operation
is enabled. It must be cleared to 0 for Scenic Highway operation.
The power-on default value for this register in conjunction with the power-on default value for SR11
generate an MCLK value of 45 MHz. All other MCLK values must be specified by programming of
SR10 and SR11. Loading of a new value is enabled by either bit 0 or bit 5 of SR15.
7 6 5 4 3 2 1 0
R PLL R VALUE PLL N-DIVIDER VALUE
Bit 7 Reserved
The power-on default value for this register in conjunction with the power-on default value for SR10
generate an MCLK value of 45 MHz. All other MCLK values must be specified by programming of
SR10 and SR11. Loading of a new value is enabled by either bit 0 or bit 5 of SR15.
7 6 5 4 3 2 1 0
R PLL M-DIVIDER VALUE
Bit 7 Reserved
The power-on default value for this register in conjunction with the power-on default value for SR13
generate a DCLK value of 25.175 MHz. The default value is automatically placed in this register when
bits 3-2 of 3C2H are programmed to 00b. If bits 3-2 of CR2H are programmed to 01b, the appropriate
PLL R and PLL N values for a 28.322 MHz DCLK will automatically be placed in this register. All other
DCLK values must be specified by programming of SR12 and SR13. Loading of a new value is enabled
by either bit 1 or bit 5 of SR15 and by setting bits 3-2 of 3C2H to 11b.
7 6 5 4 3 2 1 0
R PLL R VALUE PLL N-DIVIDER VALUE
Bit 7 Reserved
The power-on default value for this register in conjunction with the power-on default value for SR12
generate a DCLK value of 25.175 MHz. The default value is automatically placed in this register
when bits 3-2 of 3C2H are programmed to 00b. If bits 3-2 of CR2H are programmed to 01b, the ap-
propriate PLL M value for a 28.322 MHz DCLK will automatically be placed in this register. All other
DCLK values must be specified by programming of SR12 and SR13. Loading of a new value is en-
abled by either bit 1 or bit 5 of SR15 and by setting bits 3-2 of 3C2H to 11b.
7 6 5 4 3 2 1 0
R PLL M-DIVIDER VALUE
Bit 7 Reserved
7 6 5 4 3 2 1 0
EXT EXT P151 CLR CLK EN MPLL DPLL
DCLK MCLK SEL CNT TEST CNT PD PD
Setting this bit to 1 allows pin 151 to act as an MCLK input. This is enabled by setting
bit 6 of this register to 1.
This bit can also be set to 1 at reset via power-on strapping of PD11. An external
MCLK is only used for S3 test purposes.
This bit can also be set to 1 at reset via power-on strapping of PD11. An external
DCLK is only used for S3 test purposes.
7 6 5 4 3 2 1 0
2 CYC DCLK\ CLK DCLK/ VCLK MCLK DRFQ MFRQ
MWR INV LOAD 2 OUT OUT EN EN
When new MCLK PLL values are programmed, this bit can be set to 1 to load these
values in the PLL. The loading may be delayed a small but variable amount of time.
This bit should be cleared to 0 after loading to prevent repeated loading. Alternately,
use bit 5 of this register to produce an immediate load.
When new DCLK PLL values are programmed, this bit can be set to 1 to load these
values in the PLL. Bits 3-2 of 3C2H must also be set to 11b if they are not already at
this value. The loading may be delayed a small but variable amount of time. This bit
should be programmed to 1 at power-up to allow loading of the VGA DCLK value and
then left at this setting. Use bit 5 of this register to produce an immediate load.
This bit is effective only when the LPB feature connector is enabled.
Either this bit or bit 6 of this register must be set to 1 for clock doubled RAMDAC op-
eration (mode 0001).
To produce an immediate MCLK and DCLK load, program this bit to 1 and then to 0.
Bits 3-2 of 3C2H must also then be programmed to 11b to load the DCLK values if
they are not already programmed to this value. This register must never be left set to
1.
Either this bit or bit 4 of this register must be set to 1 for clock doubled RAMDAC op-
eration (mode 0001).
Setting this bit to 1 bypasses the VGA logic for linear addressing when bit 7 of SRA is
set to 1. This can allow 2 MCLK operation for MCLK frequencies between 55 and 57
MHz.
7 6 5 4 3 2 1 0
CLOCK TEST RESULTS HIGH BYTE
7 6 5 4 3 2 1 0
CLOCK TEST RESULTS LOW BYTE
7 6 5 4 3 2 1 0
CLKx LUT DAC TST TST TST TST TST
2 WR PD BLUE GRN RED RST EN
When the RAMDAC is powered down, the RAMDAC memory retains its data.
This bit must be set to 1 when mode 0001 is specified in bits 7-4 of CR67 or SRC.
Either bit 4 or bit 6 of SR15 must also be set to 1.
7 6 5 4 3 2 1 0
R R R R R R SIGSEL
GOP0 and GOP1 are bits 0-1 of the General Output Port register (CR5C).
When the system powers up with a default value of 00b for bits 1-0, both pin 151 and
pin 153 will be driven high (logic 1) for VL-Bus configurations and pins 151 and 190
will be driven high for PCI bus configurations.
ViRGE has additional registers to extend the functions beyond VGA. These registers are located in CRT
Controller address space at locations not used by the IBM VGA. All of these registers are read/write
protected at power-up by hardware reset. In order to read/write these registers, CR38 and/or CR39 must
be loaded with a changed key pattern (see the register description). The registers will remain unlocked
until the key pattern is reset by altering a significant bit.
In the following register descriptions, ‘R’ stands for reserved (write =0, read = undefined). See Appendix
A for a table listing each register in this section and its page number.
This register should contain the same value as the upper byte of the PCI Device ID (Index 02H) register.
7 6 5 4 3 2 1 0
CHIP ID HIGH (56H)
7 6 5 4 3 2 1 0
CHIP ID LOW (31H)
7 6 5 4 3 2 1 0
REVISION LEVEL
7 6 5 4 3 2 1 0
CHIP ID REVISION STATUS
7 6 5 4 3 2 1 0
HST OLD-DSAD ENH VGA CPUA
R DFF 17 16 MAP 16B R BASE
Bit 1 Reserved
This is useful in VGA text modes when VGA graphics controller functions are typi-
cally not used.
Setting this bit to 1 overrides the settings of bit 6 of CR14 and bit 3 of CR17 and
causes the use of doubleword memory addressing mode. Also, the function of bits 3-
2 of GR6 is overridden with a fixed 64K map at A0000H.
Bits 5–4 OLD-DSAD 17, 16 - Old Display Start Address Bits 17-16
Bits 17-16 of start address (CRC, CRD) and cursor location (CRE, CRF)
Bits 1-0 of the Extended System Control 2 register (CR51) are bits 19-18 of the ad-
dress and enable access to up to 4 MBytes of display memory. If a value is pro-
grammed into bits 3-0 of the Extended System Control 3 register (CR69), this value
becomes the upper 4 bits of the display start base address and bits 5-4 of CR31 and
bits 1-0 of CR51 are ignored.
Bit 6 HST DFF - Enable High Speed Text Display Font Fetch Mode
0 = Normal font access mode
1 = Enable high speed text display
Setting this bit to 1 is only required for DCLK rates greater than 40 MHz. See bit 5 of
CR3A.
Bit 7 Reserved
7 6 5 4 3 2 1 0
VGA INT
R FXPG R EN R R R R
Bit 5 Reserved
The standard 256K VGA memory page always ends on a natural 256K boundary and
accesses beyond this boundary will wrap. If the starting address is moved via bits 4-0
of CR69 (or bits 5-4 of CR31 and bits 1-0 of CR51), the 256K page may not end on a
256K boundary and accesses past the boundary will not wrap. This is the case when
this bit is cleared to 0. For standard VGA compatibility when the page base address is
moved, this bit is set to 1 to cause wrapping at a 256K boundary.
Bit 7 Reserved
7 6 5 4 3 2 1 0
LOCK BDR LOCK VCLK= DIS
R PLTW SEL DACW -DCK R VDE R
Bit 0 Reserved
Bit 1 DIS VDE - Disable Vertical Display End Extension Bits Write Protection
0 = VDE protection enabled
1 = Disables the write protect setting of the bit 7 of CR11 on bits 1 and 6 of CR7
Bit 2 Reserved
Bit 7 Reserved
7 6 5 4 3 2 1 0
ENB PCI PCI PCI
R R R SFF R RET ABT SNP
Bit 3 Reserved
7 6 5 4 3 2 1 0
LOCK LOCK OLD-CPU-BASE-ADDRESS
R R HTMG VTMG 17 16 15 14
Bits 3-2 of the Extended System Control 2 register (CR51) are bits 19-18 of the ad-
dress and enable access to up to 4 MBytes of display memory. If a value is pro-
grammed into bits 5-0 of the Extended System Control 4 register (CR6A), this value
becomes the upper 6 bits of the CPU base address and bits 3-0 of CR35 and bits 3-2 of
CR51 are ignored.
CR6
CR7 (bits 7,5,3,2,0)
CR9 (bit 5)
CR10
CR11 (bits 3-0)
CR15
CR16
CR6, CR7 registers are also locked by bit 7 of the Vertical Retrace End register (CR11).
CR00
CR1
CR2
CR3
CR4
CR5
CR17 (bit 2)
All these registers (except bit 2 of CR17) are also locked by bit 7 of the Vertical Re-
trace End register (CR11).
* Bits 1-0 are read only. The other bits can be written only after 0A5H is written to CR39.
This register samples the reset state from PD bus pins [7:0]. Other configuration strapping bits are
found in CR37, CR68 and CR6F.
7 6 5 4 3 2 1 0
MEM SIZE VBE MEM MODE SYS BUS
This register samples the reset state from PD bus pins [15:8]. Other configuration strapping bits are
found in CR36, CR68 and CR6F.
7 6 5 4 3 2 1 0
R R R RS CS VBS R EV
Bit 1 Reserved
Loading 01xx10xx (e.g., 48H) into this register unlocks the extended CRTC registers from CR2D through
CR3F for read/writes. (x = don’t care)
7 6 5 4 3 2 1 0
=0 =1 =1 =0
Loading 101xxxxx (e.g., A0H) unlocks the extended CRTC registers registers from CR40 through CRFF
for reading/writing (x = don’t care). Loading A5H allows bits 7-2 of CR36, bits 7-0 of CR37 and bits 7-0
of CR68 to be written.
7 6 5 4 3 2 1 0
=1 =0 =1
7 6 5 4 3 2 1 0
PCIRB HST ENH TOP ENB REF-CNT
DISA R DFW 256 MEM RFC 1 0
If enabled by setting bit 2 of this register to 1, these bits override the refresh count in
bit 6 of CR11 and specify the number of refresh cycles per horizontal line.
Setting this bit to 1 is only required for DCLK rates greater than 40 MHz. See bit 6 of
CR31.
Bit 6 Reserved
This value must lie in the horizontal blanking period and is typically 5 less than the value pro-
grammed in CR0. This parameter helps to ensure that adequate time is available during horizontal
blanking for activities such as RAM refresh that require control of the display memory. Bit 9 of this
value is bit 6 of CR5D. This register must be enabled by setting bit 4 of CR34 to 1.
7 6 5 4 3 2 1 0
START DISPLAY FIFO FETCH
This value allows determination of the even/odd row active display starting positions when operat-
ing in an interlaced mode. This register is enabled by bit 5 of CR42.
7 6 5 4 3 2 1 0
INTERLACE RETRACE START POSITION
7 6 5 4 3 2 1 0
RDY EN
=0 =0 R CTL R R R ENH
7 6 5 4 3 2 1 0
BIOS-FLAG-REGISTER-1
7 6 5 4 3 2 1 0
INTL
R R MODE R R R R R
7 6 5 4 3 2 1 0
HCTR OLD
X2 R R R R LSW8 R R
7 6 5 4 3 2 1 0
HWGC HWGC
R R R 1280 R R R ENB
The high order three bits are written into CR46 and the low order byte is written into CR47.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R HWGC ORG X (H) HWGC ORG X (L)
Bits 10–0 HWGC ORG X(H) (L) - X-Coordinate of Cursor Left Side
The high order three bits are written into CR48 and the low order byte is written into CR49.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R HWGC ORG Y (H) HWGC ORG Y (L)
7 6 5 4 3 2 1 0
TRUE COLOR FOREGROUND STACK (0-2)
Three foreground color registers are stacked at this address. The stack pointer (com-
mon with CR4B) is reset to 0 by reading the Hardware Graphics Cursor Mode register
(CR45). Each write to this register (CR4A) increments the stack pointer by 1, so three
writes provide 24 bits of true color information.
7 6 5 4 3 2 1 0
TRUE COLOR BACKGROUND STACK (0-2)
Three background color registers are stacked at this address. The stack pointer (com-
mon with CR4A) is reset to 0 by reading the Hardware Graphics Cursor Mode register
(CR45). Each write to this register (CR4B) increments the stack pointer by 1, so three
writes provide 24 bits of true color information.
The high order four bits are written into CR4C and the low order byte is written into CR4D.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R HWGC STA(H) HWGC STA(L)
Bits 11–0 HWGC STA(H)(L) - Hardware Graphics Cursor Storage Start Address
7 6 5 4 3 2 1 0
R R HWGC PAT DISP START X-POS
Bits 5–0 HWGC PAT DISP START X-POS - HWGC Pattern Display Start-X Pixel Position
This value is the offset (in pixels) from the left side of the 64x64 cursor pixel pattern
from which the cursor is displayed. This allows a partial cursor to be displayed at the
left border of the display.
7 6 5 4 3 2 1 0
R R HWGC PAT DISP START Y-POS
Bits 5–0 HWGC PAT DISP START Y-POS - HWGC Pattern Display Start-Y Pixel Position
This value is the offset (in pixels) from the top of the 64x64 cursor pixel pattern from
which the cursor is displayed. This allows a partial cursor to be displayed at the top
of the display.
7 6 5 4 3 2 1 0
LOG-SCR-W OLD-CBAD OLD-DSAD
R R 9 8 19 18 19 18
7 6 5 4 3 2 1 0
EXT-BIOS-FLAG-REGISTER-1
7 6 5 4 3 2 1 0
SWP MMIO MMIO BIG ENDIAN
R NBL WIN SELECT LIN ADDR R
Bit 0 Reserved
Bits 2-1 BIG ENDIAN LIN ADDR - Big Endian Data Byte swap (linear addressing only)
00 = No swap (Default)
01 = Swap bytes within each word
10 = Swap all bytes in doublewords (bytes reversed)
11 = Reserved
Bits 4-3 of this register must be programmed to 10b for this bit to be effective.
Bit 7 Reserved
7 6 5 4 3 2 1 0
R R R R R R BIG ENDIAN
Bits 1–0 BIG ENDIAN - Big Endian Data Byte Swap (not linear addressing or image writes)
00 = No swap (Default)
01 = Swap bytes within each word
10 = Swap all bytes in doublewords (bytes reversed)
11 = Swap according to BE[3:0] (VL-Bus) or C/BE[3:0] (PCI)
7 6 5 4 3 2 1 0
TOFF MS R ENB
VCLK R R /X11 GIR R R
When this bit is set to 1 and SR1C_10 = 01b, the GPIOSTR strobe for reading General
Input Port data is generated when 3C8H is read. The data is transmitted directly to
SD[7:0] for VL-Bus configurations. PCI configurations must use the LPB General Input
Port capability.
Bit 3 Reserved
This bit select the type of decoding used for the 64x64x2 storage array of the hard-
ware graphics cursor. See the Programming the Hardware Cursor section for a de-
scription of the decoding.
7 6 5 4 3 2 1 0
DIS DIS
R R R R R VSYN HSYN R
Bit 0 Reserved
7 6 5 4 3 2 1 0
RAS ENB LAT LAW-SIZE
PRE R R LA DEL R 1 0
Bit 2 Reserved
This bit is effective only when one decode wait state is selected by setting bit 4 of
CR40 to 1.
Enabling linear addressing disables access to the A000H-AFFFH region unless bank-
ing is enabled via bit 0 of CR31, the window size is set to 64K via bits 1-0 of this regis-
ter and A000H is specified as the base in CR59-5A.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LINEAR-ADDRESS-WINDOW-POSITION
CR59 contains the upper byte (15-8) and CR5A contains the lower byte (7-0). These registers specify
system address bits 31-16 of the Linear Address Window Position in 32-bit CPU address space. The
Linear Address Window resides on a 64KB, 1MB, 2MB or 4MB memory boundary (size-aligned
boundary). Some LSBs of this register (illustrated by “xx..xx” in the following table) are ignored
because of the size-aligned boundary scheme.
Bits 15-0 are common with bits 31-16 of the base address programmed into the PCI
Base Address 0 register at address 10H-12H. Writes to these bits in either register will
also be written to the other. Writes to CR59 and CR5A should be read-modify- writes
that do not change the upper 6 bits, as these bits are written by the system BIOS to
place ViRGE in a unique address space. Note that system BIOS writes will leave bits 9-
0 in an indeterminate state, so these should be properly initialized before linear ad-
dressing is enabled.
If a 64K window is specified and bit 0 of CR31 is set to 1, bits 5-0 of CR6A specify the
64K page of display memory to be accessed through a 64K window located at the ad-
dress specified in these registers.
7 6 5 4 3 2 1 0
GENERAL OUT PORT
This register can be used in a variety of ways. See Section 12-4 for a complete de-
scription.
7 6 5 4 3 2 1 0
SFF EHS SHS EHB SHB HDE HT
R 8 6 8 7 8 8 8
Bit 7 Reserved
7 6 5 4 3 2 1 0
LCM VRS SVB VDE VT
R 10 R 10 R 10 10 10
Bit 3 Reserved
Bit 5 Reserved
Bit 7 Reserved
7 6 5 4 3 2 1 0
R BIG ENDIAN R R R R R
Bits 6-5 BIT ENDIAN - Big Endian Data Byte Swap (image writes only)
00 = No swap (Default)
01 = Swap bytes within each word
10 = Swap all bytes in doublewords (bytes reversed)
11 = Reserved
Bit 7 Reserved
7 6 5 4 3 2 1 0
DELAY BLANK DAC
R R 2 1 0 MMIO R R
7 6 5 4 3 2 1 0
PCI TOFF PCI ENBL
DE PADT R R DISC R RST ENH
This bit has the same function as MM850C_0. It enables operation of the S3D Engine.
Setting this bit has the same effect as setting MM8504_15-14 (Write) to 10b.
Bit 2 Reserved
Setting this bit to 1 allows PCI burst cycles to be interrupted if AD[1:0] ≠ 00b or if the
address during the burst goes outside the address ranges supported by ViRGE.
7 6 5 4 3 2 1 0
COLOR MODE STREAMS VCLK
3 2 1 0 MODE R PHS
Bit 1 Reserved
The Streams Processor should only be enabled or disabled during the VSYNC period.
This is the third byte (along with CR36 and CR37) of the power-on strapping bits. CR6F contains the
fourth byte. PD[23:16] are sampled on power-on reset and their states are written to bits 7-0 of this
register. A5H must be written to CR39 to provide read/write access to this register.
7 6 5 4 3 2 1 0
RAS - RAS - CAS/OE
R BIOS AREA PCG LOW ADJUST
If MM8204_7 = 0, the trailing edges of CAS/OE active are delayed by the amount indi-
cated by these bits. If MM8204_7 = 1, the entire CAS/OE active pulses are shifted (de-
layed) by the amount indicated by these bits. The timing adjustment shown above is
an approximation. It is affected by both process and signal loading and must be
measured for each design.
This parameter specifies the length of the RAS active time for a single row/column ac-
cess. RAS may be held low longer to accommodate additional page mode accesses
to the same row.
When RAS goes high to end a memory cycle, this parameter specifies the minimum
period it must be held high before beginning another memory access cycle.
Bit 7 Reserved
7 6 5 4 3 2 1 0
R R R R DISPLAY-START-ADDRESS
7 6 5 4 3 2 1 0
R R CPU-BASE-ADDRESS
7 6 5 4 3 2 1 0
EXT-BIOS-FLAG-REGISTER-3
7 6 5 4 3 2 1 0
EXT-BIOS-FLAG-REGISTER-4
7 6 5 4 3 2 1 0
RESERVED
7 6 5 4 3 2 1 0
RAMDAC SIGNATURE TEST DATA
This is the fourth byte of power-on strapping bits. PD[28:24] are sampled at reset and the values are
written to bits 4-0 of this register. A5H must be written to CR39 to provide read/write access to this
register. This register will power up with a value of 1FH if any of PD[28:24] are not pulled low.
7 6 5 4 3 2 1 0
R R R WE ADJUST IOEN IOSEL R
Bit 0 Reserved = 0
Bit 2 of this register must be cleared to 0 for this bit to have effect.
Enabling I/O access allows the serial port to be used for I2C communications when
ViRGE is disabled.
If MM8204_8 = 0, both the leading and trailing edges of WE are delayed by the
amount specified in these bits. If MM8204_8 = 1, only the trailing edge is delayed by
the amount specified in these bits.
This section describes the S3d Registers for ViRGE. These registers are used to accelerate the display
of 2D and 3D graphics.
In all register bit descriptions, the letter “R” identifies reserved bits (a reserved bit’s read value is
undefined unless noted, and you may write only zero to a reserved bit).
The S3d registers are memory-mapped starting at an offset of 100 A0000H from the base address.
Table 19-1 shows the location of each register organized by drawing command type. All registers with
the same mnemonic for different commands are the same register with multiple addresses. For
example, at "xx" = D4, the three 2D commands use a register called SRC_BASE, with each of the 2D
commands having a unique address for this register. Similarly, the two 3D commands share the Z-BASE
register. The DEST_BASE register is shared by all commands at "xx" = D8. Each shared register is
described only once in a section (2D or 3D) along with all of its addresses.
When the ROP chosen for a BitBLT uses a color pattern, the 8x8 pixel pattern data must be stored in
the register address space starting at offset 100 A100H. The amount of register space required is a
function of the color depth as shown in Table 19-2. The value is derived by multiplying 64 pixels (8x8
pattern) by the color depth (bytes/pixel) and dividing by 4 bytes/doubleword (32-bit registers).
The pattern color data is written starting with the upper left pixel (0,0) to the end of the line (7,0) and
then proceeding across each line to the last pixel (8,8). Pixel 0,0 is written to 100 A100H. The data are
stored fully packed.
For 8 bits/pixel, pixel 0,0 is written to the low order byte 0, pixel 1,0 is written to byte 1, etc. Pixel 4,0
would then be written to the low order byte of 100 A104H and so on. The 8-bit value for each pixel is
an index to the DAC palette registers.
For 16 bits/pixel, pixel 0,0 is written to the low order word of 100 A100H, pixel 1,0 to the high order
word, etc. Either RGB1555 or RGB565 coding can be used.
For 24 bits/pixel, pixel 0,0 is written to the 3 low order bytes of 100 A100H (RGB888 format). The blue
value for pixel 1,0 is written to the high order byte of 100 A100H. The red and green values for pixel
1,0 are written to the low order word of 100 A104H and so on. Thus pixel data crosses doubleword
boundaries.
19.3 2D REGISTERS
This section describes all the registers used with the 2D drawing commands (BitBLT/Rectangle Fill, 2D
Line and 2D Polygon).
Read/Write Offset: A4D4H (BitBLT), A8D4H (2D Line), ACD4H (2D Polygon)
Power-On Default: Undefined
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SOURCE BASE ADDRESS 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R SOURCE BASE ADDRESS
Value = base address in video memory of source data for 2D drawing operations
(quadword aligned)
This value is required when the source is video memory (screen). It is different from
the destination base address when the data is located in off-screen memory. This is
the 0,0 pixel address for off-screen data. The stride for off-screen data is programmed
in the Destination/Source Stride register (MMxxE4).
Read/Write Offset: A4D8H (BitBLT), A8D8H (2D Line), ACD8H (2D Polygon)
Power-On Default: Undefined
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DESTINATION BASE ADDRESS 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R DESTINATION BASE ADDRESS
Value = base address in video memory of destination data for 2D drawing operations
(quadword aligned)
This is the 0,0 pixel address in video memory for the screen resolution being used. It
will normally be at the start of video memory.
Read/Write Offset: A4DCH (BitBLT), A8DCH (2D Line), ACDCH (2D Polygon)
Power-On Default: Undefined
Bit 1 of the Command Set register must be set to 1 for the settings in this register to have effect.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R RIGHT CLIPPING LIMIT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R LEFT CLIPPING LIMIT
Value = pixel position of the last pixel to be drawn on each line. The first pixel is 0.
Value = pixel position of the first pixel to be drawn on each line. The first pixel is 0.
Read/Write Offset: A4E0H (BitBLT), A8E0H (2D Line), ACE0H (2D Polygon)
Power-On Default: Undefined
Bit 1 of the Command Set register must be set to 1 for the settings in this register to have effect.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R BOTTOM CLIPPING LIMIT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R TOP CLIPPING
LIMIT
Value = line position of the last line to be drawn. The first line is 0.
Value = line position of the first line to be drawn. The first line is 0.
Read/Write Offset: A4E4H (BitBLT), A8E4H (2D Line), ACE4H (2D Polygon)
Power-On Default: Undefined
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R SOURCE STRIDE 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R DESTINATION STRIDE 0 0 0
Value = byte offset of vertically adjacent pixels for the source data. Bits 2-0 must be
000b.
Value = byte offset of vertically adjacent pixels for the destination data. Bits 2-0 must
be 000b.
The pattern data in this register is used when bit 8 of the Command Set register is set to 1 to specify
a mono pattern. The first four lines of the pattern are specified in this register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
L20 L21 L22 L23 L24 L25 L26 L27 L10 L11 L12 L13 L14 L15 L16 L17
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
L40 L41 L42 L43 L44 L45 L46 L47 L30 L31 L32 L33 L34 L35 L36 L37
The second (high order) 32 bits are found in the Mono Pattern 1 register. These two
registers define an 8x8 mono pattern. In the above register bit table, LXY means bit Y
of line X, with the leftmost bit of each line (row) being bit 0.
The pattern data in this register is used when bit 8 of the Command Set register is set to 1 to specify
a mono pattern. The second four lines of the pattern are specified in this register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
L60 L61 L62 L63 L64 L65 L66 L67 L50 L51 L52 L53 L54 L55 L56 L57
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
L80 L81 L82 L83 L84 L85 L86 L87 L70 L71 L72 L73 L74 L75 76 L77
Value = second (high order) 32 bits of a 64-bit mono pattern (little endian format)
The first (low order) 32 bits are found in the Mono Pattern 0 register. These two regis-
ters define an 8x8 mono pattern. In the above register bit table, LXY means bit Y of
line X, with the leftmost bit of each line (row) being bit 0.
The pattern color data in this register is used when bit 8 of the Command Set register is set to 1 to
specify a mono pattern and the pattern bit is 0. The color depth specified must match the value se-
lected by bits 4-2 of the Command Set register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA 2 DATA 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R DATA 3
Value = DAC CLUT index (8 bits/pixel), lower byte of color data (15/16 bits/pixel), blue
color index (24 bits/pixel
Value = Reserved (8 bits/pixel), upper byte of color data (15/16 bits/pixel), green color
index (24 bits/pixel)
Read/Write Offset: A4F4H (BitBLT), A8F4H (2D Line), ACF4H (2D Polygon)
Power-On Default: Undefined
The pattern color data in this register is used when bit 8 of the Command Set register is set to 1 to
specify a mono pattern and the pattern bit is 1. It is also the pattern color used for rectangle fills,
line draws and polygon fills, regardless of any pattern specification. The color depth specified must
match the value selected by bits 4-2 of the Command Set register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA 2 DATA 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R DATA 3
Value = DAC CLUT index (8 bits/pixel), lower byte of color data (15/16 bits/pixel), blue
color index (24 bits/pixel
Value = Reserved (8 bits/pixel), upper byte of color data (15/16 bits/pixel), green color
index (24 bits/pixel)
For mono image transfers (bit 6 of the Command Set register set to 1), this is the source color when
the image bit is 0. It is not used when color compare is enabled (bit 9 of the Command Set register
set to 1). The color depth specified must match the value selected by bits 4-2 of the Command Set
register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA 2 DATA 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R DATA 3
Value = DAC CLUT index (8 bits/pixel), lower byte of color data (15/16 bits/pixel), blue
color index (24 bits/pixel
Value = Reserved (8 bits/pixel), upper byte of color data (15/16 bits/pixel), green color
index (24 bits/pixel)
For mono image transfers (bit 6 of the Command Set register set to 1), this is the source color when
the image bit is 1. For 8- or 15/16-bits/pixel color image transfers when transparent color is enabled
(bit 9 of the Command Set register set to 1), the image data color is compared with this color. If it
matches, the screen is not updated. If it does not match, the image data color is used to update the
screen. In all cases, the color depth specified must match the value selected by bits 4-2 of the Com-
mand Set register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA 2 DATA 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R DATA 3
Value = DAC CLUT index (8 bits/pixel), lower byte of color data (15/16 bits/pixel), blue
color index (24 bits/pixel)
Value = DAC CLUT index (8 bits/pixel), upper byte of color data (15/16 bits/pixel),
green color index (24 bits/pixel)
The 8 bits/pixel color must be programmed to both the DATA 1 and DATA 2 bytes.
The 24 bits/pixel color is used only for mono image transfers.
Read/Write Offset: A500H (BitBLT), A900H (2D Line), AD00H (2D Polygon)
Power-On Default: Undefined
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R FDO ITA TP MP IDS MS DE DEST FORMAT HC AE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
23D 2D COMMAND YP XP 256 ROPS R
Bit 0 AE - Autoexecute
0 = Execute command when this register is written to
1 = Execute command when the highest address register in a drawing type set is
written to
The highest address register in a drawing type set is easily seen in Table 20-1, where
it is the bottom register in each column. For example, if this bit is set to 1, a BitBLT is
executed when the RDEST_XY (MMA50C) register is written to. Similarly, execution
of a 2D line command is based on writing to the LYCNT register, etc. This setting al-
lows multiple executions of a given command using different parameters without re-
writing the Command Set register.
To turn off autoexecute without executing a command, write to this register with this
bit cleared to 0 and bits 30-27 programmed to 1111b (NOP).
The settings in the clipping registers (MMxxDC, MMxxE0) are effective only when this
bit is set to 1.
Parameter values calculated during the execution of the command end up the same
regardless of the setting of this bit. That is, the command is fully executed except for
the possible non-drawing of the new pixel.
When this bit is set to 1, source data is provided by CPU writes to the offset range of
100 0000H to 100 7FFFH or the alternate image transfer port range of 100 D000H to
100 EFFFH. Bit 6 of this register specifies whether mono or color data is being trans-
ferred.
This bit is cleared to 0 for a BitBLT using a ROP with a color source. The 8x8 color pat-
tern is found starting at location 100 A100H. For a mono pattern, the pattern informa-
tion is determined from the Mono Pattern 0 and 1 registers. This bit must be set to 1
for a rectangle fill operation.
Bit 9 TP - Transparent
0 = A mono source image transfer uses both the source foreground (image bit = 1)
and source background (image bit = 0) colors to update the screen. A color image
transfer uses the CPU-provided colors.
1 = A mono source image transfer updates the screen only when the source
foreground color is selected (image bit = 1). Otherwise (image bit = 0), the screen
pixel is left unchanged. A color image transfer updates the screen with the
transmitted color only when that color does not match the color in the source
foreground color register. If a color match occurs, the destination pixel is not
updated. This transparent color feature for color image transfers can be used for
8- and 16-bit color modes, but not for 24-bit color.
Note: This bit is effective only when bit 7 of this register is set to 1. A setting of 1 for
the mono source case provides "transparent text" capability. The term "transparent
text" refers to the updating of only the pixels forming the text characters and not the
entire rectangular text block using the background color for non-text areas.
All image transfers are doublewords. If the end of a bit map line is reached within a
doubleword transfer, the setting of these bits determines how the start of the next
line is handled. If doubleword aligned, data in the last doubleword beyond the end of
the line is discarded and the next line begins on the next doubleword. If word aligned
and an upper word of data remains after the end of the line is reached, that word will
be used to begin the next line. If byte aligned, the next line with begin on the next
byte in the doubleword after the end of the line. The latter is used only for mono
source data, e.g., text.
Value = binary key selecting one of 256 three operand raster operations as defined in
Appendix A.
The full 256 three-operand ROPs are available for BitBLT and image transfer opera-
tions. The other 2D operations (Rectangle Fill, Line Draw and Polygon Fill) can only
use the subset of the 256 ROPs that does not have a source. When the ROP contains a
pattern, the pattern must be mono and the hardware forces the pattern value to the
pattern foreground color regardless of the values programmed in the Mono Pattern
registers.
The NOP option is required to turn off autoexecute without executing a command.
See the definition for bit 0 of this register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R RECTANGLE HEIGHT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R RECTANGLE WIDTH
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SOURCE Y
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R SOURCE X
Value = y coordinate in lines of the upper left hand corner of the source rectangle for
a BitBLT
Value = x coordinate in pixels of the upper left hand corner of the source rectangle for
a BitBLT
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R DESTINATION Y
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R DESTINATION X
Value = y coordinate in lines of the upper left hand corner of the filled rectangle to be
drawn or the destination for a BitBLT
Value = x coordinate in pixels of the upper left hand corner of the filled rectangle to
be drawn or the destination for a BitBLT
This register specifies the x coordinates of the first and last pixels drawn for a line. This provides
the ability to not draw the last pixel of each line segment when the line is to be extended to form a
polyline.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 END1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 0 0 0 0 END0
Value = x coordinate (in pixels) of the last pixel to be drawn for the topmost scanline.
The first coordinate value is 0. Bits 15-11 are sign bits and must be 0’s to indicate a
positive value.
Value = x coordinate (in pixels) of the first pixel to be drawn for the bottommost scan-
line. The first coordinate value is 0. Bits 31-27 are sign bits and must be 0’s to indicate
a positive value.
ViRGE line draw always proceeds from bottom to top. If the requested line is drawn
upward with a don’t draw the last pixel instruction, the END0 coordinate will be the
same as the requested start x coordinate and the END1 coordinate will be 1 less (if
drawn from left to right) or 1 more (if drawn from right to left) than the requested end
x coordinate. If the requested line is drawn downward, the END1 coordinate will be
the same as the requested start x coordinate and the END0 coordinate will be 1 more
(if drawn from right to left) or one less (if drawn from left to right) than the requested
end x coordinate. See the programming examples for 2D line draw for a more de-
tailed explanation.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
X DELTA HIGH
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
X START HIGH
For an X major line, the absolute x value increases faster than the absolute y value as
the line is drawn. In this case, there may be more than one pixel drawn per scan line.
For a Y major line, the absolute y value increases faster than the absolute x value. In
this case, at most one pixel will be drawn per scan line. If the requested line is drawn
upward, x1 is the requested starting x coordinate. If the requested line is drawn down-
ward, x1 is the requested ending x coordinate. X DELTA is the value programmed in
MMA970. The field format is S11.20, i.e, bit 31 is the sign bit (0 = positive), with 11 in-
teger positions and 20 fractional positions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R Y START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
ViRGE draws lines from bottom to top. Therefore this value will be the largest of the
requested starting and ending y coordinates.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SCAN LINE COUNT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DIR R R R R R R R R R R R R R R R
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RIGHT EDGE X DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
RIGHT EDGE X DELTA HIGH
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RIGHT EDGE X START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
RIGHT EDGE X START HIGH
For an X major line, value = (x1 << 20) - (RIGHT EDGE X DELTA/2) + (1 << 19)
For a Y major line, value = x1 << 20 + (1 << 19)
For an X major line, the absolute x value increases faster than the absolute y value as
the line is drawn. In this case, there may be more than one pixel drawn per scan line.
For a Y major line, the absolute y value increases faster than the absolute x value. In
this case, at most one pixel will be drawn per scan line. If the requested line is drawn
upward, x1 is the requested starting x coordinate. If the requested line is drawn down-
ward, x1 is the requested ending x coordinate. X DELTA is the value programmed in
MMA970. The field format is S11.20, i.e, bit 31 is the sign bit (0 = positive), with 11 in-
teger positions and 20 fractional positions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LEFT EDGE X DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LEFT EDGE X DELTA HIGH
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LEFT EDGE X START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LEFT EDGE X START HIGH
For an X major line, value = (x1 << 20) - (LEFT EDGE X DELTA/2) + (1 << 19)
For a Y major line, value = x1 << 20 + (1 << 19)
For an X major line, the absolute x value increases faster than the absolute y value as
the line is drawn. In this case, there may be more than one pixel drawn per scan line.
For a Y major line, the absolute y value increases faster than the absolute x value. In
this case, at most one pixel will be drawn per scan line. If the requested line is drawn
upward, x1 is the requested starting x coordinate. If the requested line is drawn down-
ward, x1 is the requested ending x coordinate. X DELTA is the value programmed in
MMA970. The field format is S11.20, i.e, bit 31 is the sign bit (0 = positive), with 11 in-
teger positions and 20 fractional positions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R Y START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
ViRGE draws lines from bottom to top. Therefore this value will be the largest of the
requested starting and ending y coordinates. This value need only be programmed
once for each polygon.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SCAN LINE COUNT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R ULE URE R R R R R R R R R R R R
The first polygon update proceeds upward to the first vertex. y2 is the requested end-
ing y coordinate for the line leading to that vertex and y1 is the requested starting y
coordinate for that line. Both bit 28 and bit 29 will be set to 1 for the first update. For
the second polygon update, only the X DELTA for the line extending from the first ver-
tex is re-specified and only the update bit (28 or 29) for that edge is set to 1. The
value in this scan line count field is set for the number of scan lines from the first ver-
tex to the second vertex. See the polygon fill programming examples for a more com-
plete explanation of how to program the polygon fill registers at each step to form a
complete polygon.
19.4 3D REGISTERS
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Z-BUFFER BASE ADDRESS 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R Z-BUFFER BASE ADDRESS
Value = base address in video memory of the z-buffer used in 3D drawing operations
to store depth information for each pixel. Bits 2-0 must be 000b (quadword aligned).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DESTINATION BASE ADDRESS 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R DESTINATION BASE ADDRESS
Value = base address in video memory of destination data for 2D drawing operations.
Bits 2-0 must be 000b (quadword aligned).
This is the 0,0 pixel address in video memory for the screen resolution being used. It
will normally be at the start of video memory.
Bit 1 of the Command Set register must be set to 1 for the settings in this register to have effect.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R RIGHT CLIPPING LIMIT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R LEFT CLIPPING LIMIT
Value = pixel position of the last pixel to be drawn on each line. The first pixel is 0.
Value = pixel position of the first pixel to be drawn on each line. The first pixel is 0.
Bit 1 of the Command Set register must be set to 1 for the settings in this register to have effect.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R BOTTOM CLIPPING LIMIT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R TOP CLIPPING
LIMIT
Value = line position of the last line to be drawn. The first line is 0.
Value = line position of the first line to be drawn. The first line is 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R SOURCE STRIDE 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R DESTINATION STRIDE 0 0 0
Value = byte offset of vertically adjacent pixels for a flat (not mipmapped) texture
map. Bits 2-0 must be 000b.
Value = byte offset of vertically adjacent pixels for the destination data. Bits 2-0 must
be 000b.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R Z STRIDE 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Value = byte offset of vertically adjacent pixels for the Z-buffer data . Bits 2-0 must be
000b.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TEXTURE BASE ADDRESS 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R TEXTURE BASE ADDRESS
Value = base address in video memory of the texture data (flat or mipmapped). Bits 2-
0 must be 000b (quadword aligned).
This is used as the texel color for lighting when texture wrapping is not enabled (bit 26 of the Com-
mand Set register is cleared to 0) and the texture rectangle is too small to complete the fill. This
must be in the same format at the texture color.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA 2 DATA 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R DATA 3
Value = DAC CLUT index (8 bits/pixel), lower byte of color data (15/16 bits/pixel), blue
color index (24 bits/pixel
Value = Reserved (8 bits/pixel), upper byte of color data (15/16 bits/pixel), green color
index (24 bits/pixel)
This is the fog color blended with the pixel color when bit 17 of the Command Set register is set to
1. This operation is also called depth cueing when the fog factor (source alpha) corresponds to the
distance from the viewer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN COLOR INDEX BLUE COLOR INDEX
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R RED COLOR INDEX
When using one of the Blend4 modes for texel storage, this register specifies one of the color limits
used in the interpolation of the texel color during the generate phase of pixel coloring.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN COLOR INDEX BLUE COLOR INDEX
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R RED COLOR INDEX
When using one of the Blend4 modes for texel storage, this register specifies one of the color limits
used in the interpolation of the texel color during the generate phase of pixel coloring.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN COLOR INDEX BLUE COLOR INDEX
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R RED COLOR INDEX
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TB TEX FLTR MODE MIPMAP LEVEL SIZE TEX CLR FORMAT DEST FORMAT HC AE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
23D 3D COMMAND TWE ZB MODE ZUP ZB COMP ABC FE TB
Bit 0 AE - Autoexecute
0 = Execute command when this register is written to
1 = Execute command when the highest address register in a drawing type set is
written to
The highest address register in a drawing type set is easily seen in Table 20-1, where
it is the bottom register in each column. For example, if this bit is set to 1, a 3D line is
executed when the 3YCNT (MMB17C) register is written to. Similarly, execution of a
3D Triangle command is based on writing to the TY01_Y12 (MMB57C) register. This
setting allows multiple executions of a given command using different parameters
without re-writing the Command Set register.
To turn off autoexecute without executing a command, write to this register with this
bit cleared to 0 and bits 30-27 programmed to 1111b (NOP).
The settings in the clipping registers (MMxxDC, MMxxE0) are effective only when this
bit is set to 1.
Value = s, where 2s is the size of one side of the largest mipmap texture rectangle
Only modes with no filtering (000b and 100b) can be used with 8 bits/pixel palettized
data. In addition, the texture blending mode must be decal (bits 16-15 of this register
= 10b.)
Fogging is not available for Gouraud shaded triangles or if source alpha is used for
blending. If the fog factor (source pixel alpha value) corresponds to the distance from
the viewer, this function is also called depth cueing.
If wrapping is disabled, the texture border color (MMB4F0) may need to be specified.
The NOP option is required to turn off autoexecute without executing a command.
See the definition for bit 0 of this register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BLUE DELTA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GREEN DELTA
Value = Delta value for the accumulation of the blue attribute. The format is S8.7.
Value = Delta value for the accumulation of the green attribute. The format is S8.7.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RED DELTA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALPHA DELTA
Value = Delta value for the accumulation of the red attribute. The format is S8.7.
Value = Delta value for the accumulation of the alpha attribute. The format is S8.7.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 BLUE START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 GREEN START
Value = Starting value for the accumulation of the blue attribute. The format is S8.7,
where S must be 0.
Value = Starting value for the accumulation of the green attribute. The format is S8.7,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 RED START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 ALPHA START
Value = Starting value for the accumulation of the red attribute. The format is S8.7,
where S must be 0.
Value = Starting value for the accumulation of the alpha attribute. The format is S8.7,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Z DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Z DELTA HIGH
Value = Delta value for the accumulation of the Z attribute. The format is S16.15.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Z START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 Z START HIGH
Value = Starting value for the accumulation of the Z attribute. The format is S16.15,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 END1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 0 0 0 0 END0
Value = x coordinate (in pixels) of the last pixel to be drawn for the topmost scanline.
The first coordinate value is 0. Bits 15-11 are sign bits and must be 0’s to indicate a
positive value.
Value = x coordinate (in pixels) of the first pixel to be drawn for the bottommost scan-
line. The first coordinate value is 0. Bits 31-27 are sign bits and must be 0’s to indicate
a positive value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
X DELTA HIGH
Value = Delta value for the accumulation of the X attribute. The format is S11.20.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 X START HIGH
Value = Starting value for the accumulation of the X attribute. The format is S11.20,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R Y START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
ViRGE draws lines from bottom to top. Therefore this value will be the largest of the
requested starting and ending y coordinates.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SCAN LINE COUNT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DIR R R R R R R R R R R R R R R R
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BASE V
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R BASE V
Value = Base vertical coordinate value for texels. The format is (4 + s).(16-s), where s
is the number of mipmap levels programmed in MMB500_11-8.
This is the common offset for all V coordinate values for textures.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BASE U
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R BASE U
Value = Base horizontal coordinate value for texels. The format is (4 + s).(16-s), where
s is the number of mipmap levels programmed in MMB500_11-8.
This is the common offset for all U coordinate values for textures.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WX DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
WX DELTA HIGH
Value = Delta value for the accumulation of the W attribute (homogeneous coordi-
nate) with respect to X. The format is S12.19.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WY DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
WY DELTA HIGH
Value = Delta value for the accumulation of the W attribute (homogeneous coordi-
nate) with respect to Y. The format is S12.19.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
W START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 W START HIGH
Value = Starting value for the accumulation of the W attribute (homogeneous coordi-
nate). The format is S12.19, where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DX DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DX DELTA HIGH
Value = Delta value for the accumulation of the D attribute with respect to X. The for-
mat is S4.27.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
VX DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VX DELTA HIGH
Value = Delta value for the accumulation of the V attribute with respect to X. The for-
mat is S(4 + s).(27 - s) if perspective is enabled (3D command = 0101b or 0110b),
where s is the number of mipmap levels programmed in MMB500_11-8. The format is
S12.8.11 without perspective enabled. This format is 1 sign bit, 12 integer bits, 8 filter
bits and 11 fractional bits.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
UX DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
UX DELTA HIGH
Value = Delta value for the accumulation of the U attribute with respect to X. The for-
mat is S(4 + s).(27 - s) if perspective is enabled (3D command = 0101b or 0110b),
where s is the number of mipmap levels programmed in MMB500_11-8. The format is
S12.8.11 without perspective enabled. This format is 1 sign bit, 12 integer bits, 8 filter
bits and 11 fractional bits.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DY DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DY DELTA HIGH
Value = Delta value for the accumulation of the D attribute with respect to Y. The for-
mat is S4.27.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
VY DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VY DELTA HIGH
Value = Delta value for the accumulation of the V attribute with respect to Y. The for-
mat is S(4 + s).(27 - s) if perspective is enabled (3D command = 0101b or 0110b),
where s is the number of mipmap levels programmed in MMB500_11-8. The format is
S12.8.11 without perspective enabled. This format is 1 sign bit, 12 integer bits, 8 filter
bits and 11 fractional bits.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
UY DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
UY DELTA HIGH
Value = Delta value for the accumulation of the U attribute with respect to Y. The for-
mat is S(4 + s).(27 - s) if perspective is enabled (3D command = 0101b or 0110b),
where s is the number of mipmap levels programmed in MMB500_11-8. The format is
S12.8.11 without perspective enabled. This format is 1 sign bit, 12 integer bits, 8 filter
bits and 11 fractional bits.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 D START
Value = Starting value for the accumulation of the D attribute. The format is S4.27.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
V START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 V START HIGH
Value = Starting value for the accumulation of the V attribute. The format is
S(4 + s).(27 - s) if perspective is enabled (3D command = 0101b or 0110b), where s is
the number of mipmap levels programmed in MMB500_11-8. The format is S12.8.11
without perspective enabled. This format is 1 sign bit, 12 integer bits, 8 filter bits and
11 fractional bits. In either case, the sign bit must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
U START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 U START HIGH
Value = Starting value for the accumulation of the U attribute. The format is
S(4 + s).(27 - s) if perspective is enabled (3D command = 0101b or 0110b), where s is
the number of mipmap levels programmed in MMB500_11-8. The format is S12.8.11
without perspective enabled. This format is 1 sign bit, 12 integer bits, 8 filter bits and
11 fractional bits. In either case, the sign bit must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BLUE X DELTA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GREEN X DELTA
Value = Delta value for the accumulation of the blue attribute with respect to X. The
format is S8.7.
Value = Delta value for the accumulation of the green attribute with respect to X. The
format is S8.7.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RED X DELTA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALPHA X DELTA
Value = Delta value for the accumulation of the red attribute with respect to X. The
format is S8.7.
Value = Delta value for the accumulation of the alpha attribute with respect to X. The
format is S8.7.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BLUE Y DELTA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GREEN Y DELTA
Value = Delta value for the accumulation of the blue attribute with respect to Y. The
format is S8.7.
Value = Delta value for the accumulation of the green attribute with respect to Y. The
format is S8.7.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RED Y DELTA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALPHA Y DELTA
Value = Delta value for the accumulation of the red attribute with respect to Y. The
format is S8.7.
Value = Delta value for the accumulation of the alpha attribute with respect to Y. The
format is S8.7.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 BLUE START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 GREEN START
Value = Starting value for the accumulation of the blue attribute. The format is S8.7,
where S must be 0.
Value = Starting value for the accumulation of the green attribute. The format is S8.7,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 RED START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 ALPHA START
Value = Starting value for the accumulation of the red attribute. The format is S8.7,
where S must be 0.
Value = Starting value for the accumulation of the alpha attribute. The format is S8.7,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ZX DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ZX DELTA HIGH
Value = Delta value for the accumulation of the Z attribute with respect to X. The for-
mat is S16.15.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ZY DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ZY DELTA HIGH
Value = Delta value for the accumulation of the Z attribute with respect to Y. The for-
mat is S16.15.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Z START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 Z START HIGH
Value = Starting value for the accumulation of the Z attribute. The format is S16.15,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
XY12 DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
XY12 DELTA HIGH
Value = Delta value for the accumulation of the X attribute with respect to Y along the
12 side. The format is S11.20.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X12 END LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 X12 END HIGH
Value = X coordinate for the last pixel drawn for side 12. The format is S11.20, where
S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
XY01 DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
XY01 DELTA HIGH
Value = Delta value for the accumulation of the X attribute with respect to Y along the
01 side. The format is S11.20.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X01 END LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 X01 END HIGH
Value = X coordinate for the last pixel drawn for side 01. The format is S11.20, where
S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
XY02 DELTA LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
XY02 DELTA HIGH
Value = Delta value for the accumulation of the X attribute with respect to Y along the
02 side. The format is S11.20.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X START LOW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 X START HIGH
Value = Starting value for the accumulation of the X attribute. The format is S11.20,
where S must be 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R Y START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SCAN LINE COUNT 12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
L/R R R R R SCAN LINE COUNT 01
Value = The number of scan lines required to render the 12 side of the triangle.
See 3D Programming in Section 15 for a graphic description of this field. Either this
field or the SCAN LINE COUNT 01 field below must be non-zero for the S3d Engine to
draw a triangle.
Value = The number of scan lines required to render the 01 side of the triangle.
See 3D Programming in Section 15 for a graphic description of this field. Either this
field or the SCAN LINE COUNT 12 field above must be non-zero for the S3d Engine to
draw a triangle.
The triangle must always be rendered in the direction starting with the triangle side
with the largest Y component. See 3D Programming in Section 15 for a graphic de-
scription.
In all register bit descriptions, the letter “R” identifies reserved bits (a reserved bit’s read value is
undefined unless noted, and you may write only zero to a reserved bit).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R R R R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R PSHFC R PSIDF R R R R R R R R
Bit 27 Reserved
Bit 31 Reserved
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
G/U/Cb KEY (LOW) B/V/Cr KEY (LOW)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R KC R RGB CC R/Y KEY (LOW)
Bit 27 Reserved
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R DDA HORIZONTAL ACCUMULATOR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R SFC R SDIF R R R R R R R R
Value = 2 (W0-1) - (W1-1), where W0 is the line width in pixels before scaling and W1
is the line width in pixels after scaling. This is a signed value.
When this field is programmed, the value does not take effect until the next VSYNC.
When this field is programmed, the value does not take effect until the next VSYNC.
Bit 27 Reserved
When this field is programmed, the value does not take effect until the next VSYNC.
Any valid setting can be used for any degree of stretch. The parenthetical comments
are recommendations which may not be optimal for all cases.
Bit 31 Reserved
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
U/Cb KEY (UPPER) V/Cr KEY (UPPER)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R Y KEY (UPPER)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R K2 HORIZONTAL SCALE FACTOR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R K1 HORIZONTAL SCALE FACTOR
Value = W0-1, where W0 is the width in pixels of the initial output window (before
scaling)
When this field is programmed, the value does not take effect until the next VSYNC.
Value = W0-W1, where W0 is the initial (unscaled) window width in pixels and W1 is
the final output window width in pixels. This is a signed value and will always be
negative.
When this field is programmed, the value does not take effect until the next VSYNC.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R KP R R R R R KS R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R COMP MODE R R R R R R R R
Bits 4-2 Ks
When this field is programmed, the value does not take effect until the next VSYNC.
Bits 12-10 Kp
When this field is programmed, the value does not take effect until the next VSYNC.
When this field is programmed, the value does not take effect until the next VSYNC.
If a primary stream is enabled, this register specifies the starting address in the frame buffer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PRIMARY BUFFER ADDRESS 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R PRIMARY BUFFER ADDRESS 0
If the primary stream is double buffered, this register specifies the starting address in the frame buffer
for the second buffer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PRIMARY BUFFER ADDRESS 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R PRIMARY BUFFER ADDRESS 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R PRIMARY STREAM STRIDE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Value = byte offset of vertically adjacent pixels in the primary stream buffer(s)
If double buffering is used, the stride must be the same for both buffers.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R LST LSL LIS R SBS PBS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Bit 3 Reserved
This bit selects the starting address for writing LPB data into the frame buffer. When
the value programmed to this bit takes effect is determined by the setting of bit 5 of
this register. This bit can be toggled at the completion of writing all the data for a
frame to the frame buffer via bit 6 of this register
If a secondary stream is enabled, this register specifies the starting address in the frame buffer
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SECONDARY BUFFER ADDRESS 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R SECONDARY BUFFER ADDRESS 0
If the secondary stream is double buffered, this register specifies the starting address in the frame
buffer for the second buffer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SECONDARY BUFFER ADDRESS 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R SECONDARY BUFFER ADDRESS 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R SECONDARY STREAM STRIDE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Value = byte offset of vertically adjacent pixels in the secondary stream buffer(s)
If double buffering is used, the stride must be the same for both buffers.
When an opaque overlay mode is being used (bits 26-24 of MM81A0 = 000b or 001b), the fields in this
register can be programmed to eliminate the fetching of the pixels for the rectangular area under the
top (opaque) window. This reduces the memory bandwidth requirements. The bottom window should
be full-screen when this feature is enabled. None of the fields in this register have an effect unless bit
31 is set to 1. Note that only horizontal coordinates must be specified. The vertical coordinates are
handled automatically by the hardware.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R PIXEL STOP FETCH R R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OOC TSS R PIXEL RESUME FETCH R R R
Value = [Offset in quadwords from the background starting pixel horizontal position
to the first pixel of the line not to be fetched from memory (hidden background)] + 1
quadword
If the primary stream is the background, MM81F0_26-16 define the starting position
for each line in the background window (X0) and MM81F8_26-16 define the first pixel
position for each line in the top window (X1). The latter is the first background pixel
that does not need to be fetched. The value programmed in this field is then [(X1 -
X0) x bytes per pixel/8] +1. If the result is a fraction, it is rounded up the next highest
integer. This gives the required quadword offset (O) for this field. This value is also
used in the calculation for the field value of bits 28-19 of this register.
If the secondary stream is the background, the value is [(X0 - X1) x bytes per pixel/8]
+ 1.
Value = {Offset in quadwords from the background starting pixel horizontal position
to the line position of the resumption of pixel fetching from memory (i.e., visible back-
ground)} - 1 quadword
The value is determined by adding the Pixel Stop Fetch field value (O) above (bits 12-
3) to the width in quadwords of the top window (W). The width of the top window in
pixels (P) is found in MM81F4_26-16 if the primary stream is on top and in
MM81FC_26-16 if the secondary stream is on top. W in quadwords = P x bytes per
pixel/8. If this is a fraction, the result is truncated to the next lowest integer. The value
in this field is then [W + O] - 1.
Bit 29 Reserved
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R K1 VERTICAL SCALE FACTOR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Value = [height (in lines) of the initial output window (before scaling)] - 1
When this field is programmed, the value does not take effect until the next VSYNC.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R K2 VERTICAL SCALE FACTOR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Value = [height (in lines) of the initial output window (before scaling)] - [height (in
lines) of the final output window (after scaling)]
When this field is programmed, the value does not take effect until the next VSYNC.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R DDA VERTICAL ACCUMULATOR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Value = 2’s complement of [height (in lines) of the output window after scaling] - 1
When this field is programmed, the value does not take effect until the next VSYNC.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R R R R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R PDD MAR TSM EWS R R
Bit 18 EWS - EDO Memory Wait State Control (LPB Memory Cycles Only)
0 = Standard 2-cycle memory operation
1 = 1-cycle EDO memory operation (requires EDO memory capable of this)
This bit must be set to correspond to the memory type used when enabling LPB op-
eration.
PD[15:0] are driven with the ROM address. This bit should normally be left at its de-
fault value of 0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R PRIMARY STREAM Y-START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R PRIMARY STREAM X-START
Value = Screen line number +1 of the first line of the primary stream window
Value = Screen pixel number +1 of the first pixel of the primary stream window
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R PRIMARY STREAM HEIGHT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R PRIMARY STREAM WIDTH
Value = Number of pixels -1 displayed in each line in the primary stream window
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SECONDARY STREAM Y-START
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R SECONDARY STREAM X-START
Value = Screen line number +1 of the first line of the secondary stream window
Value = Screen pixel number +1 of the first pixel of the secondary stream window
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R SECONDARY STREAM HEIGHT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R SECONDARY STREAM WIDTH
Value = Number of pixels -1 displayed in each line in the primary stream window
This section describes the Memory Port Controller (MPC) Registers for ViRGE. These registers are used
to adjust memory control signals and control the video data FIFOs.
In all register bit descriptions, the letter “R” identifies reserved bits (a reserved bit’s read value is
undefined unless noted, and you may write only zero to a reserved bit).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PS THRESHOLD R SS THRESHOLD R P/S BOUNDARY
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R
All other values are reserved and must not be programmed. Each slot holds 1 quad-
word.
Bit 5 Reserved
When the secondary stream FIFO empties down to this value, an internal signal is
generated requesting refilling of the secondary stream FIFO. This value must be ≤ the
secondary stream FIFO size specified in bits 4-0 of this register.
Bit 11 Reserved
When the primary stream FIFO empties down to this value, an internal signal is gener-
ated requesting refilling of the primary stream FIFO. This value must be ≤ the primary
stream FIFO size specified in bits 4-0 of this register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R DRR LPR WED COA R R R WT RL RP RI
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PS TIMEOUT SS TIMEOUT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R PST
Value = number of MCLKs that the secondary stream is given read access to video
memory before its grant is withdrawn
Value = number of MCLKs that the primary stream is given read access to video mem-
ory before its grant is withdrawn
This bit is effective when the primary and secondary streams have simultaneous re-
quests for video memory access pending.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
S3D ENGINE TIMEOUT CPU TIMEOUT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
EXT TIMEOUT LPB TIMEOUT
Value = number of MCLKs that the CPU is given access to video memory before its
grant is withdrawn
Value = number of MCLKs that the S3D Engine is given access to video memory be-
fore its grant is withdrawn
Value = number of MCLKs that the LPB is given write access to video memory before
its grant is withdrawn
Value = number of MCLKs that another memory master is given access to video mem-
ory before its grant is withdrawn
This register is used when the CPU is doing DMA transfers from video memory as specified by clear-
ing bit 1 of MM8580 to 0 (read) and setting bit 0 of MM8588 to 1 (video DMA enable).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMA READ BASE ADDRESS 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R DMA READ BASE ADDRESS
Value = Starting address in video memory for data to be DMAed to system memory
(quadword aligned)
This register is used when the CPU is doing DMA transfers from video memory as specified by clear-
ing bit 1 of MM8580 to 0 (read) and setting bit 0 of MM8480 to 1 (video DMA enable).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R DMA READ STRIDE 0 ATC
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R DMA READ WIDTH 0 0 0
The rearranged settings provide a narrower and deeper memory page size to mini-
mize page breaks when drawing is limited to a small area of the screen. The 10 set-
ting provides the narrowest page size.
Bit 2 Reserved = 0
Value = Number of quadwords to add to the address at the end of a line to generate
the address for the next line to be transferred
A DMA transfer from video memory to system memory starts at the address speci-
fied in MM8220_22_3 and proceeds for the number of quadwords defined by the
value in bits 27-19 of this register. The stride value is then added to end of line ad-
dress to get the address for the start of the next line to be transferred.
In all register bit descriptions, the letter “R” identifies reserved bits (a reserved bit’s read value is
undefined unless noted, and you may write only zero to a reserved bit).
This read-only register provides information on interrupt status, monitor I.D. and the number of bits
per pixel. See the Subsystem Control (MM8504, Write Only) register for details on enabling and clearing
interrupts.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
S3d LPB 3DF CD HD FIFO FIFO 3D VSY
R R ENG S3d FIFO SLOTS FREE INT FIFO DON DON EMP OVF DON INT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
This register allows each of several interrupt sources to be enabled or disabled. Interrupt status (Subsystem
Status (MM8504, Read Only) can be cleared. This register also controls the software reset of the graphics
engine.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
S3d RST 3DF CDD FIFO ENB 3DD VSY HDD 3DF CDD HDD FIFO FIFO 3DD VSY
1 0 ENB ENB EMP OVF ENB ENB ENB CLR CLR CLR CLE CLO CLR CLR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LA RST ENB
R R R R R R CMD FIFO STATUS R ENB R R DM EHFC
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
This bit should be toggled (program a 1 and then a 0) by software immediately after
the completion of each read DMA operation.
Bit 5 Reserved
This section describes the Direct Memory Access (DMA) registers for ViRGE. These registers are used
to control the two DMA channels when ViRGE operates as a PCI bus master. The video/graphics data
transfer channel handles:
• Compressed video data transfers from system memory to an MPEG-1 decoder via the LPB
• Decompressed video data (software MPEG) transfers to the frame buffer via the LPB
• Frame buffer data transfers to system memory
For the latter case, the video memory read data location and structure are specified in MM8220 and
MM8224. These are described in the Memory Port Controller section.
The command data channel handles transfers of command and drawing parameter data from system
memory to the S3D Engine.
In all register bit descriptions, the letter “R” identifies reserved bits (a reserved bit’s read value is
undefined unless noted, and you may write only zero to a reserved bit).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
STARTING MEMORY ADDRESS R/W R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
STARTING MEMORY ADDRESS
Bit 0 Reserved
Data written to the LPB output FIFO can be directed to an MPEG decoder (com-
pressed data) or to video memory with optional decimation.
Value = Starting memory address when performing a DMA transfer from video mem-
ory to system memory or from system memory to the LPB output FIFO
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMA TRANSFER LENGTH R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R DMA TRANSFER LENGTH
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R R R R VDE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
This bit is reset to 0 by the DMA controller at the completion of a video/graphics DMA
transfer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BASE ADDRESS R R R R R R R R R R BS R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BASE ADDRESS
Bit 0 Reserved
Bits 15-12 must be 000b for a 64K buffer size (64K aligned).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WRITE POINTER R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R WPU
Value = next doubleword address after the last doubleword written to the system
memory buffer
Software must set this bit to 1 each time it updates the write pointer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
READ POINTER R R
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
4K buffer: address = base address 31-12 (concat) read pointer 11-2 (concat) 00
64K buffer: address = base address 31-16 (concat) read pointer 15-2 (concat) 00
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R R R R CDE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
In all register bit descriptions, the letter “R” identifies reserved bits (a reserved bit’s read value is
undefined unless noted, and you may write only zero to a reserved bit).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R LBA CHS CVS LHS LVS R R CBS SF LR LPB MODE LE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CFL R R R R ILC SNO CS R VFT R R R MBS
Once enabled, the LPB is reset either by a system reset or via bit 4 of this register.
This bit should be set and then reset before switching between LPB modes.
Writing a 1 to this bit immediately loads the base address currently being pointed to.
Bits 17-16 MBS - Maximum LPB to Scenic/MX2 Compressed Data Burst Size (Scenic/MX2 mode
only)
00 = Burst 1 32-bit word
01 = Burst 2 32-bit words
10 = Burst 3 32-bit words
11 = Burst all 32-bit words (until empty)
With a setting of 11b, software must ensure that no more than eight 32-bit words are
burst to the Scenic/MX2 in a single burst. For example, if the FIFO is full (8 entries),
no more entries should be written until the burst is complete.
When this many slots are filled in the video FIFO, a request is generated to the mem-
ory manager to begin emptying the FIFO. This is used to maximize the efficiency of
the memory interface.
Bit 23 Reserved
This bit allows for the LPB to be used in pass-through mode (MMFF00_3-1 = 100b)
when ViRGE is configured for compatible mode. The LPB is normally driven by LCLK,
but this is not available in compatible mode.
This bit must be set when the first HSYNC does not occur within the VSYNC active pe-
riod.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R OFAE OFE OFF R R R R R R R OFIFO STATUS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VF1A VF1E VF1F R R R R R R VF0A VF0E VF0F R R R R
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R SPS EFI ELI FEI
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R SPW R R R R SPM EFM ELM FEM
A serial port start condition occurs when SPD (pin 206) is driven low by another de-
vice while SPCLK (pin 205) is not being driven low. Writing a 1 to this bit clears the in-
terrupt.
Setting this bit to 1 enables serial port wait states until the Host is ready to process
the data.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPB BUFFER ADDRESS 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R LPB BUFFER ADDRESS 0
Value = starting address 0 (offset in bytes from the start of the frame buffer) for writ-
ing LPB data to the frame buffer
This value will normally be the same as the secondary stream frame buffer address 0.
The value must start on an 8-byte boundary.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPB BUFFER ADDRESS 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R LPB BUFFER ADDRESS 1
Value = starting address 1 (offset in bytes from the start of the frame buffer) for writ-
ing LPB data to the frame buffer
This value will normally be the same as the secondary stream frame buffer address 1.
Both address 0 and address 1 are defined when double buffering is used. The value
must start on an 8-byte boundary.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPB DIRECT READ/WRITE ADDRESS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R TT LPB READ/WRITE ADDRESS
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPB DIRECT READ/WRITE DATA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LPB DIRECT READ/WRITE DATA
A write to this register triggers a read/write sequence based on the address informa-
tion in MMFF14_23-0.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R LPB GIP LPB GOP
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
These bits are driven onto the LPB LD[3:0] lines whenever a write is performed to
CR5C. STWR is asserted (low) at this time for use as an enable strobe for latching the
data into an external buffer.
Bits 7-4 LPB General Purpose Input Data Port (Read only)
Whenever a write is performed to CR5C, STWR is asserted (low). This strobe can be
used to enable a register to drive data onto any or all of the LD[7:4] lines. This data is
then latched into these bits.
This register can also be accessed at I/O ports E2H or E8H. See the Serial Communications Port de-
scription in Section 12.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R B4M B3M B2M B1M B0M R R R SPE SDR SCR SDW SCW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R R
Pin 205 carries the DDC/I2C clock, depending on the operational mode. When pin 205
is tri-stated, other devices may drive this line. The actual state of the pin is read via
bit 2 of this register.
Pin 206 carries the DDC/I2C data, depending on the operational mode. When pin 206
is tri-stated, other devices may drive this line. The actual state of the pin is read via
bit 3 of this register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R VIDEO INPUT LINE WIDTH
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R VIDEO INPUT WINDOW HEIGHT
This is the width of the displayed line after the offset specified in MMFF28_11-0. Be-
fore the 2 is subtracted, the number of pixels must be a multiple of 4. For example, in
Video 16 mode, if the line width is 637 pixels, this must be rounded up to 640. The
programmed value is then 640 - 2 = 638.
This is the number of displayed lines - 1 after the offset specified in MMFF28_24_16.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R HORIZONTAL VIDEO DATA OFFSET
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R VERTICAL VIDEO DATA OFFSET
Value = [number of LCLKs between HSYNC and the start of valid pixel data] - 2
Value = number of HSYNCs between VSYNC and the first valid data line
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
VIDEO DATA BYTE MASK
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VIDEO DATA BYTE MASK
Each 32 bytes of video data input is compared with this mask. If a bit in this mask is 1,
the corresponding byte is discarded. If a bit is a 0, the corresponding byte is passed
to the video memory. In Video 16 mode, each bit masks 2 bytes. In pass-through
mode, each bit masks 4 bytes. Normally, decimation starts with bit 0 after an HSYNC.
If a horizontal video data offset is specified in MMFF28_11-0 (video 8 or 16 modes
only), decimation aligns with the start of data after the offset.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
VIDEO DATA LINE MASK
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VIDEO DATA LINE MASK
Each 32 lines of video data input is compared with this mask. If a bit in the mask is 0,
the corresponding line is discarded. If a bit is a 1, the corresponding line is passed to
the video memory. If a vertical video data offset is specified in MMFF28_24-16 (video
8 or 16 modes only), decimation does not align with the starting line after the offset
and instead starts from VSYNC.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R LINE STRIDE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R R R R R R R R R R R R R R R
This offset is added to the line starting address each HSYNC to get the new line start-
ing address. Each line must begin on an 8-byte boundary.
Writes to any of the addresses in this 8 doubleword address range will be transferred to the LPB input
FIFO. This allows efficient use of the MOVSD assembly language instruction. Accesses must be to
doubleword addresses.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OUTPUT FIFO DATA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OUTPUT FIFO DATA
Note: Software must never transfer more compressed data than there is room for in
the output FIFO. This information is read from MMFF04_3-0.
The PCI specification defines a configuration register space. These registers allow device relocation,
device independent system address map construction and automatic configurations. ViRGE provides
a subset of these registers, which are described below.
The configuration register space occupies 256 bytes. When a configuration read or write command is
issued, the AD[7:0] lines contain the address of the register in this space to be accessed. ViRGE supports
or returns 0 for the first 64 bytes of this space.
In the following register descriptions, ’R’ stands for reserved (write = 0, read = undefined).
Vendor ID
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Vendor ID
Device ID
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Device ID
Command
This register controls which types of PCI cycles ViRGE can generate and respond to.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DAC MEM I/O
R R R R R R R R R R SNP R R BME
Status
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R RMA RTA R DEVSEL R R R R R R R R R
Bit 11 Reserved
Class Code
This register is hardwired to 30000xxH to specify that ViRGE is a VGA-compatible display controller.
The xx will change with each revision.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PROGRAMMING INTERFACE REVISION ID
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BASE CLASS CODE SUB-CLASS
Latency Timer
7 6 5 4 3 2 1 0
BM LATENCY TIMER 0 0 0
These are the 3 lsb’s of the latency timer value, providing 8 clocks granularity.
Value = number of PCI clocks ViRGE can keep its bus master grant without having it
removed
These are the 5 msb’s of this value. The three lsb’s are 000b. This value is normally
programmed by the system BIOS based in part on the requested value in bits 15-8 of
3EH.
Base Address 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R PREF MSI
=0 TYPE =00 =0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BASE ADDRESS 0 R R R R R R R R R R
Value = upper 6 bits of the base address for accessing ViRGE registers and memory
via memory-mapped I/O
This field provides for address relocation. These bits map to system address bits 31-
26. All other address bits (25-4) return 0 on read to specify that ViRGE requires a 64
MByte address space. Note that writes to CR59_7-2 will also update this field, so if the
linear addressing base address is being changed, the programmer must do a read-
modify-write to ensure that this field is not changed.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R R R R R R R R R R R R R R R ADE
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BIOS ROM BASE ADDRESS
Interrupt Line
This register contains interrupt line routing information written by the POST program during power-on
initialization.
7 6 5 4 3 2 1 0
INTERRUPT LINE
Interrupt Pin
This register is hardwired to a value of 1 to specify that INTA is the interrupt pin used.
7 6 5 4 3 2 1 0
INTERRUPT PIN
Latency/Grant
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MAXIMUM LATENCY MINIMUM GRANT
Value = Length of burst period required in units of 250 ns (33 MHz clock)
Value = Maximum latency of PCI access in units of 250 ns (33 MHz clock)
ViRGE supports all 256 triadic raster operations The boolean operators used as as follows:
(ROPs) for BitBLTs as defined by Microsoft for
Windows. The coding for these is found on the o = bitwise OR
following pages.
x = bitwise EXCLUSIVE OR
The HEX value in the first column is the ROP
code. This value must be programmed into bits a = bitwise AND
7-0 of D2E8H at the time that a ROPBLT command
is executed. n = bitwise NOT (inverse)
The effect of the ROP is shown in reverse Polish For example, ROP 16H is PSDPSanaxx. The pat-
notation in the second column. This is interpreted t e r n i s f i r s t A N D e d wi t h t he s ou rc e
as follows: [PSD(PaS)naxx]. The result is inverted and then
ANDed with the destination [PS((Da(notPaS))xx.
S = Source bitmap This result is EXCLUSIVE ORed with the source.
Finally, the result of this is EXCLUSIVE ORed with
P = Pattern the pattern.
This Appendix contains tables listing all the registers in each of categories corresponding to Sections
16-26 of this data book.
• VGA
• Extended Sequencer
• Extended CRTC
• S3D
• Streams Processor
• Memory Port
• DMA
• LPB
• Miscellaneous
• PCI Configuration Space
Within each table, registers are listed in order of increasing addresses/indices. Name, address, register
bit descriptions with read/write status and the page number of the detailed register description are
provided for each register. All addresses and indices are hexadecimal values.
This section lists the registers which support the S3D Engine functions. All of these registers are enabled
only if bit 0 of CR40 is set to 1.
When a PCI configuration read or write command is issued, AD[7:0] contain the address of the register
in the configuration space to be accessed.
Index
INDEX I-1
ViRGE Integrated 3D Accelerator
I-2 INDEX
ViRGE Integrated 3D Accelerator
FIFO status I
command FIFO 22-5
S3d Engine FIFO 22-2 I square C
filtering textures 15-27 See serial port
fogging 15-30 ID, chip 18-1 - 18-2
enable 19-31 image transfer
font selection 16-8 alignment 19-13
frame buffer data source 19-13
See display memory first doubleword select 19-14
mono or color source 19-12
G initialization 5-1
interlaced operation 18-11 - 18-12
General Data bus interrupt
BIOS ROM interface 12-2 command DMA done interrupt clear 22-3
general input port 16-39 command DMA done interrupt enable 22-3
description 12-4 command DMA done interrupt status 22-2
enable 12-4, 18-19 command FIFO empty interrupt clear 22-3
general output port 18-22 command FIFO empty interrupt enable 22-3
description 12-5 command FIFO empty interrupt status 22-1
LPB 24-10 command FIFO overflow interrupt enable 22-
Gouraud shading 19-32 3
green PC command FIFO overflow interrupt status 22-
HSYNC/VSYNC control 12-4, 17-4 1
commandFIFO overflow interrupt clear 22-3
H enable 12-9, 18-3
generation 12-9
hardware graphics cursor host DMA done interrupt clear 22-3
background color 18-15 host DMA done interrupt enable 22-3
enable 18-13 host DMA done interrupt status 22-2
foreground color 18-14 LPB 24-6
pattern display x origin 18-15 S3d Engine done interrupt status 22-1
pattern display y origin 18-16 S3d Engine interrupt clear 22-3
programming 15-31 - 15-32 S3d Engine interrupt enable 22-3
storage start address 18-15 S3d FIFO empty interrupt clear 22-3
Windows/X-Windows modes 15-31, 18-19 S3d FIFO empty interrupt enable 22-3
x origin 18-14 S3d FIFO empty interrupt status 22-2
y origin 18-14 vertical retrace interrupt clear 16-18
high speed text display 18-3 vertical retrace interrupt enable 16-18
high speed text font writing 18-10 vertical retrace interrupt status 16-3
horizontal blank vertical sync interrupt clear 22-2
end 16-12 vertical sync interrupt enable 22-3
start 16-12 vertical sync interrupt status 22-1
horizontal display end 16-11
horizontal sync L
control for power management 17-4
polarity 16-2 latency timer 25-4
horizontal sync position LCLK
end 16-13 invert 24-4
start 16-13 lighting textures 15-29
horizontal total 16-11 line compare 16-23
HSYNC line draw
direction control 3-8 drawing direction 19-19
endpoints 19-17
INDEX I-3
ViRGE Integrated 3D Accelerator
I-4 INDEX
ViRGE Integrated 3D Accelerator
INDEX I-5
ViRGE Integrated 3D Accelerator
I-6 INDEX
ViRGE Integrated 3D Accelerator
z-buffering
base address 19-24
buffer update enable 19-32
programming 15-25
select compare mode 19-31
select mode 19-32
INDEX I-7
ViRGE Integrated 3D Accelerator
S3 Incorporated, P.O. Box 58058, Santa Clara, CA 95052-8058 Tel: 408-980-5400, Fax: 408-980-5444