home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 2 #9 / utv2n9s1.d64 / kustom.doc < prev    next >
Text File  |  2022-08-28  |  15KB  |  174 lines

  1. @@
  2.  
  3.      Kustom Keyboard Instructions
  4.  
  5.  
  6.    Copyright 1989 by Jon Perregaux
  7.          All Rights Reserved
  8.  
  9.  
  10.  
  11.             Published by
  12.       Softdisk Publishing, Inc.
  13.  
  14.  
  15.  
  16.  
  17. %cPART I: GETTING STARTED
  18.  
  19.      KUSTOM KEYBOARD runs on the Commodore 128 in 40 column mode and requires either a joystick or 1351 proportional mouse plugged into control port #2.  KUSTOM KEYBOARD cannot be run from the UpTime menu or in 64 mode.  To start the program, flip the UpTime disk to side two and press the RESET button.  The program will autoboot.
  20.  
  21.      When the program first boots, you will be prompted to select an input device.  Press 1 and RETURN to select a joystick or press 2 and RETURN to select the 1351 mouse.
  22.  
  23.      If KUSTOM KEYBOARD is booted in 80 columns, it will go through the same "select input device" routine and begin loading the program.  A flashing message will inform you that the program only runs in 40 column mode.  You must switch your monitor into 40 column mode.
  24.  
  25.      KUSTOM KEYBOARD supports up to four disk drives (one at a time) and can be loaded from any valid device number.  The 1541, 1571 and 1581 drives are all supported.
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. %cPART II: WHAT IS KUSTOM KEYBOARD?
  37.  
  38.      Simply put, KUSTOM KEYBOARD allows the Commodore 128 keyboard to be completely or partially redefined.  Any key which generates a character or control code can be changed to "print" a different character.  After a keyboard definition is completed, it will be saved to disk as two disk files.  Later on, these files can be loaded into memory whenever you wish the keyboard to be redefined to your specifications.
  39.  
  40.      Now that the simple stuff is out of the way, let's cover some technical ground.  Understanding the following information will help you to better take advantage of custom keyboard definitions in your own programs.
  41.  
  42.      60 times per second, the C128 stops what it's doing and performs a list of housekeeping activities.  Chief among these is checking the keyboard for a keypress and saving the keycode value in register 212 ($D4).  By using the following program, it is possible to see all the different values that result when the C128's keys are pressed:
  43.  
  44. %c10 PRINT PEEK (212) : GOTO 10
  45.  
  46.      One immediate problem is that there is no direct relationship between keycodes stored in register 212 and the ASCII codes that the keys are supposed to generate.  For example, pressing "A" generates a CHR$(65) but its keycode value is 10.  Press SHIFT-A and the computer generates a CHR$(193) - but the keycode value remains 10!  How, then, does the computer know what characters to produce?
  47.  
  48.      The C128 uses translation tables to help it figure out what characters it should print.  There are six tables: NORMAL, SHIFT, COMMODORE, CONTROL, ALT and CAPS LOCK.  Since there are 89 possible keycode values, each table is only 89 bytes long.  When the computer gets a keycode, it refers to the appropriate table by using the keycode as an index.  So if we press the "A" key, generating keycode 10, the computer looks 10 positions past the beginning of the NORMAL keyboard table.  There it finds a value of 65, which is the ASCII code for an unshifted A.  If we press SHIFT-A, the computer looks 10 positions past the beginning of the SHIFT table and finds a value of 193.  And so on.
  49.  
  50.      If no keys are pressed, a keycode of 88 results.  All six tables store character code 255 at position 88, which indicates to the computer that no character should be printed.  (It is possible to effectively "disable" a key simply by changing its assigned character code to 255.)
  51.  
  52.      Like the C64, the C128 keeps its keycode tables stored in ROM.  Unlike the C64, however, the C128 provides a set of programmable pointers in RAM that allow the keycode tables to be relocated anywhere in BANK 15 memory.  This makes a program like KUSTOM KEYBOARD possible.  By changing the pointers to an area of free RAM occupied by custom keycode tables, the keyboard becomes instantly redefined!
  53.  
  54.  
  55.      The pointers appear as follows:
  56.  
  57. 830-831 ($033E-$033F): NORMAL
  58. 832-833 ($0340-$0341): SHIFT
  59. 834-835 ($0342-$0343): COMMODORE
  60. 836-837 ($0344-$0345): CONTROL
  61. 838-839 ($0346-$0347): ALT *
  62. 840-841 ($0348-$0349): CAPS LOCK
  63.  
  64.      * The ALT pointer actually points to the NORMAL keycode table, which explains why ALT seems to have no function.  Because of this, there are actually only five tables in ROM.  Unlike the C128 system, KUSTOM KEYBOARD sets up six full tables in RAM.
  65.  
  66.      KUSTOM KEYBOARD generates two files for each custom keycode table saved to disk.  These are named "FILENAME1" and "FILENAME2".  ("FILENAME" can be any name of your choosing that is 15 characters or less.  The program automatically adds the "1" and "2".)
  67.  
  68.      The files are numbered for a reason.  File 1 contains the custom definitions, which load into memory beginning at 4864 ($1300).  File 2 contains the 12 pointer values needed to locate the custom definitions.  These load into memory at 830 ($033E).  It is important to load the definitions first.  If the pointer values are loaded first without keycode tables residing at 4864 ($1300), the C128 keyboard will be redefined as meaningless garbage.  STOP-RESTORE will not bring back the old keyboard.  You will have to press RESET and start over.
  69.  
  70.  
  71. %cPART III: BEFORE YOU CREATE
  72.  
  73.      KUSTOM KEYBOARD is completely menu driven, utilizing a point-and-click environment similar to GEOS.  Before editing begins, the program brings up a dialog box asking if you wish to CREATE a new file, OPEN an old file or QUIT back to BASIC 7.0.
  74.  
  75.      Click on CREATE when you want to make a brand new keyboard definition.  Type in a name for the files that will be created.  The program will automatically add "1" and "2" to the name of each of the files created.  After a brief pause, during which the two files are created in the disk directory, the editing environment becomes available and you may begin.
  76.  
  77.      Click on OPEN if you have previously created a custom keyboard file and you wish to work on it some more.  A file selecting dialog box will appear and access the currently active disk drive.  After identifying the drive being used, the disk name and ID will appear and the directory will be scanned for KUSTOM KEYBOARD definitions.  When the filenames appear, click on the file you wish to open then click the OPEN box.  Use the scroll arrows to move the list of names up and down if necessary.  Click DISK to switch disks or DRIVE# to switch to the next available drive.  To cancel the file selecting box, click on the tiny close box in the upper right corner.
  78.  
  79.      NOTE: two demo keyboards are included: "Dvorak" and "Enhanced." DVORAK is a faithful reproduction of the famous speed typist's layout, including relocated punctuation marks.  Press CAPS LOCK to access the normal QWERTY keyboard.  ENHANCED is a regular Commodore keyboard with enhanced ALT and CAPS LOCK functions.
  80.  
  81.      Clicking QUIT on the CREATE/OPEN dialog box will immediately return the system to BASIC 7.0 and the familiar green-on-grey environment.  You will find that all LOAD and SAVE commands are disabled, but otherwise you are free to perform routine CBM DOS tasks such as viewing directories, scratching files and formatting disks.  To return to KUSTOM KEYBOARD, just press the RESTORE key.
  82.  
  83.  
  84. %cPART IV: SELECTING OPTIONS
  85.  
  86.      The program uses pull down menus to access its many functions.  Running along the top of the screen, these are KEYBOARD, FILE, EDIT and GOODIES.
  87.  
  88.      The KEYBOARD menu allows you to select any one of the six keycode tables (NORMAL, SHIFT, etc.).  The currently selected table will be highlighted in purple on the grey pull down menu.
  89.  
  90.      The FILE menu is used to handle the files you are creating.  CLOSE saves the current keyboard definitions and returns to the CREATE/OPEN/QUIT dialog box.  UPDATE saves your work then allows you to continue working.  RECOVER loads the last saved version of your keyboard definitions, thus wiping out any changes you have made since.  RENAME changes the name of the files being created.  Type in a new name and press RETURN or click on the CANCEL box.  Finally, QUIT saves your work then returns the system back to BASIC 7.0.