From Processor To Display

What is the programming side of the keyboard's PrintScreen?
When I hit this button, what is the computer doing to give me the image that my monitor is displaying?

In the same arena, how does the computer tell the monitor what to display visually? I move the mouse and the cursor appears to be moving as a result of my manipulation, but I know it is some intricate process of programmed communication. What is happening here? not so much in lay men's terms but to the grit of it.

If I wanted to write code to alter what and how the monitor is told to display, and also how the mouse and keyboard receive their information and send it to the monitor... what languages and or avenues ought I look into? Is this all machine language? assembly? higher?

Depends on your system. On a lot of systems printscreen doesn't do anything.

The video screen is, ultimately, showing the contents of memory -- a special memory block on the video card itself. For 32-bit color, each four bytes is one pixel. The video card reads through 60+ times a second and blasts the raw data to your screen, over and over. Whenever its contents change, the new pixels will show up the next redraw.

This memory is special of course, but the computer can still use it like ordinary memory. That's why video cards need such fast buses, so the CPU can transfer data across it almost as fast as its own memory. Your computer can and does write to it whenever it pleases, and can read from it too. So printscreen just grabs its contents(or, more likely, tells the OS to grab its contents.) It might even just grab a copy of what it kept from last time instead of grabbing from video memory itself...

The GUI goes through a list of windows and their contents, and from them creates a block of memory representing pixels, then copies it into video memory. Next time the video card redraws the screen it'll redraw that new information.

Sometimes, if there's just a small change happening like the mouse moving. the GUI can get away with only changing a square surrounding the area that's changed, which is a whole lot faster than updating the whole thing.

If you're using a GUI you can talk to it in a variety of languages. You'd just be using the usual GUI toolkits and so forth. If you want to talk to it raw, you'd use something like SDL which can either jump through the correct hoops in whatever your OS is to give you raw video memory or, if it can't(plenty of GUI's don't give you direct access), give you something that acts as close to real video memory as it can.

1 Like

Thanks for your time Corona688. I really appreciate the response you wrote.