Note: This article was scanned using OCR from the Fall 1985 CCCE Newsletter. Please contact us if you identify any OCR errors.
The current Apple computers, the Apple II and IIc, properly display both upper and lower case letters, and the SHIFT key works to permit a user to select the case. On earlier Apple computers, the II"and II Plus, lower case cannot be displayed on the text screen, and lower case letters cannot be typed from the keyboard, regardless of what is done with the SHIFT key.
Two problems frequently appear due to this incompatability between computers:
1) Programs written on the IIe or IIc may use lower case on the text screen. When these characters are printed on the screen of an Apple II Plus, they appear as an uninterpretable combination
of inverse numbers and special characters.
2) Software written on an Apple II Plus may expect all letters typed at the keyboard to be upper case. Such software might demand "Y" or "N" as an answer to a question while rejecting lower case "y" and "n". Sometimes software will .. even tell users to place the caps lock key down instead of properly handling whatever is typed. ·
This article describes how both problems may be managed for programs on Apple computers, and gives the code required in both Applesoft BASIC and assembler. ·The assembler code can be used in conjunction with many BASIC programs that others have written, requiring no or very few changes to the primary BASIC program.
Listing 1 shows a BASIC program for which the display appears in mixed upper and lower case on an Apple IIe or IIc but in upper case only on an Apple II Plus. The CALL 768 within the program makes the display operate this way. The command PR#O may be used to restore the unmodified display. In the same program, a CALL 802 turns the keyboard input (for GET or INPUT statements) into entirely upper case on any of the three models, independent of whether the SHIFT or caps lock key is used. The command IN#O returns the SHIFT and CAPS LOCK keys to their normal function.
The BASIC program POKEs into memory a short machine language program that examines characters which are sent to the screen or typed and changes lower case into upper case when necessary. Listing 2 shows the annotated assembler code which accomplished the two tasks of handling the display and input. A CALL 768 hooks the routine at $30B to process output. The model of Apple computer in use is determined by an examination of the value found in location 64435 .. ( $FBB3) Apple IIe and IIc computers (including the enhanced version of the IIe announced in March 1985) have the value 6 at this location. Apple II Plus computers have the value 234 ($EA) here. If the value 234 (SEA) is not found, then the routine does no further work. If 234 ($EA) is found, then the code from $314 to #31E changes all lower case letters into upper case letters. A CALL 804 hooks the routine at $32B to handle input. This code is active on any model· of computer, but it will have no opportunity to find lower case input on an Apple II Plus. For generality, the routines have not been hooked up to DOS. The result is that they operate properly under both DOS 3.3 and ProDOS, but they may have the effect of turning off DOS. Rehook DOS 3.3 by using a CALL 1002 and rehook ProDOS with a CALL 39565. Usually RESET will also rehook DOS.
Apple II Plus computers can be modified to better handle upper and lower case letters. A lower case display chip, available for about $30.00, permits a mixed upper/lower case display. One way of enabling the SHIFT key is to connect one wire of the keyboard to the connection used . for game paddles. Usually the flag input at 49251 ($C063) is used so that the operation of paddles need not be affected. Then a short machine language input routine similar to the one used here can examine this location to determine whether the SHIFT key is down. Some word processors (such as Screenwriter) and quiz maker programs (such as All of the Above) permit the user to specify whether such changes have been made. Either modification may be made and used independently, but the combination of the two overcomes one of the most important shortcomings of the Apple II Plus computer compared to the Apple IIe.
The technique of having a special machine language routine to filter the input of output is not limited to controlling the case of letters. An example of the application of this technique may be found in the software package Concentrated Chemical Concepts published by John Wiley & Sons. This software package was written and published before Apple IIe computers were available. Several programs in this package use the shift key to signal that a number should be printed. as a superscript. For example, when the SHIFT key is held down while the "2" key is pressed, the programs print a superscript 2. On the Apple II Plus computer, pressing the SHIFT key with the number 2 produces quotation marks. Thus the programs print a superscript 2 whenever the quotation marks are typed. On the Apple IIe, pressing the SHIFT key with the number 2 produces the at sign, @. A revised edition of the software handles the change in keyboard layout with no changes to the BASIC code. Instead a short machine language routine for handling input turns @ into quotation marks if the computer in use is an Apple IIe or IIc.