Micro­power

  

Volume 1, Number 4 – December 1981

Page 20 of 33

110 REM * TEST A BLOCK OF PIXELS 40 X 30
120 FOR S=15 TO 75 STEP 15
130 FOR T=15 TO 45 STEP 15
140 IF POINT (S,T)=1 THEN 10
150 NEXT T,S
160 GOTO 20

Printing Characters From The Keyboard

In the manual there is an appendix headed ‘Single Character Input of Reserved Words’. From the list you will see that when typing in a program you can use various combinations of keys to obtain single characters (often referred to as ‘Tokens’) which the computer interprets as instructions. For example:–

? = PRINT         CTRL/​GRA/H =GOTO.

This does save time and space when keying in a long program, but also causes a lot of headaches when editing. When the program is listed the tokens are expanded to the full reserved words; consequently lines may exceed 48 characters, and when you try to edit them you loose charactrers from the end. It is all too easy to ‘crash’. In Direct Mode, however, they are always useful. E.g. GRA/​Space = LIST.

You might also make use of this facility when designing graphics shapes for use in a program. It is worthwhile marking the chart supplied in the manual with the key designations. For instance, the first two lines (32 chars.) are obtained by depressing the graphics and control keys plus @, A-Z, [, \, ], ^ and _.

Let us look at what happens when we press the graphics and control keys. The former sets Bit 7, while the latter flips Bit 6. E.g. The @ character (shift@) is 40 in hex or 01000000 in binary, the bits being numbered 7 to 0 from left to right. Setting Bit 7 gives 1100 0000, or C0 in hexadecimal, and flipping Bit 6 gives 1000 0000 or 80 hex. Thus character 80 hex can be typed with CTRL/​GRA/​shift@. Similarly, 8F in hexadecimal is obtained with CTRL/​GRA/O.

Character FF illustrates the effect of flipping Bit 6 from off to on. The ? has a hex value of 3F (0011 1111). CTRL/? gives 7FH (01111111) , and GRA/​CTRL/? gives 0FFH (11111111)

You can always try out various key combinations by typing them directly into a Basic line, and then expanding them by LISTing the ‘program’. For example, type in a line number and then hold the Graphics key down while you enter A, B, C, D, E, F. Now press ‘Return’ and LIST the line. You will find that the interpreter expands it to:–

Page 20 of 33