home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progbas / ascsu205.arj / ANYKEY.DOC < prev    next >
Text File  |  1991-11-23  |  3KB  |  79 lines

  1.                               NOTES ON ANYKEY.COM
  2.  
  3.                                  Version 1.00
  4.  
  5.                                  Matt Roberts
  6.                                3 Cedar St., # 8
  7.                            Montpelier, Vt 05602-3006
  8.  
  9.  
  10.                                    08-07-91
  11.  
  12. ───────────────────────────────────────────────────────────────────────────────
  13.  
  14. ANYKEY.COM was my first, rather weak, attempt at writing GETKEY.COM.  When I 
  15. tried it out, I realized it just wasn't worth the time loss for such a small 
  16. return.  For some reason, though, I didn't erase it after I wrote GETPAUSE.COM 
  17. (and later, GETKEY.COM).
  18.  
  19. I recently stumbled upon it, and thought it wasn't a bad example of the INKEY$ 
  20. function.  In fact, it solved a problem with that command which had been 
  21. plaguing me for some time.
  22.  
  23. ASIC 2.01 doesn't have the REPEAT...UNTIL and WHILE...WEND loop commands.  
  24. With other BASIC languages, both compilers and interpreters, I was trying to 
  25. use the INKEY$ function like this:
  26.  
  27. A$=INKEY$
  28. WHILE A$=""
  29. WEND
  30.  
  31. or like this:
  32.  
  33. A$=INKEY$
  34. REPEAT
  35. UNTIL A$<>""
  36.  
  37.  
  38. Using these methods, pressing the desired key would not produce an immediate 
  39. result.  In fact, I usually had to hold down the key until it repeated, which 
  40. generally played havoc with the results of the program I was trying to write.  
  41. Since I don't know much about computer architecture, I don't know why these 
  42. two loops didn't work, but they didn't.  However, ASIC's approach to the same 
  43. loop, using an IF...THEN statement coupled with an implied GOTO (IF condition 
  44. THEN label), solved the problem completely.  Use of the loop, as shown in 
  45. ANYKEY.ASI, will work with GW-BASIC, Locomotive BASIC 2, ApBASIC, and probably 
  46. all the other BASICs you're likely to run across.  Pressing the key gets an 
  47. immediate result, and the resulting programs look a great deal more 
  48. professional.
  49.  
  50. If you have another BASIC, such as Microsoft's BASICA/GW-BASIC, you can see 
  51. for yourself the problems with the REPEAT...UNTIL and WHILE...WEND loops.  You 
  52. can run ANYKEY.COM to see how it works if you wish, but there are no 
  53. surprises; it just works the way you'd expect.
  54.  
  55. You may have to do a little modifying of the code, of course, to adapt it to 
  56. other BASICs, for instance adding line numbers, and so forth.
  57.  
  58.  
  59.                                      TESTS
  60.  
  61. 2
  62. Version numbers exist for the purpose of testing this disk's utilities on 
  63. other computers.  This version has been tested on the following:
  64.  
  65. Amstrad PC1512 SD: This system has an 8086 CPU, a composite monochrome 
  66. monitor, and CGA which can access 16 shades of gray (or color with a color 
  67. monitor) with a resolution of up to 640 X 200.  The system originally came 
  68. with 512K RAM, which I've upgraded to 640K.  It came with a single 5.25", 360K 
  69. drive.  A second internal drive of the same type was later added, and I've 
  70. installed a 49Mb hard disk card.  Operating system is MS-DOS 3.20.  This line 
  71. has been discontinued.  This utility had no problems running on the Amstrad. 
  72.  
  73.  
  74. Packard Bell Pack-Mate: This system has an 80286 CPU and a color VGA monitor.  
  75. Drives are one 40Mb internal hard disk, one 5.25", 1.2Mb drive, and one 3.5", 
  76. 1.44 Mb drive.  Operating system is MS-DOS 3.30.  This utility had no problems 
  77. running on the Packard Bell. 
  78.  
  79.