你知道键盘上Scroll Lock键有什么用吗?可能大多数人都不知道这个键,恐怕它只是为了点亮键盘上的一个灯而以。但从原来DOS以来的人们估计或多或少的知道这个键是用于滚动锁定的,那具体是怎么一回事呢?请看下文:
[原文链接]http://www.straightdope.com/mailbag/mscrolllock.html
Dear Straight Dope:
Why does my computer keyboard have this "Scroll Lock" key that seems to serve no purpose whatsoever? In 15 years I don't remember ever pushing that button. I'm almost scared to touch it --Insanegrey, Lawrence, KS
Guest contributor Una Persson replies:
Although your mother told you that there are many things to avoid touching (like downed electric lines, scorpions, and the "naughty place"), don't be afraid to touch the Scroll Lock key. Nothing bad will happen ? in fact, probably nothing at all will happen. Once upon a time, however, something did.
The Scroll Lock key has appeared on the keyboards of IBM personal computers since the original 83-key PC/XT and the 84-key AT layouts, and remains on the 101-key and greater "enhanced" keyboards currently in use. The Scroll Lock key wasn't on the original Macintosh keyboards but appears on the Mac's "enhanced" keyboard.
The main intent of the Scroll Lock key was to allow scrolling of screen text up, down and presumably sideways using the arrow keys in the days before large displays and graphical scroll bars. You can see where this might have been handy in the DOS era, when screen output typically was limited to 80 characters wide by 25 rows deep. For some types of programs, spreadsheets being the obvious example, it's still handy now. In Microsoft Excel, Scroll Lock allows you to scroll a spreadsheet with the arrow keys without moving the active cell pointer from the currently highlighted cell. In Quattro Pro, another spreadsheet program, Scroll Lock works in a similar manner, although in contrast to Excel it's not possible to scroll the active cell pointer completely off the screen.
Other programs use Scroll Lock for special functions. It's said (although I haven't personally verified this) that the Linux operating system as well as some early mainframe and minicomputer terminals employed Scroll Lock to stop text from scrolling on your screen in command-line sessions ? pausing the scrolling, in effect. The ancient DOS adventure game ?Rogue? (one of my all-time favorites) used Scroll Lock to scroll your character?s movement through the ASCII dungeons on the display. I'm told some computers in the late 1980s used the Scroll Lock key to halt the scrolling of the boot-up messages that appeared when you started the computer. This last use may be apocryphal, as I could find no examples of computers that displayed this behavior. The point is, Scroll Lock sometimes does something besides make that little light light up.
Other odd keys worthy of note on your keyboard include the SysRq key (sometimes appearing as SysReq), which shares the same key as the ?Print Screen? key. (Historical sidelight ? SysRq was the ?84th key? added when the 83-key PC/XT keyboard became the 84-key AT keyboard.) Unless programmed by a particular application, the SysRq key does nothing in most operating systems, including DOS, Windows, and OS/2. The SysRq key has different "hooks" into the system BIOS (basic input/output system, the interface between the software and the low-level functions of the computer) from the other keys on the keyboard. IBM evidently included this key to facilitate task switching in future operating systems ? that is, to allow either switching from one task to another (as on a mainframe computer), or interrupting all tasks and returning control to the keyboard. Advanced MS-DOS Programming, second edition, Microsoft Press, states:
A multitasking program manager would be expected to capture INT 15H so that it can be notified when the user strikes the SysReq key.
In layman's terms that means, "You can make a multitasking program manager monitor a specific location in your computer's hardware so it can do something cool, such as letting the user switch tasks, when the SysReq key is pressed." As it turned out, the developers of Windows didn't use SysReq when implementing task switching. Some new keyboards no longer feature this key, and its days seem numbered.
The Pause/Break key was used in the DOS command line environment to pause scrolling of text on the screen, which could, depending on the program and its method of text output to the screen, have the effect of pausing program execution. I have several old DOS power plant analysis programs that run under OS/2, Windows NT, and Windows XP, and I can attest that the Pause key effectively pauses execution of all of these programs by halting display of their screen output. Other programs may be unaffected by the Pause key, though, depending on how they are written and whether or not they output text to the screen. The Break key, when combined with the Ctrl key, is used to terminate DOS applications ? and still does today, even in the DOS window of Windows XP. Some DOS communication programs used the Break key as a shortcut to terminate a modem connection, but that was really a function of the program, not the operating system.
The <`> key is called many names. According to the "Hacker's Jargon FAQ," these include:
backquote, left quote, left single quote, open quote, (grave accent), grave. Rare: backprime, [backspark], unapostrophe, birk, blugle, back tick, back glitch, push, (opening single quotation mark), quasiquote.
That's nice, but what is the symbol used for? It has no operating system function in DOS or Windows (although it does find use in the UNIX operating system), and in most type fonts doesn't match the appearance of an ordinary single quote (apostrophe), so it can't really be used as an open quote mark. However, programmers, being loath to let extraneous keys sit unused on a keyboard, have found use for it as an operator in the LISP and Python programming languages.
The pipe key <|>, also known as the bar key or vertical bar, is found above the backslash key <\>. It sees frequent use in C, C++, C# and other programming languages where it serves as the "OR" symbol. A single pipe indicates "bitwise OR," and two pipes together (||) signify "logical OR." For example:
C = (A | B)
means "apply bit operations to A and B and put the result in C." That is, if A is 0000 0110, and B is 1111 0000, then the result is:
A 0000 0110
B 1111 0000
--------------
C 1111 0110
which is bit-level arithmetic. If you're not a programmer, don't worry about it. The use of double pipes, such as:
if(A > 0 || B >0)
is a logical statement that means, "If variable A is greater than 0, or variable B is greater than 0, then do something."
In command-line environments such as DOS, the pipe symbol can add functionality to a DOS command. The way I most frequently use it is when doing a directory listing (DIR) on a large directory with hundreds of files. Say I type ?DIR? at the command prompt like so:
C:\Una\Lesbian Porn>DIR
. . . then the 22,000 files in that directory scroll past so fast I can't see their names. However, if I apply the pipe function at the command prompt like this:
C:\Una\Lesbian Porn>DIR | more
. . . then the display will show me one screen of files at a time, with a "More" at the bottom. To display the next screen of files, I hit any key to continue, until all of the files in the directory have been listed (or I break, by pressing Ctrl-C). What's happening is that the pipe symbol causes the output of the DIR command to be "piped" to the "More" (paging) command. You get pretty much the same result by using the "/p" modifier, such as "DIR /p," to display directory information a page at a time.
One suspects that some oddball keys were put on the PC keyboard (or to be more precise, included in the ASCII character set, most of which found its way onto the PC keyboard) because the developers figured they'd come in handy for something. On the whole that has turned out to be the case--programmers and developers have found a use for nearly every key on the keyboard, even if that use isn't obvious to the general computing public. Witness the tilde <~>, which, whatever use it may have as a diacritical mark, now can mean "home directory" or "text omitted," among other things. Given the pace of change in information technology, there's a lot to be said for designing your user interface for maximum flexibility.
--Guest contributor Una Persson (nee Anthracite)
Straight Dope Science Advisory Board