************************************¢ ¢¢CX-85 KEYPAD¢¢by Kevin Packard, WNYAUG¢¢ Anyone who has ever used a¢calculator must have noted how much¢easier it is to enter numbers then with¢a typewriter style keyboard. I am truly¢convinced this is due to the difference¢in key arrangement. A numeric keypad¢can be operated using one hand and¢movement is limited to a small area. ¢This arrangement is so much more¢efficient that numeric keypads are¢being incorporated as standard features¢on the most keyboards.¢¢ Programs have been written that¢will redefine the ATARI keyboard so¢that this arrangement is simulated. I¢find this approach cumbersome due to¢the off set of the keys. You end up¢looking at your hand more often then¢the input information.¢¢ There is another approach. You¢can buy a CX-85 Keypad and plug it into¢joystick port #2. The keys are full¢size and there is a bump on the #5 key¢so you can always find your way back to¢the home position. Not only that but¢you get an additional 4 function keys¢(great for cursor controls).¢¢ So why doesn't everyone have one? ¢Cost must have been a big factor when¢they first came out. The CX-85 sold¢for over $60 six years ago. Also on¢the box was the claim that it would¢work with the Bookkeeper and VisiCalc. ¢Software seemed to be limited. And¢maybe people just didn't know about¢it.¢¢ The first problem has been solved.¢I've seen the keypads being sold for¢less then $10. You may have to look¢the advertisements over pretty well to¢find it. If you read this far you must¢now know it exists and if you read on¢you will read that software is less of¢a problem then you might think. If you¢can't find it, write it.¢¢ The hardware is quite interesting.¢Under the 17 keys is a circuit board¢that reads the keypad. When you press¢a key it sets the output code for that¢key and maintains (latches) that code¢until another key is pressed. Another¢bit (or control line) is set when the¢key is in the down position.¢¢ The CX-85 connects to the computer¢through a joystick port. Which port¢can be determined by the program. The¢four joystick pins and one of the¢paddle ports is used for the key code. ¢The trigger pin is set only when a key¢is pressed.¢¢ Two programs come with the CX-85, ¢both utilize page 6 and operate during¢the VBI (vertical blank interrupt). ¢During the VBI the trigger is checked¢to see if a key is pressed. If the¢trigger is not set the VBI routine is¢exited. When it senses that the trigger¢is set it then reads the 4 joystick¢pins and paddle port. The paddle port¢condition is added to the joystick bits¢in such a way as to generate a unique¢number for that key. The number of that¢key is then used as an offset into a¢table that contains the ATASCII code¢for the character you wish the key to¢represent. The character code is then¢placed to the keyboard location and the¢VBI is exited. From there on the¢computer acts as if a normal key has¢been pressed.¢¢ In the VBI routine there is an¢auto-repeat function and a slight delay¢time before reading the paddle port. ¢The paddle port contains an RC circuit¢that does not react to changes as¢quickly as the joystick ports. The¢delay time is needed to allow the¢paddle port to reach its on/off state. ¢It is for this reason that the keypad¢inputs need to be latched. Once set¢the keypad will not change the code¢half way through the delay timing¢routine. This delay is not long in¢human terms but to the computer these¢milliseconds are important.¢¢ The only difference between the¢two programs is the way they are loaded¢and function keys are defined different¢characters. One file is a boot¢program. This program has no file name¢but will boot if it is in the disk¢drive when you turn the computer on. ¢The routine is loaded and then you are¢asked to change disks. The program is¢set up to use with VisiCalc (a spread¢sheet program). The function keys are¢set up to be used like the cursor¢control keys. I have used it with¢VisiCalc and Calc Magic and it makes¢data entry so much easier.¢¢ The other program is an autorun¢file that will load in like any autorun¢file. Once installed you can then use¢it with other files. I've used it¢mostly in BASIC but I have had it¢running with some machine language¢programs (Speed Script is one).¢¢ The most convenient aspect of¢using the keypad with BASIC is that you¢can redefine the keys under program¢control. (It is possible in assembly¢language but have never tried it.) The¢memory location for the keys are in the¢user's guide. The locations are not in¢sequencial order so you will need a¢list of the locations. To refine the¢#1 key, POKE 1593 with the ATASCII¢code you want inputted when the key is¢pressed. ¢¢ As an example, let's say you want¢to draw borders around a menu display¢using a screen editor. You could¢search your keyboard for the characters¢for the corners and sides. Or use the¢keypad by redefining the keys so that¢#7 is the upper-left hand corner, #8 is¢a horizontal line, #9 is the¢upper-right hand corner, etc. Now since¢the keypad is in the shape of a square¢it is easy to remember which key to¢press for what portion of the border¢you want. If the 4 function keys are¢set for cursor control, you won't have¢to touch the regular keyboard to¢complete the border.¢¢ The disk also contains the source¢code of the keypad handler. The¢assembly code is written using the¢Atari Macro Assembler. It is possible¢to change the table and compile the new¢program. If this is not a viable way¢then there is an alternative. In the¢September 1986 issue of Computer¢Shopper is a program titled "CX-85¢Numeric Keypad Driver Creator" by Jeff¢Brenner. This is a BASIC program that¢will allow you to redefine the table¢and then automatically write an¢AUTORUN.SYS file to a disk. With this¢program you need to press a key on the¢keypad and then press the key on the¢keyboard that you want in the table. ¢When you are finished press START and¢the modified autorun file will be¢saved. The program does not have the¢autorepeat routine, but this is a small¢sacrifice for the ease of use.¢¢ Many times while entering BASIC¢programs you come across a group of¢DATA statements with numeric data¢(character set, machine code). The¢following program changes the table to¢make entry of this data easy. It¢redefines the first three function keys¢as "D", "A", and "T". The forth¢function key is defined as the back¢space key for mistakes, and the "." key¢is changed to a ",".¢¢10 REM CHANGE CX85 HANDLER FOR DATA¢INPUT¢20 POKE 1615,12¢30 POKE 1611,32¢40 POKE 1583,58¢50 POKE 1585,63¢60 POKE 1587,45¢70 POKE 1589,52¢100 NEW¢¢ After the keypad handler is loaded¢and you have run this program DATA¢lines can be entered without touching¢the keyboard. Simply type the line¢number and use the function keys to¢spell DATA. After this you can start¢entering in the numbers. Press the¢decimal point key for the comma to¢separate numbers. Since Atari BASIC¢will place the spaces where they are¢needed there is no need to type them. ¢They will be there when you list the¢program. ¢¢ The keypad can do all this and¢more. There should not be a an¢application program written that¢doesn't use this keypad's convenience. ¢Maybe if more people owned a CX-85 more¢programs would claim "CX-85¢compatible". But then if more programs¢claimed this there would be more of a¢reason to buy one.¢¢¢*************************************¢¢