Back to main

 

Function 61 - get parameters for direct access to the chart

 

A bit of theory:

The program can access the data of the graphic screen (the area of ​​memory that actually displays the contents of the screen) directly without calling the system functions via the gs selector:

mov eax, [gs: 0] will place the first dword of the buffer in eax containing information about the color of the left top point (and possibly the colors of several of the following). mov [gs: 0], eax when operating in VESA modes with LFB will set the color of the left top point (and possibly the colors of the next few). Knowledge is required to interpret graphic screen data.

some parameters that are returned by this function.

 

Remarks:

·         Graphics options rarely change when the system is running.

·         When the video mode changes, the system redraws all windows (event with code 1) and redraws the background (event 5). The same events occur in other cases that occur much more often than the video mode change.

·         When operating in LFB video modes, the gs selector points to the LFB itself, so reading / writing gs directly changes the screen contents. When working in video modes without LFB, gs points to a certain area of ​​kernel data, and all display functions faithfully perform double work of writing directly to the screen and writing to this buffer. As a result, when reading the contents of this buffer, the results correspond to the contents of the screen (with, generally speaking, a large color resolution), and the entry is ignored. An exception is the 320 * 200 mode, for which the screen is updated in the main loop of the system thread in accordance with the movements of the mouse cursor.

 

Screen resolution

 

Options:

·         eax = 61 - function number

·         ebx = 1 - number of subfunction

Return value:

·         eax = [x-axis resolution] * 65536 + [y-axis resolution]

 

Remarks:

·         You can use function 14, given that it returns sizes 1 less. This is a fully equivalent method.

 

The number of bits per pixel

 

Options:

·         eax = 61 - function number

·         ebx = 2 - subfunction number

Return value:

·         eax = number of bits per pixel (24 or 32)

 

Number of bytes per line

 

Options:

·         eax = 61 - function number

·         ebx = 3 - subfunction number

Return value:

·         eax = number of bytes that one scan line occupies (horizontal line on the screen)

 

Constants for registers:

  eax - SF_GET_GRAPHICAL_PARAMS (61)

  ebx - SSF_SCREEN_SIZE (1), SSF_BITS_PER_PIXEL (2),

    SSF_BYTES_PER_LINE (3)