home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TP003.ZIP / WHEELS.DOC < prev    next >
Encoding:
Text File  |  1986-11-08  |  29.8 KB  |  569 lines

  1. San Francisco PC Users Group:     S O F T W A R E   L I B R A R Y
  2. =================================================================
  3. Volume ###: TURBO WHEELS -- handy routines for TURBO Pascal programs.
  4.  
  5. Index   Name           Description
  6.  
  7. ###.01  READTHIS.NOW   Details on all the files on this disk
  8. ###.02  ALLFILES.LIB   / Get all files that match template, display, and
  9. ###.03  ALLFILES.PAS   \ take selection
  10. ###.04  CIRCLE  .LIB   / Circle-drawing procedure for graphics mode
  11. ###.05  CIRCLE  .PAS   \
  12. ###.06  CURSOR  .LIB   / Change or hide cursor
  13. ###.07  CURSOR  .PAS   \
  14. ###.08  DISKMOD .PAS   Disk sector viewing & modification, using GETSECTR.LIB
  15. ###.09  DISKTYP .LIB   / Get disk type (single/double/fixed, 8/9 sectors).
  16. ###.10  DISKTYP .PAS   \ Returns disk size in K (160, 180, 320, 360)
  17. ###.11  EQUIPMNT.LIB   / Function Equipment returns information about
  18. ###.12  EQUIPMNT.PAS   \  equipment is attached to your PC
  19. ###.13  ERRMESSG.LIB   Error messages for DOS 2.0 function calls
  20. ###.14  EXISTFIL.LIB   / Test for existence of a file before you try
  21. ###.15  EXISTFIL.PAS   \ to open it -- avoid crashes.
  22. ###.16  EXTENDIO.LIB    / EXTENDed IO based on DOS 2.0 full-path commands.
  23. ###.17  EXTENDIO.PAS   <  ~.DAT contains the specifications for all
  24. ###.18  EXTENDIO.DAT    \ the new IO functions
  25. ###.19  FANCYKEY.PAS   Character or phrase for key pressed (uses KEYBOARD.LIB)
  26. ###.20  FILEATTR.LIB   / Read and write the attribute byte for any file
  27. ###.21  FILEATTR.PAS   \  (Read-Only, Hidden, System, Archive)
  28. ###.22  FILENAME.TYP   Filename type definition--shared by several others
  29. ###.23  GETFILE .LIB   / Procedures to GET FILEs matching a template.  Also
  30. ###.24  GETFILE .PAS   \ see ALLFILES
  31. ###.25  GETFREE .LIB   / Get amount of free space on disk -- protect your
  32. ###.26  GETFREE .PAS   \ programs from "out of space" crashes
  33. ###.27  GETINTGR.LIB   / Takes an integer in a given range, protected against
  34. ###.28  GETINTGR.PAS   \ invalid keystrokes
  35. ###.29  GETKEYS .LIB   / Simple procedure to catch any keystroke, used in many
  36. ###.30  GETKEYS .PAS   \ of the other programs on this disk
  37. ###.31  GETSECTR.LIB   Read a sector from disk to buffer.  See DISKMOD.PAS
  38. ###.32  GETSETDD.LIB   / Get or Set the default drive.
  39. ###.33  GETSETDD.PAS   \
  40. ###.34  GRFXTABL.LIB   / Get the dot patterns from the ROM graphics table.
  41. ###.35  GRFXTABL.PAS   \ Also see TITLES
  42. ###.36  GTSETDIR.LIB   / Get or Set the current directory path.
  43. ###.37  GTSETDIR.PAS   \
  44. ###.38  HEXFUNCT.LIB   / Convert integers in range -32,768 to 32,767 to
  45. ###.39  HEXFUNCT.PAS   \ Hexadecimal strings from $0000 to $FFFF
  46. ###.40  KAVAIL  .LIB   / Returns available memory in K
  47. ###.41  KAVAIL  .PAS   \
  48. ###.42  KEYBOARD.LIB   / Another approach to catching any keystroke.  See
  49. ###.43  KEYBOARD.PAS   \ SCANCODES.DAT for chart of Scan Codes
  50. ###.44  KEYCHART.DAT   Chart of key codes for GETKEYS.LIB
  51. ###.45  LABEL   .PAS   Uses GETSECTR to read and write diskette label
  52. ###.46  LESSRAM .PAS   / Reset your "official" amount of memory lower, for
  53. ###.47  LESSRAM .COM   \ programs.  Uses REBOOT.LIB.  Runs COMPILED only
  54. ###.48  MKRMDIR .LIB   / Make or remove subdirectories
  55. ###.49  MKRMDIR .PAS   \
  56. ###.50  MONITOR .LIB   Simple procedure to check for color or mono
  57. ###.51  MOVEFILE.LIB   / DOS 2.0 file RENAME--can also MOVE to other directory
  58. ###.52  MOVEFILE.PAS   \ by naming a valid new path
  59. ###.53  NEWINT9 .LIB   / Change the keyboard interrupt to get key release codes
  60. ###.54  NEWINT9 .PAS   \ and disable typematic.  For games, music.
  61. ###.55  NOSOUND .PAS   Quick rescue in case you accidentally leave sound on
  62. ###.56  NUMDISKS.PAS   / Change "official" number of disk drives.  For use w/
  63. ###.57  NUMDISKS.COM   \ certain RAMdisks.  Uses REBOOT.  Runs COMPILED only.
  64. ###.58  PARAMETR.LIB    / Pass parameters to programs from DOS command line.
  65. ###.59  PARAMETR.PAS   < Gets parameter string up to 80 characters.
  66. ###.60  PARAMETR.COM    \ PARAMETR only works if COMPILED
  67. ###.61  POPSCREN.LIB    / "Pop" full screens into view by addressing screen
  68. ###.62  POPSCREN.DAT   < memory.  Uses SCREENS.TYP.  ~.DAT is a sample screen
  69. ###.63  POPSCREN.PAS    \ file used as a demo.
  70. ###.64  QUEUE   .LIB   / A generic QUEUE -- shows how to use dynamic variables
  71. ###.65  QUEUE   .PAS   \ for those who are new to them.
  72. ###.66  README  .###   YOU ARE READING IT
  73. ###.67  REBOOT  .LIB   "Warm" system reboot, without clearing RAM
  74. ###.68  RECTANGL.LIB   / Rectangle-drawing procedure for graphics modes
  75. ###.69  RECTANGL.PAS   \
  76. ###.70  REGPACK .TYP   Contains type definition for REGPACK
  77. ###.71  SAFEWRIT.LIB   / Write to screen w/o letting control characters wreck
  78. ###.72  SAFEWRIT.PAS   \ the display.
  79. ###.73  SCANCODE.DAT   Chart of keyboard Scan Codes -- use with KEYBOARD.LIB
  80. ###.74  SCREEN  .LIB   / Direct video screen input/output
  81. ###.75  SCREEN  .PAS   \
  82. ###.76  SCREENS .TYP   Type declarations for full-screen manipulation
  83. ###.77  SUCCESS .DOC   Descriptions of ANOTHER set of INCLUDE files
  84. ###.78  TITLES  .LIB   / Using ROM character patterns to create titles
  85. ###.79  TITLES  .PAS   \
  86. ###.80  WINDOWS .LIB   / Eases use of windows and window-frames
  87. ###.81  WINDOWS .PAS   \
  88.  
  89.  
  90.  
  91.                           T U R B O   W H E E L S
  92.                                version 1.00
  93.                     Copyright 1984 by Neil J. Rubenking
  94.  
  95.         This disk contains quite a few procedures and functions that make
  96.     TURBO Pascal easier to use.  Why re-invent the wheel when you can get
  97.     TURBO WHEELS?  I am releasing it for distribution in the User Group/
  98.     Bulletin Board network subject to the following stipulations:
  99.  
  100.         1)  Anyone may get a copy of these files for examination, either
  101.             through their local Users Group or Bulletin Board, or by
  102.             sending me a blank, DOUBLE-sided diskette and a prepaid,
  103.             self-addressed diskette mailer.  Regardless of how the disk
  104.             is obtained, anyone who actually finds the contents USEFUL
  105.             should send me $10, so I can continue writing and releasing
  106.             software in this User-Supported fashion.  Send $10 to:
  107.  
  108.                             Neil J. Rubenking
  109.                             300 Page St.
  110.                             San Francisco, CA  94102
  111.  
  112.         2)  I retain all rights to the SOURCE code.  Recipients of the
  113.             procedures may freely $INCLUDE them in compiled programs,
  114.             but may not release the SOURCE.
  115.  
  116.         3)  Clubs may freely copy and distribute the disk for a nominal
  117.             fee, not to exceed $8.
  118.  
  119.         With the legalities aside, I hope you find these procedures useful
  120.     in your programs.  Each has at least one "driver" program, to illustrate
  121.     its actual use.  If you are new to the concept of $INCLUDEing pre-written
  122.     code in your TURBO Pascal programs, study the drivers.  There are also
  123.     several minor applications/utilities constructed using 8 or 10 of the
  124.     handy procedures.  A listing and description of the procedures follows.
  125.  
  126.         A keen observer might correctly deduce the following from the type of
  127.     files I have put on this disk.
  128.  
  129.         1)  I don't have a Color/Graphics display,
  130.         2)  I don't do much in math and scientific programming,
  131.         3)  I do write programs that involve creating and manipulating
  132.             disk files,
  133.         4)  I do like my programs to look and sound good.
  134.  
  135.         You may have noticed other disks of TURBO files on the market.  One
  136.     that I have found useful is just called "Procedures and Functions for
  137.     TURBO Pascal", from:
  138.  
  139.                               The Success Press
  140.                               P.O. Box 2795
  141.                               Des Plaines, IL  60018
  142.  
  143.         Send Bill Todd $20 to receive these procedures.  A list of them is
  144.     on this disk as "SUCCESS.DOC".
  145.  
  146.                                                 TURBO WHEELS   page 2
  147.  
  148.             *** SETTING UP THE DISK ***
  149.  
  150.         Format a blank diskette with the /S option, to make it a "bootable"
  151.     DOS disk.  Copy COMMAND.COM onto it, too.  Copy all the files from this
  152.     diskette onto the new diskette, and finally copy the files TURBO.COM and
  153.     TURBO.MSG from the TURBO Pascal disk.  Now your TURBO is a more powerful
  154.     development tool -- it has WHEELS!
  155.  
  156.     NOTE: If you're pressed for room, you only need the *.COM, *.LIB, *.TYP,
  157.           *.DAT and the *.PAS files.  The latter are handy but not necessary.
  158.           This would leave about 68K left on the disk for ASTCLOCK.COM,
  159.           ANSI.SYS, etc.  -- C.T. Wiebe, PDSE reviewer.
  160.  
  161.             *** FILES ON THIS DISK ***
  162.  
  163.         The file "README.###" is a list of all the files, with a one-line
  164.     description of each for quick reference.  The files for INCLUsion in your
  165.     programs have the extension .LIB or .TYP.  Almost every .LIB file has a
  166.     short program to illustrate its action (often called a "driver").  The
  167.     drivers have the same name as their .LIB file, but the extension is .PAS.
  168.     There are several utility application programs that use 8 or 10 .LIB files,
  169.     and a few data files (extension .DAT).  Now on to the descriptions of the
  170.     individual files.
  171.  
  172.  
  173.             *** TYPE DECLARATION FILES ***
  174.  
  175.         Most of the files on this disk use variables of type REGPACK (for
  176.     REGister PACK) or FILENAME_TYPE.  The description at the top of the INCLUDE
  177.     file will indicate if these or any other files need to also be present.
  178.     The reason to NOT write these type declarations directly into the files
  179.     that require them is that TURBO objects to multiple descriptions of the
  180.     same TYPE.
  181.  
  182.     FILENAME.TYP contains the definition of "filename_type" as a string
  183.         of up to 64 characters.
  184.  
  185.     REGPACK.TYP describes the type of variable required as input by TURBO's
  186.         procedures INTR and MSDOS.  You do not need to understand these to
  187.         use them! (But if you DO, you can do a lot!)
  188.  
  189.     SCREENS.TYP is the declaration of variable type SCREEN, which is exactly
  190.         the same "shape" as the (text) video display memory.  Using variables
  191.         of this TYPE, you can easily do direct screen manipulation.
  192.  
  193.     ERRMESSG.LIB is another file that is required by quite a few others.
  194.         It contains the function MESSAGE which receives as input a one-byte
  195.         error code (output of a DOS function) and returns the "translation"
  196.         of that code, as specified in the DOS 2.0 manual.
  197.  
  198.  
  199.  
  200.  
  201.                                                 TURBO WHEELS   page 3
  202.  
  203.             *** DOS 2.0 FILE HANDLING ***
  204.  
  205.         TURBO's file handling procedures do NOT work with subdirectories, as
  206.     you may have found out.  The following procedures are implementations of
  207.     the DOS 2.0 procedures--all the ordinary ones and some new ones, too.
  208.  
  209.     EXTENDIO.DAT is an exact description of the parameters passed to and
  210.         from these new IO functions.  Until you are used to using them,
  211.         you may want to actually insert this document into your source for
  212.         reference (or refer to it using SIDEKICK!).
  213.  
  214.     EXTENDIO.LIB, for EXTENDed Input/Output, contains 2.0 versions of Reset,
  215.         Rewrite, Close, Read, Write, Seek, and Erase.  Each new procedure
  216.         has the same name as the one it replaces, preceded by an X (Xreset,
  217.         Xclose, etc.).  Any time you use these Extended IO procedures, you
  218.         will also have to $INCLUDE the TYPE files REGPACK.TYP and
  219.         FILENAME.TYP, and the file ERRMESSG.LIB--all of these procedures
  220.         return a one-byte error code if anything goes wrong, and ERRMESSG.LIB
  221.         lets you interpret the error by saying "writeLn(message(error))".
  222.             In the DOS 2.0 mode, instead of a File Variable (a variable of
  223.         TYPE "file of something") you will use an INTEGER File Handle.
  224.         XReset and XRewrite receive a full-path filename (up to 64 char-
  225.         acters) and return the file handle, which you will use for all
  226.         further references to the file.  XClose receives just the file
  227.         handle (any open file has a handle), and XErase receives just the
  228.         path/filename.
  229.             Since DOS 2.0 files are effectively just files of bytes, the
  230.         XRead and XWrite operations work rather differently from their
  231.         forebears.  You pass the File Handle, the variable to/from which
  232.         data is to be read/written, and the SIZE of that variable (easily
  233.         obtained with TURBO's SizeOf function).  If the variable is a 1K
  234.         array, then 1K will be read into it (or written from it).  The
  235.         Size-passing is necessary.  Without it, you would have to write a
  236.         new XRead and XWrite for each type of variable!
  237.             XSeek is a bit complicated.  You pass the File Handle (as usual),
  238.         the Size of the records in your file, and the point from which you
  239.         want to start your XSeek (Beginning, End, or Current position), and
  240.         you get back the new current position.  Even if you don't want the
  241.         new current position (e.g., you just wanted to set the file pointer
  242.         back to the beginning, or all the way to the end for APPEND), you
  243.         still have to provide a dummy variable for it.
  244.             For very detailed descriptions of the parameters to pass to and
  245.         from these EXTENDed Input Output operations, see EXTENDIO.DAT.
  246.  
  247.     MOVEFILE.LIB might well be called "XRename", because it does serve to
  248.         rename files on any path.  However, the Renaming extends to the full
  249.         path -- you can MOVE a file to a different subdirectory simply by
  250.         changing its path.  You pass the old path and the new path, and
  251.         receive the usual one-byte error code if anything goes wrong.
  252.  
  253.  
  254.  
  255.  
  256.                                                 TURBO WHEELS   page 4
  257.  
  258.     GETFILE.LIB contains two procedures, Find_First and Find_Next.
  259.         Find_First serves to find the first occurrence of a file matching
  260.         the template you supply (using the standard DOS wildcard characters,
  261.         ? for any character and * for anything at all, AND using full-path
  262.         filenames).  You also specify the File Attribute--you can GET files
  263.         that are Read-Only, Hidden, System, Volume label, or Directory.
  264.         Find_First sets the DTA (Disk Transfer Area) to a buffer supplied by
  265.         you and either puts information about the file in the buffer, or
  266.         returns an error code.  Once you have Found the First occurrence,
  267.         you repeat Find_Next until you don't find any more.
  268.  
  269.     ALLFILES.LIB is a very handy procedure to include in any program that
  270.         makes use of other files (e.g., a word processor, picture editor,
  271.         music maker, etc.).  You pass the top left and bottom right coor-
  272.         dinates of an available screen area, and a template for the files
  273.         you want, and ALLFILES takes over.  It opens and frames a window at
  274.         the coordinates and displays all matching files.  The user positions
  275.         a pointer at the required file and presses <return> to select it.
  276.         If there are more files than will fit in the window, the user has
  277.         he choice of selecting a visible file or going on to another window
  278.         full.  Once a file is selected, ALLFILES erases its window and returns
  279.         the filename.  Note that your program will not have to test for
  280.         existence of the file before trying to open it--you KNOW it exists.
  281.             For an extremely classy use of ALLFILES, you may want to use the
  282.         technique described in SCREENS.LIB to save whatever is on the screen
  283.         before calling ALLFILES and pop it right back when ALLFILES is done.
  284.  
  285.     MKRMDIR.LIB brings the DOS MKDIR and RMDIR (MaKe DIRectory and ReMove
  286.         DIRectory) into TURBO.  If you want to do it, you can.
  287.  
  288.     FILEATTR.LIB lets you change the File Attribute byte (Read-Only, Hidden,
  289.         System, Archive) of a file on any path.
  290.  
  291.     GTSETDIR.LIB lets you GET or SET the current subDIRectory.  It may well
  292.         be used in conjunction with GETSTDD below.
  293.  
  294.  
  295.             *** DOS 1 OR 2 FILE HANDLING ***
  296.  
  297.     GETSETDD.LIB uses DOS function calls to GET or SET the Default Drive.
  298.  
  299.     EXISTFIL.LIB checks for the existence of a file.  You pass it the
  300.         "old-fashioned" filename (no subdirectory!) and it returns true
  301.         or false.  (The EXTENDed I/O operations do not directly crash your
  302.         program if the file requested does not exist, so they don't need a
  303.         corresponding 2.0 function.)
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                                                 TURBO WHEELS   page 5
  312.  
  313.             *** DISK READ/WRITE PROCEDURES ***
  314.  
  315.     DISKTYP.LIB checks the type of disk (single/double sided, 8/9 sectors
  316.         per track).  You pass the drive letter, and it returns the number
  317.         of K of disk space (an integer, 160, 180, 320, or 360), 0 if an
  318.         invalid drive was specified, or 1 for a non-standard format.
  319.  
  320.     GETSECTR.LIB conducts I/O between a specific sector on the disk and a
  321.         buffer variable declared by you.  You specify [R]ead or [W]rite and
  322.         the side, sector, and track, and the buffer variable is either read
  323.         from or written to the disk.  As usual, a one-byte error code is
  324.         returned.  On the advice of the DOS Manual, GetSector makes three
  325.         tries at reading the sector before it gives up and returns an error
  326.         code.
  327.             The buffer variable must be 512 bytes, but you can choose to
  328.         arrange these bytes in convenient ways.  For example, in the
  329.         application LABEL.PAS, the buffer is an array[1..16] of type
  330.         directory_entry, and reading a directory sector gives you instant
  331.         access to its 16 entries.  NOTE that, unlike most of the procedures
  332.         on this disk, GETSECTR does not have a driver with the same name.
  333.         The sample programs that use GETSECTR are LABEL and DISKMOD.
  334.  
  335.     LABEL.PAS uses DISKTYP.LIB, GETSECTR.LIB, and several other files to
  336.         read and write the volume label.  It first seeks an existing label
  337.         in the directory (NOTE:  the volume label is just a special kind
  338.         of directory entry.)  If found, you may change it.  If not found,
  339.         the first directory slot that is either never-used or erased is
  340.         converted to a label of your choice.  The current date and time are
  341.         properly included with your volume label, but the bit-manipulation
  342.         that does that is horrifying!
  343.  
  344.     DISKMOD.PAS is a working Disk Sector Viewing and Modifying program,
  345.         based on DISKMODF.BAS by John VanderGrift.  You select a sector
  346.         and get it displayed both in (filtered) ASCII and hex.  You can
  347.         modify the displayed sector by simply typing in new values, but
  348.         you must specifically ask to record the modifications.  Pressing
  349.         PgDn and PgUp move to the next or previous sectors -- the procedures
  350.         "increment" and "decrement" embody the DOS sector numbering scheme.
  351.  
  352.  
  353.             *** VIDEO DISPLAY PROCEDURES ***
  354.  
  355.     CURSOR.LIB contains the procedure Cursor_Control.  You set the top and
  356.         bottom "scan lines" for the cursor.  You'll want to $INCLUDE the
  357.         file MONITOR.LIB and ask to CheckColor before you change the cursor
  358.         around, because the Monochrome cursor has 14 scan lines (numbered
  359.         0 at the top to 13 at the bottom) while the Color cursor is only
  360.         7 high (0 to 6).  The normal cursor is 12,13 in Mono and 6,7 in color.
  361.         In Monochrome, you can get a two-part cursor by setting the top line
  362.         below the bottom.  NOTE that you can "kill" the cursor by setting the
  363.         top line to 48, bottom to 0.
  364.  
  365.  
  366.                                                 TURBO WHEELS   page 6
  367.  
  368.     MONITOR.LIB sets the values of the variables COLOR (boolean) and
  369.         ScreenSeg (integer) for use by other procedures.  Besides
  370.         $INCLUDEing it, you must invoke CheckColor at the beginning
  371.         of your program.
  372.  
  373.     SCREEN.LIB contains procedures to read and write the character and
  374.         screen attribute (i.e., COLOR) at any location on the screen IN
  375.         TEXT MODE.  The driver, SCREEN.PAS, is a little video game showing
  376.         how handy these procedures can be.
  377.  
  378.     POPSCREN.LIB is a slightly frivolous use of the SCREEN data type,
  379.         declared in SCREENS.TYP.  Several SCREEN variables are created
  380.         and rapidly switched to the display.  A pop-up menu example is
  381.         included.
  382.  
  383.     POPSCREN.DAT is a screen file used by POPSCREN.LIB.
  384.  
  385.     GRFXTABL.LIB defines a table of ROMEntries "on top" of the ROM
  386.         graphics table, giving us (read-only) access to the dot patterns
  387.         used to create the monochrome characters.
  388.  
  389.     TITLES.LIB contains the procedure MakeTitle.  Given a title up to ten
  390.         characters and a starting row, it makes a big title on the screen
  391.         by using the character patterns from GRFXTABL.
  392.  
  393.     WINDOWS.LIB offers another approach to using windows.  The variable
  394.         type "corners" is declared to be an array[1..4] of byte.  Windows
  395.         that your program will use are set at the beginning of the program
  396.         by declaring CONSTants of type "corners".  The procedures DoWindow
  397.         and DoFrame operate on input of type "corners".  If, later in the
  398.         development of your program, you want to move the windows around,
  399.         you just change the CONSTant declaration at the top.
  400.  
  401.  
  402.             *** KEYBOARD PROCEDURES ***
  403.  
  404.     GETKEYS.LIB is one of my favorites.  The line "GetKeys(C,D)" causes
  405.         your program to wait for a keystroke and, if it is an "ordinary"
  406.         keystroke, returns the character in C and chr(0) in D.  If, however,
  407.         it was a "special" keystroke (arrow key, function key), it returns
  408.         chr(27) in C and a code character in D.  The file KEYCHART.DAT
  409.         tabulates these special codes.
  410.  
  411.     KEYBOARD.LIB is another approach to trapping keystrokes.  It uses the
  412.         keyboard BIOS interrupt $16 to get the scan code and ASCII code of
  413.         any key pressed.  The file SCANCODE.DAT is a chart of keyboard
  414.         codes, along with a table of "extended" scan codes.
  415.  
  416.     FANCYKEY.LIB goes KEYBOARD one better.  It returns a phrase describing
  417.         the key pressed, such as "Alt-A", "Shift-F1", "Back Tab", etc.
  418.  
  419.  
  420.  
  421.                                                 TURBO WHEELS   page 7
  422.  
  423.     NEWINT9.LIB is an ambitious procedure.  The keyboard's output is
  424.         generally handled by Interrupt $9, which is called BY THE KEYBOARD
  425.         whenever a key is struck.  This interrupt checks for shift states,
  426.         filters out key release codes, and produces the "typematic" effect,
  427.         whereby a key held down repeats.  Certain applications might be
  428.         better off WITHOUT the typematic and WITH access to the key release
  429.         codes -- my own PIANO MAN program comes to mind.  I required a note
  430.         to sound ONCE when a key was pressed and stop when that key was
  431.         released.  Games might requires this feature.  If you do use it,
  432.         your program should:
  433.  
  434.             1)  invoke procedure SetUpInt, which creates the new interrupt.
  435.             2)  invoke NewInt, which saves the normal interrupt vector and
  436.                 replaces it with directions to the new one.
  437.             3)  MOST IMPORTANT, before the program ends, invoke OldInt to
  438.                 restore the normal interrupt.  If you don't do this, or if
  439.                 your program crashes before it can do it, you cannot
  440.                 communicate through your keyboard, and you have to turn
  441.                 the PC off and on again.
  442.  
  443.         Used with care, NEWINT9 can satisfy a real need.
  444.  
  445.  
  446.             *** GRAPHICS ***
  447.  
  448.     (Let me note that I myself do not have a Color/Graphics adapter, so I
  449.     haven't had much opportunity to write for one.  However, the mighty
  450.     BORLAND has a Graphics tool set for their usual price of $50.)
  451.  
  452.     CIRCLE.LIB draws a circle on your screen.  You specify six parameters:
  453.         H, K and R are the X and Y coordinates of the circle's center and
  454.         its radius.  "Res" is the resolution -- the number of dots used to
  455.         draw the circle is proportional to Res, as is the time required to
  456.         draw it.  "Aspect" is a real value that describes the circle's
  457.         "roundness" -- adjust to a perfect circle, or change it to get an
  458.         ellipse.
  459.             Finally,  "color" can be 1, 2, or 3 if you are in the Graphics
  460.         mode that supports four colors.  (See the description of graphics
  461.         modes in the TURBO 2.0 manual).
  462.  
  463.     RECTANGL.LIB naturally draws a rectangle on the screen.  You tell it
  464.         the X and Y coordinates of the upper left and lower right corners,
  465.         the color (1, 2, or 3 if appropriate), and 1 for a filled rectangle,
  466.         0 for hollow.
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.                                                 TURBO WHEELS   page 8
  477.  
  478.             *** MISCELLANEOUS ROUTINES ***
  479.  
  480.     EQUIPMNT.LIB uses Interrupt $11 to check the equipment attached to
  481.         your PC.  It reports on number of printers, RS232 ports, game
  482.         ports, and diskette drives, the initial video mode, or the amount
  483.         of RAM on the motherboard.
  484.  
  485.     GETINTGR.LIB is intended to save you the embarrassment of having your
  486.         program crash because someone made an invalid entry for an integer.
  487.         At the same time, it makes sure that the entry is within a ranges
  488.         you specify.  Non-numeric keystrokes are ignored, BackSpace works,
  489.         and the function does not give up until a valid integer is entered.
  490.  
  491.     GETFREE.LIB is another face-saver.  It gets the amount of free space on
  492.         the current disk.  That way, your programs can check for space and
  493.         give alternatives if there's not enough, rather than ignominiously
  494.         crashing.
  495.  
  496.     HEXFUNCT.LIB contains the procedure HEX which receives an integer and
  497.         returns a 5-character hex string (e.g., $BF00).  The hex string
  498.         always refers to a positive number -- TURBO's integer variable type
  499.         uses its highest bit to indicate sign, thus restricting the integer
  500.         range to -32,768 to +32,767.  Hex equivalents are calculated by
  501.         considering negative integers as offsets down from $10000 (decimal
  502.         65,536).  Thus, HEX(-1) = $FFFF.  (NOTE:  the TURBO manual says
  503.         that the integer range is as stated above, but in my experience,
  504.         it is not possible to enter -32,768.)
  505.  
  506.     KAVAIL.LIB returns the number of KiloBytes of memory available.  It
  507.         takes into account the MemAvail function's quirk of reporting
  508.         amounts greater than 32,767 as negative numbers.
  509.  
  510.     NOSOUND.PAS does nothing but shut off the sound, if one of your
  511.         programs crashes with sound on.  When you need it, you NEED it!
  512.  
  513.     PARAMETR.LIB contains the function GetParameter, which returns a string
  514.         of up to 80 characters consisting of whatever was entered on the
  515.         command line after the name of the program.  This O N L Y works in
  516.         COMPILED programs.
  517.     QUEUE.LIB is a generic Queue data structure.  One of Pascal's great
  518.         advantages over BASIC is its implementation of Pointer^ variables
  519.         and dynamic lists.  By keeping your data in a linked list instead
  520.         of an array, you can dedicate only as much memory as you need, up
  521.         to all the memory the system has.  If you test for memory available
  522.         with KAVAIL before you add each item to the list, you can safely
  523.         expand to the maximum memory of different systems without crashing
  524.         for lack of memory.
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                                                 TURBO WHEELS   page 9
  532.  
  533.     REBOOT.LIB does just what it says.  The "warm" reboot produced by
  534.         Interrupt $19 does NOT clear the RAM, so, for example, SIDEKICK
  535.         will stay resident.  The programs LESSRAM and NUMDISKS use REBOOT
  536.         to cause the PC to act as if its internal DIP switches had been
  537.         reset to indicate a different number of disk drives or different
  538.         amount of RAM.  One note of caution -- There seems to be some
  539.         interference in this reboot process from certain device drivers
  540.         in the CONFIG.SYS file.  The symptom is that the driver (e.g.,
  541.         your hard disk driver, or a RAMdisk) installs itself and then the
  542.         A: drive spins . . . and spins . . . and that's it.  To avoid this
  543.         problem, you could always rename CONFIG.SYS to something else
  544.         temporarily.  IF you can figure out why this happens and how to
  545.         get around it, PLEASE let me know!
  546.  
  547.     LESSRAM.COM is handy if you always write your programs on your
  548.         souped-up 640K SuperPC and want to test whether it will actually
  549.         run on a lesser machine with, say 96K.  You COULD open the box and
  550.         change the switches, but it's a lot easier just to go back to DOS
  551.         and type LESSRAM 96.
  552.  
  553.     NUMDISKS.COM's raison d'etre is the current confusion of method among
  554.         RAMdisks.  Some require that the internal switches be set to the
  555.         total number of physical drives and RAMdisks, while others insist
  556.         that the switches show physical drives only.  If you need to switch
  557.         around, you can enter NUMDISKS <number>.  If you put NUMDISKS in a
  558.         batch file, be sure to add an "n" (or "N") to the number so the
  559.         program won't pause for a keypress before rebooting.
  560.  
  561.     SAFEWRIT.LIB is one way to get around the fact that you cannot WRITE
  562.         certain characters to the screen -- they get interpreted as Control
  563.         Characters and warp your display.  Procedure SafeWrite catches these
  564.         characters and replaces them with a related character in Low Video.
  565.         Note that another approach would be to use the procedures in
  566.         SCREEN.LIB to send characters directly to the screen memory.
  567.         Using this latter method, you can put ANY character on the screen.
  568.  
  569.