home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / canada-remote-systems / geos / utils / keyfer.sfx / keyfer.doc (.txt) < prev    next >
GEOS ConVerT  |  1990-02-12  |  16KB  |  94 lines

  1. EKeyfer.Doc
  2. PRG formatted GEOS file V1.0
  3. KEYFER.DOC
  4. BLASTER'S CONVERTER V2.5
  5. GC Epson RX-80
  6. GC Epson 3 pass
  7. Write Image V2.1
  8. geoWrite    V2.1
  9. @An IBM PC to C-64 Keyboard Converter
  10. (C) Joel Kolstad, April 1991
  11. After years of using my Commodore 64, its keyboard started to become unresponsive and not at all very usable.  I tried all the usual remedies -- cleaning the key pads, buffing the contacts, etc., but found that sooner or later the keyboard would start exhibiting the same problems once again.  I got so fed up with not having a decent keyboard, I finally decided to take a drastic step -- I decided to interface an IBM PC keyboard to the Commodore 64.
  12. Note that when I say "IBM PC keyboard," I 
  13.  IBM PC or IBM XT; 
  14.  IBM AT or PS/2!  These keyboards use somewhat different methods of sending keycodes and will not work with my converter.  Although you probably won't harm anything in trying, you certainly won't accomplish anything useful either.  Note also that there are some so-called "universal" keyboards out there that are supposed to adapt themselves to the computer in use.  I haven't tried any of them, so I cannot say if they work or not.  It anybody tries this, please let me know of the results.
  15. Luckily for most of us, PC/XT keyboards are the kind most commonly found at surplus stores and swap meets.  They also tend to be quite inexpensive -- $20-$40 is not at all uncommon.  Why are they so cheap?  Pretty much because they're quite dumb: All they know how to do is send key scan codes, whereas newer keyboards let you do things like change the indicator lights, change key repeat rates, etc.  Since the C-64 is used to dealing with a brainless keyboard, though, the standard PC/XT keyboards are fine for this application.
  16. The converter I built is based on the Intel 8748 microcontroller and Dallas Semiconductor's DS1277 8x8 crosspoint switch.  The Intel 8748 microcontroller is a now-ancient (about 10 years old) chip containing a CPU, a 1K EPROM, 32 bytes of RAM, a timer/counter, a little interrupt logic, and the obligatory I/O.  An interesting bit of trivia is that many PC/XT keyboards use an 8748 (or close derivative) themselves; this basically leaves us with some mechanical switches talking to an 8748 talking to another 8748 talking to the 6526 in the C-64!  The DS1277 is a newer chip that contains an 8x8 bank of analog switches -- a "crosspoint switch."  This 8x8 matrix is exactly how the Commodore 64 keyboard is laid out, and therefore proves quite useful in designing a converter circuit.  The DS1277 replaces at least 8 conventional TTL chips while utilizing a simple serial interface for easy control by the 8748.
  17. In designing the 8748's firmware, I attempted to create a program that allowed as complete of a C-64 keyboard emulation as possible.  The end result is very good -- caps lock and num lock work, cursor keys do what they should do, different keymaps can be selected so that pressing keys like { and } will actually work, etc.  I think you'll be pleased with the end result.
  18. Here's how it works...
  19. Normally you type away.  Back space is the C-64's "Delete" key, insert is shifted delete.  F1-F8 are still F1-F8, even numbers add the required shift.  Alt is defined as the 
  20. Commodore
  21.  (C=) key.  Tab is turned into a Ctrl-I.  ESC is turned into the back arrow.  F9 and F10 are both defined as stop.  Note that hitting the F9 or F10 after the other one has already been hit will cancel out the original keystroke.
  22. Cursor keys automatically have shifts added when needed.  For instance, if you hit the left arrow key, the C-64 will actually "see" the right arrow key and a shift.  (In fact, all keys that need a shift "added" use the right shift key.)
  23. To enter caps lock mode, hit caps lock.  
  24. You can't be pressing A-Z while hitting caps lock
  25.  (why would you?) 
  26. or it 
  27. @will
  28.  be ignored.
  29.   Note that the PC keyboard will 
  30. always
  31.  toggle its "Caps Lock" light (if it has one) when you hit caps lock -- 
  32. even if the keystroke was ignored by the converter.
  33.   However, if the caps lock was ignored by the converter, the next time you hit caps lock it too will be ignored (so now, the "Caps Lock" light on the keyboard will be off, and the converter still won't be capitalizing anything).  This is intended to try to keep the converter's caps lock status the same as the keyboard's as much as possible.  
  34. Num lock mode is quite similar to caps lock mode.  You can't be hitting 0-9 or . while attempting to enter it, or it will be ignored in the same vein as caps lock.
  35. To enter shifted symbols (the ones above 0-9, the brackets, etc.) you hit Shift 
  36. first
  37.  and the key with the symbol on it 
  38. second
  39. .  Of course, this is the way you're 
  40. supposed
  41.  to do it anyway, but the reason that you really should is because the C-64's shifted symbols don't match with PC/XT keyboards.  For instance, an @ is above the 2 key on PC/XT keyboards.  On the C-64 keyboard, a " is above the 2 key.  Now, if you hit shift and 2 on the PC keyboard, the C-64 will see an @, like it should.  However, if you instead hit 2 and 
  42.  shift, the C-64 will see just the shifted 2 -- a ".  Like the caps lock/num lock "caveat" mentioned above, this one shouldn't change the way you type; it's just something you might find interesting to be aware of.
  43. Trying to decide what to do with the non-standard characters ({,},~, etc.) was a little tricky.  In fact, eventually I gave up on the hope of only having one keymap for the non-standard keys.  Instead, there are four tables which the microcontroller uses to look up the non-standard keys.  To select one of these tables, press Ctrl, Alt, and 0, 1, 2, or 3 on the 
  44. numeric keypad
  45. .  The keys which get re-mapped are (presently): `~\|_{} and the PgUp, PgDn, End, and Del keys (on the numeric keypad).  The four keymaps are currently set for these four programs: 0 -- NovaTerm by Nick Rossi (the PgUp and PgDn keys work in the text editor only; they're just F1 and F2.  Same for Del.)  GeoWrite by Berkeley Software (the End key doesn't do anything since GeoWrite doesn't have a "jump to end of line" feature), Power C (now defunct) by Spinnaker Software (in the editor, of course), and Kermit by Dr. Evil Laboratories (now distributed by CMD) (the PgUp, PgDn, and End keys don't do anything).  Note that NovaTerm's editor is the only editor where a "delete character under cursor" function is supported; in all the other keymaps, Del acts just like back space.  When you first power up the converter, keymap 0 (NovaTerm) is selected.  If you switch keymaps,the converter will attempt to reset the keyboard.  Not all keyboards are resetable, though.  Those that do will flash their Caps Lock and Num Lock lights.  If you're using a keyboard which doesn't support reset, you should be aware that you can confuse yourself as to the status of Num Lock or Caps Lock; changing the keymap will 
  46. always
  47.  turn them off in the converter, so if one was on and you changed the keymap, the indicator light will make you think you have the mode locked, while the converter will still be ignorant of your perception.  Oops.  Anyway, the moral is this: Get a keyboard that supports hardware reset (or get one that doesn't have any indicator lights!), or else make sure Caps Lock and Num Lock are off before changing keymaps.
  48. Scroll Lock is now Restore.  Really!  So, now you hit F10-Scroll lock.  Apologies to those who might be annoyed by the Scroll Lock light on some keyboards; they latch, Restore doesn't. Personally, I wired one of my keyboard's Scroll Lock light so that it was permanently on, thereby serving as a power light.  Alternatively, you might just snip a connection and never see the light again.  Or, you could just buy a keyboard without any indicators (the original IBM PC/XT keyboard, which I'm using to type right now, comes highly recommended for this reason and also for its "feel!")  I have considered using F9 or F10 as restore, but they just seem a little too close for comfort.
  49. Finally, as a token of appreciation to the MS-DOS world that gives us these keyboards to begin with, Ctrl-Alt-Delete will reset the converter and the keyboard.  But no, it won't help a runaway C-64 program!  (Note that this action doesn't change the current keymap.)
  50. If you want to, you can optionally build a keyboard "passthru" for all 20 Commodore keyboard pins that will let you use a PC/XT keyboard and the Commodore keyboard together (see the schematic).  If you use both keyboards together, the C-64 will simply see the union of C-64 keys and PC/XT keys.  If you ever take your C-64 somewhere without a PC/XT keyboard, you won't notice a thing (except your old friends, the mushy keys!).
  51. By now you may be itching to build the circuit... good!  You can build it just about anyway you want; nothing is really critical.  I've personally built three converters, and I point-to-point wired them all.  However, wire-wrapping should be just as effective.  Keep the .1uf capacitors close to the power leads of the DS1277 and 8748 or they won't be effective.
  52. You might have a hard time getting the 8748 programmed.  Many places have standard EPROM programmers, but nowhere near as many have 8748 programmers.  If you want to get an 8748 programmed and can't do it, I'll see you a preprogrammed and tested 8748 for a nominal fee; see below.  It should also be noted that they 8748 can run code from a standard EPROM outside of the 8748.  In this case, the EPROM and an additional latch chip are needed.  (In fact, since you're running code from outside of the microcontroller, you can use the EPROMless version of the 8748 -- the 8048).  
  53. Personally, I don't think all the extra wiring makes it worth it.  After all, a two chip circuit 
  54. that does something useful is kind of slick!
  55. Here are some sources for get
  56. Personally, I don't think all the extra wiring makes it worth it.  After all, a two chip circuit 
  57. that does something useful is kind of slick!
  58. Here are some sources for getting parts:
  59. --> (Blank) 8748s:  JDR Microdevices ($8.95) at 1-800-538-5000 has these (ask for a catalog).  DigiKey (1-800-DIGI-KEY) and JameCo (1-415-592-8097) have them too.
  60. --> DS1277:  Dallas Semiconductors would be glad to charge your credit card $4.85 plus shipping if you give them a call at 1-800-336-6933.
  61. --> 11MHz crystal: DigiKey has these for a buck or so.
  62. --> Connectors: DigiKey, yet again.  Look under "Waldhom Header Connectors."  You'll need a female 20 pin connector (use 2 10 pin ones) to sit on the 64's keyboard connector, a male (non-polarized) 20 pin header if you want a keyboard passthru, and a 5 pin female DIN connector for the PC/XT keyboard.  If you want to be able to easily remove the converter board, it's recommended that the 5 pin DIN connector run to a 5 pin header connector that goes to a 5 pin header on the converter board.
  63. --> Miscellaneous capacitors, etc.: Mouser (1-800-34-MOUSER) or DigiKey.
  64. --> Keyboards!  Check out an issue of 
  65. Nuts & Volts
  66.  magazine.  (Nuts & Volts can be reached at 714-632-7721; you can probably talk them into sending you a free sample issue.)  $20 keyboards aren't at all uncommon in their advertisements!  I've used two keyboards myself: one a Bondwell keyboard sold to me by (Nuts & Volts advertiser) Lesko Electronics (414-553-9440) for $25 (white, keys have a good "click" to them, supports hardware reset, nice and small), as well as an original IBM PC keyboards (no indicator lights, 
  67. really
  68.  nice feel to the keys).  Both have worked marvelously.
  69. Finally, you can obtain some of these parts from me:
  70.     --> Programmed and tested 8748... $20
  71. --> DS1277... $5
  72. --> 11 MHz crystal... $1
  73. --> Set of all miscellaneous components (connectors, capacitors, diode)... $4
  74. If you order less than $7 in parts, please add $3 for shipping.  Otherwise, I'll pick up the shipping.  In either case, I'll also ship a laser printed version of all of these documents.
  75. My address is:
  76. Joel Kolstad
  77. 7505 E. Hampstead Ct.
  78. Middleton, WI 53562-3609
  79. You can also try calling me at home during reasonable hours of the day... (608) 836-5885.  I probably won't be there since I live on campus during the school year and spend most of my time at work when not at school, but my parents or brother should be able to give you a phone number where I can be reached.
  80. Note that I cannot currently provide circuit boards.  This is unfortunate, but I just don't have the capital around to get a run of boards made.  However... if you have a user's group that would like to buy at least 10 converters, I'd have more than enough incentive to not only get some circuit boards made, but also to give a group discount.
  81. Although I'm not requesting any money for this circuit, I'm certainly not going to refuse any, either!  I'm a college student in electrical engineering, and as any college student will tell you, "money is tight."  If you find this article useful and have a little money to spare, I'd be quite grateful if you sent whatever you think is reasonable.  A big "Thanks!" in advance to those who do this.
  82. Well, that should be everything you'll need to know to build a converter.  Should you have any questions, comments, etc., you can mail me at the above address, or send me e-mail on the Internet (kolstad@cae.wisc.edu) or through Q-Link (as "ZimboB1").
  83. This converter is one circuit I've made that's turned out quite well.  The extended functionality of an IBM PC/XT keyboard is quite useful, and most certainly a better setup than the C-64's original keyboard.
  84.                                                                                
  85.                                                                                                          ---Joel Kolstad
  86. ----------------------------------------------------------------------------------------------------
  87. Revision history:
  88. April 13th, 1991: Initial release.
  89. April 28th, 1991: Schematic change to support 8748 operation (original development was done on an 8749).  Tab key mapped to Ctrl-I.
  90. June 4th, 1991: Added selectable keymaps.
  91. June 10th, 1991: Fixed a nasty bug that added "phantom shifts" under certain conditions.
  92. July 16th, 1991: Initial Q-Link release.  Due to a myriad of problems with Q-Link and user environments, this release didn't make it into very many people's hands.
  93. November 28th, 1991: (gobble, gobble)  Second Q-Link release.  Thanksgiving break gave me a chance to put all of this stuff into a Commodore usable format (the original release still had files in all sorts of strange formats relating to all the different machines I'd used for development; UNIX boxes, MS-DOS machines, Amigas, etc.)  Now, anybody with GEOS should have access to everything they need.
  94.