VGA Hardware: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
Combuster (talk | contribs)
→‎Shift modes: added table
Line 420: Line 420:
While going through memory, the sequencer reads in a 4 bytes at a time from each of the four planes, then outputs 8 pixel colors. The VGA has three distinct modes of grouping this data into pixel values. The setting depends on two bits in a VGA register: the 256-color shift and interleaved shift bits. when both are off, Single shift mode is selected, otherwise the corresponding mode is used (256 color shift mode takes precedence over interleaved shift mode)
While going through memory, the sequencer reads in a 4 bytes at a time from each of the four planes, then outputs 8 pixel colors. The VGA has three distinct modes of grouping this data into pixel values. The setting depends on two bits in a VGA register: the 256-color shift and interleaved shift bits. when both are off, Single shift mode is selected, otherwise the corresponding mode is used (256 color shift mode takes precedence over interleaved shift mode)


{| {{Wikitable}}
'''TODO: table of registers involved'''
|-
! Register Name
! Port
! Index
! 7
! 6
! 5
! 4
! 3
! 2
! 1
! 0
|-
| Graphics Mode Register
| 0x3CE
| 0x05
|
| 256-Color Shift
| Interleaved Shift
|
|
|
|
|
|}


* Single shift mode
* Single shift mode
:This mode is used in 16 color modes. For each pixel, one bit is popped off each plane and put together to form the value of a pixel.
:This mode is used in 16 color modes. For each pixel, one bit is popped off each plane and put together to form the value of a pixel. An example is given in [[VGA Hardware#Memory Layout in 16-color graphics modes|Memory Layout in 16-color graphics modes]]
An example is given in [[VGA Hardware#Memory Layout in 16-color graphics modes|Memory Layout in 16-color graphics modes]]


* Interleaved Shift Mode
* Interleaved Shift Mode
:This mode makes 4-color modes relatively easy: 2 bits are popped off the most significant side of plane 0. The same is done with plane 2, which become the most significant bits (in 4-color modes, these are zero) After 4 pixels being popped from planes 0 and 2, the same is done with plane 1 and 3, until all 8 pixels have been generated.
:This mode makes 4-color modes relatively easy: 2 bits are popped off the most significant side of plane 0. The same is done with plane 2, which become the most significant bits (in 4-color modes, these are zero) After 4 pixels being popped from planes 0 and 2, the same is done with plane 1 and 3, until all 8 pixels have been generated.


* 256-Color Shift Mode
* 256-Color Shift Mode