In all your keyboards there is a strange key: Print Screen . But, have you ever wondered what that key does there? What sense does it make that it is in that place in the times in which with cropping tools we can copy pieces of the screen as an image and even all of it? What is its origin ?
What the print screen key does is a copy of the image buffer at the time it is pressed, but it has a curious history that goes back to the days of the first PC, the IBM 5150 , when there were no graphical interfaces but only text and MS-DOS so simple that it lacked even peripheral management since that was done by the BIOS, whose acronym stood for basic input and output system.
When the user pressed this key, what he did is print the current screen through the LPT1 port, the standard port of printers at that time, and the grace of everything is where this port was found in the first PCs that appeared on the market .
The printer port on the graphics card: the source of the Print Screen key
The first computers did not have a printer management system as complex as the one we have today, and what is more, they did not even have their own but the graphics cards themselves had the printer port integrated in such a way. So when the user pressed the print screen key, the image buffer was automatically sent to the printer directly, so this was the only way in which documents could be printed with the first PCs.
The port for the printer was called LPT1, Line Print Terminal 1, and when the user pressed the key to print what happened was that 1 byte per clock cycle was copied from the VRAM to the LPT1 port found on the graphics card; in the process, the entire video memory was traversed until the last memory address of the same was reached.
The first printers that were used in the offices at that time were not inkjet printers but dot matrix printers, where each bit of the image buffer that was transmitted through the port and was interpreted as if it were a point on the paper , but later this was adapted to printers capable of printing in color, in which various bits of the image buffer were encoded as one color or another.
The old way of managing peripherals
Nowadays, the management of input and output peripherals is managed almost automatically, either by the use of software drivers that make the operating system dedicate itself to this task or by the work of the IOMMU that is in charge to automate the accesses of the operating system and applications to each peripheral.
But in the past, programmers had to know the memory map of computers, and this means that there were certain memory addresses that did not store data, but when invoked they activated certain functions in the hardware and for this there were two types of memory addresses With regard to hardware: some addresses were used to send data to the hardware and others simply did not store anything, but activated certain functions of the peripherals.
The problem is that if we wanted to copy the content of the image buffer to the printer under this concept we would have to manually manage this process through the code in each program, that is, each application would have to have its own printing functions, but not only from printing but also in things as simple as storing a file on disk, capturing the keystroke, and for those more common tasks IRQs or interrupt requests were used.
The Print key. Pant and IRQ7
To facilitate the work of the programmers there were a series of communication tasks with the peripherals that were managed by the BIOS, in such a way that the programmers did not have to develop a small program for such trivial things, among them printing a document.
In the first generations of PCs, when the print screen key was pressed, what was done was to invoke channel 7 for interrupt requests to the CPU (IRQ 7 or Interrupt Request), then it would stop doing what it was doing and the process of copying whatever was in the image buffer directly to the printer port, momentarily stopping all other CPU functions to carry out the printing process.
This was much easier than having to create a program for all the manual and tedious process of having to copy all the data and allowed any program to print with the user at the press of a single key, since the whole process was automated, simply with the Print key. Pant. It was wired directly or semi-directly to IRQ7.
As of PC AT, the LPT1 port left the graphics card to be located in another part of the computer (the motherboard), and nevertheless it did not result in a change in the way the programs act because they simply invoked the interrupt request 7 to operate and send the data to the printer.
The print screen key at present
At a certain point, the many applications began to use complex on-screen user interfaces that were not interested in being printed on the printer, so they had to manage their own printing systems.
When Windows 3.1 began to standardize, the call to IRQ7 for printing was discontinued to use software drivers managed by the operating system itself to communicate with the printer, and since then the print screen key simply copies the image buffer into the section of memory dedicated to the clipboard and this has been the case since then, since from that point the print key was no longer associated with said interrupt request.
Over time we have seen the LPT1 being replaced by the USB port and the BIOS by the UEFI, so everything that made sense of the “Print Screen” key originally has already disappeared.