CLOSE

Overview of VESA BIOS Extensions (VBE)

The VESA BIOS Extensions (VBE) is a set of software interfaces standardized by the Video Electronics Standards Association (VESA) that allow operating systems and applications to access the advanced features of video hardware, regardless of the underlying hardware. VBE provides a standardized way for software to interact with the graphics card's firmware, enabling higher resolutions and color depths than the standard VGA modes.

VESA BIOS Extensions (VBE) is a VESA standard that defines an interface for software to access compliant video boards at high resolutions and bit depths. Unlike traditional BIOS calls (INT 10h), which are limited to resolutions of 640x480 pixels with 16-color (4-bit) depth or less, VBE allows for more advanced graphics capabilities.

Purpose:

  • VBE provides a standardized way for software to interact with video cards, enabling high-resolution graphics modes.
  • It replaces the limitations of older BIOS calls (INT 10h) by allowing access to higher resolutions and color depths.

Versions:

VBE has evolved over time:

  • Early VBE: Versions 1.0, 1.1, and 1.2 (defined in the late 1980s and early 1990s) required real mode and had limited features.
  • VBE Core 2.0: Introduced in November 1994, it added features like linear framebuffer access and protected mode banking.
  • VBE 3.0: The most capable version, supporting high resolutions and bit depths.

Functionality:

  • Capabilities Determination: Applications can query the graphics card’s capabilities (e.g., supported modes, memory layout).
  • Display Mode Setting: VBE allows setting display modes (resolutions, color depths).
  • Linear Framebuffer Access: Provides direct access to the framebuffer memory.
  • Protected Mode Banking: Efficiently manages memory in protected mode.

Key Features of VBE

  • Standardized Interface:
    • VBE provides a uniform software interface to video hardware, allowing developers to write code that works across a wide range of graphics cards without needing to know the specifics of each card.
  • High Resolutions and Color Depths:
    • VBE supports a variety of video modes beyond the standard VGA, including high resolutions (e.g., 1024x768, 1280x1024) and color depths (e.g., 15-bit, 16-bit, 24-bit, and 32-bit color).
  • Protected Mode Interface:
    • VBE includes support for protected mode, allowing modern operating systems to use these video modes while maintaining system stability and security.
  • Linear Framebuffer:
    • VBE supports linear framebuffer modes, which simplify the programming model by providing direct access to video memory.

Our BareMetal Example:

I Will keep giving example of our BareMetal OS during the explanation of the VBE functions in below sections.

The most basic steps are as follows:

0x4F00:

  • Get the VESA Information using the Function 0x4F00.
  • It would contain the general information about the VBE implementation of the Hardware.
  • The most important things which we requires from this structure is:
    • video_mode_pointer: Pointer to video mode list, which will be used in next function to get information about the particular video mode.
    • We traverse through the video mode list pointed by the video_mode_pointer and pass that video mode to the Function 0x4F01. Means for each video mode we will call 0x4F01 function to get the video mode information and compare the received data which is width, height and bits per pixel with which we desired. If we get the desired video mode then we set it up using the 0x4F02 function.

0x4F01:

  • Get the Information of particular Video Mode.
  • We pass the video mode from the video mode list to get information about that mode.
  • The Information is returned into a buffer which we pass to this function.
  • It contains four important fields which we need as of now:
    • .x_resolution: which will contains the width of the passed video mode.
    • .y_resolution: which will contains the height of the passed video mode.
    • .bits_per_pixel: which will contains the bits per pixel information for the passed video mode.
    • .physical_base_pointer: which will contains the Frame buffer address for the passed video mode, with which we can draw on screen by just writing pixel data starting from this memory address.
  • We will compare our desired width, height and bits per pixel with every mode while traversing through the list.
  • When we get the desired video mode then set it up using the 0x4F02 function.

0x4F02:

  • In this we function we pass the desired video mode which we want to set.
  • We need to set the bit 14 to enable the Linear Frame Buffer while setting the video mode.

This whole will be the process to achieve this.

VESA BIOS Extensions (VBE) Functions

The VESA BIOS Extensions (VBE) provide a set of functions that software can use to control the video hardware in a standardized manner.

All VBE Functions are called with the AH register set to 4Fh to distinguish them from the standard VGA BIOS functions. The AL register is used to indicate which VBE function is to be performed.

VBE Return Status:

The AX register is used to indicate the completion status upon return from VBE functions. If VBE support for the specified function is available, the 4Fh value passed in the AH register on entry is returned in the AL register. If the VBE function completed successfully, 00h is returned in the AH register. Otherwise the AH register is set to indicate the nature of the failure.

VBE RETURN STATUS
 AL == 4Fh: Function is supported
 AL != 4Fh: Function is not supported
 AH == 00h: Function call successful
 AH == 01h: Function call failed
 AH == 02h: Function is not supported in the current hardware configuration
 AH == 03h: Function call invalid in current video mode

These functions are typically accessed through the BIOS interrupt 0x10. Below are the primary VBE functions, along with a brief description of each.

1 VBE Function 00h - Return VBE Controller Information

This function retrieves general information about the VBE implementation and the capabilities of the video hardware. This required function returns the capabilities of the display controller, the revision level of the VBE implementation, and vendor specific information to assist in supporting all display controllers in the field.

  • Purpose:
    • The purpose of this function is to provide information to the calling program about the general capabilities of the installed VBE software and hardware. This function fills an information block structure at the address specified by the caller.

Input:

  • AX = 0x4F00 (VBE function number)
  • ES:DI = Pointer to a buffer for storing the VBE information, It should point to 512-byte buffer where the VBE BIOS information will be stored.
  • Execute int 0x10: Before Calling int 10h, ensure that ES:DI points to the buffer where you want to store the VBE information.

Output:

  • AX = VBE return status (0x004F if successful)
  • Buffer at ES is filled with VBE controller information
mov ax, 0x4F00
mov di, vbe_info_block
int 0x10

cmp ax, 0x004F
jne .vesa_error

;; do something here like printing info
mov si, .vbe_signature
mov cx, 4
call print_passed_char




.vesa_error:
	mov al, 'F'
	mov ah, 0x0E
	int 0x10
	cli
	hlt

;; This function prints the specified number of character from the buffer
;; si = pointer to buffer
;; cx = number of characters to print
print_passed_char:
	pusha
	.print_passed_char_loop:
	lodsb
	mov ah, 0x0E
	int 0x10
	loop .print_passed_char_loop
	popa
ret

VBE Info Structure:

; The VBE Controller Information structure
; The BIOS will fill this buffer with the relevant data.
; You can allocate this buffer in the `.bss` section or any other suitable memory area.

vbe_info_block:
    .vbe_signature db 'XXXX'        ; VbeSignature (4 bytes, should be 'VESA' in a real scenario)
    .vbe_version dw 0x0300          ; VbeVersion (2 bytes, BCD for 3.00)
    .oem_string_pointer dd 0        ; OemStringPtr (4 bytes, pointer)
    .capabilities dd 0              ; Capabilities (4 bytes)
    .video_mode_pointer dd 0        ; VideoModePtr (4 bytes, pointer)
    .total_memory dw 0              ; TotalMemory (2 bytes)
    .oem_software_rev dw 0          ; OemSoftwareRev (2 bytes)
    .oem_vendor_name_pointer dd 0   ; OemVendorNamePtr (4 bytes, pointer)
    .oem_product_name_pointer dd 0  ; OemProductNamePtr (4 bytes, pointer)
    .oem_product_revision_pointer dd 0 ; OemProductRevPtr (4 bytes, pointer)
    .reserved times 222 db 0        ; Reserved (222 bytes)
    .oem_data times 256 db 0        ; OemData (256 bytes)

Explanation of the Structure Fields

  1. vbe_signature: This should contain the characters 'VESA' to indicate that the structure is correctly filled by the VBE implementation. In your example, it's 'VBE2' for illustration purposes.
    1. Size = 4 bytes
    2. Purpose = Contains the characters “VESA” to indicate the structure is filled by the VBE implementation.
  2. vbe_version: This field specifies the VBE version. In this case, 0x0300 represents version 3.00.
    1. Size = 2 bytes
    2. Purpose = Contains the VBE version number.
  3. oem_string_pointer: This is a 32-bit pointer (VbeFarPtr) to a null-terminated OEM string.
    1. Size = 4 bytes (32-bit far pointer)
    2. Purpose = Pointer to a null-terminated OEM string.
  4. capabilities: This field describes the capabilities of the graphics controller.
    1. Size = 4 bytes
    2. Purpose = Indicates capabilities of the graphics controller.
      • Bit 0: DAC width is switchable.
      • Bit 1: Controller is VGA compatible.
      • Bit 2: RAMDAC is fixed (if set, the DAC width is fixed at 8 bits per primary color).
  5. video_mode_pointer: This is a 32-bit pointer (VbeFarPtr) to an array of supported video modes, each represented by a 16-bit mode number.
    It points to a list of mode numbers for all display modes supported by the VBE implementation. Each mode number occupies one word (16 bits). The list of mode numbers is terminated by a -1 (0xFFFF).
    1. It is an segment:offset pointer to the list of supported video modes.
      1. Size = 4 bytes (32-bit far pointer)
      2. Purpose = Pointer to a list of supported video modes. Each mode is identified by a 16-bit mode number. The list is terminated with 0xFFFF.
      3. Combining Segment and Offset:
        1. To obtain the actual memory address, combine the segment and offset:
          1. Calculate the physical address as (video_modes_segment << 4) + video_modes_offset.
          2. This gives you the linear address where the list of supported video modes is stored.
          3. Iterating Through the Video Modes:
            • Once you have the physical address, treat it as an array of 16-bit values (mode numbers).
            • Iterate through this array until you encounter the end-of-list marker, which is typically 0xFFFF.
            • Each value represents a supported video mode (e.g., 0x0103, 0x0118, etc.).
  6. total_memory: This specifies the amount of video memory in 64KB blocks. For example, if this value is 0x0010, it means there is 1MB of video memory.
    1. Size = 2 bytes
    2. Purpose = Specifies the total amount of video memory in 64KB blocks.
  7. oem_software_rev: This is the revision number of the VBE software implementation.
    1. Size =  2 bytes
    2. Purpose = OEM software revision number.
  8. oem_vendor_name_pointer: This is a 32-bit pointer (VbeFarPtr) to a null-terminated string containing the vendor name.
    1. Size = 4 bytes (32-bit far pointer)
    2. Purpose = Pointer to a null-terminated string containing the vendor name.
  9. oem_product_name_pointer: This is a 32-bit pointer (VbeFarPtr) to a null-terminated string containing the product name.
    1. Size = 4 bytes (32-bit far pointer)
    2. Purpose = Pointer to a null-terminated string containing the vendor name.
  10. oem_product_revision_pointer: This is a 32-bit pointer (VbeFarPtr) to a null-terminated string containing the product revision.
    1. Size = 4 bytes (32-bit far pointer)
    2. Purpose = Pointer to a null-terminated string containing the product revision.
  11. reserved: This array of 222 bytes is reserved for future use and should be zeroed out.
    1. Size  = 222 bytes
    2. Purpose = Reserved for future expansion and should be zeroed out.
  12. oem_data: This area of 256 bytes is reserved for OEM-specific data.
    1. Size = 256 bytes.
    2. Purpose = OEM-specific data area.
width: dw 1920
height: dw 1080
bpp: db 32
mode: dw 0

Assembly Code:

vbeInfoBuffer resb 512	; Buffer to store VBE controller information.
print_buffer resb 32	; Buffer for printing VBE information

mov ax, 0x4f00			; VBE function 0x4F00
mov di, vbeInfoBuffer	; Pointer to buffer for VBE information
int 0x10				; BIOS video interrupt

; Check return status
cmp ax, 0x004F			; Check if function call was successful
jne error_handler		; Jump to error handler if not successful

; Print VBE controller information
call print_vbe_info

error_handler:
	; Handle error condition here
	; For example, print an error message 
	jmp $

; Function to print VBE controller information
print_vbe_info:
    ; Print VBE signature
    mov esi, vbeInfoBuffer
    mov edi, print_buffer
    mov ecx, 4
    rep movsb            ; Copy VBE signature to print buffer
    mov byte [edi], 0   ; Null-terminate the string
    call print_string   ; Print the string in the buffer

    ; Print VBE version
    mov ax, word [esi + 4]  ; VBE version is a word (2 bytes)
    call print_hex_word     ; Print VBE version in hexadecimal

    ; Print other fields similarly
    ; For example, capabilities, total memory, OEM vendor name, etc.

    ret

; Function to print a string
print_string:
    mov ah, 0x0E           ; BIOS function to print character
    mov bx, 0x0007         ; Display page (0), attribute (white on black)
.loop:
    lodsb                  ; Load character from string into AL
    test al, al            ; Check for null terminator
    jz .done               ; If null terminator, exit loop
    int 0x10               ; Otherwise, print the character
    jmp .loop              ; Continue printing characters
.done:
    ret

; Function to print a hexadecimal word (2 bytes)
print_hex_word:
    ; Convert each nibble of the word to a hexadecimal character and print it
    mov cx, 4               ; Loop counter for each nibble
.next_nibble:
    rol ax, 4               ; Rotate left to get next nibble in AL
    mov dl, al              ; Move nibble to DL for printing
    and dl, 0x0F            ; Mask upper bits to isolate nibble
    add dl, '0'             ; Convert nibble to ASCII character
    cmp dl, '9'             ; Check if character is in range '0' to '9'
    jbe .print_digit        ; If yes, print digit
    add dl, 7               ; If not, adjust for characters 'A' to 'F'
.print_digit:
    mov ah, 0x0E            ; BIOS function to print character
    mov bx, 0x0007          ; Display page (0), attribute (white on black)
    int 0x10                ; Call BIOS interrupt to print character
    loop .next_nibble       ; Continue with next nibble
    ret
; Function to print a newline character
print_newline:
    mov ah, 0x0E            ; BIOS function to print character
    mov al, 0x0A            ; Newline character
    mov bh, 0x00            ; Page number
    mov bl, 0x07            ; Attribute (white on black)
    int 0x10                ; Call BIOS interrupt to print character
    mov al, 0x0D            ; Carriage return character
    int 0x10                ; Call BIOS interrupt to print character
    ret

; Function to print OEM string
print_oem_string:
    mov edi, print_buffer   ; Destination buffer
    xor ecx, ecx            ; Clear ECX register
    mov cl, 32              ; Maximum characters to print
    cld                     ; Set direction flag to forward
    repne scasb             ; Scan for null terminator
    jecxz .done             ; If not found, exit
    mov ecx, 32             ; Reset ECX to maximum characters to print
    mov esi, edi            ; Set source index to destination
    sub esi, ecx            ; Calculate source pointer
    mov edi, print_buffer   ; Reset destination pointer
    mov ecx, 32             ; Reset ECX to maximum characters to print
    rep movsb               ; Copy string to buffer
.done:
    call print_string       ; Print the string
    ret
modeInfoBuffer  resb 256         ; Buffer to store mode information

; Invoke VBE function 0x4F01 to get supported video modes
    mov ax, 0x4F01         ; VBE function 0x4F01
    mov di, modeInfoBuffer ; Pointer to buffer for mode information
    mov cx, 256            ; Size of mode information buffer
    int 0x10               ; BIOS video interrupt
    
    ; Check return status
    cmp ax, 0x004F         ; Check if function call was successful
    jne error_handler      ; Jump to error handler if not successful

    ; Print supported video modes
    call print_supported_modes
    
    ; Function to print supported video modes
print_supported_modes:
    mov esi, modeInfoBuffer       ; Set source index to mode information buffer
    mov edi, print_buffer         ; Set destination index to print buffer
    mov cx, word [esi]            ; Number of supported modes
    mov byte [edi], 'S'           ; Print 'Supported Modes:' header
    mov byte [edi + 1], ' '
    mov byte [edi + 2], ' '
    add edi, 3                    ; Move destination index
    call print_string             ; Print header
    call print_newline            ; Print newline

.loop_modes:
    add esi, 2                    ; Move to next mode number
    mov ax, [esi]                 ; Get video mode number
    call print_hex_word           ; Print mode number in hexadecimal
    call print_newline            ; Print newline
    loop .loop_modes              ; Repeat for all supported modes

    ret
    

2 VBE Function 01h - Return VBE Mode Information

This function returns detailed information about a specific VBE mode.  This required function returns extended information about a specific VBE display mode from the mode list returned by VBE Function 00h.  This function fills the mode information block, ModeInfoBlock, structure with technical details on the requested mode. The ModeInfoBlock structure is provided by the application with a fixed size of 256 bytes

  • Function Code:
    • The VBE Function code 0x4f01 corresponds to “Get Mode Info”.
    • You will pass the desired video mode (usually represented by a mode number) in the CX register.
  • Buffer for Mode Info:
    • Prepare a 256-byte buffer (mode info block) where the function will store the details of the specified mode.
    • Set ES:DI to point to the this buffer before invoking the function.
  • Mode Info Block Structure:
    • It is of 256 bytes in size.
    • The mode info block contains various fields, including:
      • pitch: Number of bytes per horizontal line.
      • width: Width of the mode in pixels.
      • height: Height of the mode in pixels.
      • bpp: Bits per pixel in this mode.
      • framebuffer: Physical address of the linear frame buffer (where you can write to draw on the screen).

Input:

  • AX = 0x4F01 (VBE function number)
  • CX = VBE mode number
  • ES:DI = Pointer to a buffer for storing the mode information

Output:

  • AX = VBE return status (0x004F if successful)
  • Buffer at ES is filled with mode information
mov ax, 0x4F01
mov cx, modeNumber		; The Mode which we want information of.
mov di, mode_info_block	; Mode info structure which will be populated by mode info by the BIOS.
int 0x10
;; 256 bytes long
mode_info_block:
    ;; Mandatory info for all VBE revisions
	.mode_attributes: dw 0
	.window_a_attributes: db 0
	.window_b_attributes: db 0
	.window_granularity: dw 0
	.window_size: dw 0
	.window_a_segment: dw 0
	.window_b_segment: dw 0
	.window_function_pointer: dd 0
	.bytes_per_scanline: dw 0

    ;; Mandatory info for VBE 1.2 and above
	.x_resolution: dw 0
	.y_resolution: dw 0
	.x_charsize: db 0
	.y_charsize: db 0
	.number_of_planes: db 0
	.bits_per_pixel: db 0
	.number_of_banks: db 0
	.memory_model: db 0
	.bank_size: db 0
	.number_of_image_pages: db 0
	.reserved1: db 1

    ;; Direct color fields (required for direct/6 and YUV/7 memory models)
	.red_mask_size: db 0
	.red_field_position: db 0
	.green_mask_size: db 0
	.green_field_position: db 0
	.blue_mask_size: db 0
	.blue_field_position: db 0
	.reserved_mask_size: db 0
	.reserved_field_position: db 0
	.direct_color_mode_info: db 0

    ;; Mandatory info for VBE 2.0 and above
	.physical_base_pointer: dd 0     ; Physical address for flat memory frame buffer
	.reserved2: dd 0
	.reserved3: dw 0

    ;; Mandatory info for VBE 3.0 and above
	.linear_bytes_per_scan_line: dw 0
    .bank_number_of_image_pages: db 0
    .linear_number_of_image_pages: db 0
    .linear_red_mask_size: db 0
    .linear_red_field_position: db 0
    .linear_green_mask_size: db 0
    .linear_green_field_position: db 0
    .linear_blue_mask_size: db 0
    .linear_blue_field_position: db 0
    .linear_reserved_mask_size: db 0
    .linear_reserved_field_position: db 0
    .max_pixel_clock: dd 0

    .reserved4: times 190 db 0      ; Remainder of mode info block

BareMetal Example:

In order to get the modes list we need to use the video_mode_pointer obtained from the 0x4F00 function call.

mov ax, word [vbe_info_block.video_mode_pointer]	; Load pointer (offset part into AX)
mov [offset], ax		; Store in variable
mov ax, word [vbe_info_block.video_mode_pointer + 2]	; Load pointer (segment part) into AX
mov [segment], ax		; Store in variable for future uses
mov fs, ax				; AX wich holds the segment part, set to FS
mov si, [offset]		; Move offset to SI
; Get next VBE video mode

.find_mode:
	mov dx, [fs:si]		; move values stored at FS:SI into DX
	inc si
	inc si				; Increment si by 2
	mov [offset], si	; Store updated SI
	mov [mode], dx		; Store the video mode pointed by SI to mode variable
	
	cmp dx, word 0xFFFF	; at end of video mode list?
	je end_of_modes		; if end of the video mode list jump to the end_of_modes
	
	;; Get info of the current video mode from the video list
	mov ax, 0x4F01		; Get vbe mode info function
	mov cx, [mode]		; store the mode into CX whose Info we want
	mov di, mode_info_block	; Mode info block mem address
	int 0x10
	
	cmp ax, 0x4F		; compare ax with 0x4F
	jne .error			; if not equal to 0x4F means error
	
	;; Here it means we got the information of particular mode
	;; Print Out mode values
	mov dx, [mode_info_block.x_resolution]	; get the x resolution
	call print_hex		; Print width		; print it
	mov ax, 0x0E20		; Print a space with ah = 0x0E, al = 0x20 = 32 ASCII		
	int 0x10			; video services interrupt
	
	mov dx, [mode_info_block.y_resolution]	; get the y resolution
	call print_hex		; Print height
	mov ax, 0x0E20		; Print a space
	int 0x10			; video services interrupt
	
	xor dh, dh			; clear DH register
    mov dl, [mode_info_block.bits_per_pixel]	; Get the bits per pixel info
    call print_hex	; Print bpp
    mov ax, 0E0Ah	; Print a newline
    int 10h
    mov al, 0Dh
    int 10h
    
    ;; Compare values with desired values
    mov ax, [width]			; width variable contains the width of video mode which we want
    cmp ax, [mode_info_block.x_resolution]	; compare it with the x resolution
    jne .next_mode							; if not same jump to .next_mode
    
    mov ax, [height]					
    cmp ax, [mode_info_block.y_resolution]
    jne .next_mode

    mov ax, [bpp]
    cmp al, [mode_info_block.bits_per_pixel]
    jne .next_mode
    
    ;; At this point we have the desired mode id in the [mode] variable if it is supported by the graphics card.

3 VBE Function 02h - Set VBE Mode

This function sets the video mode to a specified VBE mode number.

Input:

  • AX = 0x4F02 (VBE function number)
  • BX = VBE mode number (bit 14 set for linear framebuffer)

Output:

  • AX = VBE return status (0x004F if successful)

Syntax:

mov ax, 0x4F02
mov bx, modeNumber	; The desired video mode which we want to set
int 0x10

BareMetal Example:

mov ax, 0x4F02	; Set VBE mode
mov bx, [mode]	; The desired video mode id which we stored during iterating through the video mode list.

or bx, 0x4000	; Enable Linear fram buffer, bit 14 to 1
xor di, di
int 0x10

cmp ax, 0x004F
jne .error

;; Do your work here, the video mode would have been set by now.

4 VBE Function 03h - Return Current VBE Mode

This function returns the currently active VBE mode.

Input:

  • AX = 0x4F03 (VBE function number)

Output:

  • AX = VBE return status (0x004F if successful)
  • BX = Current VBE mode number
mov ax, 0x4F03
int 0x10
mov currentMode, bx

5 VBE Function 04h - Save/Restore State

This function saves or restores the video hardware state.

Input:

  • AX = 0x4F04 (VBE function number)
  • DL = Sub-function (00h for save, 01h for restore)
  • ES = Pointer to a buffer for storing/restoring the state

Output:

  • AX = VBE return status (0x004F if successful)
; Save state
mov ax, 0x4F04
mov dl, 0x00
mov di, saveStateBuffer
int 0x10

; Restore state
mov ax, 0x4F04
mov dl, 0x01
mov di, saveStateBuffer
int 0x10

6 VBE Function 05h - Display Window Control

This function controls the memory window used in banked modes.

Input:

  • AX = 0x4F05 (VBE function number)
  • BX = Window number (0 for Window A, 1 for Window B)
  • DX = Window address

Output:

  • AX = VBE return status (0x004F if successful)
mov ax, 0x4F05
mov bx, windowNumber
mov dx, windowAddress
int 0x10

7 VBE Function 06h - Get/Set Logical Scan Line Length

This function gets or sets the length of the logical scan line.

Input (Set):

  • AX = 0x4F06 (VBE function number)
  • BL = 00h (set scan line length)
  • CX = Number of bytes per scan line

Output:

  • AX = VBE return status (0x004F if successful)
  • BX = Maximum number of bytes per scan line (if successful)

Input (Get):

  • AX = 0x4F06 (VBE function number)
  • BL = 01h (get scan line length)

Output:

  • AX = VBE return status (0x004F if successful)
  • BX = Bytes per scan line
  • DX = Maximum scan line length
; Set scan line length
mov ax, 0x4F06
mov bl, 0x00
mov cx, scanLineLength
int 0x10

; Get scan line length
mov ax, 0x4F06
mov bl, 0x01
int 0x10
mov bx, bytesPerScanLine
mov dx, maxScanLineLength

8 VBE Function 07h - Set/Get Display Start

This function sets or gets the display start address.

Input (Set):

  • AX = 0x4F07 (VBE function number)
  • BH = 00h (set display start)
  • BL = 00h (set by pixel)
  • CX = Starting X position
  • DX = Starting Y position

Output:

  • AX = VBE return status (0x004F if successful)

Input (Get):

  • AX = 0x4F07 (VBE function number)
  • BH = 01h (get display start)

Output:

  • AX = VBE return status (0x004F if successful)
  • CX = Starting X position
  • DX = Starting Y position
; Set display start
mov ax, 0x4F07
mov bh, 0x00
mov bl, 0x00
mov cx, startX
mov dx, startY
int 0x10

; Get display start
mov ax, 0x4F07
mov bh, 0x01
int 0x10
mov cx, startX
mov dx, startY