How does a computer draw anything to the screen at the lowest level (nothing about external libraries like X11)? Are there supposed to be assembly commands that do this? How exactly does the CPU control what appears on the screen?
The video hardware is constantly reading this memory and using whatever technology to send signals to the monitor that essentially tell it the amount of red, green, and blue to light up for a particular pixel, constantly scanning the screen with up to date information.
Explanation: Light pens enables users to interact with the screen with pinpoint accuracy. It's main use is to select text, draw pictures and interact with elements on a computer screen or monitor.
Fundamentally the same way it reads from the harddrive, or plays a sound effect.
By writing certain data to specific memory addresses which are mapped by the memory controller to the external hardware in question (harddrive, GPU or sound card in these cases). When the hardware receives those writes, it interprets the data written as instructions about what to do.
The CPU is really kind of isolated from the rest of the system. All it really knows about is the memory bus. It can read and write data on that bus, and that's basically it. Some of these reads/writes go to memory, and others can be mapped to the control registers of various hardware, or to the device's memory if such exists, allowing the CPU to communicate with other devices.
A modern GPU has its own dedicated RAM, which it can load data into. So the CPU sends off instructions to the GPU, specifying where in main memory it can find the data used to generate the screen contents and what to do with it. Then the GPU loads that data from main memory into its own RAM, where it performs the necessary transformations and computations, before writing it into its frame buffer, which the montitor is constantly reading from.
Typically there is an area of memory called frame buffer in your video card. Writing a value there means to establish the color value of a pixel.
You can consider a frame buffer like a 2D array, where each bit represent a pixel on the screen. To represent colors are used different levels of buffer. Today a common frame buffer has 24 level (8 for each RGB color component) and allow the defenition of 2^24 possible colors.
Nowadays generally the access to the frame buffer occurs through the GPU for perforances issues: even if it possible for the CPU to perform this task, it's quite expensive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With