Search code examples
assemblyintelosdevvgavideo-memory

Meaning of bytes in Intel GMA950 private buffer, in VGA text mode


When working on the text screen (mode 3, 80x25) both the usual Video Buffer at B800h and the Linear Frame Buffer (LFB) near the end of the 4GB address space are active. I've found that for each character cell on the display, the LFB uses 8 bytes. The first byte (a) represents the ASCII and the second byte (b) represents the attribute.

On an empty display page these 8 bytes look like:

20h,07h,00h,00h,00h,00h,00h,00h
(a) (b) (c) (d) (e) (f) (g) (h)    

Does anyone know what the extra 6 bytes are used for? I observed that only the first (c) and fifth (g) of these mystery bytes are actually refreshed with values that seem random to me. The other 4 bytes remain at zero, but if I put anything in them it survives even a video mode set.


Solution

  • ...private buffer...mystery bytes...

    There's nothing secretive about it. If it looks like a linear frame buffer, and if it functions like a linear frame buffer, and if it sits where you would expect a linear frame buffer, then most probably it is a linear frame buffer. Henceforward I'll call it the LFB.

    To get the address of the LFB on the GMA950 you can use this code:

    mov di, 0018h       ;Offset for GMADR
    mov bx, 0010h       ;[15-8] Bus=0, [7-3] Device=2, [2-0] Function=0
    mov ax, B10Ah       ;Read PCI dword
    int 1Ah
    and ecx, F0000000h  ; --> ECX is linear address of the LFB
    

    In the 16-color graphics modes the LFB is organized like so:

     --------------------------------- 1st byte of bit-plane 0
     |   ----------------------------- 1st byte of bit-plane 1
     |   |   ------------------------- 1st byte of bit-plane 2
     |   |   |   --------------------- 1st byte of bit-plane 3
     |   |   |   |   ----------------- 2nd byte of bit-plane 0
     |   |   |   |   |   ------------- 2nd byte of bit-plane 1
     |   |   |   |   |   |   --------- 2nd byte of bit-plane 2
     |   |   |   |   |   |   |   ----- 2nd byte of bit-plane 3
     |   |   |   |   |   |   |   |
    00h,00h,00h,00h,00h,00h,00h,00h
    (a) (b) (c) (d) (e) (f) (g) (h)
    

    The text video modes use a similar organization and thus the bytes at (c) and (g) are tied to bit-plane 2, meaning they represent bit patterns for the character set. Over are the days with cumbersome access to bit-plane 2 for font manipulation!
    I don't know why Intel chose to not put a character code at (e) or an attribute byte at (f), but doesn't it at least bear some resemblance with the Odd/Even scheme?

    Now until someone else comes up with a better explanation, you can investigate matters further by:

    • Writing to all available display pages and seeing where the IGD puts the character codes and attribute bytes.
    • Loading extra fonts (through BIOS) and seeing where the IGD stores these.