3: Applications and Education
Beginner's Keyboard
Marty Albers
Here is a short, simple program that gives very young computer users an entertaining introduction to the keyboard.

Software for young children is hard to find. Most kids' games and educational software are difficult for the preschooler to understand. Relating screen movement to joystick control can be a hard concept to grasp. I wrote the following program for my two-year-old so he would not feel left out when the rest of the family used the computer. It was designed to be easy to use (just push a key), educational (learn letters and numbers), and entertaining (colors and sound), and to provide a friendly start into the world of computer literacy.

Beginning programmers will also find this program rewarding, with some useful ideas to try on their own. An explanation of some of the less obvious lines follows. On lines 10 and 35 you will see one method of keyboard input without selecting the RETURN key (see "Reading the Atari's Keyboard on the Fly," COMPUTE!'s First Book of Atari). Line 20 POKEs address 16 with 112 to disable the BREAK key. Line 45 allows larger characters in Graphics modes 1 and 2 by using the PRINT #6; statement. Also on line 45 is a conversion of the keyboard input from ATASCII code to character format: CHR$(I).

Two sound registers are used (line 50), one with pure tones and one with distortions. Don't forget to turn the sounds off (line 51). The "default colors" are used, a black screen and four others for the characters. To find the other colors, use the Atari logo key and shift between the upper- and lowercase. The RETURN key is used in line 41 to start a new row of characters. When the screen is full, you start again in line 42. Now begin!

Beginner's Keyboard
10 OPEN #1,4,0,"K:"
15 GRAPHICS 2+16:L=0
20 POKE 16,112
25 FOR R=0 TO 20:IF R=20 THEN R=0:L=L+1
35 GET #1,I
40 IF I=155 AND I=11 THEN GOTO 15
41 IF I=155 THEN R=-1:L=L+1
42 IF R=18 AND L=11 THEN GOTO 15
45 PRINT #6;CHR$(I)
50 SOUND 0,2*I,10,8:SOUND 1,2.5*I,8,10:FOR T=1 TO 75:NEXT T
51 SOUND 0,0,0,0:SOUND 1,0,0,0
The author talks about "when the screen is full, you start again in line 42." But according to line 40, this seems like it should also happen if the user presses RETURN "when the screen is full", or on the last line, that is. But there is a logic error on line 40, where the author says "IF I=155 AND I=11", which is impossible (it cannot be both at the same time). By running the program with this line, if you press RETURN on the last line of the screen, you will get the following error:
ERROR-   141 AT LINE 45
The correct line should be:
40 IF I=155 AND L=11 THEN GOTO 15
which is the line that is included in the saved and LiSTed BASIC files.

Listing. Beginner's Keyboard.
Download (Saved BASIC) / Download (Listed BASIC)

Return to Table of Contents | Previous Section | Next Section