home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MADTRB04.ZIP / READTHIS.NOW < prev    next >
Encoding:
Text File  |  1985-11-29  |  28.8 KB  |  579 lines

  1.  
  2.  
  3.                           T U R B O   W H E E L S
  4.                                version 1.00
  5.           
  6.                       Copyright 1984 by Neil J. Rubenking
  7.           
  8.  
  9.                    
  10.      This disk contains quite a few procedures and functions that
  11.           
  12.      make TURBO Pascal easier to use.  Why re-invent the wheel when
  13.           
  14.      you can get TURBO WHEELS?  I am releasing it for distribution in
  15.           
  16.      the User Group/Bulletin Board network subject to the following
  17.           
  18.      stipulations:
  19.           
  20.  
  21.      1)  Anyone may get a copy of these files for examina-
  22.      tion, either through their local Users Group or
  23.           
  24.      Bulletin Board, or by sending me a blank, DOUBLE-sided
  25.           
  26.      diskette and a prepaid, self-addressed diskette
  27.           
  28.      mailer.  Regardless of how the disk is obtained, anyone
  29.           
  30.      who actually finds the contents USEFUL should send me
  31.           
  32.      $10, so I can continue writing and releasing software
  33.           
  34.      in this User-Supported fashion.  Send $10 to:
  35.           
  36.  
  37.                Neil J. Rubenking
  38.           
  39.                300 Page St.
  40.           
  41.                San Francisco, CA  94102
  42.           
  43.  
  44.      2)  I retain all rights to the SOURCE code.  Recipients
  45.           
  46.      of the procedures may freely $INCLUDE them in compiled
  47.           
  48.      programs, but may not release the SOURCE.
  49.           
  50.  
  51.      3)  Clubs may freely copy and distribute the disk for a
  52.           
  53.      nominal fee, not to exceed $8.
  54.           
  55.  
  56.           With the legalities aside, I hope you find these procedures
  57.           
  58.      useful in your programs.  Each has at least one "driver" program,
  59.           
  60.      to illustrate its actual use.  If you are new to the concept of
  61.           
  62.      $INCLUDEing pre-written code in your TURBO Pascal programs, study
  63.           
  64.      the drivers.  There are also several minor applications/utilities
  65.           
  66.      constructed using 8 or 10 of the handy procedures.  A listing and
  67.           
  68.      description of the procedures follows.
  69.           
  70.  
  71.           A keen observer might correctly deduce the following from
  72.           
  73.      the type of files I have put on this disk.
  74.           
  75.  
  76.           1) I don't have a Color/Graphics display
  77.           
  78.           2) I don't do much in math and scientific programming
  79.           
  80.           3) I do write programs that involve creating and manipu-
  81.              lating disk files.
  82.           
  83.           4) I do like my programs to look and sound good.
  84.           
  85.  
  86.           You may have noticed other disks of TURBO files on the
  87.           
  88.      market.  One that I have found useful is just called "Procedures
  89.           
  90.      and Functions for TURBO Pascal", from:
  91.           
  92.  
  93.                The Success Press
  94.           
  95.                P.O. Box 2795
  96.           
  97.                Des Plaines, IL
  98.           
  99.  
  100.      Send Bill Todd $20 to receive these procedures.  A list of
  101.           
  102.      them is on this disk as "SUCCESS.DOC".
  103.           
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.                                                 TURBO WHEELS   page 2
  112.  
  113.  
  114.  
  115.      *** SETTING UP THE DISK ***
  116.           
  117.  
  118.           Format a blank diskette with the /S option, to make it a
  119.           
  120.      "bootable" DOS disk.  Copy COMMAND.COM onto it, too.  Copy all
  121.           
  122.      the files from this diskette onto the new diskette, and finally
  123.           
  124.      copy the files TURBO.COM and TURBO.MSG from the TURBO Pascal disk.
  125.           
  126.      Now your TURBO is a more powerful development tool -- it has WHEELS!
  127.               development tool -- it has WHEELS!
  128.           
  129.  
  130.  
  131.      *** FILES ON THIS DISK ***
  132.           
  133.  
  134.           The file "README.###" is a list of all the files, with a
  135.           
  136.      one-line description of each for quick reference.  The files for
  137.           
  138.      INCLUsion in your programs have the extension .LIB or .TYP.
  139.           
  140.      Almost every .LIB file has a short program to illustrate its
  141.           
  142.      action (often called a "driver").  The drivers have the same name
  143.           
  144.      as their .LIB file, but the extension is .PAS.  There are several
  145.           
  146.      utility application programs that use 8 or 10 .LIB files, and a
  147.           
  148.      few data files (extension .DAT).  Now on to the descriptions of
  149.           
  150.      the idividual files.
  151.           
  152.  
  153.  
  154.      *** TYPE DECLARATION FILES ***
  155.  
  156.       Most of the files on this disk use variables of type REGPACK
  157.           
  158.      (for REGister PACK) or FILENAME_TYPE.  The description at the top
  159.           
  160.      of the INCLUDE file will indicate if these or any other files
  161.           
  162.      need to also be present.  The reason to NOT write these type
  163.           
  164.      declarations directly into the files that require them is that
  165.           
  166.      TURBO objects to multiple descriptions of the same TYPE.
  167.           
  168.  
  169.      FILENAME.TYP contains the definition of "filename_type" as a
  170.           
  171.           string of up to 64 characters.
  172.           
  173.  
  174.      REGPACK.TYP describes the type of variable required as input by
  175.           
  176.           TURBO's procedures INTR and MSDOS.  You do not need to
  177.           
  178.           understand these to use them!  (But if you DO, you can do a
  179.           
  180.           lot!)
  181.           
  182.  
  183.      SCREENS.TYP is the declaration of variable type SCREEN, which is
  184.           
  185.           exactly the same "shape" as the (text) video display
  186.           
  187.           memory.  Using variables of this TYPE, you can easily do
  188.           
  189.           direct screen manipulation.
  190.           
  191.  
  192.      ERRMESSG.LIB is another file that is required by quite a few
  193.           
  194.           others.  It contains the function MESSAGE which receives as
  195.           
  196.           input a one-byte error code (output of a DOS function) and
  197.           returns the "translation" of that code, as specified in the
  198.           
  199.           DOS 2.0 manual.
  200.           
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.                                                 TURBO WHEELS   page 3
  216.  
  217.      *** DOS 2.0 FILE HANDLING ***
  218.           
  219.  
  220.      TURBO's file handling procedures do NOT work with subdirec-
  221.           
  222.      tories, as you may have found out.  The following procedures are
  223.           
  224.      implementations of the DOS 2.0 procedures--all the ordinary ones
  225.           
  226.      and some new ones, too.
  227.           
  228.  
  229.      EXTENDIO.DAT is an exact description of the parameters passed to
  230.           
  231.           and from these new IO functions.  Until you are used to
  232.           
  233.           using them, you may want to actually insert this document
  234.           
  235.           into your source for reference (or refer to it using
  236.           
  237.           SIDEKICK!).
  238.           
  239.  
  240.      EXTENDIO.LIB, for EXTENDed Input/Output contains 2.0 versions of
  241.           
  242.           Reset, Rewrite, Close, Read, Write, Seek, and Erase.  Each
  243.           
  244.           new procedure has the same name as the one it replaces,
  245.           
  246.           preceded by an X (Xreset, Xclose, etc.).  Any time you use
  247.           
  248.           these Extended IO procedures, you will also have to $INCLUDE
  249.           
  250.           the TYPE files REGPACK.TYP and FILENAME.TYP, and the file
  251.           
  252.           ERRMESSG.LIB--all of these procedures return a one-byte
  253.           
  254.           error code if anything goes wrong, and ERRMESSG.LIB lets you
  255.           
  256.           interpret the error by saying "writeLn(message(error))".
  257.           
  258.  
  259.                In the DOS 2.0 mode, instead of a File Variable (a
  260.           
  261.           variable of TYPE "file of something") you will use an
  262.           
  263.           INTEGER File Handle.  XReset and XRewrite receive a full-
  264.           
  265.           path filename (up to 64 characters) and return the file
  266.           
  267.           handle, which you will use for all further references to the
  268.           
  269.           file.  XClose receives just the file handle (any open file
  270.           
  271.           has a handle), and XErase receives just the path/filename.
  272.           
  273.  
  274.                Since DOS 2.0 files are effectively just files of
  275.           
  276.           bytes, the XRead and XWrite operations work rather diffe-
  277.           
  278.           rently from their forebears.  You pass the File Handle, the
  279.           
  280.           variable to/from which data is to be read/written, and the
  281.           
  282.           SIZE of that variable (easily obtained with TURBO's SizeOf
  283.           
  284.           function).  If the variable is a 1K array, then 1K will be
  285.           
  286.           read into it (or written from it).  The Size-passing is
  287.           
  288.           necessary.  Without it, you would have to write a new XRead
  289.           
  290.           and XWrite for each type of variable!
  291.           
  292.  
  293.                XSeek is a bit complicated.  You pass the File Handle
  294.           
  295.           (as usual), the Size of the records in your file, and the
  296.           
  297.           point from which you want to start your XSeek (Beginning,
  298.           
  299.           End, or Current position), and you get back the new current
  300.           
  301.           position.  Even if you don't want the new current position
  302.           
  303.           (e.g., you just wanted to set the file pointer back to the
  304.           
  305.           beginning, or all the way to the end for APPEND), you still
  306.           
  307.           have to provide a dummy variable for it.
  308.           
  309.  
  310.           For very detailed descriptions of the parameters to
  311.           
  312.           pass to and from these EXTENDed Input Output operations, see
  313.           
  314.           EXTENDIO.DAT.
  315.           
  316.  
  317.      MOVEFILE.LIB might well be called "XRename", because it does
  318.           
  319.           serve to rename files on any path.  However, the Renaming
  320.           
  321.           extends to the full path--you can MOVE a file to a different
  322.           
  323.           subdirectory simply by changing its path.  You pass the old
  324.           
  325.           path and the new path, and receive the usual one-byte error
  326.           
  327.           code if anything goes wrong.
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                 TURBO WHEELS   page 4
  335.  
  336.      GETFILE.LIB contains two procedures, Find_First and Find_Next.
  337.           
  338.           Find_First serves to find the first occurrence of a file
  339.           
  340.           matching the template you supply (using the standard DOS
  341.           
  342.           wildcard characters, ? for any character and * for anything
  343.           
  344.           at all, AND using full-path filenames).  You also specify
  345.           
  346.           the File Attribute--you can GET files that are Read-Only,
  347.           
  348.           Hidden, System, Volume label, or Directory.  Find_First sets
  349.           
  350.           the DTA (Disk Transfer Area) to a buffer supplied by you and
  351.           
  352.           either puts information about the file in the buffer, or
  353.           
  354.           returns an error code.  Once you have Found the First
  355.           
  356.           occurrence, you repeat Find_Next until you don't find any
  357.           
  358.           more.
  359.           
  360.  
  361.      ALLFILES.LIB is a very handy procedure to include in any program
  362.           
  363.           that makes use of other files (e.g., a word processor,
  364.           
  365.           picture editor, music maker, &c.).  You pass the top left
  366.           
  367.           and bottom right coordinates of an available screen area,
  368.           
  369.           and a template for the files you want, and ALLFILES takes
  370.           
  371.           over.  It opens and frames a window at the coordinates and
  372.           
  373.           displays all matching files.  The user positions a pointer
  374.           
  375.           at the required file and presses <return> to select it.  If
  376.           
  377.           there are more files than will fit in the window, the user
  378.           
  379.           has the choice of selecting a visible file or going on to
  380.           
  381.           another window full.  Once a file is selected, ALLFILES
  382.           
  383.           erases its window and returns the filename.  Note that your
  384.           
  385.           program will not have to test for existence of the file
  386.           
  387.           before trying to open it--you KNOW it exists.
  388.           
  389.  
  390.           For an extremely classy use of ALLFILES, you may want
  391.           
  392.          to use the technique described in SCREENS.LIB to save
  393.           
  394.          whatever is on the screen before calling ALLFILES and pop it
  395.           
  396.          right back when ALLFILES is done.
  397.           
  398.  
  399.      MKRMDIR.LIB brings the DOS MKDIR and RMDIR (MaKe DIRectory and
  400.           
  401.          DIRectory) into TURBO.  If you want to do it, you can.
  402.           
  403.  
  404.      FILEATTR.LIB lets you change the File Attribute byte (Read-Only,
  405.           
  406.           Hidden, System, Archive) of a file on any path.
  407.           
  408.  
  409.      GTSETDIR.LIB lets you GET or SET the current subDIRectory.  It
  410.           
  411.           may well be used in conjunction with GETSTDD below.
  412.           
  413.  
  414.  
  415. *** DOS 1 OR 2 FILE HANDLING ***
  416.           
  417.  
  418.     GETSETDD.LIB uses DOS function calls to GET or SET the Default
  419.           
  420.          Drive.
  421.           
  422.  
  423.      EXISTFIL.LIB checks for the existence of a file.  You pass it the
  424.           
  425.          "old-fashioned" filename (no subdirectory!) and it returns
  426.           
  427.          true or false.  (The EXTENDed I/O operations do not directly
  428.           
  429.          crash your program if the file requested does not exist, so
  430.           
  431.          they don't need a corresponding 2.0 function.)
  432.           
  433.  
  434.  
  435. *** DISK READ/WRITE PROCEDURES ***
  436.           
  437.  
  438.      DISKTYP.LIB checks the type of disk (single/double sided, 8/9
  439.           
  440.           sectors per track).  You pass the drive letter, and it
  441.           
  442.           returns the number of K of disk space (an integer, 160, 180,
  443.           
  444.           320, or 360), 0 if an invalid drive was specified, or 1 for
  445.           
  446.           a non-standard format.
  447.  
  448.  
  449.  
  450.  
  451.                                                 TURBO WHEELS   page 5
  452.  
  453.      GETSECTR.LIB conducts I/O between a specific sector on the disk
  454.           
  455.           and a buffer variable declared by you.  You specify [R]ead
  456.           
  457.           or [W]rite and the side, sector, and track, and the buffer
  458.           
  459.           variable is either read from or written to the disk.  As
  460.           
  461.           usual, a one-byte error code is returned.  On the advice of
  462.           
  463.           the DOS Manual, GetSector makes three tries at reading the
  464.           
  465.           sector before it gives up and returns an error code.
  466.           
  467.                The buffer variable must be 512 bytes, but you can
  468.           
  469.           choose to arrange these bytes in convenient ways.  For
  470.           
  471.           example, in the application LABEL.PAS, the buffer is an
  472.           
  473.           array[1..16] of type directory_entry, and reading a direc-
  474.           
  475.           tory sector gives you instant access to its 16 entries.
  476.           
  477.           NOTE that, unlike most of the procedures on this disk,
  478.           
  479.           GETSECTR does not have a driver with the same name.  The
  480.           
  481.           sample programs that use GETSECTR are LABEL and DISKMOD.
  482.           
  483.  
  484.      LABEL.PAS uses DISKTYP.LIB, GETSECTR.LIB, and several other files
  485.           
  486.           to read and write the volume label.  It first seeks an
  487.           
  488.           existing label in the directory (NOTE:  the volume label is
  489.           
  490.           just a special kind of directory entry.)  If found, you may
  491.           
  492.           change it.  If not found, the first directory slot that is
  493.           
  494.           either never-used or erased is converted to a label of your
  495.           
  496.           choice.  The current date and time are properly included
  497.           
  498.           with your volume label, but the bit-manipulation that does
  499.           
  500.           that is horrifying!
  501.           
  502.  
  503.      DISKMOD.PAS is a working Disk Sector Viewing and Modifying
  504.           
  505.           program, based on DISKMODF.BAS by John VanderGrift.  You
  506.           
  507.           select a sector and get it displayed both in (filtered)
  508.           
  509.           ASCII and hex.  You can modify the displayed sector by
  510.           
  511.           simply typing in new values, but you must specifically ask
  512.           
  513.           to record the modifications.  Pressing PgDn and PgUp move to
  514.           
  515.           the next or previous sectors--the procedures "increment" and
  516.           
  517.           "decrement" embody the DOS sector numbering scheme.
  518.           
  519.  
  520.  
  521. *** VIDEO DISPLAY PROCEDURES ***
  522.           
  523.  
  524.      CURSOR.LIB contains the procedure Cursor_Control.  You set the
  525.           
  526.           top and bottom "scan lines" for the cursor.  You'll want to
  527.           
  528.           $INCLUDE the file MONITOR.LIB and ask to CheckColor before
  529.           
  530.           you change the cursor around, because the Monochrome cursor
  531.           
  532.           has 14 scan lines (numbered 0 at the top to 13 at the
  533.           
  534.           bottom) while the Color cursor is only 7 high (0 to 6).  The
  535.           
  536.           normal cursor is 12,13 in Mono and 6,7 in color.  In
  537.           
  538.           Monochrome, you can get a two-part cursor by setting the top
  539.           
  540.           line below the bottom.  NOTE that you can "kill" the cursor
  541.           
  542.           by setting the top line to 48, bottom to 0.
  543.           
  544.  
  545.      MONITOR.LIB sets the values of the variables COLOR (boolean) and
  546.           
  547.           ScreenSeg (integer) for use by other procedures.  Besides
  548.           
  549.           $INCLUDEing it, you must invoke CheckColor at the beginning
  550.           of your program.
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.                                                 TURBO WHEELS   page 6
  562.  
  563.      SCREEN.LIB contains procedures to read and write the character
  564.           
  565.           and screen attribute (i.e., COLOR) at any location on the
  566.           
  567.           screen IN TEXT MODE.  The driver, SCREEN.PAS, is a little
  568.           
  569.           video game showing how handy these procedures can be.
  570.           
  571.  
  572.      POPSCREN.LIB is a slightly frivolous use of the SCREEN data type,
  573.           
  574.           declared in SCREENS.TYP.  Several SCREEN variables are
  575.           
  576.           created and rapidly switched to the display.  A pop-up menu
  577.           
  578.           example is included.
  579.           
  580.  
  581.      POPSCREN.DAT is a screen file used by POPSCREN.LIB
  582.           
  583.  
  584.      GRFXTABL.LIB defines a table of ROMEntries "on top" of the ROM
  585.           
  586.           graphics table, giving us (read-only) access to the dot
  587.           
  588.           patterns used to create the monochrome characters.
  589.           
  590.  
  591.      TITLES.LIB contains the procedure MakeTitle.  Given a title up to
  592.           
  593.           ten characters and a starting row, it makes a big title on
  594.           
  595.           the screen by using the character patterns from GRFXTABL.
  596.           
  597.  
  598.      WINDOWS.LIB offers another approach to using windows.  The
  599.           
  600.           variable type "corners" is declared to be an array[1..4] of
  601.           
  602.           byte.  Windows that your program will use are set at the
  603.           
  604.           beginning of the program by declaring CONSTants of type
  605.           
  606.           "corners".  The procedures DoWindow and DoFrame operate on
  607.           
  608.           input of type "corners".  If, later in the development of
  609.           
  610.           your program, you want to move the windows around, you just
  611.           
  612.           change the CONSTant declaration at the top.
  613.           
  614.  
  615.  
  616. *** kEYBOARD PROCEDURES ***
  617.           
  618.  
  619.      GETKEYS.LIB is one of my favorites.  The line "GetKeys(C,D)"
  620.           
  621.           causes your program to wait for a keystroke and, if it is an
  622.           
  623.           "ordinary" keystroke, returns the character in C and chr(0)
  624.           
  625.           in D.  If, however, it was a "special" keystroke (arrow key,
  626.           
  627.           function key), it returns chr(27) in C and a code character
  628.           
  629.           in D.  The file KEYCHART.DAT tabulates these special codes.
  630.           
  631.  
  632.      KEYBOARD.LIB is another approach to trapping keystrokes.  It uses
  633.           
  634.           the keyboard BIOS interrupt $16 to get the scan code and
  635.           
  636.           ASCII code of any key pressed.  The file SCANCODE.DAT is a
  637.           
  638.           chart of keyboard codes, along with a table of "extended"
  639.           
  640.           scan codes.
  641.           
  642.  
  643.      FANCYKEY.LIB goes KEYBOARD one better.  It returns a phrase
  644.           
  645.           describing the key pressed, such as "Alt-A", "Shift-F1",
  646.           
  647.           "Back Tab", etc.
  648.           
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.                                                 TURBO WHEELS   page 7
  667.  
  668.      NEWINT9.LIB is an ambitious procedure.  The keyboard's output is
  669.           
  670.           generally handled by Interrupt $9, which is called BY THE
  671.           
  672.           KEYBOARD whenever a key is struck.  This interrupt checks
  673.           
  674.           for shift states, filters out key release codes, and
  675.           
  676.           produces the "typematic" effect, whereby a key held down
  677.           
  678.           repeats.  Certain applications might be better off WITHOUT
  679.           
  680.           the typematic and WITH access to the key release codes -- my
  681.           
  682.           own PIANO MAN program comes to mind.  I required a note to
  683.           
  684.           sound ONCE when a key was pressed and stop when that key was
  685.           
  686.           released.  Games might requires this feature.  If you do use
  687.           
  688.           it, your program should:
  689.           
  690.  
  691.                1) invoke procedure SetUpInt, which creates the new
  692.           
  693.                   interrupt.
  694.           
  695.  
  696.                2) invoke NewInt, which saves the normal interrupt
  697.           
  698.                   vector and replaces it with directions to the new one.
  699.           
  700.  
  701.                3) MOST IMPORTANT, before the program ends, invoke
  702.           
  703.                   OldInt to restore the normal interrupt.  If you don't
  704.           
  705.                   do this, or if your program crashes before it can do
  706.           
  707.                   it, you cannot communicate through your keyboard, and
  708.           
  709.                   you have to turn the PC off and on again.
  710.           
  711.                   Used with care, NEWINT9 can satisfy a real need.
  712.           
  713.  
  714.  
  715. *** GRAPHICS ***
  716.           
  717.  
  718.      (Let me note that I myself do not have a Color/Graphics adapter,
  719.      so I haven't had much opportunity to write for one.  However, the
  720.           
  721.      mighty BORLAND has a Graphics tool set for their usual price of
  722.           
  723.      $50.)
  724.           
  725.  
  726.      CIRCLE.LIB draws a circle on your screen.  You specify six
  727.           
  728.           parameters: H, K and R are the X and Y coordinates of the
  729.           
  730.           circle's center and its radius.  "Res" is the resolution --
  731.           
  732.           the number of dots used to draw the circle is proportional
  733.           
  734.           to Res, as is the time required to draw it.  "Aspect" is a
  735.           
  736.           real value that describes the circle's "roundness" -- adjust
  737.           
  738.           to a perfect circle, or change it to get an ellipse.
  739.           
  740.           Finally,  "color" can be 1, 2, or 3 if you are in the
  741.           
  742.           Graphics mode that supports four colors.  (See the descrip-
  743.           
  744.           tion of graphics modes in the TURBO 2.0 manual).
  745.           
  746.  
  747.      RECTANGL.LIB naturally draws a rectangle on the screen.  You tell
  748.           
  749.           it the X and Y coordinates of the upper left and lower right
  750.           
  751.           corners, the color (1, 2, or 3 if appropriate), and 1 for a
  752.           filled rectangle, 0 for hollow.
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.                                                 TURBO WHEELS   page 8
  773.  
  774. *** MISCELLANEOUS ROUTINES ***
  775.           
  776.  
  777.      EQUIPMNT.LIB uses Interrupt $11 to check the equipment attached
  778.           
  779.           to your PC.  It reports on number of printers, RS232 ports,
  780.           
  781.           game ports, and diskette drives, the initial video mode, or
  782.           
  783.           the amount of RAM on the motherboard.
  784.           
  785.  
  786.      GETINTGR.LIB is intended to save you the embarrassment of having
  787.           
  788.           your program crash because someone made an invalid entry for
  789.           
  790.           an integer.  At the same time, it makes sure that the entry
  791.           
  792.           is within a ranges you specify.  Non-numeric keystrokes are
  793.           
  794.           ignored, BackSpace works, and the function does not give up
  795.           
  796.           until a valid integer is entered.
  797.           
  798.  
  799.      GETFREE.LIB is another face-saver.  It gets the amount of free
  800.           
  801.           space on the current disk.  That way, your programs can
  802.           
  803.           check for space and give alternatives if there's not enough,
  804.           
  805.           rather than ignominiously crashing.
  806.           
  807.  
  808.      HEXFUNCT.LIB contains the procedure HEX which receives an integer
  809.           
  810.           and returns a 5-character hex string (e.g., $BF00).  The hex
  811.           
  812.           string always refers to a positive number -- TURBO's integer
  813.           
  814.           variable type uses its highest bit to indicate sign, thus
  815.           
  816.           restricting the integer range to -32,768 to +32,767.  Hex
  817.           
  818.           equivalents are calculated by considering negative integers
  819.           
  820.           as offsets down from $10000 (decimal 65,536).  Thus, HEX(-1)
  821.           
  822.           = $FFFF.  (NOTE:  the TURBO manual says that the integer
  823.           
  824.           range is as stated above, but in my experience, it is not
  825.           
  826.           possible to enter -32,768. )
  827.           
  828.  
  829.           
  830.      KAVAIL.LIB returns the number of KiloBytes of memory available.
  831.           
  832.           It takes into account the MemAvail function's quirk of
  833.           
  834.           reporting amounts greater than 32,767 as negative numbers.
  835.           
  836.  
  837.           
  838.      NOSOUND.PAS does nothing but shut off the sound, if one of your
  839.           
  840.           programs crashes with sound on.  When you need it, you NEED
  841.           
  842.           it!
  843.           
  844.  
  845.           
  846.      PARAMETR.LIB contains the function GetParameter, which returns a
  847.           
  848.           string of up to 80 characters consisting of whatever was
  849.           
  850.           entered on the command line after the name of the program.
  851.           
  852.           This O N L Y works in COMPILED programs.
  853.           
  854.  
  855.      QUEUE.LIB is a generic Queue data structure.  One of Pascal's
  856.           
  857.           great advantages over BASIC is its implementation of
  858.           
  859.           Pointer^ variables and dynamic lists.  By keeping your data
  860.           
  861.           in a linked list instead of an array, you can dedicate only
  862.           
  863.           as much memory as you need, up to all the memory the system
  864.           
  865.           has.  If you test for memory available with KAVAIL before
  866.           
  867.           you add each item to the list, you can safely expand to the
  868.           
  869.           maximum memory of different systems without crashing for
  870.           
  871.           lack of memory.
  872.           
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.                                                 TURBO WHEELS   page 9
  886.  
  887.  
  888.      REBOOT.LIB does just what it says.  The "warm" reboot produced by
  889.           
  890.           Interrupt $19 does NOT clear the RAM, so, for example,
  891.           
  892.           SIDEKICK will stay resident.  The programs LESSRAM and
  893.           
  894.           NUMDISKS use REBOOT to cause the PC to act as if its
  895.           
  896.           internal DIP switches had been reset to indicate a different
  897.           
  898.           number of disk drives or different amount of RAM.  One note
  899.           
  900.           of caution -- There seems to be some interference in this
  901.           
  902.           reboot process from certain device drivers in the CONFIG.SYS
  903.           
  904.           file.  The symptom is that the driver (e.g., your hard disk
  905.           
  906.           driver, or a RAMdisk) installs itself and then the A: drive
  907.           
  908.           spins . . . and spins . . . and that's it.  To avoid this
  909.           
  910.           problem, you could always rename CONFIG.SYS to something
  911.           
  912.           else temporarily.  IF you can figure out why this happens
  913.           
  914.           and how to get around it, PLEASE let me know!
  915.           
  916.  
  917.      LESSRAM.COM is handy if you always write your programs on your
  918.           
  919.           souped-up 640K SuperPC and want to test whether it will
  920.           
  921.           actually run on a lesser machine with, say 96K.  You COULD
  922.           
  923.           open the box and change the switches, but it's a lot easier
  924.           
  925.           just to go back to DOS and type LESSRAM 96.
  926.           
  927.  
  928.      NUMDISKS's raison d'etre is the current confusion of method among
  929.          RAMdisks.  Some require that the internal switches be set to
  930.           
  931.           the total number of physical drives and RAMdisks, while
  932.           
  933.           others insist that the switches show physical drives only.
  934.           
  935.           If you need to switch around, you can enter NUMDISKS
  936.           
  937.           <number>.  If you put NUMDISKS in a batch file, be sure to
  938.           
  939.           add an "n" (or "N") to the number so the program won't pause
  940.           
  941.           for a keypress before rebooting.
  942.           
  943.  
  944.      SAFEWRIT.LIB is one way to get around the fact that you cannot
  945.           
  946.           WRITE certain characters to the screen -- they get inter-
  947.           
  948.           preted as Control Characters and warp your display.
  949.           
  950.           Procedure SafeWrite catches these characters and replaces
  951.           
  952.           them with a related character in Low Video.  Note that
  953.           
  954.           another approach would be to use the procedures in
  955.           
  956.           SCREEN.LIB to send characters directly to the screen
  957.           
  958.           memory.  Using this latter method, you can put ANY character
  959.           
  960.           on the screen.
  961.           
  962.  
  963.