Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 10, NO. 1 / JANUARY 1984 / PAGE 221

A $3.50 Apple key pad. Wally Hubbard.

A $3.50 Apple Key Pad

I haven't yet met an Apple owner who could be considered poor. Nor have I met one who had all the gadgets he wanted. The Apple is a "gadget-friendly' computer: there are eight slots for cards of all kinds, game paddle connections, keyboard modifications, fans, power supplies, and upper/lower-case adapter ROMs.

My Apple came barebones; I bought some RAM chips from the back pages of a magazine to fill it up cheaply and then a disk drive. Then came a music card, an interface, then another, and now seven of the eight slots are filled with no good way to reach the eighth because of all the wires. If riches were counted by the number of green circuit boards a person has, I would be in good shape.

One thing I couldn't see spending money on, however, was a numeric keypad. I don't enter that many numbers. And besides, there is always another gadget that claims my dollars first.

Made of RAM

You get what you pay for: this keypad has no extra keys to sit beside your Apple and no snazzy ribbon cable to thread into the back of your computer. It is just an assembly language program that must be typed in. But it costs only about $3.00--whatever you paid for this magazine (if you subscribe, you got a discount).

The keypad uses the existing Apple keyboard, and translates the U, I, and O keys to 4, 5, 6 and the J, K, L keys to 1, 2, 3. Those are the keys right below 7, 8, and 9 on the keyboard, so the layout is like a numeric keypad. M is zero, and the comma and period both translate to decimal points. The number keys remain the same. The spacebar acts as a return key along with the regular return key. All other keys are translated to spaces, except for the parentheses, asterisk, slash, minus, and plus. The keypad is shown in Figure 1.

As a bonus, the keypad allows you to add, multiply, subtract, and divide. And it lets you include variables A, B, and C in your data entry. In addition, you can use parenthese to nest operations.

If you type:

2{2 + 2 -3)/8

your Appeal does the figuring and it is just as if you had typed:

.25

If you type:

A*2

the input is twice the value of the variable A.

If you enter a blank line, you get a syntax error, which must be taken care of with an ONERR GOTO. If you want, the error handling can be used to set up special features. For instance, a blank line could mean the variable is to be set equal to a default value.

To use the keypad, use this command in your program:

CALL 768 A and the input will be assigned to the variable A. The general syntax is CALL 768 (var) where (var) is any real variable.

Applesoft Helped

Actually, most of the programming needed to implement this keypad is allready available in Applesoft, in the permanent memory. So we are hitching a ride. If you want to know how the keypad works, look at the assembly listing (Listing 1). If you want it to work immediately, type in data shown in the memory dump and save it to disk (Listing 2). Then check your work by trying to use it with the Basic demonstration program (Listing 3).

I do not recommend using the keypad subroutine without writing a Basic program. It probably won't work, because the CALL 768 (var) interactive command is stored in the same buffer as the keypad input, and you will erase it while it is still being read. this problem doesn't occur when you use CALL 768 (var) from within a program.

Reference

The Applesoft subroutines are listed and explained in the article "Applesoft Internal Entry Points,' by John Crossley, in Volume 1 Number 1 of Apple Orchard. Published by the International Apple Core, 908 George St., Santa Clara, CA 95050. Cost: $2.50.

Table: Listing 1.

Table: Listing 2. Key Pad memory dump. Enter the Monitor (CALL-151) and type the following:

Table: Listing 3. Key Pad Demonstration Program. Pressing just the return key at the prompt enters a default value of 123456.789.

Photo: Figure 1.