Obsah
Grafickej režim (graphics mode)
Spustit grafickej režim se musí v reálnym režimu nebo ve virtual 8086
(Múže změnit GDT).
V chráněnym režimu se s obrazovkou pracuje přes linear frame buffer.
struct VbeInfoBlock{
char VbeSignature[4] // "VESA"
uns2 VbeVersion // 200h
ptr4 OemStringPtr
uns1 Capabilities[4]
ptr4 VideoModePtr // real mode pointer to Video Mode List (array
of words terminated -1)
uns2 TotalMemory // Number of 64KiB memory blocks
// VBE 2.0
uns2 OemSoftwareRev
ptr4 OemVendorNamePtr
ptr4 OemProductNamePtr
ptr4 OemProductRevPtr
uns1 Reserved[222]
uns1 OemData[256] // Data Area for OEM Strings
}
struct ModeInfoBlock{
uns2 ModeAttributes
uns1 WinAAttributes, WinBAttributes
uns2 WinGranularity
uns2 WinSize
uns2 WinASegment, WinBSegment
ptr4 WinFuncPtr // pointer to window function
uns2 BytesPerScanLine // pitch
// VBE 1.2
uns2 XResolution, YResolution
uns1 XCharSize, YCharSize
uns1 NumberOfPlanes
uns1 BitsPerPixel
uns1 NumberOfBanks
uns1 MemoryModel
uns1 BankSize // bank size in KB
uns1 NumberOfImagePages
uns1 Reserved // reserved for page function
// Direct Color fields (required for direct/6 and YUV/7 memory models)
uns1 RedMaskSize, RedFieldPosition, GreenMaskSize, GreenFieldPosition
uns1 BlueMaskSize, BlueFieldPosition, RsvdMaskSize, RsvdFieldPosition
uns1 DirectColorModeInfo
// VBE 2.0
ptr4 PhysBasePtr // physical address for linear frame buffer
uns4 OffScreenMemOffset // pointer to start of off screen memory
uns2 OffScreenMemSize // amount of off screen memory in 1K units
uns1 Reserved[206]
}
VbeInfoBlock vib
ModeInfoBlock mib
V reálnym režimu
// Return VBE Controller Information
mov ax, 4F00h
push ds
pop es
mov di, offset vib
int 10h
cmp al, 4Fh
jnz l_error
// Return VBE mode information (call for each vmode in VideoModePtr)
mov ax, 4F01h
mov cx, vmode
push ds
pop es
mov di, offset mib
int 10h
cmp al, 4Fh
jnz l_error
// Set VBE Mode
mov ax, 4F02h
mov bx, vmode
or bx, 4000h // create linear frame buffer
int 10h
cmp al, 4Fh
jnz l_error
V chráněnym režimu
Pokud nemáte zapnutý stránkování, použijte deskriptor s bází PhysBasePtr.
Pokud máte zapnutý stránkování, namapujte si libovolnou lineární adresu na
fyzickou PhysBasePtr.
Pixel[x,y] najdete na adrese LA + (y * BytesPerScanLine) + (x * (BitsPerPixel
/ 8))