ZX SPECTRUM Introduction |
2. The Keyboard The keyboard of the Spectrum Is very similar to a standard typewriter. The letter and number keys are in the same place; however each key can perform more than one function. On a normal typewriter the letters appear in lower case, and when used in conjunction with the shift key, appear as upper case (capitals). The Spectrum keyboard is just the same. To help you know what mode the keyboard is in, a reversed out (white on black) letter appears on the screen indicating the position of the next character that appears when a key is pressed. The letter is flashing to distinguish it from any character already on the screen. It is called the cursor. When first switched on the Spectrum shows a copyright message on the screen. Pressing any key brings up the word printed below the letter on the key, (this is called the keyword). This is because the computer is expecting a command from you to tell it what to do and all commands must begin with a keyword. Unlike most other computers the Spectrum allows you to enter keywords with only one key depression. For example, if the P key is pressed immediately after turning on, the keyword PRINT appears on the screen. The “ symbol is marked on the P key as well. To get it, you must press two keys at once; hold down the SYMBOL SHIFT key, which is near the bottom right-hand corner of the keyboard, and while still doing that, press the P key. |
Figure 3 The cursor now changes to an L, as a Letter is now expected by the computer. Type in the letters "Hello". If there is already some other text, for example, on the screen turn the computer of (remove the 9V plug) and start again. Use the CAPS SHIFT key to get the upper case H. In general, anything coloured white above the key requires CAPS SHIFT to access, and anything coloured red on the key requires SYMBOLS SHIFT A command beginning with PRINT tells the computer to write the letters enclosed in the double quotation marks onto the screen. For this command to be executed by the computer, the ENTER key must be used. When this has been done the screen should display the word Hello and some other characters. (A flashing question mark indicates a mistake somewhere. If this happens start again and repeat the exercise). The message at the bottom is really the computer reporting back that everything has gone 'OK'. The message is important when running programs but can be ignored at the moment. Notice something else: The letter O and the numeral 0 are represented by different characters. It is important to remember this, The numeral 0 always has a line through it. The computer will always interpret the letter O as a letter, so don't press the wrong key. Similarly, the numeral 1 and the lower case letter L are different and unlike some typewriters, these cannot be interchanged. As the keyboard mode is so important to understand it is useful to summarise what happens once again. The flashing character L is called the cursor. It shows whereabouts on the screen the computer will put the next thing that you type. It is not always an L; if you turn the computer oft and on and then press ENTER the copyright message will change into a K cursor. The letter that it uses tells you how the computer will interpret the next thing that you type. At the beginning of a Line it will be a flashing K standing for 'keyword'. (The copyright message and reports also count as a flashing K) A keyword is one of the computer's special words, occurring at the beginning of a command to give the computer a general idea of what the command is going to tell it to do. Since the computer is expecting a keyword at the beginning of a line, when you press - say - the P key the computer decides not to interpret this as a P but as PRINT; and it warns you that it is going to do this by making the cursor a K. When it has the first keyword, it doesn't expect another one so what you type now will be interpreted as letters. To show this, the computer changes the cursor to an L for 'letter'. These different states are often called modes - we shall talk about keyword (or K) mode, and letter (or L) mode. If you want to type a lot of capital letters without holding CAPS SHIFT down, you can make all letters come out as capitals by first pressing CAPS LOCK (CAPS SHIFT with 2). To show this is happening, the L cursor will be replaced by a flashing C (for ‘capitals'). To get lower case letters and the L cursor back, press CAPS LOCK a second time. (If you press CAPS LOCK during keyword mode, you will not immediately notice any difference, but you will see the effect after entering the keyword when the computer will be in C mode instead of L mode). As well as keywords, letters, numbers and various programming and scientific expressions, the keyboard also has eight graphics characters. These appear on the number keys I to 8, and can be printed onto the screen in a similar way to letters and numbers. To do this the keyboard must be changed to graphics mode. This is done by pressing the CAPS SHIFT key with the 9. Notice the cursor change to a G Pressing the 9 key will change back to L mode. There Is one last mode that the keyboard can be changed to. The extended mode, indicated by an E cursor, is obtained by pressing CAPS SHIFT and SYMBOL SHIFT at the same time. This allows most of the scientific and programming functions to be used. Pressing the two SHIFT keys again will revert the keyboard back to letter, L, mode. Even if you are the most proficient typist or programmer wrong keys get pressed. So far the only way to overcome this has been to pull the plug out. Although this may be convenient if only one command has been given to the computer, it is certainly very inconvenient if a lot of information has already been entered. Luckily we can use the DELETE key to change errors. For example, not much can go wrong with the simple command: PRINT "Hello" …or can it? Let's assume that you didn't use the SYMBOL SHIFT key to get the opening quotes. The screen would show PRINT PHello" The computer would not Have recognised what came after PRINT as no quotes indicates to the ZX Spectrum that a number is expected - and it found a letter instead. It shows its confusion by flashing a ? at the end of the line. Fortunately you don't have to type it all out again. On the top row of the keyboard are four arrows pointing in different directions and the word DELETE. To operate these keys, you have to use the CAPS SHIFT key when you press them. The sideways arrows move the cursor to the left or the right, and the DELETE key rubs out the character immediately before the cursor. To correct your nonsense line press ï (CAPS SHIFT and 5 at the same time) until the cursor is just after the P that you put in by mistake - if you hold them down for a second or two, then they will start working continuously, emitting a quiet clicking sound. In fact. it you keep your finger on any key for more than about three seconds it automatically repeats itself. Key in DELETE (CAPS SHIFT and 0) to delete the wrong P, and then type “ (SYMBOL SHIFT and P) to insert what should have been there - note that it is inserted without overwriting anything else. Try the cursor right key as well, just to get the hang of it. If you made any genuine typing mistakes, correct them in the same way, remembering that you can't overwrite mistakes; you have to delete them and then insert the corrections. Now, when you press ENTER, the computer will write your message at the top of the screen - or underneath the one it did the first time if that is still there. A full description of the keyboard can be found in Chapter 1 of the BASIC programming manual. |
|
|