SiS 315

advertisement
SiS 315
An introductory exploration of features
of the SVGA graphics processor used
in our classroom’s workstations
Some SVGA examples
•
•
•
•
•
Our GPU is manufactured by SiS
Official programming info is ‘unavailable’
Can find some “unofficial” info on internet
We explore some useful SiS 315 features
But remember: other GPU chips are NOT
hardware-compatible (so our software is
unlikely to work on other SVGA systems)
• We sacrifice the advantage of “portability”
SiS Extended Registers
• The typical Super VGA chip implements a
number of “extra” hardware registers
• Most often these appear as additions to the
standard set of VGA registers established by
IBM’s engineers:
–
–
–
–
Graphics Controller (9 registers)
Timer-Sequencer (5 registers)
CRT Controller (25 registers)
Attribute Controller (21 registers)
• Our SiS graphics processor implements “extra”
Sequencer registers (ports 0x3C4/0x3C5) and
also “extra” CRTC registers (0x3D4/0x3D5)
SiS Sequencer registers
• Five standard VGA Sequencer-registers:
0: the Reset register
1: the Clocking Mode register
2: the Map Mask register
3: the Character Map Select register
4: the Memory Mode register
• SiS implements registers 5, 6, 7, … , etc.:
In-Class Exercise
• Investigate the functionality of register 5
• Two-step process to read this register:
outb( 5, 0x3C4 );
int val = inb( 0x3C5 );
• Two-step process to write this register:
outb( 5, 0x3C4 );
outb( val, 0x3C5 );
• Alternatively: outw( (val<<8)|5, 0x3C4 );
Write a demo program
•
•
•
Remember to call function: iopl( 3 );
Then create a program-loop
For every possible byte-value:
1) write that byte-value to Seq-register 5
2) read the byte-value in Seq-register 5
3) print out the value that was read back
•
What do you learn from this exercise?
Some further experiments
• Repeat the previous experiment, but add a
new step within your program-loop:
4) read (and print) Seq-register 6
• What do you learn from THIS exercise?
• OK, try it again, but with Seq-register 7 in
place of Seq-register 6 (Caution: Don’t try
to ‘write’ new values into registers 6 or 7)
Detecting screen-height
•
•
•
•
•
•
The screen-height parameter is 11-bits
Lowest 8-bits are in CRTC register 0x12
9th and 10th bits are in CRTC register 0x07
This much is standard on VGA hardware
11th bit is in SiS Sequencer register 0x0A
We need to read all three registers, then
extract and assemble the various bits
The screen-height bits
crtc-0x12 (Vert Displ Enable End)
crtc-0x07 (Overflow Register)
screen_height - 1
?
seq-0x0A
Detecting screen-width
•
•
•
•
•
•
•
The screen-width parameter is 10 bits
It measures the width in 8-pixel units
Lowest 8-bits are in CRTC register 0x01
9th and 10th bits in Ext’d Seq register 0x0B
The parameter-value is actually one less
It gives the id-number of the final unit
So we increment it, then multiply by 8
The screen-width bits
crtc-0x01 (Horizontal Display End)
screen_width – 1 (in 8-pixel units)
seq-0x0B
Detecting CRT start-address
•
•
•
•
•
•
•
Very important parameter for animation!
This parameter is stored as 26 bits
It measures start-address in 4-byte units
Lowest byte stored in crtc register 0x0D
Next lowest byte is in crtc register 0x0C
Sequencer register 0x0D holds next byte
Sequencer register 0x37 has 2 more bits
The crt start-address bits
crtc-0x0C (Start Addr Hi)
crtc-0x0D (Start Addr Lo)
crt start-address (in 4-byte units)
seq-0x0D
seq-0x37
Detecting CRT Line-Compare
•
•
•
•
•
•
•
•
•
CRTC-address resets when counter == LC
This is useful for certain “special effects”
Screen is split into two separate “windows”
Lower window shows VRAM address 0
Upper window is from crt start-address
Lowest 8-bits from CRT register 0x18
9th bit from CRT register 0x07
10th bit from CRT register 0x09
More bits from Sequencer register 0x0F
The Line-Compare bits
crtc-0x18 (Line Compare register)
crtc-0x07 (Overflow register)
Line-Compare
crtc-0x09 (Max Scan Line)
seq-0x0F
In-Class Experiment
• Reprogram the ‘Line Compare’ parameter
with a value that is equal to one-half of the
current screen-height
• What visual effect do you observe?
• Do you see a similar effect under Linux in
both ‘text mode’ and in graphics modes?
Download