home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / altvb10b.zip / ALTVBDOS.DOC < prev    next >
Text File  |  1992-10-07  |  167KB  |  4,248 lines

  1.  
  2.           Assembly-Language Toolbox for VisualBASIC DOS
  3.           ─────────────────────────────────────────────
  4.  
  5.                          By Christy Gemmell
  6.  
  7. The Assembly-Language Toolbox started life, six years ago, as a simple
  8. collection of useful routines for adding zip to my QuickBASIC programs.
  9. They weren't just pretty faces however. In order to qualify, the Toolbox
  10. routines had to work reliably with real-life commercial applications, the
  11. ones on which my living depended. This made for pretty tough testing, but
  12. those which did survive were, in consequence, fast, robust and, above all,
  13. able to do the job. They are, in fact, doing so in Accountants and Stock-
  14. broker's offices, all over my native Great Britain.
  15.  
  16. A colleague uploaded a copy of the Toolbox onto a local BBS (Electronic
  17. Bulletin Board) and suddenly I started getting letters and phone calls
  18. from complete strangers asking for a copy of the latest version. Nearly
  19. everyone who called had suggestions of their own, remarking; "You know, if
  20. only the Toolbox had this, it would be really good...".
  21.  
  22. Wherever practicable, the good ideas (and some were brilliant) were turned
  23. into assembler code and added to the collection. Almost before I realised
  24. what was happening, the Assembly-Language Toolbox was on the Shareware
  25. circuit and being used by programmers in Europe, the USA, Canada,
  26. Australia and Japan. By December 1990 it had gone through four 'official'
  27. releases and a dozen or more unofficial ones.
  28.  
  29. Release Five come in two flavours; one for QuickBASIC 4 and the other for
  30. Microsoft's BASIC 7 Professional Development System. The QB4 version
  31. covers QuickBASIC 4.0, 4.5 and BASIC 6 while the PDS version is compatible
  32. with BASIC 7, 7.1 and Extended QuickBASIC (QBX). In either version the
  33. routines are provided both as stand-alone libraries and as Quick Libraries
  34. for use in the programming environment.
  35.  
  36. September 1992 saw the release of Microsoft's Visual BASIC for DOS, the
  37. long-awaited successor to QuickBASIC. As soon as my own copy arrived I set
  38. to work converting all the Toolbox routines to work with the new compiler.
  39. Since VBDos is upwardly compatible with QuickBASIC this was a fairly easy
  40. task and I was also able to add many new routines which I had been keeping
  41. for the next release of the QuickBASIC edition. The result is in your hands.
  42.  
  43. Using the Toolbox is easy. All the routines are written to look like
  44. standard VisualBASIC SUB programs and FUNCTION procedures. All you have to
  45. do is choose the ones you want to use in your current program and paste
  46. the appropriate DECLARE statements (a full set is provided) into the
  47. source code. If you need to output large quantities of text to the screen
  48. at high speed, for example, just copy the following line from ALTVBDOS.DEF.
  49.  
  50. DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Text$, BYVAL Attribute%)
  51.  
  52. Then, if you are running in the VisualBASIC environment, you should load
  53. the Quick Library with the command:
  54.  
  55.     VBDOS yourprog.bas /L altvbdos.qlb
  56.  
  57. Thereafter you can call FastPrint, exactly as you would any other
  58. VisualBASIC SUB program, for example like this:
  59.  
  60.     FastPrint 25, 34, "Hello World!", 48
  61.  
  62. which will print 'Hello World!' in the middle of the 25th screen row
  63. displaying it in black characters on a cyan background (if you have a
  64. colour monitor). Notice that, since a DECLARE statement has been used, you
  65. don't need to place parentheses around the argument list and that even the
  66. CALL statement is unneccessary. Used in this way, Toolbox routines become
  67. actual extensions to the VisualBASIC language.
  68.  
  69. The same DECLARE statements can still be used when you compile your
  70. programs from the DOS command line. In this case, however, you must link
  71. the compiled program to ALTVBDOS.LIB, the stand-alone library, with
  72. something like this:
  73.  
  74.     LINK yourprog,,,altvbdos.lib;
  75.  
  76. The VisualBASIC Linker will only extract, from ALTVBDOS.LIB, those modules
  77. which are explicitly named by DECLARE statements in the source file. This
  78. ensures that your programs are not burdened with unneccessary code.
  79.  
  80. Toolbox routines do not require the BASIC runtime module to be present.
  81. You can use them to produce completely stand-alone application programs
  82. which can be distributed commercially.
  83.  
  84. As its name implies, the core routines in the Assembly-Language Toolbox
  85. are written in pure Intel 80x86 assembler. Because of this they are small,
  86. efficient and blindingly fast. Moreover, since any internal variables are
  87. stored in a routine's own code segment, your program does not have to
  88. share any of it's precious data space with the library.
  89.  
  90. Christy Gemmell                                               October 1992
  91.  
  92. ──────────────────────────────────────────────────────────────────────────
  93.  
  94. The ShareWare version of the Assembly-Language Toolbox for VisualBASIC is
  95. provided, free of charge, to any VisualBASIC programmer who can find a use
  96. for it. You are encouraged to copy it, upload it to Electronic Bulletin
  97. Boards or pass it on to friends, provided only that you make no charge for
  98. doing so and that all the files on the disk are preserved intact. You may
  99. freely include Toolbox routines in your own programs, both for private use
  100. and for commercial distribution, without payment to the author.
  101.  
  102. The Professional version of the Toolbox, available to Registered Users,
  103. comes complete with all the source code, object modules for building your
  104. own custom libraries and many additional features. Registration also
  105. entitles you to a free upgrade to Release 2.0 of the Toolbox, when it
  106. becomes available, and to subsequent releases at a greatly reduced price.
  107. Full Hotline support is also included, at no extra charge.
  108.  
  109.  
  110. ─────Registration and Support──────────────────────────────────────────────
  111.  
  112. U.K. and Europe:        £25.00 (including postage and packing)
  113.  
  114. Christy Gemmell         Singular Software
  115.                         22 Peake Road, Northfields,
  116.                         Leicester LE4 7DN
  117.                         United Kingdom
  118.                         
  119.                 Tel:    (044)-0533-767960
  120.  
  121. U.S.A. and Canada:      $47.50 (Including shipping)
  122.  
  123. James Kreyling          CPC Consulting Company
  124.                         1217 Crescent Dive
  125.                         Smithfield, Va. 23430
  126.                         U.S.A.
  127.  
  128.                 Tel:    (804)-357-9190 (Voice and FAX)
  129. or from Club-PC BBS:    (804)-357-0357 (8-N-1)
  130.  
  131. Note:   When ordering the Toolbox please specify if for QuickBASIC 4.5,
  132.         BASIC 7 or VisualBASIC DOS and the floppy disk format you require.
  133.  
  134. ─────About the author─────────────────────────────────────────────────────
  135.  
  136. Christy Gemmell, the author of this package, is also major author of the
  137. definitive textbook on VisualBASIC programming, the QuickBASIC BIBLE, which
  138. is published by Microsoft Press, in association with the Waite Group, at
  139. £24.95 ($27.95 US) ISBN 1-55615-262-0. Selected as Computer Book of the
  140. Month by Jerry Pournelle in the March 1991 issue of BYTE, its thousand
  141. pages are packed with information, tips and example programs which you
  142. wont find anywhere else.  Look out for it in your local bookstore.
  143.  
  144. The Assembly-Language Toolbox for is used by thousands of programmers in
  145. Great Britain, Europe, the USA and Canada, Africa, Australasia and Japan, 
  146. to build fast and powerful BASIC programs. It has been shown at COMDEX and
  147. was featured in the November 1990 issue of BYTE magazine.
  148.  
  149. ───────────────────────────────────────────────────────────────────────
  150.  
  151.                 TOOLBOX FUNCTIONS AND PROCEDURES
  152.  
  153. This is a full, alphabetical, listing of the routines in the Assembly
  154. Language Toolbox which can be called directly by VisualBASIC programs:
  155.  
  156.  
  157. ATTRIB
  158.  
  159. This function returns the directory attributes of the specified file.
  160.  
  161. DECLARE FUNCTION Attrib% (FileSpec$)
  162.  
  163. FileSpec$ is the name of the file whose directory entry is to be tested.
  164. You should include the full pathname (including drive letter if necessary)
  165. if the file is not in the current directory.
  166.  
  167. The returned attribute value is bit-encoded as follows:
  168.  
  169.    Bit     Meaning (if set)
  170. ─────────────────────────────────────────────────────
  171.     0      Read-only     (file is Read/Write if zero)
  172.     1      Hidden
  173.     2      System
  174.     3      Volume label
  175.     4      Subdirectory
  176.     5      Archive
  177.     6      Not used
  178.     7      Shareable     (Novell Networks only)
  179. ─────────────────────────────────────────────────────
  180.  
  181. The ToolBox procedures; HIDE, SECURE and SHARE (see below) can be used to
  182. modify the attributes of a file.
  183.  
  184.  
  185. ATTRIBUTE
  186.  
  187. Converts standard MS-DOS foreground and background COLOR values into
  188. their equivalent display attribute number.
  189.  
  190. DECLARE FUNCTION Attribute% (BYVAL Fore%, BYVAL Back%)
  191.  
  192. Legal values:    Fore% = 0 - 31
  193.                  Back% = 0 - 15
  194.  
  195. The Assembly-Language Toolbox provides several routines which allow  your
  196. VisualBASIC programs to write text directly to the display with an
  197. attribute which you supply. For an explanation of display attributes, see
  198. the topic file COLOURS.HLP supplied with the Assembly-Language Toolbox
  199. demonstration program.
  200.  
  201. Note that the VisualBASIC COLOR statement only allows values of 0-7 for
  202. background colours. Toolbox display routines, however, accept the full
  203. range, using values of 8-15 to produce blinking or high-intensity
  204. background colours. See BLINKING (below) for a routine which allows
  205. you to select between these two modes.
  206.  
  207.  
  208. BACKFILL
  209.  
  210. This procedure changes the display attributes of the characters contained
  211. within the screen rectangle you specify, without overwriting the text
  212. itself.
  213.  
  214. DECLARE SUB BackFill (BYVAL R%, BYVAL C%, BYVAL H%, BYVAL W%, BYVAL A%)
  215.  
  216. R% = Top-left row of the rectangle to be coloured.
  217. C% = Top-left column of the rectangle.
  218. H% = Height of the rectangle in rows.
  219. W% = Width of the rectangle in columns.
  220. A% = Display attribute to use for colouring.
  221.  
  222.  
  223. BITSHL
  224.  
  225. Shifts all the bits of a long-integer number the specified number
  226. of places to the left.  This effectively multiplies the number by
  227. 2 ^ the number of places.
  228.  
  229. DECLARE SUB BitShl (Number&, Count%)
  230.  
  231. Number& =   The 32-bit number to be shifted 
  232.             (-2147483648 to 2147483647)
  233. Count%  =   The number of places to be shifted (1-31)
  234.  
  235.  
  236. BITSHR
  237.  
  238. Shifts all the bits of a long-integer number the specified number
  239. of places to the right.  This effectively divides the number by
  240. 2 ^ the number of places.
  241.  
  242. DECLARE SUB BitShr (Number&, Count%)
  243.  
  244. Number& =   The 32-bit number to be shifted 
  245.             (-2147483648 to 2147483647)
  246. Count%  =   The number of places to be shifted (1-31)
  247.  
  248.  
  249. BITRESET
  250.  
  251. Clears the specified bit (0-15) of the integer number supplied.
  252.  
  253. DECLARE SUB BitReSet (Number%, Bit%)
  254.  
  255.  
  256. BITSET
  257.  
  258. Sets the specified bit (0-15) in the integer number supplied to 1.
  259.  
  260. DECLARE SUB BitSet (Number%, Bit%)
  261.  
  262.  
  263. BITTEST
  264.  
  265. Returns logical TRUE (-1) if the bit (0-15) of Number% is set and FALSE
  266. (zero) if the bit is clear.
  267.  
  268. DECLARE FUNCTION BitTest% (Number%, Bit%)
  269.  
  270.  
  271. BLINKING
  272.  
  273. Toggles between blinking and high-intensity background colours
  274.  
  275. DECLARE SUB Blinking (BYVAL Switch%)
  276.  
  277. Switch% = 0         Turn background blink off/enable high intensity
  278.                     background colours.
  279.  
  280.         = non-zero  Enable background blinking/disable high intensity
  281.                     background colours
  282.  
  283. The VisualBASIC COLOR statement only recognises values of 0-7 for its'
  284. second parameter. Unlike the foreground, you cannot select blinking or
  285. high-intensity colours for the display backgound. The screen attribute
  286. parameter used with Toolbox routines such as FASTPRINT, however, do
  287. permit a background colour component in the range 0-15.
  288.  
  289. Normally, values between 8-15 will produce blinking backgrounds, but
  290. BLINKING allows you to turn the the blink off, forcing the background
  291. colour into high intensity mode. With blinking disabled you can use
  292. the full range of colours which are available to the foreground.
  293.  
  294. See ATTRIBUTE (above) for a function that calculates display attributes
  295. from the foreground and background colours you supply
  296.  
  297. Note:   This routine only works on systems with EGA, VGA and MCGA
  298.         display adaptors. Users of CGA adaptors, however, can get
  299.         the same effect by using the statement:  OUT &H3D8, 9
  300.  
  301. If you turn blinking off, remember to re-enable it before your program
  302. ends. Otherwise high-intensity backgrounds will remain in effect until
  303. another program resets the video card or you switch your computer off.
  304.         
  305.  
  306. CAPSLOCK
  307.  
  308. Toggles CAPS LOCK on or off or, alternatively, reads the current CAPS LOCK
  309. key setting.
  310.  
  311. DECLARE FUNCTION CapsLock% (BYVAL Switch%)
  312.  
  313. Switch% = 0  Turns CAPS LOCK off
  314.         = 1  Turns CAPS LOCK on
  315.  
  316. Any other value just returns the current CAPS status as a logical value
  317. where -1 (TRUE) means that CAPS LOCK is on and 0 (FALSE) means that CAPS
  318. LOCK is off.
  319.  
  320.  
  321. CGACOPY
  322.  
  323. Copies a CGA screen to or from a user-supplied string.
  324.  
  325. DECLARE SUB CgaCopy (BYVAL Switch%, Buffer$)
  326.  
  327. SWITCH%     Direction of copy   0 = copy screen to string
  328.                                 1 = copy string to screen
  329.  
  330. BUFFER$     String variable to hold the screen image, must be at least
  331.             16384 characters long or the call will fail. 
  332.  
  333. Note:       If you are using VisualBASIC 4 or 4.5, do not pass a fixed-
  334.             length string to this routine. Only variable-length strings
  335.             will work safely.
  336.  
  337. The VisualBASIC PCOPY statement is very useful for storing screen pages in
  338. memory, so that they can be kept out of sight until needed. Unfortunately
  339. it only works in text modes or, on computers with EGA or VGA video cards,
  340. in SCREEN modes 7 to 12. This routine, on the other hand, works only in
  341. the CGA display modes (SCREENs 1 and 2), it provides a useful alternative
  342. to the PCOPY statement for use with medium-resolution screens.
  343.  
  344. See also MCGACOPY for a version that can be used with SCREEN 13 displays.
  345.  
  346.  
  347. CGASCROLL
  348.  
  349. Scrolls a rectangular portion of a SCREEN 1 (320 x 200 4-colour) display
  350. four pixels to the left or to the right, wrapping the pixels which are 
  351. scrolled out at the end round to the beginning again.
  352.  
  353. DECLARE SUB CgaScroll (BYVAL xLoc%, BYVAL yLoc%, BYVAL xPixels%,_
  354.                        BYVAL yPixels%, BYVAL Direction%)                 
  355.  
  356. XLOC%       The horizontal (X) co-ordinate of the top-left corner of
  357.             the rectangle to be scrolled.
  358.  
  359. YLOC%       The vertical (Y) co-ordinate of the top-left corner of
  360.             the rectangle to be scrolled.
  361.  
  362. XPIXELS%    The width (in pixels) of the rectangle to be scrolled.
  363.  
  364. YPIXELS%    The height (in pixels) of the rectangle to be scrolled.
  365.  
  366. DIRECTION%  The direction in which the rectangle contents are to be
  367.             scrolled (0 = Left, 1 = Right).
  368.  
  369. Co-ordinates are in the ranges:  X >= 0 <= 319, Y >= 0 <= 199
  370.  
  371. X co-ordinates are aligned to the nearest byte (1 byte = 4 pixels).
  372.  
  373.  
  374. CGATEXT
  375.  
  376. Writes characters to the screen in the 320 x 200 4-colour graphics mode.
  377.  
  378. DECLARE SUB CgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  379.                      BYVAL Attr%, BYVAL Scale%)
  380.  
  381. This routine provides a convenient way of displaying text in SCREEN 1
  382. without having to bother about loading external font files. It uses the
  383. standard ROM-BIOS character definition tables built into your display
  384. adaptor, but allows you to scale them up to eight times normal size and to
  385. specify any combination of foreground and background colours.
  386.  
  387. XLOC%       The horizontal co-ordinate of the top left hand pixel
  388.             from which the text will begin (0 - 319)
  389.  
  390. YLOC%       The vertical co-ordinate of the top left hand pixel
  391.             from which the text will begin (0 - 199)
  392.  
  393. TEXT$       The string of text to be displayed (up to 63 characters).
  394.  
  395. ATTR%       The colour (or display attribute in monochrome modes) to
  396.             be given to the text. This is calculated by the formula:
  397.  
  398.             Colour% = (Background% * 256) + Foreground%
  399.  
  400.             Foreground and Background values are in the range 0 - 3
  401.  
  402. SCALE%      The character size of the text to be displayed. This ranges
  403.             from 1 to 8, where 1 is standard 40-column text and where 8
  404.             multiplies the character size by eight on both the horizontal
  405.             and vertical axes.
  406.  
  407. CGATEXT can handle both byte-aligned and non byte-aligned characters. The
  408. x, y co-ordinates you supply do not need to correspond to a row, column
  409. character cell in SCREEN 0, the alphanumeric mode. The complete ASCII set
  410. is supported, but to display foreign symbols and box-drawing characters on
  411. a CGA adaptor you must have the DOS GRAFTABL utility loaded.
  412.  
  413. Since CGATEXT does not support clipping, to ensure a clean display you
  414. must ensure that the text to be output fits within the current screen
  415. boundaries.
  416.  
  417. See also VGATEXT for displaying characters in SCREENs 7-12 and MCGATEXT
  418. for displaying characters in SCREEN 13.
  419.  
  420.  
  421. CIPHER
  422.  
  423. This routine requires that you supply two strings of characters. The first
  424. is the text to be encrypted, and the second is one or more keywords which
  425. are used to encipher the text. Thereafter, the text cannot be decrypted
  426. until you supply the same key string again.
  427.  
  428. DECLARE SUB Cipher (Text$, KeyWord$)
  429.  
  430. The encryption algorithm XORs (eXclusive ORs) the key string with string
  431. to be encrypted. This allows you to reverse the procedure and decrypt the
  432. text, simply by calling the routine a second time.
  433.  
  434. See the source code for DEMON.BAS, the ToolBox demonstration program, for
  435. an example using CIPHER.
  436.  
  437.  
  438. CLEAREND
  439.  
  440. Blank spaces of the display attribute specified are printed, starting at
  441. the current cursor position and continuing to the end of the line or,
  442. optionally, to the end of the screen.
  443.  
  444. DECLARE SUB ClearEnd (BYVAL Switch%, BYVAL Attr%)
  445.  
  446. Switch%   0 = clear to the end of the line.
  447.           1 = clear to the end of the screen.
  448.  
  449. Attr%     display attribute (1 - 255). If zero is specified then the
  450.           attribute of the character under the cursor is used.
  451.  
  452. Example:  ClearEnd 1, 0
  453.  
  454. Clears from the current cursor position to the bottom of the screen. The
  455. area cleared takes the background colour of the character under the
  456. cursor. The cursor, itself, is not updated.
  457.  
  458.  
  459. CPU
  460.  
  461. This function checks to see what type of microprocessor is installed in
  462. the computer in which the current program is running.
  463.  
  464. No calling parameters are required.
  465.  
  466. DECLARE FUNCTION Cpu% ()
  467.  
  468. The following processors can be identified by their return values :
  469.  
  470.  86 = Intel 8086          88 = Intel 8088         188 = Intel 80188        
  471. 186 = Intel 80186        286 = Intel 80286        386 = Intel 80386
  472. -86 = Intel 80C86        -88 = Intel 80C88         20 = NEC   V20
  473.  30 = NEC   V30
  474.  
  475. 486 = Intel 80486  included but not yet tested (lend us yours?).
  476.  
  477. This function is provided mainly for interest, although it can be used as
  478. an indication of how long a particular task will take to run. All of the
  479. Toolbox routines, in fact, are processor-independent and can be used on
  480. all types of IBM-PC, AT, PS/2 and compatible machines
  481.  
  482.  
  483. CURTAINS
  484.  
  485. This routine clears the display screen to the background colour specified
  486. by Attribute%. It differs from CLS in that the blanked-out area expands
  487. from a series of columns, giving the effect of a set of louvered blinds or
  488. curtains being closed. The Speed% parameter controls how quickly the
  489. routine runs, larger values making the curtains close more slowly.
  490.  
  491. DECLARE SUB Curtains (BYVAL Speed%, BYVAL Attribute%)
  492.  
  493. Try this example for a fancy effect:
  494.  
  495. FOR I% = 255 TO 0 STEP -16: Curtains 40, I%: NEXT
  496.  
  497. This procedure calls the DELAY routine (see below). This ensures that the
  498. speed value you specify will produce the same result on computers with any
  499. type of processor or clock speed.
  500.  
  501.  
  502. DAYNUMBER
  503.  
  504. Convert a date in the form DD/MM/YYYY to a long integer. The values
  505. returned are valid with dates in the range 1/3/1900 - 31/12/2099.
  506.  
  507. DECLARE FUNCTION DayNumber& (BYVAL Day%, BYVAL Month%, BYVAL Year%)
  508.  
  509. See the INTERVAL function (below) for a method of calculating the number
  510. of days between two Julian dates.
  511.  
  512.  
  513. DELAY
  514.  
  515. This procedure is like the VisualBASIC SLEEP statement, except that it
  516. allows you to specify an interval in milliseconds instead of just whole
  517. seconds. The delay will be exactly the same on a 4.77 MHz original PC as
  518. it would be on the latest 33-MHz 80486 machine.
  519.  
  520. DECLARE SUB Delay (BYVAL MilliSeconds%)
  521.  
  522. See the PAUSE routine (below) for a similar procedure which allows you to
  523. specify a delay in PC clock ticks.
  524.  
  525.  
  526. DISABLEPRTSC
  527.  
  528. This routine simply sets the Print Screen Busy flag at low-memory address
  529. 0040:0100 (Hex) so that any requests for the screen to be printed are
  530. ignored. Use this to prevent a careless operator from hanging-up the
  531. program by pressing <Prt Scrn> when the printer is off-line.
  532.  
  533. No calling parameters are required.
  534.  
  535. DECLARE SUB DisablePrtSc ()
  536.  
  537. Don't forget to use ENABLEPRTSC (see below) to re-enable this key
  538. otherwise it will remain disabled even after your program ends.
  539.  
  540.  
  541. DISKREADY
  542.  
  543. Tests if there is readable media in the floppy diskette drive specified. 
  544.  
  545. DRIVE% is the number of the diskette drive to be tested and is either
  546. zero (drive A:) or 1 (drive B:).
  547.  
  548. DECLARE FUNCTION DiskReady% (BYVAL Drive%)
  549.  
  550. This function returns a non-zero value if a readable diskette is in the
  551. drive, and zero (logical FALSE) if unable to read from the drive.
  552.  
  553. If the floppy disk in the drive specified is ready then the number that
  554. is returned is the Media Descriptor Byte, a value which indicates the
  555. type of diskette mounted, where:
  556.  
  557.       240   F0h  =  3.5"  2-sided, 18 sector
  558.       249   F9h  =  3.5"  2-sided, 9 sector or
  559.                     5.25" 2-sided, 15 sector
  560.       252   FCh  =  5.25" 1-sided, 9 sector
  561.       253   FDh  =  5.25" 2-sided, 9 sector
  562.       254   FEh  =  5.25" 1-sided, 8 sector
  563.       255   FFh  =  5.25" 2-sided, 8 sector             
  564.  
  565. DISKREADY only tests if the drive can be read from. It will not detect
  566. if the diskette in the drive is write-protected.
  567.  
  568.  
  569. DISPLAYMODE
  570.  
  571. Reads the current video display mode using the IBM ROM-BIOS numbering
  572. system.
  573.  
  574. DECLARE FUNCTION DisplayMode% ()
  575.  
  576. No calling parameters are required. Depending on the type of display
  577. adaptor installed, the function may return one of the following values:
  578.  
  579. Mode    Resolution      Mode     Colours    Remarks
  580. ─────────────────────────────────────────────────────────────────────
  581.   0     40 x 25         text        16      No colour burst
  582.   1     40 x 25         text        16      
  583.   2     80 x 25         text        16      No colour burst
  584.   3     80 x 25         text        16
  585.   4     320 x 200       graphics     4
  586.   5     320 x 200       graphics     4      No colour burst
  587.   6     640 x 200       graphics     2
  588.   7     80 x 25         text         2      Monochrome display only  
  589.   8     160 x 200       graphics    16      PCjr & Tandy 1000 only  
  590.   9     320 x 200       graphics    16      PCjr & Tandy 1000 only
  591.  10     640 x 200       graphics     4      PCjr & Tandy 1000 only
  592.  13     320 x 200       graphics    16      EGA & VGA
  593.  14     640 x 200       graphics    16      EGA & VGA
  594.  15     640 x 350       graphics     2      Monochrome EGA & VGA
  595.  16     640 x 350       graphics    16      EGA & VGA
  596.  17     640 x 480       graphics     2      VGA only
  597.  18     640 x 480       graphics    16      VGA only
  598.  19     320 x 200       graphics   256      VGA & MCGA      
  599. ─────────────────────────────────────────────────────────────────────
  600.  
  601. The SCREENMODE function (see below) can be used to return the equivalent
  602. VisualBASIC SCREEN number.
  603.  
  604.  
  605. DISPLAYPAGE
  606.  
  607. All video cards except the Monochrome Display Adaptor (MDA) are capable of
  608. switching between two or more pages of display memory. This function
  609. returns the number of the active video page, use the VisualBASIC SCREEN
  610. statement to select the page you require.
  611.  
  612. No calling parameters are required.
  613.  
  614. DECLARE FUNCTION DisplayPage% ()
  615.  
  616. The page number returned can be a value between 0 and 7, depending upon
  617. the current video mode and the amount of display memory installed.
  618.  
  619. Note:       all Toolbox routines which write directly to the screen will
  620.             automatically detect and send their output to the currently
  621.             active display page.
  622.  
  623.  
  624. DWPRINT
  625.  
  626. Sends the text supplied, to the printer, as a string of double-width
  627. characters. Output begins at the current print position and can,
  628. optionally, append a carriage-return/linefeed to take the print head to
  629. the beginning of a new line when finished.
  630.  
  631. DECLARE SUB DwPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  632.  
  633. Arguments:  Printer%    the parallel port output is to be sent to
  634.                         (1 = LPT1:, 2 = LPT2:, etc.).
  635.             Buffer$     the string of text to be printed.
  636.             NewLine%    set this to a non-zero value if you want 
  637.                         to move to a new line after printing.
  638.  
  639. The routine restores the previous print style or font before it returns
  640. and does not effect subsequent output to the printer, using the VisualBASIC
  641. LPRINT or PRINT # statements.
  642.  
  643. Note:       The version of this routine stored in the Toolbox
  644.             library is for EPSON compatible printers. If you have
  645.             an IBM graphics printer or ProPrinter, then you should
  646.             rebuild your libraries, using either the PRINTIBM.OBJ
  647.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  648.  
  649.  
  650. EMPRINT
  651.  
  652. Sends the text supplied, to the printer, as a string of emphasised
  653. characters. Output begins at the current print position and can,
  654. optionally, append a carriage-return/linefeed to take the print head to
  655. the beginning of a new line when finished.
  656.  
  657. DECLARE SUB EmPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  658.  
  659. Arguments:  Printer%    the parallel port output is to be sent to
  660.                         (1 = LPT1:, 2 = LPT2:, etc.).
  661.             Buffer$     the string of text to be printed.
  662.             NewLine%    set this to a non-zero value if you want 
  663.                         to move to a new line after printing.
  664.  
  665. The routine restores the previous print style or font before it returns
  666. and does not effect subsequent output to the printer, using the VisualBASIC
  667. LPRINT or PRINT # statements.
  668.  
  669. Note:       The version of this routine stored in the Toolbox
  670.             library is for EPSON compatible printers. If you have
  671.             an IBM graphics printer or ProPrinter, then you should
  672.             rebuild your libraries, using either the PRINTIBM.OBJ
  673.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  674.  
  675.  
  676. EMSERROR
  677.  
  678. Returns the code number of the last error which occurred during a
  679. call to the Expanded Memory Manager. If zero is returned, then no
  680. errors have occurred.
  681.  
  682. No calling parameters are required.
  683.  
  684. DECLARE FUNCTION EmsError% ()
  685.  
  686. Here is a list of possible error codes and their meanings:
  687.  
  688. 128  Internal error in EMM software     146  Source and target overlap
  689. 129  Malfunction in EMS hardware        147  Illegal region length
  690. 130  Memory manager busy                148  Region overlap
  691. 131  Invalid handle                     149  Offset outside logical page
  692. 132  Function not defined               150  Region length > 1MB
  693. 133  No more handles available          151  Cannot exchange overlap
  694. 134  Error in mapping context           152  Memory types undefined
  695. 135  Not enough pages exist             153  Not used
  696. 136  Not enough pages available         154  ARS not supported
  697. 137  Cannot allocate zero pages         155  ARS currently allocated
  698. 138  Page not allocated to handle       156  ARS not zero
  699. 139  Illegal physical page number       157  ARS not allocated
  700. 140  Save state area full               158  DMA channels not supported
  701. 141  Save of mapping context failed     159  Illegal DMA channel
  702. 142  Restore of mapping context failed  160  No handle for this name
  703. 143  Subfunction parameter not defined  161  Name already exists
  704. 144  Attribute type not defined         162  Memory address wrap
  705. 145  Feature not supported              163  Invalid pointer
  706.  
  707. 250  EMM not installed*                 251  LIM 4.0 required*
  708.  
  709. *    Toolbox error codes.
  710.  
  711. The descriptions are, of necessity, abbreviated. For more information 
  712. consult your EMS hardware manual or see:
  713.  
  714. Advanced MS-DOS Programming     by David Duncan     Microsoft Press
  715.  
  716.  
  717. EMSFRAME
  718.  
  719. Returns the segment address of the EMS page frame.
  720.  
  721. No calling parameters are required.
  722.  
  723. DECLARE FUNCTION EmsFrame% ()
  724.  
  725. The Page Frame is the area of conventional memory into which logical
  726. expanded memory pages are mapped. Under LIM 3.2 it is a contiguous
  727. block of 64RAM, divided into four 16K physical pages, located some-
  728. where between segments A000 and F000 Hex, but LIM 4.0 allows you to
  729. reserve additional 16K pages, wherever available memory exists. In
  730. either system you can rely on 4 consecutive 16K pages and this
  731. function returns a pointer to the first of them.
  732.  
  733.  
  734. EMSGET
  735.  
  736. Copies up to 64KB of data from expanded memory, starting at the
  737. logical page supplied, to an address in conventional memory.
  738.  
  739. DECLARE SUB EmsGet (BYVAL Segment%, BYVAL Offset%, BYVAL Length%,_
  740.                     BYVAL Page%, BYVAL Handle%, Done%)
  741.  
  742. Arguments:  Segment%  = segment address of target block to which
  743.                         data should be copied.
  744.             Offset%   = offset address, within target segment, to
  745.                         which data should be copied.
  746.             Length%   = length, in bytes (up to 64KB), of data to
  747.                         be copied. 
  748.             Page%     = logical EMS page holding the beginning of
  749.                         the data. If the block of data is bigger
  750.                         than 16KB, then copying will continue from
  751.                         subsequent pages until all the data has 
  752.                         been moved.
  753.             Handle%   = the EMS handle to which the page(s) have
  754.                         been allocated. This should be obtained by
  755.                         a previous call to the EMSRESERVE procedure
  756.                         (see below).
  757.             Done%     = a flag to hold the result of the operation.
  758.                         If the data was copied successfully, it is
  759.                         set to -1 (logical TRUE) on return. If zero
  760.                         (logical FALSE) is returned, the data was
  761.                         not copied successfully. In this case, you
  762.                         should make a call to the EMSERROR function
  763.                         to find out why.
  764.  
  765. If the target structure, to which the data is to be copied, is an
  766. array, you should specify its address by supplying the VARSEG and
  767. VARPTR of the first element. Be sure, however, that you do not copy
  768. a block of data bigger than the array size, otherwise you may 
  769. overwrite other variables, probably with disastrous results. 
  770.  
  771. See the EMSPUT procedure (below) for a means of copying data into
  772. logical expanded memory pages.
  773.  
  774.  
  775. EMSMAP
  776.  
  777. Map a logical expanded memory page to a physical page in the EMS
  778. Page Frame, making it accessible to your program.
  779.  
  780. DECLARE SUB EmsMap (BYVAL Handle%, Physical%, Logical%)
  781.  
  782. Arguments:  Handle%   = the EMS handle to which the logical page has
  783.                         been allocated. This will have been obtained
  784.                         by a previous call to the EMSRESERVE routine
  785.                         (see below).
  786.             Physical% = the number of the physical page to map
  787.                         (in the range 1 to 4).
  788.             Logical%  = the number of the logical page to be mapped
  789.                         (in the range from 1 to the number of pages
  790.                         allocated to Handle%).
  791.  
  792. For most applications, the EMSGET and EMSPUT procedures will be more
  793. useful, since they perform all the necessary mapping for you while
  794. moving data to and from expanded memory. If, however, you need to
  795. manipulate small quantities of data in expanded memory, use this
  796. routine to switch the relevant page into conventional memory, and
  797. the FARPEEK and FARPOKE utilities (see below) to examine or change
  798. the data itself.
  799.  
  800.  
  801. EMSOWNED
  802.  
  803. Returns the number of logical pages of EMS memory that have been
  804. allocated to the handle specified.
  805.  
  806. DECLARE FUNCTION EmsOwned% (BYVAL Handle%)
  807.  
  808.  
  809. EMSPAGES
  810.  
  811. Returns either the total number of EMS pages in the system, or the
  812. total number of free (unallocated) pages.
  813.  
  814. DECLARE FUNCTION EmsPages% (BYVAL Switch%)
  815.  
  816. Argument:   Switch% = 1  return number of unallocated pages.
  817.                       0  return total number of pages in system.
  818.  
  819.  
  820. EMSPRESENT
  821.  
  822. Tests whether the Expanded Memory System driver has been installed
  823.  
  824. No calling parameters are required.
  825.  
  826. DECLARE FUNCTION EmsPresent% ()
  827.  
  828. Returns:    -1  (logical TRUE) if EMS driver is installed.
  829.              0  (logical FALSE) if EMS driver is not installed.
  830.  
  831. Note:       This function just checks that the EMS driver is in
  832.             memory and that the EMS interrupt vector is directed
  833.             to it, it does not test if the driver is active. Use
  834.             the EMSVERSION function (see below) to test this. If
  835.             the driver responds to that function, it can be safely
  836.             assumed to be active.
  837.  
  838.  
  839. EMSPUT
  840.  
  841. Copies up to 64KB of data to expanded memory, starting at the
  842. logical page supplied, from an address in conventional memory.
  843.  
  844. DECLARE SUB EmsPut (BYVAL Segment%, BYVAL Offset%, BYVAL Length%,_
  845.                     BYVAL Page%, BYVAL Handle%, Done%)
  846.  
  847. Arguments:  Segment%  = segment address of source block from which
  848.                         data is to be copied.
  849.             Offset%   = offset address, within target segment, from
  850.                         which data is to be be copied.
  851.             Length%   = length, in bytes (up to 64KB), of data to
  852.                         be copied to expanded memory. 
  853.             Page%     = logical EMS page to hold the beginning of
  854.                         the data. If the block of data is bigger
  855.                         than 16KB, then copying will continue onto
  856.                         subsequent pages until all the data has 
  857.                         been moved.
  858.             Handle%   = the EMS handle to which the page(s) have
  859.                         been allocated. This should be obtained by
  860.                         a previous call to the EMSRESERVE procedure
  861.                         (see below).
  862.             Done%     = a flag to hold the result of the operation.
  863.                         If the data is copied successfully, it will
  864.                         be set to -1 (logical TRUE) on return. If
  865.                         zero (logical FALSE) is returned, the data
  866.                         was not copied successfully. In this case,
  867.                         you should make a call to the EMSERROR
  868.                         function to find out why.
  869.  
  870. If the source structure, from which the data is to be copied, is an
  871. array, you should specify its address by supplying the VARSEG and
  872. VARPTR of the first element. You can also copy data from absolute
  873. addresses in memory to EMS, to copy the contents of the text screen,
  874. for example, to EMS logical page 2, use the command:
  875.  
  876.     EmsPut &HB800, 0, 4000, 3, Handle%, Done%
  877.  
  878. This assumes that your computer has a colour monitor. If you have a
  879. monochrome display, substitute &HB000 for the segment address.
  880.  
  881. See the EMSGET procedure (above) for a means of retrieving data from
  882. extended memory.
  883.  
  884.  
  885. EMSRELEASE
  886.  
  887. Free-up all the pages previously allocated to this handle, and make
  888. them available to other processes.
  889.  
  890. DECLARE SUB EmsRelease (BYVAL Handle%)
  891.  
  892. You should release all the EMS pages which have been allocated to
  893. handles owned by your program, before the program terminates. If
  894. this is not done, these pages will not be available to subsequent
  895. programs which may start up and will remain locked until the system
  896. is rebooted.
  897.  
  898.  
  899. EMSREQUEST
  900.  
  901. Asks for one or more logical pages of expanded memory to be made
  902. available to your program.
  903.  
  904. DECLARE SUB EmsRequest (BYVAL Pages%, Handle%)
  905.  
  906. Arguments:  Pages%  = number of EMS pages to reserve.
  907.  
  908.             Handle% = if successful, this variable will hold the
  909.                       number of the EMS handle which controls the
  910.                       allocated pages. If unsuccessful, Handle%
  911.                       will be set to zero on return, in which case
  912.                       you should call the EMSERROR function (above)
  913.                       to see what went wrong.
  914.  
  915. You must use this handle in all subsequent calls to the Expanded
  916. Memory Manager which refer to these particular pages.
  917.  
  918. Before calling this procedure, it is a good idea to make a call to
  919. the EMSPAGES function (see above) to see how many pages are free.
  920.  
  921.  
  922. EMSRESIZE
  923.  
  924. Changes the number of pages allocated to an EMS handle.
  925.  
  926. DECLARE SUB EmsReSize (BYVAL Handle%, Pages%)
  927.  
  928. Arguments:  Handle% = a valid EMS handle to which logical expanded
  929.                       memory pages have already been allocated.
  930.  
  931.             Pages%  = the new number of pages to be allocated to
  932.                       this handle.
  933.  
  934. On return, Pages% will hold the actual number of pages that are
  935. now allocated to the handle. If this is different from the number
  936. of pages requested, then an error has occurred and you should call
  937. the EMSERROR function (see above) to check what happened.
  938.  
  939. You can request a number of pages less than or greater than the
  940. number previously allocated to the handle.
  941.  
  942. Note:       This facility is only available with LIM 4.0 EMS and
  943.             above.
  944.  
  945.  
  946. EMSVERSION
  947.  
  948. Returns the LIM version number of the Expanded Memory Manager.
  949.  
  950. No calling parameters are required.
  951.  
  952. DECLARE FUNCTION EmsVersion% ()
  953.  
  954. The number returned is a decimal integer where 32 represents LIM 3.2
  955. and 40 represents LIM 4.0. If zero is returned, then an error has
  956. occurred and you should call the EMSERROR function (see above) to
  957. find out what happened. Use the EMSPRESENT function (also above) to
  958. test that the EMM driver has, in fact, been installed.
  959.  
  960.  
  961. ENABLEPRTSC
  962.  
  963. This routine clears the Busy flag at low-memory address 0040:0100 (Hex) so
  964. that print-screen requests can be executed. Use it to cancel the effect of
  965. the DISABLEPRTSC procedure (above).
  966.  
  967. No calling parameters are required.
  968.  
  969. DECLARE SUB EnablePrtSc ()
  970.  
  971.  
  972. ENPRINT
  973.  
  974. Sends the text supplied, to the printer, as a string of enhanced
  975. characters. Output begins at the current print position and can,
  976. optionally, append a carriage-return/linefeed to take the print head to
  977. the beginning of a new line when finished.
  978.  
  979. DECLARE SUB EnPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  980.  
  981. Arguments:  Printer%    the parallel port output is to be sent to
  982.                         (1 = LPT1:, 2 = LPT2:, etc.).
  983.             Buffer$     the string of text to be printed.
  984.             NewLine%    set this to a non-zero value if you want 
  985.                         to move to a new line after printing.
  986.  
  987. The routine restores the previous print style or font before it returns
  988. and does not effect subsequent output to the printer, using the VisualBASIC
  989. LPRINT or PRINT # statements.
  990.  
  991. Note:       The version of this routine stored in the Toolbox
  992.             library is for EPSON compatible printers. If you have
  993.             an IBM graphics printer or ProPrinter, then you should
  994.             rebuild your libraries, using either the PRINTIBM.OBJ
  995.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  996.  
  997.  
  998. EXPLODE
  999.  
  1000. Clear a screen rectangle explosively. This as an alternative to the
  1001. SCROLL routine listed below.
  1002.  
  1003. DECLARE SUB Explode (BYVAL Y1%, BYVAL X1%, BYVAL Y2%, BYVAL X2%,_
  1004.                      BYVAL Attr%, BYVAL Speed%)
  1005.  
  1006. Arguments:  Y1%         =  Upper-left row of rectangle to be cleared
  1007.             X1%         =  Upper-left column of rectangle
  1008.             Y2%         =  Lower-right row of rectangle
  1009.             X2%         =  Lower-right column of rectangle
  1010.             Attr%       =  Display attribute or colour that rectangle
  1011.                            should be cleared to 
  1012.             Speed%      =  Speed (in milliseconds) of explosion.
  1013.  
  1014. The panel is cleared, starting at the centre point, and progressively
  1015. moving outwards until the defined borders are reached. This gives the
  1016. impression of the clear area exploding onto the screen.
  1017.  
  1018. This routine is called, internally, by the POPUP window function (see
  1019. below) whenever Zoom is specified.
  1020.  
  1021.  
  1022. FARPEEK
  1023.  
  1024. Reads a byte of data from anywhere in conventional memory.
  1025.  
  1026. DECLARE FUNCTION FarPeek% (BYVAL Segment&, BYVAL Offset&)
  1027.  
  1028. Arguments:  Segment&  = address of memory segment containing the byte
  1029.                         to be read.
  1030.             Offset&   = offset address, within the segment of the 
  1031.                         byte to be read.
  1032.  
  1033. Returns:    The contents of the byte specified as an integer value
  1034.             in the range 0 to 255.
  1035.  
  1036. Note:       parameters are passed as LONG integers to save you the
  1037.             hassle of having to convert argument values over 32767
  1038.             to negative signed integers. Do not use values greater
  1039.             than 65535, however, or the most significant word will
  1040.             be ignored and the address converted to Modulus 65536.
  1041.  
  1042. Using VisualBASIC's PEEK function to examine data which lies outside
  1043. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  1044. required and then to reset it afterwards. This function allows you to
  1045. read bytes, directly, from anywhere in the 1 megabyte of addressable
  1046. RAM space your computer contains.
  1047.  
  1048. The FARPOKE procedure (below) complements FARPEEK by allowing you to
  1049. write a byte of data anywhere in the 1MB addressable PC workspace.
  1050.  
  1051. See also PEEKWORD and POKEWORD which allow you to read from and write
  1052. to memory, two bytes at a time.
  1053.  
  1054. Note:       If you have an Intel 286, 386 or 486-based computer with
  1055.             the Microsoft HIMEM.SYS driver loaded, you can even use
  1056.             FARPEEK to read from the first 64KB of Extended Memory.
  1057.             Setting the segment to &HFFFF and an offset in the range
  1058.             &H10 to &HFFFF allows you access up to 65520 bytes of
  1059.             memory ABOVE the normal 1MB limit.
  1060.  
  1061.  
  1062. FARPOKE
  1063.  
  1064. Writes a byte of data to anywhere in conventional memory.
  1065.  
  1066. DECLARE SUB FarPoke (BYVAL Segment&, BYVAL Offset&, BYVAL Byte%)
  1067.  
  1068. Arguments:  Segment&  = address of memory segment containing the byte
  1069.                         to be written to
  1070.             Offset&   = offset address, within the segment of the 
  1071.                         byte to be written.
  1072.             Byte%     = the value (0 to 255) to be written to the
  1073.                         specified byte.
  1074.  
  1075. Note:       addresses are passed as LONG integers to save you the
  1076.             hassle of having to convert argument values over 32767
  1077.             to negative signed integers. Do not use values greater
  1078.             than 65535, however, or the most significant word will
  1079.             be ignored and the address converted to Modulus 65536.
  1080.  
  1081. Using VisualBASIC's POKE function to write to memory which is outside
  1082. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  1083. you want and then to set it back again afterwards. This function lets
  1084. you write bytes, directly, anywhere in the 1 megabyte of addressable
  1085. RAM space your computer contains.
  1086.  
  1087. The FARPEEK procedure (above) complements FARPOKE by allowing you to
  1088. read a byte of data from anywhere in the 1MB of addressable memory.
  1089.  
  1090. See also PEEKWORD and POKEWORD which allow you to read from and write
  1091. to memory, two bytes at a time.
  1092.  
  1093.  
  1094. FASTPRINT
  1095.  
  1096. This procedure can be used to display a string of text directly to video
  1097. memory. It is much  faster than the normal DOS services and does not
  1098. update the cursor.
  1099.  
  1100. DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Message$, BYVAL Attr%)
  1101.  
  1102. Row%        is the row where printing is to start.
  1103. Col%        is the column where printing is to start.
  1104. Message$    is the string of text to be printed.
  1105. Attr%       is the video attribute given to the text.
  1106.  
  1107. Row% and Col% follow the VisualBASIC convention of numbering screen rows
  1108. and columns with Row = 1, Column = 1 being at the top-left corner of the
  1109. display. The maximum value for Row% depends on the capabilities of the
  1110. video adaptor installed and is determined by the last WIDTH statement.
  1111. Normally it is 25 but may extend to 43 (EGA) or even 50 rows (VGA).
  1112. Maximum columns may be either 40 or 80 (the default).
  1113.  
  1114. If multiple screen pages are being used, FASTPRINT will correctly identify
  1115. the active one and output to the proper video address.
  1116.  
  1117. Note:       if an attribute of -1 is specified, the output string takes
  1118.             the colour or attribute already set into that portion of the
  1119.             screen where the string is printed.
  1120.             
  1121. Thanks to John Turnbull of Macclesfield for this suggestion.
  1122.             
  1123.  
  1124. FILEDATE
  1125.  
  1126. Gets or sets the date and time of the specified file as is displayed in
  1127. directory listings.
  1128.  
  1129. DECLARE SUB FileDate (BYVAL Switch%, DateTime$, FileSpec$)
  1130.  
  1131. Switch%     if set to a value of 1, changes the date and time of the file
  1132.             to the parameters specified in DateTime$. Any other value
  1133.             returns the date and time that the file was last written to
  1134.             in DateTime$
  1135.  
  1136. DateTime$   A string of at least 17 characters in length. If setting the
  1137.             date and time of a file, this must be written in a standard
  1138.             UK date/time format, ie:
  1139.  
  1140.             "DD/MM/YY HH:MM:SS"
  1141.  
  1142.             If you are reading the date and time, it is not necessary to
  1143.             pre-format the string, as the function will do it for you. The
  1144.             string must be of sufficient length to hold the returned date
  1145.             and time, however, or the procedure will fail.
  1146.  
  1147. FileSpec$   A string holding the pathname of the file to be examined or
  1148.             changed. It can include the drive letter and directory path
  1149.             were appropriate, but must be an explicit pathname. Wildcard
  1150.             characters are not allowed. Maximum length is 64 characters.
  1151.  
  1152. The procedure will fail if the file does not exist or is not on the path
  1153. specified. Also, since the file is actually opened by the procedure, there
  1154. must be at least one free DOS file handle available when you call it.
  1155.  
  1156. You cannot change the date and time of a file which has been flagged as
  1157. readonly or, on a network, is owned by another program.
  1158.  
  1159.  
  1160. FLOPPYDRIVES
  1161.  
  1162. This function returns the number of installed diskette drives in the
  1163. current computer system.
  1164.  
  1165. DECLARE FUNCTION FloppyDrives% ()
  1166.  
  1167. No calling parameters are required.
  1168.  
  1169.  
  1170. FREESPACE
  1171.  
  1172. You must supply the drive number of the diskette or fixed-disk which you
  1173. want to test (1 = drive A:, 2 = drive B:, etc). Pass a value of zero to
  1174. test the currently-logged or default drive. The amount of free space is
  1175. returned in bytes.
  1176.  
  1177. DECLARE FUNCTION FreeSpace& (BYVAL DriveNo%)
  1178.  
  1179. Note:       The return value will not be reliable if the drive being
  1180.             tested has an extended DOS partition which contains more
  1181.             than 32MB of free space.
  1182.  
  1183.  
  1184. GAMESPORT
  1185.  
  1186. This function checks to see if the host computer is fitted with an adaptor
  1187. for joysticks or a games paddle.
  1188.  
  1189. No calling parameters are required.
  1190.  
  1191. DECLARE FUNCTION GamesPort% ()
  1192.  
  1193. Returns logical TRUE (-1) if a games adaptor is present or FALSE (0) if no
  1194. games adaptor is fitted.
  1195.  
  1196.  
  1197. GRAPRINT
  1198.  
  1199. This routine simply serves as a function despatcher for the various
  1200. graphics text procedures, which can also be called directly. It is
  1201. intended to be called from programs which must run under a variety of
  1202. video adaptors, transferring control to the proper routine for the current
  1203. video mode. The calling program must supply appropriate parameters,
  1204. however.
  1205.  
  1206. DECLARE SUB GraPrint (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  1207.                       BYVAL Attr%, BYVAL Scale%)
  1208.  
  1209. GRAPRINT provides a convenient way of displaying text in any of the EGA,
  1210. VGA and MCGA graphics modes (SCREENs 7-13) as well as the 320 x 200 pixel
  1211. 4-colour CGA mode (SCREEN 1) without having to bother about loading
  1212. external font files. It uses the standard character definition tables
  1213. built into your display adaptor, but allows you to scale them up to eight
  1214. times normal size and to specify any combination of foreground and
  1215. background colours supported by the current video mode.
  1216.  
  1217. XLOC%       The horizontal co-ordinate of the top left hand pixel
  1218.             from which the text will begin
  1219.  
  1220. YLOC%       The vertical co-ordinate of the top left hand pixel
  1221.             from which the text will begin
  1222.  
  1223. TEXT$       The string of text to be displayed (up to 63 characters).
  1224.  
  1225. ATTR%       The colour (or display attribute in monochrome modes) to
  1226.             be given to the text. This is calculated by the formula:
  1227.  
  1228.             Colour% = (Background% * 256) + Foreground%
  1229.  
  1230.             The GRATTRIB function (see below) will perform this
  1231.             calculation for you, automatically, using the foreground
  1232.             and background values you supply.
  1233.  
  1234.             Foreground and Background values are in the ranges used
  1235.             by the current video mode (eg. 0 - 15 for SCREEN 9). The
  1236.             actual colours displayed depend upon your current PALETTE
  1237.             settings.
  1238.  
  1239.             Note:   supplying a value of -1 for background prevents
  1240.                     background pixels from being changed at all. This
  1241.                     allows text to be blended more naturally into a
  1242.                     complex graphics display, it is not supported in
  1243.                     320 x 200 4-colour mode, however.
  1244.  
  1245. SCALE%      The character size of the text to be displayed. This ranges
  1246.             from 1 to 8, where 1 is standard 80-column text (40-column
  1247.             in SCREEN 7) and 8 multiplies the character size by eight
  1248.             on both the horizontal and vertical axes.
  1249.  
  1250. GRAPRINT can handle both byte-aligned and non byte-aligned characters. The
  1251. x, y co-ordinates you supply do not need to correspond to a row, column
  1252. character cell in SCREEN 0, the alphanumeric mode. The complete extended
  1253. ASCII character set is supported, including foreign symbols and box-
  1254. drawing characters (computers with CGA adaptors must have GRAFTBL loaded
  1255. to access characters above ASCII 127, however).
  1256.  
  1257. Since GRAPRINT does not support clipping, to ensure a clean display you
  1258. must ensure that the text to be output fits within the current screen
  1259. boundaries.
  1260.  
  1261. See also CGATEXT for displaying characters in SCREEN 1, MCGATEXT for
  1262. displaying characters in SCREEN 13 and VGATEXT for displaying text in
  1263. the EGA and VGA video modes (SCREENs 7-12).
  1264.  
  1265.  
  1266. HANDLES
  1267.  
  1268. Returns the number of file handles available in the System File Table
  1269.  
  1270. DECLARE FUNCTION Handles% ()
  1271.  
  1272. The number returned by this function is equivalent to the value given
  1273. to the FILES = statement in your CONFIG.SYS script. Note that the first
  1274. five of these handles are reserved for DOS's internal use.
  1275.  
  1276.  
  1277. HELPMATE
  1278.  
  1279. This routine provides a context-sensitive on-line Help facility for your
  1280. VisualBASIC programs.
  1281.  
  1282. DECLARE SUB HelpMate (BYVAL Colour%, Title$, BYVAL Context%, Topic$)
  1283.  
  1284. Colour%   is the display attribute to be given to the Help window. If a
  1285.           value of zero is passed, HELPMATE uses default colours which
  1286.           are Black on Cyan for colour screens and inverse video for a
  1287.           monochrome display.
  1288.  
  1289. Title$    is an optional Title for the Help window. If one is supplied
  1290.           it must be no longer than 48 characters so that it can be
  1291.           easily centered in the top row of the window. If Title$ is a
  1292.           null string, HELPMATE uses its' own name as a default.  
  1293.  
  1294. Context%  is the context-sensitive flag. If set to 1, then the routine
  1295.           attempts to load the file specified by ...
  1296.  
  1297. Topic$    A legal DOS filename (up to 8 characters without extension),
  1298.           specifying the name of the Topic file to be displayed. 
  1299.           HelpMate automatically appends the extension '.HLP'.  
  1300.  
  1301. If Context% is not set, (or Topic$ is a null string), then the routine
  1302. displays a list of topics, from which you can make your own selection.
  1303.  
  1304. If Context% is set, HELPMATE will display the first page of the Topic file
  1305. specified, otherwise it begins by  overlaying the current screen with a
  1306. popup window in which is listed those HELP topics available.
  1307.  
  1308. The first topic in the list is highlighted and you can move the highlight
  1309. around the menu with the arrow keys Highlight the topic you want, then
  1310. press the <RETURN> key. The first page of that topic will be displayed in
  1311. the HELP window.
  1312.  
  1313. Page backwards and forwards through the file using the <PG UP> and <PG DN>
  1314. keys. If you page past the end of the file you will be returned to the
  1315. topic list, where you can either select another topic, or press <ESC> to
  1316. return to the VisualBASIC program. On return, the original screen and all
  1317. current variables are restored, intact, and program execution will
  1318. continue with the statement following the procedure call.
  1319.  
  1320. By default, the Toolbox Help system looks for its topic files in a sub-
  1321. directory called HELP, beneath the currently-logged directory. You can,
  1322. however, direct it to look elsewhere for files by setting a HELP variable
  1323. in the DOS environment table
  1324.  
  1325. e.g.  SET HELP=C:\BASIC\TOOLBOX\HELP
  1326.  
  1327. Alternatively, you can use the VisualBASIC ENVIRON statement within your
  1328. program, to point HELPMATE to the appropriate pathname. Remember, though,
  1329. that this method only remains in effect as long as the current program is
  1330. running and that there must be enough environment space available to hold
  1331. the HELP directory pathname.
  1332.  
  1333. A set of example Topic files, for use with the demonstration program,
  1334. DEMON.EXE is supplied with the Assembly-Language ToolBox. You can make
  1335. your own, using any Word Processor or Text Editor which can output plain
  1336. ASCII text (EDLIN will do). If you do so, bear in mind that the HelpMate
  1337. window's maximum page size is 16 rows of 55-column text. The maximum
  1338. number of pages in any one file is 256.
  1339.  
  1340.                              TIP
  1341.  
  1342. When displaying the list of available Topics, HelpMate searches the
  1343. current HELP directory for files with the extension .HLP. However, since
  1344. there is only room for 60 such filenames to be displayed in the menu
  1345. window, any files in excess of this number will be not be listed and are,
  1346. hence, inaccessible. You can, however, read any number of Context-
  1347. sensitive topic files since these are named explicitly in the call to
  1348. HelpMate which loads them. They need not, therefore, appear in the Topic
  1349. list.
  1350.  
  1351. If your application needs to provide a large number of Topic files, it is
  1352. a good idea to hide those which are context-sensitive from normal
  1353. directory searches (you can use the Toolbox Hide function to do this).
  1354. This will not prevent these files from being loaded when called, but it
  1355. does prevent them from appearing in the Topic list which gives you more
  1356. room for those general-purpose topic files which are selected by the user.
  1357.  
  1358. Note:       The \HELP directory on the ToolBox distribution disk
  1359.             contains a number of these hidden files for use by the
  1360.             demonstration program DEMON.EXE.
  1361.  
  1362.  
  1363. HIDE
  1364.  
  1365. Toggles the Hidden bit of the specified file's directory entry, making it
  1366. visible or invisible to directory listings.
  1367.  
  1368. DECLARE SUB Hide (BYVAL Switch%, FileSpec$)
  1369.  
  1370. If SWITCH% = 1 the file is hidden (regardless of whether it is currently
  1371. visible or not), any other value makes the file visible. FileSpec$ is the
  1372. name of the file to be hidden or unhidden. It can include a drive letter
  1373. and directory path but must be an explicit pathname, wildcard characters
  1374. are not allowed.
  1375.  
  1376.  
  1377. INFORM
  1378.  
  1379. Displays the message supplied in a dialogue box and waits for the user to
  1380. press the <ENTER> key before restoring the screen to its' previous state.
  1381.  
  1382. DECLARE SUB Inform (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  1383.  
  1384. ROW%        The top row of the dialogue box when it is displayed. The
  1385.             box is automatically centered within this row, which may be
  1386.             adjusted so that it remains within the screen boundaries.
  1387.  
  1388. MESSAGE$    A string of text comprising the message to be displayed. It
  1389.             must be no longer than 40 characters otherwise it will be
  1390.             truncated to fit inside the display panel.
  1391.  
  1392. ATTR%       The display attribute or colour to be given to the dialogue
  1393.             box. If an argument of zero is supplied, the box is displayed
  1394.             in cyan with a black foreground (colour monitors) or reverse
  1395.             video (monochrome monitors). On colour displays the message
  1396.             text always has a white foreground, no matter what attribute
  1397.             is specified.
  1398.  
  1399. MOUSE%      Should be set to TRUE (-1) or FALSE (0) to indicate if a
  1400.             mouse is available for use. If available, the operator can
  1401.             respond by clicking the left mouse button while the cursor is
  1402.             positioned on the radio button.     
  1403.  
  1404. This procedure is nearly identical to the MISTAKE routine (below) which is
  1405. designed for displaying error messages.
  1406.  
  1407.  
  1408. INT2E
  1409.  
  1410. Provides an interface to the MS-DOS kernel interrupt 2E (hex) service
  1411. which is sometimes called the 'Back Door to the Command Processor'.
  1412.  
  1413. DECLARE SUB Int2E (DosCmd$)
  1414.  
  1415. DosCmd$ can contain any legal MS-DOS command including the name of an
  1416. external program to be executed. 
  1417.  
  1418. INT2E is an alternative to the SHELL command already provided by
  1419. VisualBASIC. It has one advantage, however, in that many commands are
  1420. passed directly to the MS-DOS kernal instead of to a secondary copy
  1421. of the command processor. For example a SET command passed to INT2E
  1422. will set a string in the MS-DOS master environment instead of the
  1423. current program's local environment. Master environment variables
  1424. are preserved when the program terminates and are available to any
  1425. subsequent programs which may be started up.
  1426.  
  1427. If the command you pass is the name of an external command or if it
  1428. requires COMMAND.COM to be loaded then you must make sure that there
  1429. is enough memory available for it to be executed. You can free-up
  1430. memory by using VisualBASIC's SETMEM function with the appropriate
  1431. negative value.
  1432.  
  1433. Be aware that the INT 2Eh service is not documented or supported by
  1434. Microsoft and successful operation cannot be guaranteed. If the
  1435. procedure fails due to there being insufficient memory or for some 
  1436. other reason, no error message will be returned. For this reason,
  1437. the SHELL statement is usually to be preferred for accessing MS-DOS
  1438. functions, since this can be trapped for errors.
  1439.  
  1440. Note that INT2E will only work with genuine versions of Microsoft
  1441. MS-DOS or IBM PC-DOS. It will not work under DR-DOS, Norton NDOS or
  1442. versions of 4DOS prior to 4.0.
  1443.  
  1444.  
  1445. INTERVAL
  1446.  
  1447. Calculate the number of days between two dates supplied as long integer
  1448. Julian numbers. You can use the DAYNUMBER function (see above) to turn
  1449. dates in normal numeric format into Julian numbers and NUMBERDAY (below)
  1450. to convert them back again.
  1451.  
  1452. DECLARE FUNCTION Interval& (First&, Second&)
  1453.  
  1454. This function always returns a positive value, regardless of whether the
  1455. first argument is lower or greater than the second.
  1456.  
  1457.  
  1458. ITPRINT
  1459.  
  1460. Sends the text supplied, to the printer, as a string of italic characters.
  1461. Output begins at the current print position and can, optionally, append a
  1462. carriage-return/linefeed to take the print head to the beginning of a new
  1463. line when finished.
  1464.  
  1465. DECLARE SUB ItPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  1466.  
  1467. Arguments:  Printer%    the parallel port output is to be sent to
  1468.                         (1 = LPT1:, 2 = LPT2:, etc.).
  1469.             Buffer$     the string of text to be printed.
  1470.             NewLine%    set this to a non-zero value if you want 
  1471.                         to move to a new line after printing.
  1472.  
  1473. The routine restores the previous print style or font before it returns
  1474. and does not effect subsequent output to the printer, using the VisualBASIC
  1475. LPRINT or PRINT # statements.
  1476.  
  1477. Note:       The version of this routine stored in the Toolbox
  1478.             library is for EPSON compatible printers. If you have
  1479.             an IBM graphics printer or ProPrinter, then you should
  1480.             rebuild your libraries, using either the PRINTIBM.OBJ
  1481.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  1482.  
  1483.  
  1484. KEYFLAGS
  1485.  
  1486. Returns a 16-bit unsigned number which is bit-encoded with the current
  1487. status of the CTRL, ALT, INSERT and other keyboard control keys.
  1488.  
  1489. No calling parameters are required.
  1490.  
  1491. DECLARE FUNCTION KeyFlags% ()
  1492.  
  1493. The BITTEST function (see below) can be used to isolate individual bits of
  1494. the returned value. Their meanings are as follows:
  1495.  
  1496.  F E D C B A 9 8 7 6 5 4 3 2 1 0   Bits
  1497. ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
  1498. │0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│  Meaning if set
  1499. └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
  1500.  │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┴─  Left & Right SHIFT keys pressed
  1501.  │ │ │ │ │ │ │ │ │ │ │ │ │ └─────  CTRL key pressed
  1502.  │ │ │ │ │ │ │ │ │ │ │ │ └───────  ALT key pressed
  1503.  │ │ │ │ │ │ │ │ │ │ │ └─────────  SCROLL LOCK active
  1504.  │ │ │ │ │ │ │ │ │ │ └───────────  NUM LOCK active
  1505.  │ │ │ │ │ │ │ │ │ └─────────────  CAPS LOCK active
  1506.  │ │ │ │ │ │ │ │ └───────────────  INSERT key status
  1507.  │ │ │ │ │ │ │ └─────────────────  Left CTRL key pressed
  1508.  │ │ │ │ │ │ └───────────────────  Left ALT key pressed
  1509.  │ │ │ │ │ └─────────────────────  SYS REQ key pressed
  1510.  │ │ │ │ └───────────────────────  PAUSE (or CTRL-NUM LOCK) active 
  1511.  │ │ │ └─────────────────────────  SCROLL LOCK pressed
  1512.  │ │ └───────────────────────────  NUM LOCK pressed
  1513.  │ └─────────────────────────────  CAPS LOCK pressed
  1514.  └───────────────────────────────  INSERT key pressed
  1515.  
  1516. See the CAPSLOCK, NUMLOCK and SCRLOCK functions for a method of setting or
  1517. reading the status of specific control keys.
  1518.  
  1519.  
  1520. KEYFLUSH
  1521.  
  1522. This procedure flushes the keyboard type-ahead buffer and discards any
  1523. keystrokes which have not yet been processed.
  1524.  
  1525. No calling parameters are required.
  1526.  
  1527. DECLARE SUB KeyFlush ()
  1528.  
  1529. Note:       KEYFLUSH may not work properly if you have installed
  1530.             keystroke enhancement software which moves the type-ahead
  1531.             buffer to another location in memory. It DOES work with
  1532.             command-line buffers like IBM's DOSEDIT, however.
  1533.  
  1534.  
  1535. KEYIN
  1536.  
  1537. Similar to the VisualBASIC INKEY$ function, except that it waits for a
  1538. keypress instead of returning at once if none is available.
  1539.  
  1540. No calling parameters are required.
  1541.  
  1542. DECLARE FUNCTION KeyIn% ()
  1543.  
  1544. The function returns a numeric value between 0 and 255 which represents
  1545. the ASCII code of the key pressed. If one of the function keys (F1 to F12)
  1546. or a special key such as PAGEUP or one of the cursor arrows is pressed,
  1547. then a negative value is returned. Converting this number to its absolute
  1548. equivalent produces the scan code of the key.
  1549.  
  1550. Example:  KeyPress% = KeyIn%
  1551.           IF KeyPress% < 0 THEN
  1552.              ScanCode% = ABS(KeyPress%)
  1553.           ELSE
  1554.              AsciCode% = KeyPress%
  1555.           END IF
  1556.  
  1557. See the ASCICODE topic for a list of ASCII codes and their equivalent
  1558. printable characters. The SCANCODE topic lists the scan codes returned by
  1559. the various function and control keys.
  1560.  
  1561. The KEYIN function will recognise if one of the new 101/102 extended
  1562. keyboards is being used and return the correct scan codes for the extra
  1563. keys such as F11 and F12.
  1564.  
  1565.  
  1566. KEYSTAT
  1567.  
  1568. This function tests to see if a keystroke is waiting to be read. It does
  1569. not read or remove the keystroke from the typeahead buffer, use KEYIN% or
  1570. INKEY$ to do this.
  1571.  
  1572. No calling parameters are required.
  1573.  
  1574. DECLARE FUNCTION KeyStat% ()
  1575.  
  1576. KEYSTAT returns -1 (logical TRUE) if a keystroke is waiting to be
  1577. collected or 0 (logical FALSE) if the typeahead buffer is empty.
  1578.  
  1579.  
  1580. LPTSWAP
  1581.  
  1582. This procedure swaps the port addresses of the two printer channels
  1583. specified so that, for example, all output targeted to LPT1: will actually
  1584. be sent to LPT4:, and vice-versa.
  1585.  
  1586. DECLARE SUB LptSwap (BYVAL Printer1%, BYVAL Printer2%)
  1587.  
  1588. Printer1% and Printer2% are both numeric values in the range 1 - 4, where
  1589. 1 = LPT1:, 2 = LPT2:, etc.
  1590.  
  1591. Note:       any changes made using LPTSWAP will remain in effect 
  1592.             even after your program is finished.
  1593.  
  1594.  
  1595. MATHSCHIP
  1596.  
  1597. Checks to see if a floating-point maths co-processor is installed in the
  1598. system. 
  1599.  
  1600. No calling parameters are required.
  1601.  
  1602. DECLARE FUNCTION MathsChip% ()
  1603.  
  1604. MATHSCHIP returns 0 (logical FALSE) if no co-processor is available. A
  1605. non-zero value indicates that a co-processor is available and, in this
  1606. case, the function will attempt to identify it. Possible return values
  1607. are:
  1608.  
  1609.      87 =   Intel 8087
  1610.     287 =   Intel 80287
  1611.     387 =   Intel 80387 (or 80486 with built-in maths processor)
  1612.  
  1613. Waitek and other models return the same values as their Intel equivalents.
  1614.  
  1615.  
  1616. MCGACOPY
  1617.  
  1618. Copies an MCGA screen to or from a user-supplied dynamic array.
  1619.  
  1620. DECLARE SUB McgaCopy (BYVAL Switch%, SEG Array)
  1621.  
  1622. SWITCH%     Direction of copy   0 = copy screen to string
  1623.                                 1 = copy string to screen
  1624.  
  1625. ARRAY       Dynamic INTEGER or LONG integer array to hold the screen
  1626.             image. It must contain at least 64000 bytes of storage
  1627.             (32000 elements for INTEGER or 16000 for LONG) or the
  1628.             routine will fail, with possibly disastrous results.
  1629.  
  1630. Note:       It is not enough just to pass the name of the storage
  1631.             array to MCGACOPY. You must explicitly name the element
  1632.             where screen storage is to start, eg:
  1633.  
  1634.             DIM ScreenArray(1 TO 32000) AS INTEGER
  1635.             SCREEN 13
  1636.                 .
  1637.             draw some stuff
  1638.                 .
  1639.             McgaCopy 0, ScreenArray(1)
  1640.  
  1641.  
  1642. The VisualBASIC PCOPY statement is very useful for storing screen pages in
  1643. memory, so that they can be kept out of sight until needed. Unfortunately
  1644. it only works in text modes or, on computers with EGA or VGA video cards,
  1645. in SCREEN modes 7 to 12. This routine, on the other hand, works only in
  1646. the MCGA display mode (SCREEN 13), it provides a useful alternative to the
  1647. PCOPY statement for use with medium-resolution 256-colour screens.
  1648.  
  1649. See CGACOPY for a version that can be used with SCREEN 1 and 2 displays.
  1650.  
  1651.  
  1652. MCGASCROLL
  1653.  
  1654. Scrolls a rectangular portion of a SCREEN 13 (320 x 200 256-colour)
  1655. display one pixel to the left or right, wrapping those pixels which are
  1656. scrolled out at the end round to the beginning again.
  1657.  
  1658. DECLARE SUB McgaScroll (BYVAL xLoc%, BYVAL yLoc%, BYVAL xPixels%,_
  1659.                         BYVAL yPixels%, BYVAL Direction%)                 
  1660.  
  1661. XLOC%       The horizontal (X) co-ordinate of the top-left corner of
  1662.             the rectangle to be scrolled.
  1663.  
  1664. YLOC%       The vertical (Y) co-ordinate of the top-left corner of
  1665.             the rectangle to be scrolled.
  1666.  
  1667. XPIXELS%    The width (in pixels) of the rectangle to be scrolled.
  1668.  
  1669. YPIXELS%    The height (in pixels) of the rectangle to be scrolled.
  1670.  
  1671. DIRECTION%  The direction in which the rectangle contents are to be
  1672.             scrolled (0 = Left, 1 = Right).
  1673.  
  1674. Co-ordinates are in the ranges:  X >= 0 <= 319, Y >= 0 <= 199
  1675.  
  1676.  
  1677. MCGATEXT
  1678.  
  1679. Writes characters to the screen in the 320 x 200  256-colour graphics
  1680. mode (SCREEN 13).
  1681.  
  1682. DECLARE SUB McgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  1683.                       BYVAL Attr%, BYVAL Scale%)
  1684.  
  1685. This routine provides a convenient way of displaying text in SCREEN 13
  1686. without having to bother about loading external font files. It uses the
  1687. standard character definition tables built into your display adaptor, but
  1688. allows you to scale them up to eight times normal size and to specify any
  1689. combination of foreground and background colours.
  1690.  
  1691. XLOC%       The horizontal co-ordinate of the top left hand pixel
  1692.             from which the text will begin (0 - 319).
  1693.  
  1694. YLOC%       The vertical co-ordinate of the top left hand pixel
  1695.             from which the text will begin (0 - 199).
  1696.  
  1697. TEXT$       The string of text to be displayed (up to 63 characters).
  1698.  
  1699. ATTR%       The colour (or display attribute in monochrome modes) to
  1700.             be given to the text. This is calculated by the formula:
  1701.  
  1702.             Colour% = (Background% * 256) + Foreground%
  1703.  
  1704.             Foreground is in the range (0 - 255) and Background (0 - 64).
  1705.             The actual colours displayed depend upon your current PALETTE
  1706.             settings.
  1707.  
  1708.             Note:   supplying a value of -1 for background prevents
  1709.                     background pixels from being changed at all. This
  1710.                     allows text to be blended more naturally into a
  1711.                     complex graphics display.
  1712.  
  1713. SCALE%      The character size of the text to be displayed. This ranges
  1714.             from 1 to 8, where 1 is standard 40-column text and where 8
  1715.             multiplies the character size by eight on both the horizontal
  1716.             and vertical axes.
  1717.  
  1718. The complete extended ASCII character set is supported, including foreign
  1719. symbols and box-drawing characters.
  1720.  
  1721. Since MCGATEXT does not support clipping, to ensure a clean display you
  1722. must ensure that the text to be output fits within the current screen
  1723. boundaries.
  1724.  
  1725. See also CGATEXT for displaying characters in SCREEN 1 and VGATEXT for
  1726. displaying characters in SCREENs 7-12.
  1727.  
  1728.  
  1729. MISTAKE
  1730.  
  1731. Displays the error message supplied in a dialogue box and waits for the
  1732. operator to press the <ENTER> key before returning, restoring the screen
  1733. to its' previous state.
  1734.  
  1735. DECLARE SUB MisTake (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  1736.  
  1737. ROW%        The top row of the dialogue box when it is displayed. The
  1738.             box is automatically centered within this row, which may be
  1739.             adjusted so that it remains within the screen boundaries.
  1740.  
  1741. MESSAGE$    A string of text comprising the error message to be displayed.
  1742.             It must be no longer than 40 characters otherwise it will be
  1743.             truncated to fit inside the display panel.
  1744.  
  1745. ATTR%       The display attribute or colour to be given to the dialogue box.
  1746.             If an argument of zero is supplied, the box is displayed with
  1747.             bright yellow foreground on a red background (colour monitors)
  1748.             or in reverse video (monochrome monitors). On colour displays the
  1749.             message text is always given a white foreground, no matter what
  1750.             attribute is specified.
  1751.  
  1752. MOUSE%     Should be set to TRUE (-1) or FALSE (0) to indicate if a
  1753.             mouse is available for use. If available, the operator can
  1754.             respond by clicking the left mouse button while the cursor is
  1755.             positioned on the radio button.     
  1756.  
  1757. This routine is a special case of the INFORM dialogue box procedure (see
  1758. above) which can be used for any general-purpose messages which require an
  1759. acknowledgement from the operator.
  1760.  
  1761.  
  1762. MOUSEBORDER
  1763.  
  1764. Sets the maximum and minimum boundaries for mouse movement, both
  1765. horizontally and vertically.
  1766.  
  1767. DECLARE SUB MouseBorder (BYVAL x1%, BYVAL y1%, BYVAL x2%, BYVAL y2%)
  1768.  
  1769. This routine defines a screen rectangle into which the mouse cursor
  1770. is confined. x1% - y1% are the pixel co-ordinates of the upper-left
  1771. corner and x2% - y2% the pixel co-ordinates of the lower-right. If
  1772. the upper-left co-ordinates are greater than the lower-right then
  1773. the two sets of values will be swapped.
  1774.  
  1775. If the current mouse pointer is outside the defined rectangle, then
  1776. it will be moved inside it.
  1777.  
  1778.  
  1779. MOUSEHIDE
  1780.  
  1781. Make the mouse cursor invisible. 
  1782.  
  1783. DECLARE SUB MouseHide ()
  1784.  
  1785.  
  1786. MOUSEINIT
  1787.  
  1788. Initialises the mouse driver and returns the driver status. Also hides
  1789. the mouse cursor if it was previously visible.
  1790.  
  1791. DECLARE FUNCTION MouseInit% ()
  1792.  
  1793. Returns TRUE (-1) if mouse support is available or FALSE (0) if not.
  1794.  
  1795.  
  1796. MOUSEMICKEY
  1797.  
  1798. Read mouse motion counters.
  1799.  
  1800. Return the number of horizontal and vertical mickeys moved since the
  1801. last mouse function call.
  1802.  
  1803. DECLARE SUB MouseMickey (horizontal%, vertical%)
  1804.  
  1805. The returned values represent the net mouse pointer displacement since
  1806. this routine was last called. A positive number indicates movement to
  1807. the right or downward. Negative values indicate travel to the left or
  1808. upwards. One mickey is approximately 1/200" of mouse movement.
  1809.  
  1810.  
  1811. MOUSENOW
  1812.  
  1813. Returns the current state of the mouse.
  1814.  
  1815. DECLARE SUB MouseNow (leftButton%, rightButton%, xMouse%, yMouse%)
  1816.  
  1817. If leftButton% or rightButton% are TRUE (-1) than that button is
  1818. currently being pressed, otherwise they are set to FALSE (0).
  1819. xMouse% and yMouse% contain the current horizontal and vertical 
  1820. pixel co-ordinates of the mouse pointer.
  1821.  
  1822.  
  1823. MOUSEPRESSLEFT
  1824.  
  1825. Returns the mouse state at the last press of the left button.
  1826.  
  1827. DECLARE SUB MousePressLeft (leftCount%, xMouse%, yMouse%)
  1828.  
  1829. leftCount% returns the number of presses that have been made on the 
  1830. left mouse button since this routine was last called. xMouse% and
  1831. yMouse% contain the horizontal and vertical pixel co-ordinates of
  1832. the mouse pointer at the last button press (left or right).
  1833.  
  1834. Calling this procedure resets the left button press counter to zero.
  1835.  
  1836.  
  1837. MOUSEPRESSRIGHT
  1838.  
  1839. Returns the mouse state at the last press of the right button.
  1840.  
  1841. DECLARE SUB MousePressRight (rightCount%, xMouse%, yMouse%)
  1842.  
  1843. rightCount% returns the number of presses that have been made on the 
  1844. right mouse button since this routine was last called. xMouse% and
  1845. yMouse% contain the horizontal and vertical pixel co-ordinates of
  1846. the mouse pointer at the last button press (left or right).
  1847.  
  1848. Calling this procedure resets the right button press counter to zero.
  1849.  
  1850.  
  1851. MOUSEPUT
  1852.  
  1853. Sets the mouse cursor position.
  1854.  
  1855. DECLARE SUB MousePut (BYVAL xMouse%, BYVAL yMouse%)
  1856.  
  1857. xMouse% and yMouse% are the horizontal and vertical pixel co-ordinates
  1858. of the screen location where the mouse pointer is to be moved. This
  1859. position is adjusted, if necessary, to lie within the limits specified
  1860. by a previous call to MOUSEBORDER (see above).
  1861.  
  1862.  
  1863. MOUSERELLEFT
  1864.  
  1865. Returns the mouse state at the last release of the left mouse button.
  1866.  
  1867. DECLARE SUB MouseRelLeft (leftCount%, xMouse%, yMouse%)
  1868.  
  1869. leftCount% returns the number of times the left mouse button has been
  1870. released since this procedure was last called. xMouse% and yMouse%
  1871. contain the horizontal and vertical pixel co-ordinates of the mouse
  1872. pointer at the last button release (left or right).
  1873.  
  1874. Calling this routine resets the left button release counter to zero.
  1875.  
  1876.  
  1877. MOUSERELRIGHT
  1878.  
  1879. Returns the mouse state at the last release of the right mouse button.
  1880.  
  1881. DECLARE SUB MouseRelRight (rightCount%, xMouse%, yMouse%)
  1882.  
  1883. rightCount% returns the number of times the right mouse button has been
  1884. released since this procedure was last called. xMouse% and yMouse%
  1885. contain the horizontal and vertical pixel co-ordinates of the mouse
  1886. pointer at the last button release (left or right).
  1887.  
  1888. Calling this routine resets the right button release counter to zero.
  1889.  
  1890.  
  1891. MOUSERESTORE
  1892.  
  1893. Restores the mouse pointer to the position and state that was in
  1894. effect at the previous call to MOUSESAVE (see below).
  1895.  
  1896. DECLARE SUB MouseRestore ()
  1897.  
  1898.  
  1899. MOUSESAVE
  1900.  
  1901. Saves the current mouse pointer state and screen location in an
  1902. internal buffer.
  1903.  
  1904. DECLARE SUB MouseSave ()
  1905.  
  1906. The MOUSERESTORE procedure (see above) can be used to restore
  1907. the mouse pointer state.
  1908.  
  1909.  
  1910. MOUSESHOW
  1911.  
  1912. Makes the mouse cursor visible.
  1913.  
  1914. DECLARE SUB MouseShow ()
  1915.  
  1916.  
  1917. MOUSESPEED
  1918.  
  1919. Sets the mouse mickeys to pixels ratio.
  1920.  
  1921. DECLARE SUB MouseSpeed (BYVAL horizontal%, BYVAL vertical%)
  1922.  
  1923. Sets the number of mickeys that are equivalent to 8 screen pixels for
  1924. horizontal and vertical mouse movement. One mickey is approximately
  1925. 1/200" of physical mouse motion.
  1926.  
  1927.  
  1928. MOUSEWARP
  1929.  
  1930. Set the double-speed threshold.
  1931.  
  1932. DECLARE SUB MouseWarp (BYVAL threshold%)
  1933.  
  1934. Defines the threshold for doubling the speed of mouse pointer travel.
  1935. The threshold% value is supplied in mickeys/second (default = 64).
  1936. Doubling of pointer speed can be effectively disabled by setting the
  1937. threshold to a very large value (such as 32,767).
  1938.  
  1939.  
  1940. NETTEST
  1941.  
  1942. This function is used to detect if the program which calls it is running
  1943. under a Novell Network. It can be used to decide if file or record locking
  1944. is required.
  1945.  
  1946. No calling parameters are required.
  1947.  
  1948. DECLARE FUNCTION NetTest% ()
  1949.  
  1950. Returns -1 (logical TRUE) if the Network shell is present and 0 (logical
  1951. FALSE) if not. Note that the function cannot distinguish between programs
  1952. running on a local or network drive under NetWare.
  1953.  
  1954. The SHARING function (below) provides similar information for file-sharing
  1955. using DOS's SHARE.EXE program.
  1956.  
  1957.  
  1958. NUMBERDAY
  1959.  
  1960. Splits a Julian date number into day, month and year and also returns the
  1961. day of the week as a number between 0 and 6 (0 = Sunday etc..)
  1962.  
  1963. DECLARE FUNCTION NumberDay% (Number&, Day%, Month%, Year%)
  1964.  
  1965.  
  1966. NUMLOCK
  1967.  
  1968. Toggles NUM LOCK on or off or, alternatively, reads the current NUM LOCK
  1969. key setting.
  1970.  
  1971. DECLARE FUNCTION NumLock% (BYVAL Switch%)
  1972.  
  1973. Switch% = 0  Turns NUM LOCK off
  1974.         = 1  Turns NUM LOCK on
  1975.  
  1976. Any other value just returns the current NUM status as a logical value
  1977. where -1 (TRUE) means that NUM LOCK is on and 0 (FALSE) means that NUM
  1978. LOCK is off.
  1979.  
  1980.  
  1981. PARALLELPORTS
  1982.  
  1983. This function checks how many hardware printer ports are available. It
  1984. does not check to see if an actual printer is connected to each of them,
  1985. use the PRINTEST or PRINTERSTAT functions (see below) to obtain this
  1986. information.
  1987.  
  1988. No calling parameters are required.
  1989.  
  1990. DECLARE FUNCTION ParallelPorts% ()
  1991.  
  1992.  
  1993. PARKHEADS
  1994.  
  1995. Parks the heads of each fixed disk drive in the system onto the last
  1996. cylinder of the disk, preparatory to powering off.
  1997.  
  1998. DECLARE SUB ParkHeads ()
  1999.  
  2000. This routine only works reliablly on AT class computers and above.
  2001. Using it on an XT may simply cause the computer to 'hang', without
  2002. parking the heads.
  2003.  
  2004.  
  2005. PAUSE
  2006.  
  2007. This routine is used to generate machine-independent timing loops. It
  2008. simply pauses until the specified number of clock ticks have elapsed.
  2009.  
  2010. DECLARE SUB Pause (BYVAL Ticks%)
  2011.  
  2012. There are 18.2 clock ticks per second on all PCs, no matter what the
  2013. processor or processor speed.
  2014.  
  2015.  
  2016. PEEKWORD
  2017.  
  2018. Reads a long integer value from two consecutive bytes of memory.
  2019.  
  2020. DECLARE FUNCTION PeekWord& (BYVAL Segment&, BYVAL Offset&)
  2021.  
  2022. Arguments:  Segment&  = address of memory segment containing the data
  2023.                         to be read.
  2024.             Offset&   = offset address, within the segment of the 
  2025.                         two bytes to be read.
  2026.  
  2027. Returns:    contents of the two consecutive bytes in the form of a
  2028.             long integer value in the range (0 to 65535). 
  2029.  
  2030. Note:       parameters are passed as LONG integers to save you the
  2031.             hassle of having to convert argument values over 32767
  2032.             to negative signed integers. Do not use values greater
  2033.             than 65535, however, or the most significant word will
  2034.             be ignored and the address converted to Modulus 65536.
  2035.  
  2036.             If you supply an offset address of 65535 (0FFFFh) which
  2037.             would cause the second byte to cross a segment boundary,
  2038.             only the lower byte is read and returned as a value
  2039.             between (0 - 255).
  2040.  
  2041. Using VisualBASIC's PEEK function to examine data which lies outside
  2042. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  2043. required and then to reset it afterwards. This function allows you to
  2044. read data, directly, from anywhere in the 1 megabyte of addressable
  2045. RAM space your computer contains. It also reads two adjacent bytes of
  2046. data from the address supplied and converts them to a single integer.
  2047.  
  2048. The PC architecture follows the Intel convention of storing 'words'
  2049. (two-byte values) with the Least Significant part in the lower byte
  2050. (LSB) and the Most Significant (MSB) in the higher byte. Since each
  2051. byte can only hold 256 possible values (0 to 255), an integer which
  2052. has a range of from 0 to 65535 (unsigned) is stored in consecutive
  2053. bytes with the MSB being considered the number of times it can be
  2054. divided by 256 and the LSB being the remainder of this division. The
  2055. number 1000, for example would be stored in memory as follows:
  2056.  
  2057.                          LSB              MSB
  2058.                  ┌─┬─┬─┬─┬─┬─┬─┬─┐ ┌─┬─┬─┬─┬─┬─┬─┬─┐
  2059. 1000 (decimal) = │1│1│1│0│1│0│0│0│ │0│0│0│0│0│0│1│1│
  2060.                  └─┴─┴─┴─┴─┴─┴─┴─┘ └─┴─┴─┴─┴─┴─┴─┴─┘
  2061.  
  2062.                  1000 MOD 256 = 232   1000 \ 256 = 3
  2063.  
  2064. To convert the two bytes back to a single integer again, you would
  2065. use the formula: 
  2066.  
  2067.                         x = (MSB * 256) + LSB 
  2068.  
  2069. or, in our example:     x = 3 * 256 + 232 = 1000
  2070.  
  2071. PEEKWORD makes this conversion for you automatically, all you have to
  2072. do is supply the address and it returns the contents of the two bytes
  2073. in long integer format.
  2074.  
  2075. The POKEWORD procedure (below) complements PEEKWORD by allowing you
  2076. to write a word of data anywhere in the 1MB addressable PC workspace.
  2077.  
  2078. See also FARPEEK and FARPOKE which allow you to read from and write
  2079. to far memory, one byte at a time.
  2080.  
  2081.  
  2082. PERCENTBOX
  2083.  
  2084. Opens and maintains a popup window which displays a percentage value
  2085. as a horizontal bar.
  2086.  
  2087. DECLARE SUB PerCentBox (BYVAL Switch%, Message$, BYVAL Attr%,_
  2088.                         BYVAL PerCent%)
  2089.  
  2090. Arguments:  Switch%   = 1  open percentage box window
  2091.                       = 2  maintain percentage bar
  2092.                       = 3  close percentage box
  2093.                       
  2094.             Message$  = an optional message which is centred in the
  2095.                         percentage box window (Switch% = 1).
  2096.                         
  2097.             Attr%     = display colour or attribute for percentage
  2098.                         box window and text. If Attr% = 0 attribute
  2099.                         defaults to 48 (Black on Cyan) for colour
  2100.                         adaptors and 112 (Reverse) for monochrome.
  2101.                         (used only with Switch% = 1)
  2102.                         
  2103.             PerCent%  = an integer value between 0 and 100 which
  2104.                         controls the length of the percentage bar.
  2105.                         (used only with Switch% = 2)            
  2106.  
  2107. Here is another useful little routine for Toolbox users. It pops up a
  2108. window in which is displayed a percentage bar, illustrating how much
  2109. of the current process has been completed. Use it, during lengthy
  2110. operations, to reassure an operator that the program is not 'hanging',
  2111. or to indicate how much longer there is to go.
  2112.  
  2113. The Percentage Box window is popped up, centered, on the screen. It
  2114. recognises 43 and 50 line displays and will adjust itself accordingly.
  2115. Only one Percentage Box can be open at a time, although other windows
  2116. and dialogue boxes may be opened and closed while it is present. Be
  2117. careful not to overlap the Percentage Box with other windows, though.
  2118.  
  2119.  
  2120. POKEWORD
  2121.  
  2122. Writes an integer value into two consecutive bytes of memory.
  2123.  
  2124. DECLARE SUB PokeWord (BYVAL Segment&, BYVAL Offset&, BYVAL Word&)
  2125.  
  2126. Arguments:  Segment&  = address of memory segment containing the
  2127.                         location to be written to
  2128.             Offset&   = offset address, within the segment of the 
  2129.                         two bytes to be set.
  2130.             Word&     = the value to set in memory. It must be a
  2131.                         value in the range 0 to 65535.
  2132.  
  2133. The data is written in standard Intel format, with the Most
  2134. Significant part of the number (MSB) being written into the higher
  2135. of the two bytes.
  2136.  
  2137. Note:       if you supply an offset address of 65535 (0FFFFh) which
  2138.             would cause the second byte to cross a segment boundary,
  2139.             only the lower, least significant, byte (LSB) is written.
  2140.  
  2141.             Parameters are passed as LONG integers to save you the
  2142.             hassle of having to convert argument values over 32767
  2143.             to negative signed integers. Do not use values greater
  2144.             than 65535, however, or the most significant word will
  2145.             be ignored and the address converted to Modulus 65536.
  2146.  
  2147. The PEEKWORD procedure (above) complements POKEWORD by allowing you
  2148. to read a word of data from anywhere in the 1MB of addressable PC
  2149. memory.
  2150.  
  2151. See also FARPEEK and FARPOKE which allow you to read from and write
  2152. to far memory, one byte at a time.
  2153.  
  2154.  
  2155. POPUP
  2156.  
  2157. This is the Toolbox popup window generator. What are Windows?  Well if
  2158. you've used the VisualBASIC environment at all then you've used Windows.
  2159. When you press <ALT><F> to bring down the File Menu, the list of options
  2160. presented there is in a window. Notice how any characters which were
  2161. concealed when the File Menu appeared, are restored, intact, after you've
  2162. made your choice. Windows are areas of the screen which are used to hold
  2163. transient data and messages to the user. They make the most of the limited
  2164. display space available and remove the need to constantly rebuild the
  2165. screen, each time your program communicates with the world.
  2166.  
  2167. Properly  presented, windows can give the illusion of multi-tasking, even
  2168. on single-processor machines like the IBM-PC.
  2169.  
  2170. Nowadays, no program worth its' salt can be without a window of some kind.
  2171. If YOUR program is going to stand out amongst all the others, however,
  2172. they've got to be done professionally. Windows must appear instantly and
  2173. vanish, just as quickly, when no longer required. They must be as large or
  2174. as small as is necessary, for the data which you need to display, and you
  2175. should have a plentiful supply, for all the circumstances that your
  2176. program might encounter. BASIC, unfortunately, is just not fast enough to
  2177. meet all these requirements.
  2178.  
  2179. Looks like it'll have to be Assembly-Language again ...
  2180.  
  2181. DECLARE SUB PopUp (BYVAL Row%, BYVAL Col%, BYVAL Hght%, BYVAL Wdth%,_
  2182.                    BYVAL Attr%, BYVAL Brdr%, BYVAL Shdw%, BYVAL Zoom%)
  2183.  
  2184. Opens a popup window at the screen location specified.
  2185.  
  2186. Where:    P1%  is the top-left row co-ordinate
  2187.           P2%  is the top-left column co-ordinate
  2188.           P3%  is the height (in rows) of the window
  2189.           P4%  is the width (in columns) of the window
  2190.           P5%  is the display attribute or colour
  2191.           P6%  is the border style (0 = no border)
  2192.           P7%  is the shadow switch (0 = no shadow)
  2193.           P8%  is the zoom switch (0 = no zoom)
  2194.  
  2195. The first four parameters specify the size of the window and the location
  2196. on the screen at which it will appear. Border styles are as follows:
  2197.  
  2198. ┌────┐
  2199. │ 1. │    Single-lined box all round the window
  2200. └────┘
  2201. ╔════╗
  2202. ║ 2. ║    Double-lined box all round the window
  2203. ╚════╝
  2204. ╒════╕
  2205. │ 3. │    Single vertical, double horizontal
  2206. ╘════╛
  2207. ╓────╖
  2208. ║ 4. ║    Single horizontal, double vertical
  2209. ╙────╜
  2210. ╤════╤
  2211. │ 5. │    Single-lined box all round the window
  2212. ╘════╛
  2213. ╦════╦
  2214. ║ 6. ║    Double-lined box all round the window
  2215. ╚════╝
  2216. ┬────┬
  2217. │ 7. │    Single vertical, double horizontal
  2218. ╘════╛
  2219. ╥────╥
  2220. ║ 8. ║    Single horizontal, double vertical
  2221. ╙────╜
  2222.  
  2223. Border styles 5 through 8 are particularly suitable for use with pull-
  2224. down menus, descending from a horizontal bar.
  2225.  
  2226. The SHADOW switch (Parameter 7), can be used to add a black shadow beneath
  2227. your window, Giving it a three dimensional effect. Setting P7% to 1 puts
  2228. solid shadow on the left-hand side. Setting P7% to 2 puts it on the right.
  2229. values of 3 and 4 in P7% will display transparant shadow to the left or
  2230. right, respectively, any other value prevents shadow.
  2231.  
  2232. Setting Parameter 8 to a non-zero value will cause the window to ZOOM onto
  2233. the screen.  What this means is that, starting at a point source,
  2234. successively larger versions of the window will be drawn until it is the
  2235. size required. The value you supply sets the interval, in milliseconds,
  2236. between iterations and is used to control the speed at which the window
  2237. explodes onto the screen. 
  2238.  
  2239. To preserve compatibility with programs written for use with previous
  2240. versions of the Toolbox, a value of 1 in parameter 8 sets the default
  2241. delay of 20 milliseconds per iteration. At this speed, which is constant
  2242. on PCs with all types of microprocessor, the process is extremely fast
  2243. and impressive, and adds a very professional touch to your programs. 
  2244.  
  2245. Before a window is opened, the display area below it is copied to an
  2246. internal buffer, from where it will be eventually restored when the window
  2247. is closed. This buffer has a capacity of 8 KiloBytes, the equivalent of
  2248. two full screens. To calculate the storage required for a particular
  2249. window, use the formula:
  2250.  
  2251. Bytes = ((Height in rows * Width in columns) * 2) + 6
  2252.  
  2253. (add one row to the height and one column to the width if you specify
  2254. shadow)
  2255.  
  2256. The window area needs to be multiplied by 2 since each screen character
  2257. takes two bytes of memory, for itself and its attribute code. The odd six
  2258. bytes are required for the storage of buffer pointers. The window buffer
  2259. works as a LIFO (Last In First Out) stack, so that the last window opened
  2260. is the first one to be removed. You can close the current window with the
  2261. statement:
  2262.  
  2263. CALL ShutUp
  2264.  
  2265. To put text inside a window, use the FASTPRINT routine (see above). You
  2266. can clear all or part of an open window with SCROLL (see below).
  2267.  
  2268.  
  2269. PRINTERSTAT
  2270.  
  2271. DECLARE FUNCTION PrinterStat% (BYVAL Printer%)
  2272.  
  2273. This function tests the current status of the parallel printer specified.
  2274. The value returned is tested as follows :
  2275.  
  2276.    Bit     Wanted    Meaning
  2277. ─────────────────────────────────────────────────────
  2278.     7        1       Printer not busy (0 = busy)
  2279.     6        0       Printer acknowledges
  2280.     5        0       Out-of-paper
  2281.     4        1       This printer selected
  2282.     3        0       I/O error
  2283.     2        0       Not used
  2284.     1        0       Not used
  2285.     0        0       Time-out occurred
  2286. ─────────────────────────────────────────────────────
  2287.    90 Hex  144 (Decimal)
  2288.  
  2289. Specify the printer to be tested as a number between 1 and 4, where 1 =
  2290. LPT1:, 2 = LPT2:, etc.
  2291.  
  2292. Note:       Some printers also set the acknowledgement bit. If so, the
  2293.             value returned will be 208 (D0 Hex) instead of 144.
  2294.  
  2295.  
  2296. PRINTEST
  2297.  
  2298. This is a simplified version of the PRINTERSTAT function (above). It
  2299. returns a logical value to indicate whether the specified printer is ready
  2300. (TRUE = -1) or not (FALSE = 0).
  2301.  
  2302. DECLARE FUNCTION PrinTest% (BYVAL Printer%)
  2303.  
  2304. Specify the printer to be tested as a number between 1 and 4, where 1 =
  2305. LPT1:, 2 = LPT2:, etc. The function will only work with parallel printers.
  2306.  
  2307.  
  2308. PRINTSET
  2309.  
  2310. Most modern printers have a variety of useful styles and fonts which you
  2311. can select by setting dip switches or sending the appropriate control
  2312. codes from the computer. Unfortunately this is not always convenient,
  2313. especially when you are in the middle of a program and have to duck out to
  2314. set up the proper print size. PRINTSET offers a solution to this problem
  2315. in the form of a pull-down menu which allows you to select from a range of
  2316. printer features, using the 'point-and-shoot' method.
  2317.                                                     
  2318. DECLARE SUB PrintSet (BYVAL Row%, BYVAL Col%, BYVAL Attr%, BYVAL Printer%)
  2319.  
  2320. Where:  Row%     = Row number of the top left-hand corner of the menu
  2321.                    window.
  2322.         Col%     = Column number of the top left-hand corner of the menu
  2323.                    window. 
  2324.         Attr%    = the display attribute or colour which is given to the
  2325.                    menu window.
  2326.         Printer% = the printer number (i.e. 1 = LPT1, 2 = LPT2 etc).
  2327.  
  2328. If you supply a value of zero for the Attr% argument, the menu window will
  2329. take the colour or attribute of the character which will be overlaid by
  2330. the top left corner of the window, when it appears. If this character is
  2331. also a single or double-lined horizontal bar (ASCII 196 or 205), the
  2332. border of the menu will be automatically adjusted to blend in with this
  2333. line, allowing you to produce the appearance of a pulldown menu.
  2334.  
  2335. Note:       Although the Toolbox package contains copies of this module
  2336.             configured for different types of printer, only one version
  2337.             of PrintSet may be in the library at any one time.
  2338.  
  2339.             PRINTEPS.OBJ is for Epson printers
  2340.             PRINTIBM.OBJ is for IBM Grahics printers
  2341.             PRINTPRO.OBJ is for IBM Proprinters
  2342.  
  2343.  
  2344. RAMDISK
  2345.  
  2346. Many disk-intensive processes, such as file sorting, will run much faster
  2347. when performed on a ramdisk. In such cases, use this function to test if a
  2348. ramdisk is available and the FREESPACE function (above) to see if it has
  2349. enough space for the job required. Don't forget to copy your data back to
  2350. a physical drive afterwards, or you will lose it when you power off.
  2351.  
  2352. RAMDISK searches the system drive table and examines the device driver for
  2353. each block device to see if it is a ramdisk. If one is detected, the
  2354. function returns the ASCII value of the drive letter associated with it
  2355. (eg 68 = D:). If no ramdisk is present, a value of zero is returned. If
  2356. more than one ramdisk is present in the system, only the first one is
  2357. reported on.
  2358.  
  2359. No calling parameters are required.
  2360.  
  2361. DECLARE FUNCTION RamDisk% ()
  2362.  
  2363. RAMDISK will work reliably with all versions of Microsoft's RAMDRIVE and
  2364. IBM's VDISK. However it has not been tested with any of the more esoteric
  2365. virtual disk products, and may not correctly identify some of these.
  2366.  
  2367.  
  2368. RAND
  2369.  
  2370. Returns a random number. This differs from VisualBASIC's RND function in
  2371. that RAND returns an integer and you can specify the range for this value.
  2372.  
  2373. DECLARE FUNCTION Rand% (BYVAL Lower%, BYVAL Higher%)
  2374.  
  2375. Lower% and Higher% are the upper and lower limits for the random number
  2376. to be returned. If Lower% is greater than Higher% then the arguments will
  2377. be transposed.
  2378.  
  2379.  
  2380. RESEED
  2381.  
  2382. Reinitialises the random number seed used by the RAND function (above).
  2383.  
  2384. DECLARE SUB ReSeed (BYVAL Seed&)
  2385.  
  2386. Note that the argument passed is a LONG integer. This enables you to use
  2387. the value which is returned by the VisualBASIC TIMER function, eg:
  2388.  
  2389.     ReSeed TIMER
  2390.  
  2391. Note that the Toolbox random number seed is not the same as the one used
  2392. internally by VisualBASIC. You cannot, therefore, start a new sequence of
  2393. QB's RND values by using RESEED nor can you use RANDOMIZE to reinitialise
  2394. the sequence for RAND.
  2395.  
  2396. SCREENDUMP
  2397.  
  2398. Copies the contents of the current screen (text mode only) to the line
  2399. printer, just as if the operator had pressed the <Prt Scrn> key.
  2400.  
  2401. No calling parameters are required.
  2402.  
  2403. DECLARE SUB ScreenDump ()
  2404.  
  2405. Includes support for 43 and 50-line screens on EGA and VGA adaptors.
  2406.  
  2407. This routine will not work if screen print has previously been disabled by
  2408. a call to the DISABLEPRTSC routine (see above) or if the parallel printer
  2409. at LPT1: is not ready.
  2410.  
  2411.  
  2412. SCREENROWS
  2413.  
  2414. Returns the height of the current screen, in rows, as set by the last
  2415. WIDTH statement (default = 25).
  2416.  
  2417. No calling parameters are required.
  2418.  
  2419. DECLARE FUNCTION ScreenRows% ()
  2420.  
  2421. The number returned may be 25, 43 or 50, depending on the capabilities of
  2422. your display adaptor.
  2423.  
  2424.  
  2425. SCREENWIDTH
  2426.  
  2427. Returns the width of the current screen, in columns, as set by the last
  2428. WIDTH statement.
  2429.  
  2430. No calling parameters are required.
  2431.  
  2432. DECLARE FUNCTION ScreenWidth% ()
  2433.  
  2434. Possible return values are 40 and 80 (default = 80).
  2435.  
  2436.  
  2437. SCRLOCK
  2438.  
  2439. Toggles SCROLL LOCK on or off or, alternatively, reads the current SCROLL
  2440. LOCK key setting.
  2441.  
  2442. DECLARE FUNCTION ScrLock% (BYVAL Switch%)
  2443.  
  2444. Switch% = 0  Turns SCROLL LOCK off
  2445.         = 1  Turns SCROLL LOCK on
  2446.  
  2447. Any other value just returns the current SCROLL status as a logical value
  2448. where -1 (TRUE) means that SCROLL LOCK is on and 0 (FALSE) means that the
  2449. SCROLL LOCK is off.
  2450.  
  2451.  
  2452. SCROLL
  2453.  
  2454. Scrolls the contents of a screen rectangle a specified number of lines or
  2455. columns in the direction indicated, blank spaces of the background colour
  2456. specified are scrolled in to replace them.
  2457.  
  2458. DECLARE SUB Scroll (BYVAL Dir%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  2459.                     BYVAL X2%, BYVAL Units%, BYVAL Attr%)
  2460.  
  2461. Dir%        =  Scroll direction (0 = down, 1 = up, 2 = left, 3 = right).
  2462. Y1%         =  Top-left row of rectangle to be scrolled.
  2463. X1%         =  Top-left column of rectangle.
  2464. Y2%         =  Bottom-right row of rectangle.
  2465. X2%         =  Bottom-right column of rectangle
  2466. Units%      =  Number of rows or columns to scroll.
  2467. Attr%       =  Display attribute of blank spaces scrolled in.
  2468.  
  2469. Notes:      This routine will work in all graphics modes as well as on
  2470.             the text screen. When scrolling the graphics screen up or
  2471.             down, however, the attribute value must be calculated in a
  2472.             different way:
  2473.  
  2474.             On 320 x 200 4-colour and 640 x 200 2-colour displays the
  2475.             attribute represents a 1-byte pixel pattern, which is
  2476.             equivalent to 8 pixels in 2-colour (SCREEN 2) mode and 4
  2477.             pixels in 4-colour (SCREEN 1) mode. This pixel pattern is
  2478.             replicated through all the blank lines scrolled in.
  2479.  
  2480.             In all other EGA, VGA and MCGA display modes, ATTR% is
  2481.             the colour value for each pixel in the blanked lines.
  2482.  
  2483.             Scrolling sideways in graphics modes, using this routine,
  2484.             does not provide sufficiently fine movement for animation
  2485.             effects, but see the CGASCROLL and MCGASCROLL procedures
  2486.             (above) for a more precise alternative.
  2487.  
  2488.  
  2489. SECURE
  2490.  
  2491. Toggles bit zero of the specified file's directory entry, making it either
  2492. Read-only or Read/Write.
  2493.  
  2494. DECLARE SUB Secure (BYVAL Switch%, FileSpec$)
  2495.  
  2496. If SWITCH% = 1 the file is made Read-only (regardless of whether it can be
  2497. currently written to or not), any other value makes the file Read/Write.
  2498. FILESPEC is the name of the file to be hidden or unhidden. It can include
  2499. a drive letter and directory path but must be an explicit pathname,
  2500. wildcard characters are not allowed.
  2501.  
  2502.  
  2503. SERIALPORTS
  2504.  
  2505. This function checks how many serial ports are available, it does not
  2506. check to see if devices are connected to any of them.
  2507.  
  2508. No calling parameters are required.
  2509.  
  2510. DECLARE FUNCTION SerialPorts% ()
  2511.  
  2512.  
  2513. SHARE
  2514.  
  2515. Toggles bit seven of the specified file's directory entry, making it
  2516. either Shareable or Non-shareable. This routine will only work when the
  2517. program which calls it is running under a Novell Network.
  2518.  
  2519. DECLARE SUB Share (BYVAL Switch%, FileSpec$)
  2520.  
  2521. If SWITCH% = 1 the file is made Shareable (regardless of whether it can be
  2522. currently used by other programs or not), any other value makes the file
  2523. Non-shareable. FILESPEC is the name of the file to be shared. It can
  2524. include a drive letter and directory path but must be an explicit
  2525. pathname, wildcard characters are not allowed.
  2526.  
  2527.  
  2528. SHARING
  2529.  
  2530. Reports if SHARE.EXE, the MS-DOS file sharing support module, is installed
  2531. in memory. No calling parameters are required.
  2532.  
  2533. DECLARE FUNCTION Sharing% ()
  2534.  
  2535. If SHARE is installed the function returns a value of -1 (logical TRUE),
  2536. otherwise zero (logical FALSE) is returned.
  2537.  
  2538. Note:   for some reason this function does not return reliable results
  2539.         when called in the VisualBASIC environment, although it works
  2540.         fine in stand-alone programs. Does QB[X] disable SHARE then?
  2541.         
  2542. The NETTEST function (above) returns similar information for file sharing
  2543. under a Novell Network.
  2544.  
  2545.  
  2546. SHUTUP
  2547.  
  2548. Closes the last window opened by the POPUP window procedure (see above)
  2549. and restores the contents of the screen below it.
  2550.  
  2551. DECLARE SUB ShutUp (BYVAL Speed%)
  2552.  
  2553. The Speed% parameter is a delay in milliseconds. If greater than zero
  2554. it produces the effect of imploding the storage buffer contents onto the
  2555. screen, making the window appear to vanish into a point source.
  2556.  
  2557.  
  2558. FILESIZE
  2559.  
  2560. This function will return the size of the file specified in bytes, or, if
  2561. more than one match is found, the total size of all such files. If a size
  2562. of zero is returned, no matching file exists (at least not in the
  2563. directory specified).
  2564.  
  2565. DECLARE FUNCTION FileSize& (FileSpec$)
  2566.  
  2567. The filename can include a directory path and may be ambiguous, using the
  2568. wildcard characters '*' and '?'.
  2569.  
  2570. Note:   In previous versions of the Toolbox this function was called
  2571.         SIZEOF. In MASM 6, however, SIZEOF is now a reserved word so the
  2572.         name has had to be changed.
  2573.  
  2574. SOUNDEX
  2575.  
  2576. Gets the phonetic equivalent of a string. This function returns a long
  2577. integer which represents the 'sound' of a string of text using the SOUNDEX
  2578. phonetic conversion algorithm. It can be used in 'fuzzy' searches, for
  2579. example, to scan a database for an individual when you are not sure of the
  2580. exact spelling of their surname. When searching for SMITH, for instance,
  2581. SOUNDEX would also match SMYTH and SMYTHE.
  2582.  
  2583. DECLARE FUNCTION Soundex& (Text$)
  2584.  
  2585. Note that the initial letter of the search string must exactly match the
  2586. initial letter of the target. GAMMELL and CAMMEL will return different
  2587. values when passed to SOUNDEX. Note also that the function will only
  2588. convert the first word of the string, translation stops at the first
  2589. blank space.
  2590.  
  2591.  
  2592. SPOOLER
  2593.  
  2594. Gets the installed state of the DOS print spooler, PRINT.COM, so that a
  2595. program can check if it is safe to submit files to the print queue.
  2596.  
  2597. No calling parameters are required.
  2598.  
  2599. DECLARE FUNCTION Spooler% ()
  2600.  
  2601. Returns:    -1  if spooler is installed
  2602.              0  if spooler is not installed
  2603.  
  2604.  
  2605. SPOOLDELETE
  2606.  
  2607. Deletes one or more files from the current print queue.
  2608.  
  2609. FileSpec$ should include the full pathname of the file to be deleted from
  2610. the print queue. It can be ambiguous, using the DOS wildcard characters
  2611. '*' and '?', allowing you to cancel the processing of a range of files
  2612. with a single command.
  2613.  
  2614. DECLARE SUB SpoolDelete (FileSpec$)
  2615.  
  2616. Note:       This function will only work if PRINT.COM, the DOS print
  2617.             spooler has been installed. You can use the SPOOLER
  2618.             function (see above) to check if PRINT.COM is available.
  2619.  
  2620.  
  2621. SPOOLFLUSH
  2622.  
  2623. Deletes all files from the current print queue and terminates output to
  2624. the printer.
  2625.  
  2626. No calling parameters are required.
  2627.  
  2628. DECLARE SUB SpoolFlush ()
  2629.  
  2630. Note:       This function will only work if PRINT.COM, the DOS print
  2631.             spooler has been installed. You can use the SPOOLER
  2632.             function (see above) to check if PRINT.COM is available.
  2633.  
  2634.  
  2635. SPOOLLIST
  2636.  
  2637. Returns the pathname of a file in the current print queue.
  2638.  
  2639. SPOOLLIST can only be used while printing is suspended after a call to the
  2640. SPOOLSUSPEND function (see below) has been made.
  2641.  
  2642. Buffer$ must be preset to a length of at least 64 bytes for the routine to
  2643. work, although you do not have to fill it with spaces first.  When called,
  2644. immediately after printing has been suspended, SPOOLLIST will return, in
  2645. Buffer$, the pathname of the first file in the spooler print queue.
  2646.  
  2647. Further calls will return the names of subsequent files in the queue until
  2648. a string of blank spaces indicates that all entries have been read.
  2649.  
  2650. DECLARE SUB SpoolList (Buffer$)
  2651.  
  2652. The following example demonstrates how SPOOLLIST, SPOOLSUSPEND and
  2653. SPOOLRESTART can be used in a VisualBASIC program.
  2654.  
  2655.     CONST FALSE = 0, TRUE = NOT FALSE
  2656.  
  2657.     Buffer$ = STRING$(64, "*")
  2658.  
  2659.     Status% = SpoolSuspend%
  2660.     PRINT "Spooler suspended, status is"; Status%
  2661.     PRINT "Files in print queue are ...": PRINT
  2662.     Done% = FALSE: Number% = 1
  2663.     DO
  2664.         SpoolList Buffer$
  2665.         IF Buffer$ = SPACE$(64) THEN
  2666.            Done% = TRUE
  2667.         ELSE
  2668.            PRINT Number%, Buffer$
  2669.            Number% = Number% + 1
  2670.        END IF
  2671.     LOOP UNTIL Done%
  2672.     CALL SpoolReStart
  2673. END
  2674.  
  2675. Use SPOOLRESTART (see below) to resume printing after it has been
  2676. suspended for a listing of the queue contents to be made.
  2677.  
  2678. Note:       This function will only work if PRINT.COM, the DOS print
  2679.             spooler has been installed. You can use the SPOOLER
  2680.             function (see above) to check if PRINT.COM is available.
  2681.  
  2682.  
  2683. SPOOLRESTART
  2684.  
  2685. Re-enables output of spooled files to the printer after it has been
  2686. suspended for a status check or for the queue contents to be listed.
  2687.  
  2688. No calling parameters are required.
  2689.  
  2690. DECLARE SUB SpoolReStart ()
  2691.  
  2692. Note:       This function will only work if PRINT.COM, the DOS print
  2693.             spooler has been installed. You can use the SPOOLER
  2694.             function (see above) to check if PRINT.COM is available.
  2695.  
  2696.  
  2697. SPOOLSUBMIT
  2698.  
  2699. Submits a file for processing by the DOS print spooler. 
  2700.  
  2701. FileSpec$ should contain the full pathname of the file to be printed and
  2702. should be no longer than 64 characters. Wildcard characters are not
  2703. allowed. If found, the file will be added to the end of the current print
  2704. queue.
  2705.  
  2706. DECLARE SUB SpoolSubmit (FileSpec$)
  2707.  
  2708. Note:       This function will only work if PRINT.COM, the DOS print
  2709.             spooler has been installed. You can use the SPOOLER
  2710.             function (see above) to check if PRINT.COM is available.
  2711.  
  2712.  
  2713. SPOOLSUSPEND
  2714.  
  2715. Suspends output from the DOS print spooler and reports if an error has
  2716. been encountered. Printing is suspended until you use the SPOOLRESTART
  2717. procedure (see above) to resume output. 
  2718.  
  2719. No calling parameters are required.
  2720.  
  2721. DECLARE FUNCTION SpoolSuspend% ()
  2722.  
  2723. Returns:     0 = no errors
  2724.              1 = invalid function
  2725.              2 = file not found
  2726.              3 = path not found
  2727.              4 = too many open files
  2728.              5 = access denied
  2729.              8 = queue full
  2730.              9 = spooler busy
  2731.             12 = name too long
  2732.             15 = invalid drive    
  2733.  
  2734. SPOOLLIST (see above), which returns the pathnames of files in the print
  2735. queue, can only be called while the spooler is suspended.
  2736.  
  2737. Note:       This function will only work if PRINT.COM, the DOS print
  2738.             spooler has been installed. You can use the SPOOLER
  2739.             function (see above) to check if PRINT.COM is available.
  2740.  
  2741.  
  2742. STATUSLINE
  2743.  
  2744. This procedure displays the message supplied on the bottom line of the
  2745. display, prompts the user for a keypress, waits until it is received and
  2746. then returns, restoring the screen to its former state. The  ASCII value
  2747. of the keypress is returned in the variable that you assign to the
  2748. function.
  2749.  
  2750. DECLARE FUNCTION StatusLine% (Message$)
  2751.  
  2752. Note:       StatusLine will recognise if an EGA or VGA is installed and
  2753.             will correctly locate itself if the screen is in 43 or 50-
  2754.             line mode.
  2755.  
  2756.  
  2757. STRINGSCAN
  2758.  
  2759. This routine searches a variable-length string array for the string
  2760. specified, returning the element number it occupies if found.
  2761.  
  2762. DECLARE FUNCTION StringScan% (Trgt$, BYVAL Size%, BYVAL Strt%, BYVAL Addr%)
  2763.  
  2764. Arguments:  Trgt$ = target string to be searched for.
  2765.             Size% = number of array elements to be searched.
  2766.             Strt% = array element to start searching at.
  2767.             Addr% = address of start element (the VARPTR value).  
  2768.                      
  2769. See also the STRINGSORT routine (below) for a fast method of sorting a
  2770. variable-length string array.
  2771.  
  2772.  
  2773. STRINGSORT
  2774.  
  2775. This procedure can sort a string array into ascending or descending order,
  2776. very quickly indeed.
  2777.  
  2778. DECLARE SUB StringSort (BYVAL Dir%, BYVAL Size%, BYVAL Addr%)
  2779.  
  2780. Arguments:  Dir%    = sort direction (0 = ascending, 1 = descending).
  2781.             Size%   = number of elements to sort.
  2782.             Addr%   = VARPTR of element to start sorting from.
  2783.  
  2784. Note:       This routine now works perfectly with Extended VisualBASIC
  2785.             far string arrays, provided that the range of elements to
  2786.             sort are contained within a single 64K segment. If the
  2787.             array extends over more than one segment then no sorting
  2788.             will be performed at all.
  2789.  
  2790.  
  2791. ULPRINT
  2792.  
  2793. Sends the text supplied, to the printer, as a string of underlined
  2794. characters.  Output begins at the current print position and can,
  2795. optionally, append a carriage-return/linefeed to take the print head to
  2796. the beginning of a new line when finished.
  2797.  
  2798. DECLARE SUB UlPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  2799.  
  2800. Arguments:  Printer%    the parallel port output is to be sent to
  2801.                         (1 = LPT1:, 2 = LPT2:, etc.).
  2802.             Buffer$     the string of text to be printed.
  2803.             NewLine%    set this to a non-zero value if you want 
  2804.                         to move to a new line after printing.
  2805.  
  2806. The routine restores the previous print style or font before it returns
  2807. and does not effect subsequent output to the printer, using the VisualBASIC
  2808. LPRINT or PRINT # statements.
  2809.  
  2810. Note:       The version of this routine stored in the Toolbox
  2811.             library is for EPSON compatible printers. If you have
  2812.             an IBM graphics printer or ProPrinter, then you should
  2813.             rebuild your libraries, using either the PRINTIBM.OBJ
  2814.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  2815.  
  2816.  
  2817. VERIFY
  2818.  
  2819. This function opens a dialogue box, centered at the screen row specified,
  2820. in which is displayed a prompt supplied by the caller. The routine adds a
  2821. further Y/N prompt, and then waits for a keypress. Only <Y/N> responses
  2822. (in upper or lower case) are accepted and the value that is returned
  2823. evaluates to Boolean TRUE (-1), if a Y(es) response was entered, and
  2824. Boolean FALSE (0) if the reply was N(o). The screen is restored to its
  2825. previous state on exit from the function.
  2826.  
  2827. DECLARE FUNCTION Verify% (BYVAL Default%, BYVAL Row%, Prompt$,_
  2828.                           BYVAL Attr%, BYVAL Mouse%)
  2829.  
  2830. DEFAULT%    Specifies the radio button to be highlighted as the default
  2831.             response on entry into the function. Pressing <Return> or
  2832.             clicking the left mouse button without moving the pointer
  2833.             will produce the specified response. If DEFAULT% is set to
  2834.             one the YES button is highlighted. Any other value highlights
  2835.             the NO button. 
  2836.  
  2837. ROW%        The top row of the dialogue box when it is displayed. The
  2838.             box is automatically centered within this row, which may be
  2839.             adjusted so that it remains within the screen boundaries.
  2840.  
  2841. PROMPT$     A string of text comprising the message to be displayed. It
  2842.             must be no longer than 40 characters otherwise it will be
  2843.             truncated to fit inside the display panel.
  2844.  
  2845. ATTR%       The display attribute or colour to be given to the dialogue box.
  2846.             If an argument of zero is supplied, the box is displayed with
  2847.             bright white text on a blue background (colour monitors) or in
  2848.             reverse video (monochrome monitors).
  2849.  
  2850. MOUSE%      should be set to TRUE (-1) or FALSE (0) to indicate if a mouse
  2851.             is installed and can be used to respond.    
  2852.  
  2853. Notes:      The user can respond, either by pressing the <Y> or <N> keys
  2854.             or by using <TAB> to highlight the appropriate radio button
  2855.             and then pressing <RETURN>. 
  2856.  
  2857. Mouse support has now been added, enabling the operator to respond by
  2858. clicking the mouse cursor on the appropriate radio button.
  2859.  
  2860.  
  2861. VGADIM
  2862.  
  2863. Allows a program running on a computer fitted with VGA to dim or brighten
  2864. the display intensity.
  2865.  
  2866. DECLARE SUB VGADim (BYVAL Intensity%)
  2867.  
  2868. Intensity% is a number in the range -63 to +63 which sets the brightness
  2869. of the screen relative to the default value (zero).
  2870.  
  2871.  
  2872. VGALOAD
  2873.  
  2874. Loads EGA, VGA and MCGA screens into video memory from disk. This is an
  2875. alternative to the VisualBASIC BLOAD statement which cannot be used with
  2876. the higher-resolution graphics displays provided by SCREEN modes 7 to 13.
  2877.  
  2878. DECLARE SUB VGALoad (File$)
  2879.  
  2880. FILE$ must be a legal DOS filename, including extension, drive letter and
  2881. directory path where appropriate.
  2882.  
  2883. Note:       The screen image must have been previously written to a disk
  2884.             file using the VGASAVE procedure (see below) and should have
  2885.             the same resolution as that provided by the current SCREEN.
  2886.  
  2887.  
  2888. VGAPAN
  2889.  
  2890. Sets the display window co-ordinates for EGA, VGA and MCGA screens.
  2891.  
  2892. This procedure sets the origins of display window within the video display
  2893. buffer used by the EGA, VGA and MCGA adaptors.  Normally this is at the
  2894. top left-hand corner of the graphics image, but by changing co-ordinates
  2895. you can pan the display through video memory, to create some interesting
  2896. animation effects.
  2897.  
  2898. DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  2899.  
  2900. Example program
  2901.  
  2902. ' OUTPAN.BAS - pans the virtual screen window on EGA and VGA
  2903. '              display adaptors.
  2904. '
  2905. '   Author:    Christy Gemmell
  2906. '   For:       Assembly-Language ToolBox for VisualBASIC
  2907. '   Date:      11/12/89
  2908. '
  2909.     DECLARE FUNCTION KeyIn% ()
  2910.     DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  2911.  
  2912.     CONST FALSE = 0, TRUE = NOT FALSE
  2913.  
  2914.     SCREEN 9: LINE (0, 0)-(639, 349), 9, BF
  2915.     VIEW SCREEN (40, 25)-(600, 325), 0, 15
  2916.     CIRCLE (319, 174), 150, 14: PAINT (319, 174), 14, 14
  2917.  
  2918.     X% = 0: Y% = 0
  2919.  
  2920.     DO
  2921.         KeyPress% = KeyIn%: Pan% = TRUE
  2922.         SELECT CASE KeyPress%
  2923.             CASE -75
  2924.                 IF X% > 0 THEN X% = X% - 1
  2925.             CASE -77
  2926.                 IF X% < 79 THEN X% = X% + 1
  2927.             CASE -72
  2928.                 IF Y% > 0 THEN Y% = Y% - 1
  2929.             CASE -80
  2930.                 IF Y% < 22 THEN Y% = Y% + 1
  2931.             CASE ELSE
  2932.                 Pan% = FALSE
  2933.         END SELECT
  2934.         IF Pan% THEN VGAPan X%, Y% * 5
  2935.     LOOP UNTIL KeyPress% = 27
  2936. END
  2937.  
  2938.  
  2939. VGASAVE
  2940.  
  2941. Saves EGA, VGA and MCGA screens from video memory to disk. 
  2942.  
  2943. The normal VisualBASIC BLOAD and BSAVE statements only work properly with
  2944. text and CGA graphics screens. This routine allows you to do the same
  2945. with higher-resolution graphic displays in SCREEN modes 7 to 13.
  2946.  
  2947. DECLARE SUB VGASave (File$)
  2948.  
  2949. FILE$ must be a legal DOS filename, including the extension, drive letter
  2950. and directory path where appropriate.
  2951.  
  2952. A companion procedure, VGALOAD (see above) is provided to allow you to
  2953. retrieve the graphics image from disk, and restore it to the screen.
  2954.  
  2955. Example program
  2956.  
  2957. ' VGAFILE.BAS  saves and loads a high-resolution graphics image
  2958. '
  2959. '   Author:     Christy Gemmell
  2960. '   For:        Assembly-Language ToolBox for VisualBASIC
  2961. '   Date:       11/12/89
  2962. '
  2963. '   Graphics converted from Microsoft Extended Color BASIC
  2964. '
  2965.     DECLARE SUB VGALoad (File$)
  2966.     DECLARE SUB VGASave (File$)
  2967.  
  2968.     ScreenMode% = 12              ' Try other modes as well
  2969.  
  2970.     SELECT CASE ScreenMode%
  2971.         CASE 7, 13
  2972.              xMax% = 319: yMax% = 199
  2973.         CASE 8
  2974.              xMax% = 639: yMax% = 199
  2975.         CASE 9, 10
  2976.              xMax% = 639: yMax% = 349
  2977.         CASE 11, 12
  2978.              xMax% = 639: yMax% = 479
  2979.         CASE ELSE
  2980.     END SELECT
  2981.  
  2982.     SCREEN ScreenMode%: KEY OFF
  2983.     LINE (0, 0)-(xMax%, yMax%), 6, BF
  2984.     VIEW (32, 4)-(xMax% - 32, yMax% - 4), 0, 5
  2985.     WINDOW SCREEN (0, 0)-(255, 191)
  2986.     FOR I% = 1 TO 40
  2987.         READ A%, B%, C%, D%: LINE (A%, B%)-(C%, D%), 1
  2988.     NEXT I%
  2989.     PAINT (56, 20), 1, 1: PAINT (136, 64), 1, 1
  2990.     PAINT (120, 80), 1, 1: PAINT (192, 88), 14, 1
  2991.     PAINT (76, 48), 14, 1: PAINT (124, 60), 14, 1
  2992.     PAINT (68, 12), 2, 1: PAINT (80, 84), 2, 1
  2993.     PAINT (92, 128), 2, 1: PAINT (36, 156), 12, 1
  2994.     PAINT (36, 168), 1, 1: PAINT (84, 178), 14, 1
  2995.     PAINT (88, 118), 12, 1: PAINT (144, 86), 12, 1
  2996.     VGASave "ESCHER.IMG": SLEEP 1: CLS : SLEEP 3
  2997.     VGALoad "ESCHER.IMG": R$ = INPUT$(1)
  2998. END
  2999.  
  3000. DATA    68,4,200,76,52,12,112,44,128,52,172,76,128,52,68,84,112,44,84,60
  3001. DATA    128,68,99,84,68,36,97,52,128,68,154,84,128,68,128,116,128,52,128
  3002. DATA    68,68,4,52,12,172,76,142,90,142,76,142,108,142,108,200,76,200,76
  3003. DATA    200,92,200,92,68,164,128,116,84,140,52,12,52,154,52,154,68,164
  3004. DATA    68,164,68,100,68,36,68,84,84,45,84,76,84,109,84,140,68,100,97,116
  3005. DATA    84,124,112,108,68,84,128,116,84,76,112,92,112,77,112,108,84,119
  3006. DATA    92,114,142,86,151,82,180,66,186,62,186,62,236,90,236,90,68,184
  3007. DATA    68,184,16,154,16,154,52,133,16,154,16,160,16,160,68,190,68,190
  3008. DATA    68,184,68,190,236,96,236,96,236,90
  3009.  
  3010.  
  3011. VGATEXT
  3012.  
  3013. Writes characters to the screen in EGA and VGA graphics modes.
  3014.  
  3015. DECLARE SUB VgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  3016.                      BYVAL Attr%, BYVAL Scale%)
  3017.  
  3018. This routine provides a convenient way of displaying text in any of the
  3019. EGA and VGA graphics modes (SCREENs 7-12) without having to bother about
  3020. loading external font files. It uses the standard character definition
  3021. tables built into your display adaptor, but allows you to scale them up to
  3022. eight times normal size and to specify any combination of foreground and
  3023. background colours supported by the current video mode.
  3024.  
  3025. XLOC%       The horizontal co-ordinate of the top left hand pixel
  3026.             from which the text will begin
  3027.  
  3028. YLOC%       The vertical co-ordinate of the top left hand pixel
  3029.             from which the text will begin
  3030.  
  3031. TEXT$       The string of text to be displayed (up to 63 characters).
  3032.  
  3033. ATTR%       The colour (or display attribute in monochrome modes) to
  3034.             be given to the text. This is calculated by the formula:
  3035.  
  3036.             Colour% = (Background% * 256) + Foreground%
  3037.  
  3038.             Foreground and Background values are in the ranges used
  3039.             by the current video mode (eg. 0 - 15 for SCREEN 9). The
  3040.             actual colours displayed depend upon your current PALETTE
  3041.             settings.
  3042.  
  3043.             Note:   supplying a value of -1 for background prevents
  3044.                     background pixels from being changed at all. This
  3045.                     allows text to be blended more naturally into a
  3046.                     complex graphics display.
  3047.  
  3048. SCALE%      The character size of the text to be displayed. This ranges
  3049.             from 1 to 8, where 1 is standard 80-column text (40-column
  3050.             in SCREEN 7) and 8 multiplies the character size by eight
  3051.             on both the horizontal and vertical axes.
  3052.  
  3053. VGATEXT can handle both byte-aligned and non byte-aligned characters. The
  3054. x, y co-ordinates you supply do not need to correspond to a row, column
  3055. character cell in SCREEN 0, the alphanumeric mode. The complete extended
  3056. ASCII character set is supported, including foreign symbols and
  3057. box-drawing characters.
  3058.  
  3059. Since VGATEXT does not support clipping, to ensure a clean display you
  3060. must ensure that the text to be output fits within the current screen
  3061. boundaries.
  3062.  
  3063. See also CGATEXT for displaying characters in SCREEN 1 and MCGATEXT for
  3064. displaying characters in SCREEN 13.
  3065.  
  3066.  
  3067. WEEKDAY
  3068.  
  3069. This function is used to determine the day of the week for a given date.
  3070. It does this by temporarily resetting the system date to the one supplied,
  3071. reading the day from DOS, and then restoring the old date. The weekday is
  3072. returned as a number between 0 and 6, signifying Sunday through Saturday.
  3073.  
  3074. DECLARE FUNCTION WeekDay% (BYVAL Day%, BYVAL Month%, BYVAL Year%)
  3075.  
  3076.  
  3077. ──────────────────────────────────────────────────────────────────────
  3078.  
  3079. EXTRA ROUTINES FOR QB4
  3080.  
  3081. The following functions and procedures are only included in the version of
  3082. the Toolbox intended for VisualBASIC 4.x and BASIC 6. They are omitted from
  3083. the later version because the Extended VisualBASIC language provided with
  3084. the BASIC 7 Professional Development System includes new statements and
  3085. functions that render them unneccessary. Well they say that imitation IS
  3086. the sincerest form of flattery!
  3087.  
  3088.  
  3089. FINDFIRST
  3090.  
  3091. This routine sets the Disk Transfer Address to point to a local buffer and
  3092. then attempts to find a match for the file specified in WildCard$. If one
  3093. or more matches are found, the filename of the first matching file (minus
  3094. directory path), is stuffed into the second string argument. If no match
  3095. is found, this string is filled with blank spaces.
  3096.  
  3097. DECLARE SUB FindFirst (Attr%, WildCard$, Match$)
  3098.  
  3099. WildCard$ can contain an ambiguous filename, using the wildcard characters
  3100. * and ?, in which case FINDFIRST will only find the first matching file.
  3101. To obtain the names of any subsequent matches, use the FINDNEXT function
  3102. (see below).
  3103.  
  3104. Match$ must be at least twelve characters long to hold the returning
  3105. filename and extension. You do not need to clear the string first as the
  3106. function does that for you, automatically.
  3107.  
  3108. Normally, only visible files with full read\write access are found, but
  3109. you can extend this to search for hidden, read-only or system files as
  3110. well by setting the Attr% parameter to the appropriate attribute value.
  3111.  
  3112.    Attr% = 0   Visible read\write
  3113.            1   Read-only files
  3114.            2   Hidden files
  3115.            4   System files
  3116.  
  3117. Do not use the FILESIZE function while searching for files with FINDFIRST
  3118. and FINDNEXT. Since both routines relocate the DOS Disk Transfer Address
  3119. during operation, this may lead to a conflict which will cause your
  3120. program to lose track of one or more open files. You should, in any case,
  3121. always use the RESETDTA routine to restore the Disk Transfer Address after
  3122. FINDFIRST/FINDNEXT is completed.
  3123.  
  3124. The DIR$ function which Microsoft have added to Extended VisualBASIC (QBX)
  3125. provides a built-in FINDFIRST/FINDNEXT service which makes the Toolbox
  3126. routines redundant. They are, therefore, omitted from the BASIC 7 version.
  3127.  
  3128.  
  3129. FINDNEXT
  3130.  
  3131. Finds successive matches of an ambiguous filename after a previously
  3132. successful call to FINDFIRST (see above). You can call it repeatedly
  3133. until a blank string is returned in Match$, in which case there are
  3134. no more files to be found.
  3135.  
  3136. DECLARE SUB FindNext (Match$)
  3137.  
  3138. Match$ must be at least twelve characters long to hold the returning
  3139. filename and extension. It does not have to be cleared first, since the
  3140. routine does this for you, automatically.
  3141.  
  3142. Do not make use the FILESIZE function while searching for files with
  3143. FINDFIRST and FINDNEXT. Since both routines relocate the DOS Disk Transfer
  3144. Address during operation, this may lead to a conflict which will cause
  3145. your program to lose track of one or more open files. You should, in any
  3146. case, always use the RESETDTA routine to restore the Disk Transfer Address
  3147. after FINDFIRST/FINDNEXT is completed.
  3148.  
  3149. The DIR$ function which Microsoft have added to Extended VisualBASIC (QBX)
  3150. provides a built-in FINDFIRST/FINDNEXT service which makes the Toolbox
  3151. routines redundant. They are, therefore, omitted from the BASIC 7 version.
  3152.  
  3153.  
  3154. GETDIR
  3155.  
  3156. This procedure writes the pathname of the currently logged directory into
  3157. the string supplied by the caller. The user can specify what drive to
  3158. return the directory for, or default to the current drive.
  3159.  
  3160. DECLARE SUB GetDir (Drive%, Path$)
  3161.  
  3162. This routine expects two arguments to be passed to it. The first is an
  3163. integer which specifies the drive to look at :
  3164.  
  3165. 0 = default drive, 1 = drive A:, 2 = drive B:, etc.
  3166.  
  3167. the second argument is a string which will hold the path of the directory
  3168. returned by DOS. The string must be at least 64 bytes long to hold the
  3169. information. If it were not, the function might overwrite other variables
  3170. in the program data space, with unpredictable results. The returned path-
  3171. name does not include the drive identifier or a leading '\' and is
  3172. terminated by a null (0) byte. if the current directory is the root
  3173. directory, therefore, the first byte of the string will be an ASCII zero,
  3174. not a null string.
  3175.  
  3176. The CURDIR$ function which Microsoft have added to Extended VisualBASIC
  3177. (QBX) allows you to obtain the current directory path and drive, making
  3178. GETDIR redundant. It is, therefore, omitted from the BASIC 7 version of
  3179. the Assembly Language Toolbox.
  3180.  
  3181.  
  3182. GETDRIVE
  3183.  
  3184. This function returns the number of the currently-logged drive.
  3185.  
  3186. No calling parameters are required.
  3187.  
  3188. DECLARE FUNCTION GetDrive% ()
  3189.  
  3190. Values returned are in the series 0 = A:, 1 = B:, 2 = C:, etc.
  3191.  
  3192. The CURDIR$ function which Microsoft have added to Extended VisualBASIC
  3193. (QBX) allows you to obtain the current directory path and drive, making
  3194. GETDRIVE redundant. It is, therefore, omitted from the BASIC 7 version of
  3195. the Assembly Language Toolbox.
  3196.  
  3197.  
  3198. RESETDTA
  3199.  
  3200. This procedure must always be called by your program after the FINDFIRST
  3201. and FINDNEXT functions have been used. It restores the Disk Transfer
  3202. Address to its default value originally set by VisualBASIC.
  3203.  
  3204. No calling parameters are required.
  3205.  
  3206. DECLARE SUB ReSetDTA ()
  3207.  
  3208.  
  3209. SETDRIVE
  3210.  
  3211. This function changes the currently-logged drive to the one specified by
  3212. the calling program (0 = A:, 1 = B:, etc.).
  3213.  
  3214. DECLARE SUB SetDrive (Drive%)
  3215.  
  3216. Since BASIC 7 has now introduced the CHDRIVE statement which performs the
  3217. same task, SETDRIVE is only supported in the version of the Toolbox
  3218. supplied to VisualBASIC 4 users.
  3219.  
  3220.  
  3221. ──────────────────────────────────────────────────────────────────────
  3222.  
  3223. ASSEMBLY-LANGUAGE TOOLBOX INTERNAL FUNCTIONS
  3224.  
  3225. The following functions and procedures are used internally by Toolbox
  3226. routines. Assembly-Language programmers may also call them when adding
  3227. routines of their own, provided the appropriate object modules are linked
  3228. to their program at runtime.
  3229.  
  3230.  
  3231. FLAGS
  3232.  
  3233. Sets or gets the current status of individual flags in the Intra-
  3234. Application Communications area (IAC), a 16-byte block of RAM reserved, by
  3235. DOS, for signalling between applications programs.
  3236.  
  3237. Three parameters must be passed on the stack, they are:
  3238.  
  3239.         1)  Switch%     0 = get flag,   1 = set flag
  3240.         2)  Flag%       the offset into the IAC flag table (0 to 15)
  3241.         3)  Setting%    the value to be set into the specified byte
  3242.                         of the flag table (if Switch% = 1).
  3243.  
  3244. This example code fragment sets letter 'A' (ASCII 65) into flag 8 (byte 9)
  3245. of the IAC area.
  3246.  
  3247.             .model  medium              ; Required for VisualBASIC
  3248.  
  3249.             extrn   Flags: far          ; Public name of called routine
  3250.  
  3251.             .code                       ; Define code segment
  3252.  
  3253.             mov     ax,1                ; Set a flag byte
  3254.             push    ax                  ; Pass it on the stack
  3255.             mov     ax,8                ; Flag number 8
  3256.             push    ax                  ; Pass it on the stack
  3257.             mov     ax,'A'              ; Value to set
  3258.             push    ax                  ; Pass it on the stack
  3259.             call    Flags               ; Call the function
  3260.  
  3261. You must still push three parameters onto the stack even if you are only
  3262. reading a flag setting. In this case the third argument will be ignored.
  3263.  
  3264. The setting of the specified IAC flag is returned in the lower byte of the
  3265. AX register (AL). All other registers are preserved.
  3266.  
  3267.  
  3268. GETVERSION
  3269.  
  3270. This function checks the version of DOS under which the host computer is
  3271. currently running.
  3272.  
  3273.             extrn   GetVersion: far
  3274.  
  3275. The following register values may be returned:
  3276.  
  3277.     AL      = Major Version       (MS-DOS 3.2 = 3, etc.)
  3278.     AH      = Minor Version       (MS-DOS 3.2 = 20, etc.) 
  3279.                             
  3280. GETVERSION can be called directly from VisualBASIC, in which case only the
  3281. Major and Minor version numbers returned in AX are available.
  3282.  
  3283. Note:   This function returns the correct version number even under
  3284.         DOS 5.x with SETVER configured to return a different number.
  3285.  
  3286.  
  3287. HIDECURSOR
  3288.  
  3289. Makes the cursor invisible. No parameters are required or returned.
  3290.  
  3291.             extrn   HideCursor: far
  3292.  
  3293. This method ORs the byte value of the cursor start line with 32 (20 Hex)
  3294. which, on all standard video adaptors, turns off the cursor while
  3295. preserving its display characteristics. You can use the SHOWCURSOR
  3296. routine (see below) to restore the cursor to its previous state.
  3297.  
  3298. Note:       HIDECURSOR can be called directly from VisualBASIC but, since
  3299.             the LOCATE statement provides an alternative means of turning
  3300.             off the cursor, it is not necessary.
  3301.  
  3302.  
  3303. SCREENADDRESS
  3304.  
  3305. Calculate screen address from a pair of row/column co-ordinates.
  3306.  
  3307.             extrn   ScreenAddress: far
  3308.  
  3309. Given the row/column column co-ordinate of a character on the screen, this
  3310. function returns the segment:offset address of that character in video
  3311. memory. The address is correctly adjusted to the start of the the
  3312. currently active display page, but no check is made to ensure that the
  3313. co-ordinates supplied are within the actual screen bounds.
  3314.  
  3315. Input:      AL      = Row co-ordinate of character (0 = row 1).
  3316.             AH      = Column co-ordinate of character (0 = column 1).
  3317.  
  3318. Output:     ES:DI==>  Address in video display buffer of the
  3319.                       character cell specified.
  3320.             DX      = CRT status register port address.
  3321.  
  3322. It is assumed that a previous call has been made to the VIDEOTYPE function
  3323. (see below), to determine the screen width, the port address of the CRT
  3324. status register and the correct video display segment. 
  3325.  
  3326.  
  3327. SCREENCOPY
  3328.  
  3329. Copy a character and attribute from the video display to a buffer at the
  3330. address specified.
  3331.  
  3332.             extrn   ScreenCopy: far
  3333.  
  3334. If the 'snow prevention' flag is set, this routine waits until the
  3335. beginning of the next CRT horizontal retrace period before reading data
  3336. from the display. This is necessary only on machines fitted with a Colour
  3337. Graphics Adaptor (CGA) which may suffer from glitches or screen snow if
  3338. data is copied from the screen while the video buffer is being refreshed.
  3339.  
  3340. Input:      DS:SI==>    Address of the screen location from which
  3341.                         the data is to be copied. 
  3342.             ES:DI==>    Address of the buffer into which the data
  3343.                         is to be copied.
  3344.             DX =        Port address of CRT status register.
  3345.  
  3346. Output:     SI and DI   Updated to point to next buffer locations.
  3347.             AX          destroyed.
  3348.  
  3349. It is assumed that a previous call has been made to the VIDEOTYPE function
  3350. (see below), to determine the screen width, the port address of the CRT
  3351. status register and the correct video display segment. VIDEOTYPE also sets
  3352. an internal 'snow-prevention' flag if the host machine has a CGA display
  3353. adaptor installed. This activates a routine which synchronises direct
  3354. video reads and writes to the CRT vertical retrace period, preventing
  3355. interference on the display.
  3356.  
  3357.  
  3358. SCREENREAD
  3359.  
  3360. Read a character and attribute from the display.
  3361.  
  3362.             extrn   ScreenRead: far
  3363.  
  3364. This procedure is similar to SCREENCOPY (see above), except that the word
  3365. is simply loaded into AX instead of being copied into a buffer.
  3366.  
  3367. Input:      DS:SI==>    address, in the video display buffer, from
  3368.                         where the data is to be read
  3369.             DX =        port address of the CRT status register.
  3370.  
  3371. Output:     AL =        character at the specified address
  3372.             AH =        display attribute given to character
  3373.             DI          updated to point to the next word address
  3374.  
  3375. It is assumed that a previous call has been made to the VIDEOTYPE function
  3376. (see below), to determine the screen width, the port address of the CRT
  3377. status register and the correct video display segment. VIDEOTYPE also sets
  3378. an internal 'snow-prevention' flag if the host machine has a CGA display
  3379. adaptor installed. This activates a routine which synchronises direct
  3380. video reads and writes to the CRT vertical retrace period, preventing
  3381. interference on the display.
  3382.  
  3383.  
  3384. SCREENWRITE
  3385.  
  3386. Output a character and attribute to the video display.
  3387.  
  3388.             extrn   ScreenWrite: far
  3389.  
  3390. If the 'snow prevention' flag is set, this routine waits until the
  3391. beginning of the next CRT horizontal retrace period before writing data to
  3392. the display. This is necessary only on machines fitted with a Colour
  3393. Graphics Adaptor (CGA) which may suffer from glitches or screen snow if
  3394. data is written to the screen while the video buffer is being refreshed.
  3395.  
  3396. Input:      ES:DI==>    Address in the video display buffer where
  3397.                         the data is to be written. 
  3398.             DX =        Port address of CRT status register.
  3399.             AL =        Character to output.
  3400.             AH =        Display attribute to set
  3401.  
  3402. Output:     DI          Updated to point to next output address.
  3403.  
  3404. It is assumed that a previous call has been made to the VIDEOTYPE function
  3405. (see below), to determine the screen width, the port address of the CRT
  3406. status register and the correct video display segment. VIDEOTYPE also sets
  3407. an internal 'snow-prevention' flag if the host machine has a CGA display
  3408. adaptor installed. This activates a routine which synchronises direct
  3409. video reads and writes to the CRT vertical retrace period, preventing
  3410. interference on the display.
  3411.  
  3412.  
  3413. SHOWCURSOR
  3414.  
  3415. Makes the cursor visible. No parameters are required or returned.
  3416.  
  3417.             extrn   ShowCursor: far
  3418.  
  3419. This method ANDs the byte value of the cursor start line with 31 (1F Hex)
  3420. which, restores the cursor after being made invisible by the HIDECURSOR
  3421. routine (see above).
  3422.  
  3423. Note:       SHOWCURSOR can be called directly from VisualBASIC but, since
  3424.             the LOCATE statement provides an alternative means of turning
  3425.             the cursor on and off, it is not needed in high-level code.
  3426.  
  3427.  
  3428. VIDEO
  3429.  
  3430. Video equipment check. This function returns information about the active
  3431. display adaptor installed in the host system.
  3432.  
  3433.             extrn   Video: far
  3434.  
  3435. No input parameters are required, on return AX should be examined for the
  3436. following values:
  3437.     
  3438.         AL = type of video adaptor installed
  3439.  
  3440.              1 = MDA   - Monochrome Display Adaptor
  3441.              2 = CGA   - Colour Graphics Adaptor
  3442.              3 = HGC   - Hercules Graphics Card
  3443.              4 = HGC+  - Hercules Graphics Card Plus
  3444.              5 = HIC   - Hercules InColour Card
  3445.              6 = EGA   - Extended Graphics Adaptor
  3446.              7 = PGA   - Professional Graphics Adaptor (IBM PS/2)
  3447.              8 = VGA   - Video Graphics Array
  3448.              9 = MCGA  - MultiColour Graphics Adaptor  (IBM PS/2)
  3449.  
  3450.         AH  (bits 0-6) = size of display memory in 16K blocks
  3451.                          (0 = <16K, 1 = 16K, 2 = 32K, etc.)
  3452.             (bit 7)    = type of display monitor in use
  3453.                          (0 = colour, 1 = monochrome) 
  3454.  
  3455.  
  3456. VIDEOTYPE
  3457.  
  3458. Collects information about the current video display and sets various
  3459. internal flags.
  3460.  
  3461.             extrn   VideoType: far
  3462.  
  3463. The correct video display segment and CRT status port addresses are
  3464. determined for the current system and, if necessary, the internal 'snow'
  3465. prevention flag is set.
  3466.  
  3467. Input:      nothing
  3468.  
  3469. Output:     AL =    Current display mode
  3470.             AH =    Screen width in columns
  3471.             BL =    Screen height in rows
  3472.             BH =    Active display page
  3473.  
  3474. You should make a preliminary call to this function before using any of
  3475. the other internal routines which directly access video memory.
  3476.  
  3477.  
  3478. WRITEBYTE
  3479.  
  3480. Output a byte of data to video memory.
  3481.  
  3482.             extrn   WriteByte: far
  3483.  
  3484. This procedure is similar to ScreenWrite, above, except that only a single
  3485. byte is written. It is used by the BackFill routine to reset the display
  3486. attribute of a character, without changing the character itself.
  3487.  
  3488. Input:      ES:DI==>    address, in the video display buffer, where
  3489.                         the byte is to be written.
  3490.             DX =        port address of the CRT status register.
  3491.             AL =        the byte value to be written.
  3492.  
  3493. Output:     DI          updated to point to the next byte address
  3494.  
  3495. It is assumed that a previous call has been made to the VIDEOTYPE function
  3496. (see above) to determine the screen width, the port address of the CRT
  3497. status register and the correct video display segment. VIDEOTYPE also sets
  3498. an internal 'snow-prevention' flag if the host machine has a CGA display
  3499. adaptor installed. This activates a routine which synchronises direct
  3500. video reads and writes to the CRT vertical retrace period, preventing
  3501. interference on the display.
  3502.  
  3503.  
  3504. ─────────────────────────────────────────────────────────────────────────
  3505.  
  3506.                     MIXED-LANGUAGE ROUTINES
  3507.  
  3508. These are native VisualBASIC functions and procedures which call the
  3509. machine-code routines in the Assembly-Language Toolbox for VisualBASIC.
  3510. To use them, you must link both TOOLBOX.LIB, from the Assembly-Language
  3511. Library disk, and the copy of MIXED.LIB from the Mixed-Language Library
  3512. disk to your stand-alone programs, like this:
  3513.  
  3514.     LINK yourprog,,,toolbox.lib mixed.lib;
  3515.  
  3516. Since the VisualBASIC environment only allows one Quick Library to be
  3517. loaded at a time, however, the version of MIXED.QLB supplied also
  3518. contains all the routines from TOOLBOX.LIB. This allows you to use the
  3519. environment to develop and test programs which use functions from 
  3520. both libraries. Just start VisualBASIC with the command:
  3521.  
  3522.     QB(X) yourprog /L mixed.qlb
  3523.  
  3524. You can even build your own Quick Libraries, incorporating Toolbox
  3525. routines, using the VisualBASIC Linker as follows:
  3526.  
  3527.     LINK /QU yoursub.obj yourfun.obj toolbox.lib mixed.lib,,bqlb45.lib;
  3528.  
  3529. BQLB45.LIB is the special interface library supplied with Microsoft's
  3530. VisualBASIC 4.5 compiler. Substitute the following library names for other
  3531. versions of the language.
  3532.  
  3533.     BQLB40.LIB          for VisualBASIC 4.0
  3534.     BQLB41.LIB          for BASIC 6.0
  3535.     QBXQLB.LIB          for BASIC 7.0 and 7.1 PDS
  3536.  
  3537. Be sure that, whichever interface library you use, it can be found by
  3538. LINK.EXE when the library is being built. This can be done, either by
  3539. copying it to the Linker's own directory or to a subdirectory pointed to
  3540. by a LIB= environment variable in your AUTOEXEC.BAT file, for example:
  3541.  
  3542.     SET LIB=C:\QB45\LIBRARY
  3543.  
  3544. See your MS-DOS or PC-DOS manual for more information about environment
  3545. variables.
  3546.  
  3547. If you have the Professional version of the Assembly-Language Toolbox,
  3548. of course, building customised libraries is much easier since a full
  3549. set of object (.OBJ) modules, together with source code, is supplied
  3550. with this release.
  3551.  
  3552. The stand-alone (.LIB) and Quick Library (.QLB) versions of the Mixed-
  3553. Language Toolbox both contain the following SUB programs and FUNCTION
  3554. procedures:
  3555.  
  3556.  
  3557. BARMENU
  3558.  
  3559. Creates and operates a menu orientated horizontally on the screen row
  3560. specified. The calling program must supply :
  3561.  
  3562. Row%        =   The screen row on which the menu bar will appear.
  3563. Atr%        =   The display attribute or colour for the menu bar.
  3564. Opt%        =   Number of options available for selection.
  3565. Menu$()     =   String array containing selection list. Menu$(0) should
  3566.                 be set to a string of ASCII characters, corresponding to
  3567.                 the initial or key letter of each option in the list.
  3568.                 Insert a space at the appropriate position of an option
  3569.                 to be disabled. In the remaining option strings an
  3570.                 ampersand '&' indicates that the next character is the
  3571.                 Hotkey to be highlighted for that option.
  3572. Bar%        =   The menu selection to be highlighted on entry into the
  3573.                 procedure.
  3574. Nxt%        =   If set, this flag just causes the menu to be refreshed
  3575.                 without pausing for a selection from the user. This is
  3576.                 used to handle presses on the Right or Left Arrow keys
  3577.                 in the Pull-Down Menu procedure.
  3578. Ctx%        =   If set, this flag indicates that context-sensitive help
  3579.                 is available, in which case ...
  3580. Tpc$        =   The root name of the Topic file to be displayed if the
  3581.                 user presses <F1> for help. The current selection number
  3582.                 is appended to this to produce the actual filename.
  3583.  
  3584.                 eg, if Tpc$ = "CONFIG" and Bar% = 3
  3585.                 
  3586.                 HelpMate (see TOOLBOX.DOC) will look for a Topic file
  3587.                 named CONFIG3.HLP.
  3588. Mouse%      =   If set, this flag indicates that a mouse is installed
  3589.                 and can be used to make selections.
  3590. HotKeys%    =   If set, this flag allows hotkeys to go directly to a
  3591.                 selection without you having to press <ENTER> as well.
  3592.  
  3593. DECLARE SUB BarMenu (Row%, Atr%, Opt%, Menu$(), Bar%, Nxt%, Ctx%,_
  3594.                      Topic$, Mouse%, HotKeys%)
  3595.  
  3596. On completion the procedure returns with the following variable set:
  3597.  
  3598. Bar%        =   Number of selection made by user. If zero then the
  3599.                 <Escape> key was pressed to abort the procedure
  3600.                 without making a selection.
  3601.  
  3602. VERMENU (see below) is a similar procedure which operates a vertically
  3603. orientated point-and-shoot type menu.
  3604.  
  3605. See the source code of DEMON.BAS, the Toolbox demonstration program, for
  3606. examples of BARMENU and VERMENU in use.
  3607.  
  3608.  
  3609. BINDEC
  3610.  
  3611. Translates a string of binary digits to their long integer decimal
  3612. equivalent.
  3613.  
  3614. DECLARE FUNCTION BinDec& (Binary$)
  3615.  
  3616.  
  3617. CAPITAL
  3618.  
  3619. Converts all alphabetic characters in a string to lower-case,
  3620. except for the first character of each word, which is forced
  3621. to upper-case.
  3622.  
  3623. DECLARE FUNCTION CapItal$ (Original$)
  3624.  
  3625. This function is designed for use in printing address labels
  3626. and can correctly identify and format proper surnames like
  3627. 'McLaughlin'.
  3628.  
  3629.  
  3630. CENTRE
  3631.  
  3632. Centres the string supplied within an empty string of specified width.
  3633.  
  3634. DECLARE FUNCTION Centre$ (Text$, MaxWidth%)
  3635.  
  3636. This function is called by the VERMENU routine (see below) to centre the
  3637. title of a pull-down menu within the window it refers to.
  3638.  
  3639.  
  3640. CHECKPRINTER
  3641.  
  3642. This procedure checks if the specified parallel printer is ready and
  3643. on-line. If so, it returns immediately with Ready% set to -1 (TRUE), if
  3644. not, CHECKPRINTER displays the message 'PRINTER NOT READY' on the bottom
  3645. row of the screen and waits for the operator to correct the problem and
  3646. press a key.
  3647.  
  3648. If the user presses <Escape>, the procedure returns with Ready% set to
  3649. zero (FALSE). Any other keystroke causes it to go back and test the
  3650. printer again. CHECKPRINTER will not return until either the printer is
  3651. ready for output, or the <Escape> key is pressed.
  3652.  
  3653. DECLARE SUB CheckPrinter (Printer%, Ready%)
  3654.  
  3655. Printer% is the number of the parallel printer to test (1 = LPT1: etc).
  3656.  
  3657. Example:    CheckPrinter 1, Ready%              ' Test LPT1:
  3658.             IF NOT Ready% THEN
  3659.                STOP
  3660.             ELSE
  3661.                LPRINT Stuff$
  3662.             END IF 
  3663.  
  3664.  
  3665. DATEINPUT
  3666.  
  3667. Accepts and verifies date input in a Reverse Video entry panel, all the
  3668. usual editing keys are supported and entry is terminated by either a
  3669. Carriage Return or one of several special function keys (see below).
  3670.  
  3671. DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  3672.  
  3673. Default$    =  default string which can be accepted by just pressing
  3674.                the <Enter> key.
  3675. Context%    =  set TRUE if context-sensitive help is available, in
  3676.                which case ... 
  3677. Topic$      =  name of the HELP Topic file to display whenever the
  3678.                <F1> key is pressed. 
  3679. HotKey%     =  If entry is terminated by anything other than the
  3680.                <Enter> key, this variable will contain an explanatory
  3681.                return code ..
  3682.  
  3683. Return Codes:   1  =  <Escape> abort entry returning a null string
  3684.                 2  =  <F2>     repeat previous entry for this field
  3685.                 3  =  <Up Arr> pressed, move to previous field 
  3686.                 4  =  <Dn Arr> pressed, move to next field
  3687.                 5  =  <Pg Up>  pressed, move to top of screen
  3688.                 6  =  <Pg Dn>  pressed, move to end of screen
  3689.  
  3690. Editing Keys:   <L.Arrow>   =  Move cursor one character to the left
  3691.                 <R.Arrow>   =  Move cursor one character to the right
  3692.                 <Home>      =  Move cursor to first character of field
  3693.                 <End>       =  Move cursor to last character of field
  3694.                 <Ctrl End>  =  Clear from current cursor position to
  3695.                                the end of the entry field.
  3696.                 <BackSpace> =  Replace character under cursor with a
  3697.                                blank space and move cursor one character
  3698.                                to the left.
  3699.                 <F1>        =  pop up on-line HELP screen.
  3700.  
  3701. DATEINPUT is designed to be used as part of a full-screen data-entry
  3702. system. Your program can examine the return code to determine whether
  3703. the operator wishes to terminate entry or move forwards or backwards
  3704. between entry fields.
  3705.  
  3706. See also the REVINPUT function for a similar, more general-purpose,
  3707. data-entry routine.
  3708.  
  3709.  
  3710. DAYSBETWEEN
  3711.  
  3712. Calculates the number of days between two dates, supplied as strings in
  3713. the format DD/MM/YYYY. The function will provide accurate results when
  3714. supplied with dates between 01/01/1901 and 31/12/2099.
  3715.  
  3716. DECLARE FUNCTION DaysBetween& (Date1$, Date2$)
  3717.  
  3718. See the INTERVAL function for a method of calculating the number of
  3719. days between two Julian dates.
  3720.  
  3721.  
  3722. DECBIN
  3723.  
  3724. Translates a decimal number to an equivalent string of binary digits.
  3725.  
  3726. DECLARE FUNCTION DecBin$ (Decimal&)
  3727.  
  3728.  
  3729. DOSVERSION
  3730.  
  3731. Gets the current Operating System (DOS) version. The version is returned
  3732. as a string in the form "3.20" (for DOS 3.2).
  3733.  
  3734. No calling parameters are required.
  3735.  
  3736. DECLARE FUNCTION DosVersion$ ()
  3737.  
  3738. The correct version will be returned, even under DOS 5.0 with SETVER
  3739. set to report otherwise.
  3740.  
  3741.  
  3742. FINDFILE
  3743.  
  3744. This function can be used to locate a particular file in any drive or
  3745. directory of the current system. Supply it with a pathname or an ambiguous
  3746. filespec and it will display a list of all matching files from which the
  3747. user can select the one required by highlighting it with the cursor arrow
  3748. keys. The function returns the full pathname of the file selected or a
  3749. null string if <ESC> was pressed.
  3750.  
  3751. DECLARE FUNCTION FindFile$ (FileSpec$, Attr%, Mouse%)
  3752.  
  3753. FileSpec$   =  Pathname of file to be located. It can include a drive
  3754.                letter and the filename may be ambiguous if you use the
  3755.                wildcard characters '*' or '?'.
  3756.  
  3757. Attr%       =  The display attribute for the file selection box if more
  3758.                than one match is expected. If Attr% = 0 the function
  3759.                uses default colours - Black on Cyan for colour monitors
  3760.                and inverse video for monochrome monitors.
  3761.  
  3762. Mouse%      =  set this to TRUE (non-zero) if mouse support is required.
  3763.  
  3764. On entry, FILESPEC$ should contain the name of the file to be located. If
  3765. the filespec is ambiguous, the program presents a directory listing, in a
  3766. popup window, of all files which match and allows the operator to select
  3767. the actual one required. If the pathname is explicit, FindFile just checks
  3768. if it actually exists. On return FILESPEC$, will contain the full pathname
  3769. of the selected file, or a null string if it was not located (or the
  3770. <Escape> key was pressed).
  3771.  
  3772.  
  3773. GETFLAG
  3774.  
  3775. The MIXED-LANGUAGE Toolbox includes a pair of functions which give you
  3776. access to the INTRA-APPLICATION COMMUNICATION AREA (IAC), an area of
  3777. memory which has been reserved, by DOS, so that programs can communicate
  3778. with each other. The IAC is 16 bytes long and is located, in low RAM at
  3779. addresses 0000:04F0 - 04FF (Hex). Once set, an IAC flag retains it's value
  3780. until you reset it or the computer is rebooted.
  3781.  
  3782. This function returns the value of one of the IAC flag bytes (1 to 16).
  3783.  
  3784. DECLARE FUNCTION GetFlag% (Flag%)
  3785.  
  3786. You can set the current setting of a particular IAC flag byte with the
  3787. SETFLAG function.
  3788.  
  3789. Since VisualBASIC programs, compiled with the /O switch to run stand-alone,
  3790. cannot pass variables to chain modules, you can use this feature to
  3791. implement a limited form of parameter passing.
  3792.  
  3793.  
  3794. GRATTRIB
  3795.  
  3796. Calculate display attribute for graphics modes, given the foreground
  3797. and background colours required.
  3798.  
  3799. DECLARE FUNCTION GrAttrib% (ForeGround%, BackGround%)
  3800.  
  3801. GRATTRIB calculates the attribute value which controls the foreground and
  3802. background colours of characters displayed using the GRAPRINT, CGATEXT,
  3803. MCGATEXT and VGATEXT procedures. It translates them using the formula:
  3804.  
  3805.     Attribute% = (BackGround% * 256) + ForeGround%
  3806.  
  3807. Make sure that you use foreground and background colour values appropriate
  3808. to the SCREEN mode currently in use.
  3809.  
  3810. The ATTRIBUTE function provides a similar service for use with text mode
  3811. screens
  3812.  
  3813.  
  3814. ISDIR
  3815.  
  3816. This routine tests to see if the supplied string is the name of a
  3817. directory. To do this a local error handler is established to trap any
  3818. run-time errors and an attempt is made to change to the directory
  3819. specified in TEST$. If an error occurs then ISDIR% is set to Boolean FALSE
  3820. (zero), otherwise TRUE (-1) is returned.
  3821.  
  3822. DECLARE FUNCTION IsDir% (Test$)
  3823.  
  3824. ISDIR is used by the FINDFILE function when searching for files on another
  3825. drive or directory.
  3826.  
  3827.  
  3828. LEGALNAME
  3829.  
  3830. This function returns TRUE or FALSE to indicate if the filespec passed to
  3831. it is legal. To do this, each character in the string is compared with a
  3832. set of illegal characters. If none are found a further check is made to
  3833. ensure there are no more than eight characters in the name and three in
  3834. the extension.
  3835.  
  3836. FUNCTION LegalName% (FileSpec$)
  3837.  
  3838.  
  3839. LINEUP
  3840.  
  3841. Returns a string representation of a numeric value. If COMMA% is TRUE
  3842. (non-zero) then the string has commas inserted between every group of
  3843. three digits to the left of the decimal. If LENGTH% is non-zero then the
  3844. resulting string is left padded with spaces to produce a string of the
  3845. required length. If CURRENCY$ is not null, the character it contains will
  3846. be prefixed to the returned string.
  3847.  
  3848. DECLARE FUNCTION LineUp$ (Num#, Places%, Comma%, Length%, Currency$)
  3849.  
  3850.  
  3851. LONGDATE
  3852.  
  3853. This function accepts a three-part numeric date and transcribes it into
  3854. a string containing the date in words. This includes the day of the week,
  3855. which is obtained by calling DOS's internal time and date services. DOS
  3856. is also used to check for an invalid date.
  3857.  
  3858. DECLARE FUNCTION LongDate$(Day%, Month%, Year%)
  3859.  
  3860. LONGDATE returns a null string if the arguments passed evaluate to an
  3861. illegal date (eg 29/2/1989).
  3862.  
  3863.  
  3864. MATCH
  3865.  
  3866. Returns the starting position of a string of characters within
  3867. a larger string.
  3868.  
  3869. DECLARE FUNCTION Match% (Start%, Search$, Pattern$)
  3870.  
  3871. Call with:  Start%   = character position in search string to
  3872.                        start searching from
  3873.             Search$  = String to search
  3874.             Pattern$ = String expression to search for 
  3875.  
  3876. Returns:    Position of first character of Pattern$ in Search$
  3877.             (0 if Pattern$ is not found)
  3878.  
  3879. Wildcards:  #   match any numeric character
  3880.             !   match any alphabetic character
  3881.             ?   match any character
  3882.  
  3883.             \   indicates that the next character in the string
  3884.                 to search for is literal, not a wildcard.
  3885.  
  3886. This function is similar to INSTR but allows the use of wildcards. It is
  3887. based on the MATCH function provided by Digital Research's C-BASIC.
  3888.  
  3889.  
  3890. MEDIA
  3891.  
  3892. Gets or sets the volume label and/or serial number of the specified
  3893. disk drive. Also returns the file system (FAT) type. This procedure
  3894. only works with DOS 5.0 or greater.
  3895.  
  3896. DECLARE SUB Media (Set%, Drive$, Volume$, Serial$, FileSy$)
  3897.  
  3898. Set%    =   FALSE (zero) Get media information.
  3899.             TRUE (non-zero) Set media information.
  3900. Drive$  =   The drive letter of the disk to be processed. A colon
  3901.             may be included although it is not necessary. If Drive$
  3902.             is a null string then the default, currently-logged, 
  3903.             drive is assumed.
  3904. Volume$ =   The disk volume label (maximum 11 characters). If this
  3905.             is a null string and Set% = TRUE, then the existing label
  3906.             is not changed. To blank out an existing volume label,
  3907.             fill Volume$ with at least one ASCII space character,
  3908. Serial$ =   The disk serial number (8 hexadecimal characters). If
  3909.             this is a null string and Set% = TRUE, then the existing
  3910.             serial number is not changed. When setting a new serial
  3911.             number do not include the intervening colon.
  3912. FileSy$ =   The file system in use on the specified drive. Under DOS 5
  3913.             this is either 12-bit or 16-bit FAT. Provided for information
  3914.             only, you cannot change it except by reformatting the drive.
  3915.  
  3916. Note that the Volume Label is the one written that is written into the
  3917. Boot Record when the disk is formatted and is not necessarily the same
  3918. as the one set or returned by the DOS LABEL command.
  3919.  
  3920.  
  3921. NEXTWORD
  3922.  
  3923. Extracts the first word from a string.
  3924.  
  3925. DECLARE FUNCTION NextWord$ (Last$)
  3926.  
  3927. This function extracts the first complete word from a string of
  3928. text and pads it with a single leading and trailing space. The
  3929. returned word is actually removed from string which was passed
  3930. to NEXTWORD so the function can be called repeatedly to extract
  3931. each word until LAST$ is empty.
  3932.  
  3933.  
  3934. PANEL
  3935.  
  3936. This procedure is used to produce rectangular boxes, upon the video
  3937. display, of various shapes and colours. The calling program should supply
  3938. the row/column co-ordinate of the top, left-hand corner of the required
  3939. panel, its height in rows and width in columns. You should also specify
  3940. the display attribute that the panel will be displayed in and the border
  3941. style to frame it with.
  3942.  
  3943. DECLARE SUB Panel (Row%, Col%, Rows%, Cols%, Border%, Attr%)
  3944.  
  3945. Panels can be drawn with the following border styles:
  3946.  
  3947. ┌───┐         ╔═══╗         ╓───╖        ╒═══╕
  3948. │ 1 │         ║ 2 ║         ║ 3 ║        │ 4 │
  3949. └───┘         ╚═══╝         ╙───╜        ╘═══╛
  3950.  
  3951. Any other value draws the panel without a border.
  3952.  
  3953. Although the boxes drawn by PANEL resemble popup windows, you cannot
  3954. restore the screen contents overwritten by a box once it has been drawn.
  3955. See the POPUP and SHUTUP routines, however, for a full windowing
  3956. system which does preserve the display.
  3957.  
  3958.  
  3959. REVINPUT
  3960.  
  3961. Accepts user input in a Reverse Video entry panel, all the usual editing
  3962. keys are supported and entry may be terminated by either a carriage-return
  3963. or one of several special function keys (see below).
  3964.  
  3965. DECLARE FUNCTION RevInput$ (Max%, Visible%, Default$, Legal$, Ctx%, Topic$,_
  3966.                             Mask%, HotKey%)
  3967.  
  3968. Max%         =  maximum number of characters which can be accepted.
  3969. Visible%     =  maximum number of characters which are visible on the
  3970.                 display. If non-zero and less than Max%, this is the
  3971.                 actual size of the data-entry panel.
  3972.     Note:       the data-entry panel will scroll, if necessary, to
  3973.                 ensure that the current character position is always
  3974.                 visible.      
  3975. Default$     =  default string which can be accepted by just pressing
  3976.                 the <Enter> key.
  3977. Legal$       =  a string of legal characters which are acceptable for
  3978.                 input. If a null string is passed then all printable
  3979.                 characters will be accepted. 
  3980. Ctx%         =  set TRUE if context-sensitive help is available, in
  3981.                 which case ... 
  3982. Topic$       =  name of the HELP Topic file to display whenever the
  3983.                 <F1> key is pressed. 
  3984. Mask%        =  if TRUE (non-zero) prevents the characters entered from
  3985.                 being echoed to the display. Instead an asterisk (*) is
  3986.                 displayed for each character position although the entry
  3987.                 string itself is unaffected. Use this for passwords.
  3988. HotKey%      =  If entry is terminated by anything other than the
  3989.                 <Enter> key, this variable will contain an explanatory
  3990.                 return code ..
  3991.  
  3992. Return Codes:   1  =  <Escape> abort entry returning a null string
  3993.                 2  =  <F2>     repeat previous entry for this field
  3994.                 3  =  <Up Arr> pressed, move to previous field 
  3995.                 4  =  <Dn Arr> pressed, move to next field
  3996.                 5  =  <Pg Up>  pressed, move to top of screen
  3997.                 6  =  <Pg Dn>  pressed, move to end of screen
  3998.                 7  =  A hotkey was supplied and used. The calling
  3999.                                program takes appropriate action.
  4000.  
  4001.                 You can specify any key as the hotkey by setting your
  4002.                 own value in HotKey% before calling REVINPUT. This
  4003.                 number can either be the ASCII code of any standard
  4004.                 key or the SCAN code (as a negative value) of one of
  4005.                 the function keys. Set HotKey% to zero to turn off
  4006.                 keyboard trapping (except for keys 1-6 above).            
  4007.  
  4008. Editing Keys:   <L.Arrow>   =  Move cursor one character to the left
  4009.                 <R.Arrow>   =  Move cursor one character to the right
  4010.                 <Home>      =  Move cursor to first character of field
  4011.                 <End>       =  Move cursor to last character of field
  4012.                 <Ctrl End>  =  Clear from current cursor position to
  4013.                                the end of the entry field.
  4014.                 <Insert>    =  Toggle between Insert and Overtype modes
  4015.                 <Delete>    =  Delete character under the cursor.
  4016.                 <BackSpace> =  Replace character under cursor with a
  4017.                                blank space and move cursor one character
  4018.                                to the left.
  4019.                 <F1>        =  pop up on-line HELP screen.
  4020.  
  4021. REVINPUT is designed to be used as part of a full-screen data-entry
  4022. system. Your program can examine the return code to determine whether the
  4023. operator wishes to terminate entry or move forwards or backwards between
  4024. entry fields.
  4025.  
  4026. See also the DATEINPUT function for a keyboard routine specially designed
  4027. to ask the operator for a date!!!!
  4028.  
  4029.  
  4030. ROOTNAME
  4031.  
  4032. Extracts the root filename from a full directory pathname.
  4033.  
  4034. DECLARE FUNCTION RootName$ (Path$, Extension%)
  4035.  
  4036. Path$       the full directory pathname of the file in question. This
  4037.             string can include the drive letter followed by a colon.
  4038.  
  4039. Extension%  If TRUE (non-zero) the returned filename will include the
  4040.             filename extension (if any). If FALSE (zero) the extension
  4041.             part is trimmed off.
  4042.  
  4043.  
  4044. ROUND
  4045.  
  4046. Rounds a double-precision number to the number of decimal places required
  4047. and returns it as a string.
  4048.  
  4049. DECLARE FUNCTION Round$ (Number#, Places%)
  4050.  
  4051.  
  4052. SALUTE
  4053.  
  4054. DECLARE FUNCTION Salute$ (Original$)
  4055.  
  4056. This function strips all but the first and last words from a string
  4057. and capitalises the first letter of each remaining word. This produces
  4058. a string suitable for use as the salutation of a letter.
  4059.  
  4060.  
  4061. SCREENMODE
  4062.  
  4063. This function calls ROM-BIOS to check the current video mode and then
  4064. converts the returned value to the equivalent VisualBASIC SCREEN number.
  4065. It can detect the Hercules 720 x 348 graphics mode (SCREEN 3) and the new
  4066. Olivetti 640 x 400 mode (SCREEN 4) as well as the Tandy 1000 and PCjr CGA
  4067. modes (SCREENs 5 & 6) which are not supported by VisualBASIC.  Other
  4068. unsupported graphics modes return a value of -1.
  4069.  
  4070. No calling parameters are required.
  4071.  
  4072. DECLARE FUNCTION ScreenMode% ()
  4073.  
  4074.  
  4075. SETFLAG
  4076.  
  4077. This routine is used to set  one of the sixteen system flags to a value of
  4078. between 0 and 255. These flags are situated in the Intra-Application
  4079. Communications area, an area reserved by DOS for user programs to signal
  4080. to each other. FLAG% is the flag number (1-16), VALUE% is the value you
  4081. want to set.
  4082.  
  4083. DECLARE SUB SetFlag (Flag%, Setting%)
  4084.  
  4085. You can read the current setting of a particular IAC flag byte with the
  4086. GETFLAG function.
  4087.  
  4088.  
  4089. SORTFILE
  4090.  
  4091. expects the user to supply the name of the file to be sorted. The file,
  4092. itself, must be fixed length and its name can include a drive letter and
  4093. directory pathname. The logical record length of the file must also be
  4094. supplied, along with the start position and length of the field which the
  4095. file is to be sorted on.
  4096.  
  4097. The procedure returns with Done% set to -1 (logical TRUE), if the sort
  4098. completed successfully, or to zero (logical FALSE) if an error occurred.
  4099.  
  4100. DECLARE SUB SortFile (PathName$, OffSet%, FieldLen%, RecordLen%, Done%)
  4101.  
  4102. The program first checks the size of the file and the amount of free disk
  4103. space to see if the it can be sorted in memory, this requires space for
  4104. two copies of the file on disk. If it is too large, the file is sorted in
  4105. place so that no extra disk space is required. Using this method, which is
  4106. far slower, the file may be of any size up to 4 Gigabytes.
  4107.  
  4108. Note:       If, when sorting in place on disk, SORTFILE detects that there
  4109.             is a Ramdisk installed with enough free space to hold the file
  4110.             that is being sorted, the program will copy and sort the file
  4111.             there. This is much faster than a conventional disk sort, but
  4112.             still not as fast as sorting directly in memory.
  4113.  
  4114. Programs calling this routine must have at least two unused file buffers
  4115. available (i.e. no more than thirteen files must be already open).
  4116.  
  4117.  
  4118. SPLITNAME
  4119.  
  4120. Parses a string containing the full or postal name of a person and
  4121. extracts the TITLE, INITIALS and SURNAME from it.
  4122.  
  4123. DECLARE SUB SplitName (Source$, Title$, Initial$, SurName$)
  4124.  
  4125. Most commonly used titles (eg MR, MRS, MISS, MS) are correctly
  4126. identified and seperated out.
  4127.  
  4128.  
  4129. STRIPQUOTES
  4130.  
  4131. Strips quotation marks and commas from a string which is to be
  4132. written to a comma-delimited ASCII file.
  4133.  
  4134. DECLARE FUNCTION StripQuote$ (Source$)
  4135.  
  4136. All double quote characters (") found in SOURCE$ are replaced
  4137. with single quotes (') and all commas replaced by blank spaces.
  4138. The length of the string is unchanged.
  4139.  
  4140.  
  4141. UNPAD
  4142.  
  4143. Removes multiple spaces from a string, making sure that no word
  4144. in a string of text has more than one blank space between it.
  4145.  
  4146. DECLARE FUNCTION UnPad$ (Text$, Length%)
  4147.  
  4148. Text$       the string of text to be processed.
  4149.  
  4150. Length%     on return, holds the length of the string after
  4151.             processing.
  4152.  
  4153. Leading and trailing spaces are also trimmed.
  4154.  
  4155.  
  4156. VERMENU
  4157.  
  4158. Displays and operates a pulldown menu, allowing the user to select from
  4159. the list of options displayed in the menu window. 
  4160.  
  4161. DECLARE SUB VerMenu (Row%, Col%, Attr%, Bdr%, Opts%, Title$, Menu$(),_
  4162.                      Choice%, Nxt%, Bar%, Ctx%, Tpc$, Mouse%, HotKeys%)
  4163.  
  4164. Expects:  Row%, Col%    screen co-ordinates of top-left corner of the
  4165.                         window containing the menu.
  4166.           Attr%         display attribute given to menu window.
  4167.           Bdr%          Border style (1 - 8, 0 = no border). see the
  4168.                         WINDOWS documentation for a list of styles.
  4169.           Opts%         Number of options provided by menu.
  4170.           Title$        Title for the menu, if null string then no
  4171.                         title is displayed.
  4172.           Menu$()       Text for options list. 
  4173.                         MENU$(0) should contain a list of Hotkey
  4174.                         characters, one for each option. Insert a space
  4175.                         at the appropriate position if an option is to
  4176.                         be disabled. A hash character '#' in Menu$(0)
  4177.                         will replace the option at that position with
  4178.                         a horizontal line seperator.
  4179.                         In the remaining option strings an ampersand '&'
  4180.                         indicates that the next character is the Hotkey
  4181.                         to be highlighted for that option. The Hotkey
  4182.                         character should be the same as the one in the
  4183.                         appropriate position of Menu$(0)
  4184.           Ctx%          If set, this indicates that context-sensitive
  4185.                         help is available, in which case ...
  4186.           Tpc$          The root name of the Topic file to be displayed
  4187.                         if the user presses <F1> for help. The current
  4188.                         menu number and selection number are appended to
  4189.                         this to produce the actual filename, eg where:
  4190.                         
  4191.                         Tpc$ = "CONFIG"     Bar% = 2    Choice% = 5
  4192.                         
  4193.                         HELPMATE (see TOOLBOX.DOC) looks for a Topic
  4194.                         file named CONFIG25.HLP.
  4195.  
  4196.                         (Note that Bar% is automatically set if you are
  4197.                         using this function in conjunction with BARMENU.
  4198.                         if not, Bar% defaults to zero and HELMATE expects
  4199.                         CONFIG05.HLP to be the appropriate TOPIC file.)
  4200.                         
  4201.           Mouse%        If set, this flag indicates that a mouse is
  4202.                         installed and can be used to make selections.
  4203.           HotKeys%      If set, this flag allows hotkeys to go directly
  4204.                         to a selection without the user having to press
  4205.                         <ENTER> as well.
  4206.  
  4207. Returns:  Choice%       Number of selection made by user. If zero then
  4208.                         the user pressed <ESC> to abort without making
  4209.                         a selection.
  4210.           Nxt%          Set TRUE if the user pressed the left or right
  4211.                         arrow key to move sideways to another menu, in
  4212.                         which case ....
  4213.           Bar%          is incremented or decremented accordingly.
  4214.  
  4215. The BARMENU procedure provides a similarly featured menu which is
  4216. orientated horizontally.
  4217.  
  4218. See the source code for DEMON.BAS, the Toolbox demonstration program, for
  4219. an example of VERMENU (and BARMENU) in use.
  4220.  
  4221.  
  4222. VIDEOMODE
  4223.  
  4224. Checks the video system capabilities of the host computer.
  4225.  
  4226. DECLARE SUB VideoMode (Colour%, MaxRes%, VideoRam%)
  4227.  
  4228. This function calls ROM-BIOS to check the type of display adaptor which is
  4229. installed in the host system. Three variables are supplied which, on
  4230. return, provide the following information:
  4231.  
  4232. COLOUR%   -1 = Colour adaptor   Indicates the presence of a colour
  4233.            0 = Monochrome       monitor in EGA systems. Returns -1
  4234.                                 for CGA, even if a mono monitor is
  4235.                                 bring used.
  4236. MAXRES%    highest SCREEN       Highest resolution graphics screen
  4237.            resolution           which can be set. Is equivalent to
  4238.                                 VisualBASIC SCREEN numbers. MDA can
  4239.                                 only use SCREEN 0, CGA 0, 1 and 2
  4240.                                 N.B. MaxRes% = 10 indicates an EGA
  4241.                                 with mono monitor. This means that
  4242.                                 SCREEN 9 can NOT be used.
  4243. VIDEORAM%  in kilobytes         Amount of dedicated display memory
  4244.                                 installed. 
  4245.                                 MDA = 4K, CGA = 16K, EGA = 64-256K
  4246.  
  4247.  
  4248.