MODIFYING THE KEY TABLES IN TPKEY.BAS:¢ ¢ With BASIC only, there is only TPKEY with TEXTPRO keys in Port 1 and¢ BCALC keys in Port 2. If you wish to modify the tables in TPKEY.BAS it¢ was written to make it easier for you.¢ ¢ LOAD "D:TPKEY.BAS"¢ LIST 210,350¢ ¢ These lines contain the DATA values for each key on the keypad. TABLE 1¢ (Port 1) is in lines 210-270 and TABLE 2 in lines 290-350. e.g.:¢ ¢ 210 REM PORT 1 TEXTPRO KEYCODE TABLE:¢ 220 DATA 134,24,149,130,185,184¢ 230 REM ,DEL, 4, 5 , 6 , N , 7¢ ¢ Use the REM lines below each DATA line as a reference to which KEY is¢ defined by the keycode number above it.¢ ¢ Print KEYBOARD.TXT for a complete listing of keyboard, or PEEK(764),¢ values for all keys. You must decide if your new key is UN-SHIFTED,¢ SHIFT, CONTROL or SHIFT+CONTROL. Pick the number from the proper column.¢ Unshifted letters are lower case. If you want upper case use the SHIFT¢ column.¢ ¢ If you change any DATA number it will will fail the checksum test in LINE¢ 90. You have to adjust the value of TOT in line 90 to reflect the¢ increase or decrease of each DATA item you change. e.g. Your new item is¢ 41 more than the original item, you add 41 to "TOT<>263141" in LINE 90,¢ changing it to "TOT<>263182". Or use the shortcut that I use: change LINE¢ 80 to compute the new value of TOT.¢ ¢ 80 POKE I,NUM:TOT=TOT+I+NUM:NEXT I:? TOT:END¢ ¢ Type RUN and the program will end with the new TOT printed on screen.¢ LIST 90 and type the new number into that line and press RETURN. Remove¢ what you added after "NEXT I" from LINE 80.¢ ¢ You should also edit the REM LINES 10,60 to identify the changes you made¢ to the tables.¢ ¢ REMEMBER TO PRESS RETURN AS YOU EDIT EACH LINE IN THE LISTING!¢ ¢ SAVE modified program under your own unique filename.¢ ¢ BASIC users also have the option of using any one of the three .COM¢ handlers by renaming it AUTORUN.SYS (or whatever autorun name your DOS¢ requires) on the boot disk. The handler will install after DOS is¢ loaded.¢ ¢ Do not append another AUTORUN.SYS to any key.COM file since it has no¢ INIT address and will not execute. However, it might work if you include¢ "A=USR(1536)" in the BASIC program that is RUN from the other segment of¢ the AUTORUN.SYS file. I haven't tested this.¢ ¢ MODIFYING TPKEY.SRC MAC/65 ASSEMBLER SOURCE CODE:¢ ¢ To assemble a TPKEY.COM file with the INITAD ($02E2) instead of RUNAD¢ ($02E0), edit TPKEY.SRC LINE 1020 as follows:¢ ¢ 1020 *= $02E2¢ ¢ Assemble a new TPKEY.COM from MAC/65:¢ ¢ Edit¢ ASM,,#D:TPKEY1.COM<Return>¢ ¢ TPKEY1.COM will execute with another binary file appended to it.¢ ¢ MODIFYING THE KEY TABLES IN TPKEY.SRC:¢ ¢ TPKEY.SRC is the MASTER MAC/65 ASCII source code used to assemble¢ TPKEY.COM. This source file allows you to re-assemble the routine to load¢ at a different address. Edit line 100 with the new load address. Just¢ make sure you have enough memory for 154 bytes at the new address.¢ ¢ 0100 *= $0600¢ ¢ Or you may modify the key output. See lines 0690 to 0830 for both¢ keyboard tables. TABLE_1 is for Port 1, etc. The "keypad" lines are¢ notated to show which bytes apply to each key on the CX85. These bytes¢ are the keyboard values, PEEK(764), not ATASCII. See KEYCODE.TXT for¢ keyboard values.¢ ¢ Example: TPKEY.BAS has the same two tables as TPKEY.SRC. Port 2 changes¢ the defaults to cursor keys and CTRL-A for the ESC key. You may modify¢ any of lines 220-350 to send any keys you wish.¢ ¢ TPKEYDEF.TBL - is a Mac/65 "merge" source code listing of lines¢ 0690-0830, Tables 1 and 2, plus rem (;) lines 10, 40-60. Port 1 TABLE is¢ the same as in TPKEY.SRC. Port 2 is redefined for DEFAULT Keypad labels.¢ See TPKEYDEF.TXT for key definitions.¢ ¢ KEYBAS.TBL - is another Mac/65 "merge" listing just like the one above.¢ It re-defines the Port 1 TABLE for BASIC DATA line entries. Port 2 is¢ redefined for MATH functions. See KEYBAS.TXT for key definitions.¢ ¢ You can edit either of the above .TBL files, or use them as they are.¢ ¢ These "merge" files were used to create TPKEYDEF.COM and KEYBAS.COM. To¢ assemble a COM handler with MAC/65, do the following:¢ ¢ Edit¢ ENTER #D:TPKEY.SRC<Return>¢ ¢ Edit¢ ENTER #D:KEYBAS.TBL,M<Return>¢ ¢ Edit¢ ASM,,#D:KEYBAS.COM<Return>¢ ¢ You will see that KEYBAS.TBL merged (,M) with TPKEY.SRC, creating the¢ full KEYBAS.SRC code file. You may save it to disk with SAVE¢ #D:KEYBAS.M65 as a tokenized Mac/65 source file or LIST #D:KEYBAS.SRC to¢ save it in ASCII format.¢ ¢ Use either .TBL file provided in the package as a guide to making your¢ own "merge" files for different sets of keypad tables for use with other¢ programs that would benefit from use of a keypad.¢ ¢ PROGRAMMER'S COMMENTS:¢ ¢ A BASIC USR call pushes one byte on the stack, equal to the number of¢ parameters being passed by the USR call, in this case, zero. Therefore,¢ the first byte in the USR routine must be PLA (104 decimal or "h" in¢ binary code). This pulls the byte off the stack, restoring the correct¢ return address to the top of the stack. It only does this in BASIC.¢ A=(1536) executes at $0600, beginning with PLA to pull a byte off the¢ stack. The accumulator now reads zero, since zero parameters were passed¢ in the TPKEY USR call.¢ ¢ During binary load, DOS does not push a parameter byte on the stack.¢ Therefore the .COM file must skip over the the PLA byte when executing.¢ Thus the RUN address is $0601 (START+1), not $0600.¢ ¢ By the way, the byte at $0600 is used by the program as a temporary¢ storage address once the routine executes, since PLA is no longer needed¢ by BASIC and not used with DOS binary load. It will contain a 1 or 0¢ while the VBI is running. So the byte is not wasted in the object code.¢ When you disable the VBI with all 3 CONSOLE keys, the original byte at¢ $0600 (104 or "h") is restored and all the VBI addresses are reset to¢ original values before exiting the VBI. So the original routine is still¢ in Page Six memory, standing by to be called into use from BASIC, if¢ desired, by A=USR(1536).¢ ¢ Just a few suggestions on how to modify the CX85 handlers included in¢ this package. Enjoy.¢ __________________________¢ Frank Walters - 09/20/97¢