How does the processor interact with the monitor?

So the question is: how does a computer switch from a binary code representing the letter "g" to the correct combination of pixel illumination?

Here is what I have managed to find out so far. I understand how the processor accepts the input data generated by the keyboard and stores it in RAM, and then retrieves it for operations using a set of instructions. I also understand how this happens with these operations. The CPU then transmits the result of the operation, which for this example is a set of instructions that extracts the "g" from the memory address and sends it to the output monitor.

Now my question is, does the processor convert the letter "g" to the bitmap directly, or does it use a graphics processor that is built-in or separate, or does the monitor handle the conversion?

Also, is it possible to write custom code that interprets the binary and formats it for display?

+4
source share
2 answers

On most systems, the central processor does not speak directly to the monitor; he sends commands to a graphic card, which, in turn, generates an electrical signal, which the monitor translates into an image on the screen. There are many steps in this process, and the processing model is system dependent.

From a software point of view, communication with a graphics card is done using a graphics card driver that translates your program and operating system requests into something that the hardware on the card can understand.

There are different types of drivers; The easiest way to explain a text mode driver. In text mode, the screen consists of several cells, each of which can contain only one of the predefined characters. The driver includes a predefined bitmap font that describes what the character looks like, indicating which pixels are on and which are off. When the program asks for a character to be printed on the screen, the driver looks at it in a font and tells the card to change the electrical signal that it sends to the monitor so that the pixels on the screen display what is in the font.

Text mode has limited use. You get only one font choice, a limited choice of colors, and you cannot draw graphics like lines or circles: you are limited by characters. For high-quality graphical output, a different driver is used. Graphic cards usually include a memory buffer that contains the contents of the screen in a well-defined format, for example, "n bits per pixel, m pixels per line" .. To draw something on the screen, you just need to write to this memory buffer. For this, the driver maps the buffer to computer memory so that the operating system and programs can use the buffer as if it were part of RAM. Programs can then directly place the pixels they want to show and place the letter g on the screen so that the application programmer displays the pixels in a way that is similar to that letter. Of course, there are many libraries that will help programmers do this, otherwise the current state of the GUI will be even more tolerant than it is.

Of course, this is a simplification of what is actually happening on the computer, and there are systems that do not work exactly like that, for example, some processors have an integrated graphics card, and some output devices are not based on pixel drawing, but the structure of the lines, but I hope that this will ease the confusion a bit.

+5
source

See here http://en.m.wikipedia.org/wiki/Code_page_437 It describes a character-based mechanism used to display characters on a VGA monitor in character mode.

+1
source

Source: https://habr.com/ru/post/1496505/


All Articles