home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / basic / wbb14 / bb.doc next >
Encoding:
Text File  |  1993-06-18  |  165.7 KB  |  5,877 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           BasicBasic is copyright (c) 1992, 1993 by Mark Davidsaver.
  8.           All rights reserved.
  9.  
  10.  
  11.           LICENSE INFORMATION
  12.           -------------------------------------------------------
  13.  
  14.       This shareware version of BasicBasic may be distributed
  15.       to others subject to the following 2 conditions:
  16.  
  17.         1) Only a nominal fee, not to exceed $5.00, may be
  18.            charged for distribution.
  19.  
  20.         2) The following files must ALL be distributed UNALTERED.
  21.  
  22.          DOS Version             Windows Version
  23.          -----------             ---------------
  24.          BBE.EXE                 WBBE.EXE
  25.          BB.EXE                  WBB.EXE
  26.          BBLIB14.EXE             WBBLIB14.EXE
  27.          BBR.DAT                 BBR.DAT
  28.          BB14.STB                BB14.STB
  29.          BB.DOC                  BB.DOC
  30.          ORDER.DOC               ORDER.DOC
  31.          SAMPLE1.EXE             SAMPLE1.BAS
  32.          SAMPLE2.EXE             SAMPLE2.BAS
  33.          SAMPLE3.EXE             SAMPLE3.BAS
  34.          SAMPLE4.EXE             SAMPLE4.BAS
  35.          SAMPLE5.EXE             SAMPLE5.BAS
  36.          SAMPLE6.EXE             SAMPLE6.BAS
  37.          SAMPLE7.EXE             SAMPLE7.BAS
  38.          SAMPLE8.EXE             SAMPLE8.BAS
  39.          SAMPLE9.EXE             SAMPLE9.BAS
  40.          SAMPLE10.EXE            SAMPLE10.BAS
  41.          SAMPLE11.EXE            SAMPLE11.BAS
  42.          SAMPLE12.EXE            SAMPLE12.BAS
  43.          SAMPLE13.EXE            SAMPLE13.BAS
  44.                      SAMPLEW1.BAS
  45.                      SAMPLEW2.BAS
  46.                      SAMPLEW3.BAS
  47.                      SAMPLEW4.BAS
  48.                      SAMPLEW3.ICO
  49.                      BBICON.EXE
  50.                      WBB.FON
  51.  
  52.           The software and accompanying documentation are provided
  53.           "as is" without warranty of any kind.  The entire risk as
  54.           to the results and performance of the software is assumed
  55.           by you.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.                                TABLE OF CONTENTS
  78.  
  79.  
  80.                 Summary ................................  2
  81.  
  82.                 Getting Started Quickly ................  3
  83.  
  84.                 DOS Instructions ..... .................  5
  85.  
  86.                 Windows Instructions ..... .............  9
  87.  
  88.                 Statement and Function Reference ....... 13
  89.  
  90.                 Graphics Programming for Beginners ..... 47
  91.  
  92.                 Programming Buttons .................... 50
  93.  
  94.                 Programming Menus ...................... 52
  95.  
  96.                 Programming Dialog Boxes ............... 54
  97.  
  98.                 Program Icon ........................... 60
  99.  
  100.                 Communications Programming ............. 62
  101.  
  102.                 Windows and Graphics ................... 63
  103.  
  104.                 Bitmaps ................................ 67
  105.  
  106.                 Windows and Fonts ...................... 71
  107.  
  108.                 Chaining and Common .................... 75
  109.  
  110.                 BasicBasic Technical ................... 76
  111.  
  112.                 Windows Metacommands ................... 78
  113.  
  114.                 Metacommands ........................... 79
  115.  
  116.                 Seperate Compilation ................... 80
  117.  
  118.                 Default Windows Font.................... 82
  119.                  (386 Enhanced Mode Font information)
  120.  
  121.                 Errors ................................. 84
  122.  
  123.                 Keyboard codes ......................... 86
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                        1
  130.  
  131.  
  132.  
  133.  
  134.  
  135.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.           SUMMARY
  143.           -------------------------------------------------------
  144.  
  145.           BasicBasic is an easy to use program development system
  146.           for DOS or Windows.  You can use BasicBasic to make your
  147.           own programs.  BasicBasic creates EXE files which can be
  148.           run under DOS or Windows.  BasicBasic supports both
  149.           graphics and text screens.  BasicBasic supports many
  150.           commands common to other Basic compilers, as well as, many
  151.           new commands unique to BasicBasic.
  152.  
  153.           Programs written using BasicBasic can run under either DOS
  154.           or Windows.  The BasicBasic development system, itself,
  155.           may run under either DOS or Windows.
  156.  
  157.           Here is a list of statements and functions the BasicBasic
  158.           compiler recognizes.  Refer to the detailed description
  159.           later on for the exact syntax recognized.
  160.  
  161.           ABS   ADDSUBMENU   ASC   ATN   BEEP   BITMAPC   BITMAPH
  162.           CALL   CBUTTON   CHAIN   CHDIR   CHDRIVE   CHR$   CIRCLE
  163.           CLOSE   CLS   COLOR   COMMAND$   COMMON   COMSTATI
  164.           COPYBITS   COS   CREATEBITMAP   CREATEFONT   CSRLIN
  165.           CURDIR$   DATA  DATE$   DBUTTON  DECLARE   DIALOG
  166.           DIALOG$   DIM   DIR$   DLEN   DO   END SUB   EOF   EXIT DO
  167.            EXIT FUNCTION   EXIT SUB   FIELD   FIX   FONT   FONT$
  168.           FOR..NEXT   FREEMEM   FUNCTION   GET   GET #
  169.           GOSUB..RETURN   GOTO   IF..THEN..ELSE   INKEY$   INPUT
  170.           INPUT #   INPUT$   INSTR  INT   KILL   LEFT$   LEN   LET
  171.           LINE   LINE INPUT #   LOADBITMAP   LOC  LOCATE   LOOP
  172.           LSET   MAINMENU   MENUITEMGRAY   MENUITEMON   MID$   MKDIR
  173.            MOUSEB   MOUSEON   MOUSEX   MOUSEY   ONCLOSE   ONPAINT
  174.           OPEN   OPEN "COMn:"   OPENFILEREAD   OPENFILESAVE   PAINT
  175.           PALETTE   POINT   POS   POSITION   POINT   PRINT #
  176.           LPRINT   PRINT USING  PUT   PUT #   LPRINT USING   PRESET
  177.           PSET    OSTYPE   RADIOON   RADIOOFF   RANDOMIZE   READ
  178.           REM   RESTORE   RETURN   RIGHT$   RMDIR   RND   SCREEN
  179.           SCROLLAREA   SELECTBITMAP   SELECTFONT   SETERRLEVEL
  180.           SHELL   SIN   SOUND   SPACE$   STOP   STOREBITMAP   STR$
  181.           STRING$   SUB   SYSTEM   TAB   TAN   TIME$   TIMER
  182.           UCASE$   VAL   WRITE #
  183.  
  184.           and the operators     +  -  /  *  \  ^  AND  OR
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                        2
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.           GETTING STARTED QUICKLY
  209.           -------------------------------------------------------
  210.  
  211.           The easiest way to run BasicBasic is to have all required
  212.           files in one directory.  Create a directory and copy the
  213.           supplied files into the directory.  BasicBasic files
  214.           required for each operating environment are:
  215.  
  216.                      FILE        USE
  217.                      _____       __________________________________
  218.  
  219.                     BBE.EXE   \
  220.                      BB.EXE   |- required under DOS
  221.                    BB14.STB   |
  222.                 BBLIB14.EXE   |
  223.                     BBR.DAT   /
  224.  
  225.  
  226.                    WBBE.EXE   \
  227.                     WBB.EXE   |- required under Windows
  228.                    BB14.STB   |
  229.                WBBLIB14.EXE   |
  230.                  BBICON.EXE   |
  231.                     WBB.FON   |
  232.                     BBR.DAT   /
  233.  
  234.           In addition many sample programs are provided to let you
  235.           get started quickly.  The sample programs have file names
  236.           of the format SAMPLEnn.BAS.  In addition an Icon (.ICO)
  237.           and Bitmap (.BMP) file are provided for use by the sample
  238.           programs.  The best way to install BasisBasic is to copy
  239.           ALL supplied files to your BasicBasic directory.
  240.  
  241.           If you are new to programming, or new to BasicBasic, it is
  242.           a good idea to start out by compiling and running these
  243.           sample programs.  If you are new to Basic programming a
  244.           good second step is to try modifying the sample programs
  245.           to operate differently.
  246.  
  247.             SAMPLE1.BAS
  248.             SAMPLE2.BAS\__ Examples applicable to DOS and Windows
  249.             SAMPLE3.BAS/
  250.                 .
  251.                 .
  252.  
  253.             SAMPLEW1.BAS
  254.             SAMPLEW2.BAS __ Examples For Windows Only
  255.                 .
  256.                 .
  257.  
  258.  
  259.  
  260.           DOS Startup:
  261.                                        3
  262.  
  263.  
  264.  
  265.  
  266.  
  267.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.             To start the BasicBasic development system under DOS you
  275.             must first be in the directory you placed the BasicBasic
  276.             files in; then type 'BBE' at the DOS prompt.
  277.  
  278.  
  279.           WINDOWS Startup:
  280.  
  281.             To start the BasicBasic developement system under
  282.             Windows you must run the program WBBE.  You can do this
  283.             from the Program Manager File menu.  Alternately you can
  284.             install WBBE in a program group using the Program
  285.             Manager and then start it by double clicking on it's
  286.             icon.
  287.  
  288.           Once started you are in the BasicBasic edit mode and can
  289.           type in programs from the keyboard or read them in from
  290.           disk.  When ready you can tell BasicBasic to run the
  291.           program.  The program will run and then control will be
  292.           returned to the BasicBasic editor.  The following sections
  293.           provide a more detailed description of how to operate in
  294.           the BasicBasic development system.
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                        4
  328.  
  329.  
  330.  
  331.  
  332.  
  333.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  334.  
  335.  
  336.  
  337.  
  338.  
  339.           DOS INSTRUCTIONS
  340.           -------------------------------------------------------
  341.  
  342.           BasicBasic allows you to write programs using the BASIC
  343.           programming language.  This programming language works the
  344.           same in DOS or Windows.  The BasicBasic editor which
  345.           allows you to enter your program is slightly different in
  346.           DOS and Windows.  This section contains specific
  347.           instructions on using the DOS version of BasicBasic.  The
  348.           next section contains similar instructions for Windows.
  349.  
  350.           (Note: If you do not want to use the BasicBasic editor,
  351.           you do not have to.  See the section on Seperate
  352.           Compilation for instructions on compiling programs entered
  353.           with another editor)
  354.  
  355.           This section assumes you have installed all required files
  356.           in one directory as described in the preceding section
  357.           'Getting Started Quickly'.  It also assumes that you have
  358.           Changed Directories so that the BasicBasic directory is
  359.           the current directory.
  360.  
  361.           To start BasicBasic you type  BBE<
  362.  
  363.                                                  (< means Enter)
  364.  
  365.           BasicBasic will then setup the screen in the following
  366.           format:
  367.  
  368.                  ---------------------------------------------
  369.             1   |                 file name line              |
  370.             2   |               Function summary line         |
  371.             3   |                                             |
  372.             .   .                                             .
  373.             .   .                                             .
  374.             .   .                                             .
  375.             25  |                   Error line                |
  376.                  ---------------------------------------------
  377.  
  378.           The top line (line 1) displays the name of the currently
  379.           opened file.  When you first start BasicBasic no file will
  380.           be opened so the top line displays the name of the
  381.           program.  The second line contains a list of the most
  382.           commonly used funtion keys.  The bottom line (line 25)
  383.           displays any errors which occur during compilation.  Lines
  384.           3 through 24 are used for display/editing of your program.
  385.  
  386.           The DOS version of BasicBasic does not use a mouse for
  387.           editing functions (though, if you have a mouse, you can
  388.           use it in the programs you write).  All editor operations
  389.           are available with a combination of keyboard keys.
  390.  
  391.           The best way to learn to use any editor is to use it.  The
  392.           BasicBasic editor is fairly straight-forward.  F1 will
  393.                                        5
  394.  
  395.  
  396.  
  397.  
  398.  
  399.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  400.  
  401.  
  402.  
  403.  
  404.  
  405.           bring up a list of all special key combinations.  F3 opens
  406.           a file for editing or compiling.  F8 compiles a program.
  407.           F9 runs a program (and compiles, if necessary).  These are
  408.           the most common special keys you will use.
  409.           
  410.           At this point open and compile or run some of the supplied
  411.           sample programs (e.g. SAMPLE1.BAS).  F3-OPEN will ask you
  412.           to enter the name of the program you want to open.  You
  413.           can either type in the file name, including the extension,
  414.           or use the TAB key to select a file from the file list
  415.           box.  You use the up and down arrow keys to scroll through
  416.           the file list box.  Remember that if you type in the file
  417.           name you MUST supply the complete name, including
  418.           extension (e.g. SAMPLE1.BAS).
  419.  
  420.           Here is a description of the editor special keys:
  421.  
  422.             Insert            Toggles between Overtype/Insert modes
  423.           
  424.             F1 Help           Displays a list of editor special keys
  425.  
  426.             F2 New            Closes any currently open file and
  427.                               clears the screen.  You will be
  428.                               prompted to save any changes.
  429.  
  430.             F3 Open           Displays a box to allow you to open a
  431.                               file.  You may either type in the
  432.                               complete file name or TAB to a file
  433.                               list box and select file with the
  434.                               arrow keys.  After highlighting the
  435.                               file you want press ENTER.
  436.  
  437.             F4 SaveAs         Allows you to save the text you are
  438.                               editing and specify a file name.
  439.  
  440.             Ctrl-F4 Save      Saves the text you are editing to the
  441.                               same name you originally opened.
  442.  
  443.             F5 Exit           Exits the program.  You will be
  444.                               prompted to save any changes.
  445.  
  446.             F6 Find           Displays a box to allow you to enter
  447.                               text to find.  Upper/lower case are
  448.                               ignored.  The search is from the
  449.                               current position in the file.  To
  450.                               search the entire file you must have
  451.                               the start of the file displayed on the
  452.                               screen.  The found string will be
  453.                               highlighted and the display altered to
  454.                               show the highlighted item on the first
  455.                               display line.  If no match is found a
  456.                               'BEEP' will be sounded.
  457.  
  458.             Ctrl-F6 Find Next Searches for the next occurence of the
  459.                                        6
  460.  
  461.  
  462.  
  463.  
  464.  
  465.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  466.  
  467.  
  468.  
  469.  
  470.  
  471.                               last search string you entered.
  472.  
  473.             F7 Next Error     If you have compiled a program and
  474.                               there were errors in the compilation,
  475.                               then the bottom line of the display
  476.                               will display the error message. If
  477.                               there is more than one error pressing
  478.                               F7 will go to the next error message.
  479.                               When an error message is displayed,
  480.                               the corresponding source line will be
  481.                               moved to the first display position if
  482.                               applicable.
  483.  
  484.             F8 Compile        Compiles your current source and makes
  485.                               an EXE file if there are no errors.
  486.  
  487.             F9 Compile & Run  Compiles your current source(only if
  488.                               required) and then executes the
  489.                               program.  When your program terminates
  490.                               you will return to the editor.
  491.                               
  492.             F10 About         Tells about BasicBasic.
  493.  
  494.             Up arrow
  495.             Down arrow
  496.             Left arrow
  497.             Right arrow       Moves cursor around the screen.
  498.  
  499.             Insert            Changes between insert mode(small
  500.                               cursor) and overwrite move (large
  501.                               cursor)
  502.  
  503.             Delete            Deletes current character
  504.  
  505.             Ctrl-PgUp         Goes to first line of file.
  506.  
  507.             Ctrl-PgDn         Goes to last line of file.
  508.  
  509.             Shift-arrow key   Holding down the shift key while
  510.                               pressing an arrow key will select text
  511.                               for copying or cutting.
  512.  
  513.             Shift-Delete      Copies currently selected text to
  514.                               clipboard.
  515.  
  516.             Ctrl-F1           If text is selected deletes all of
  517.                               selected text and transfers to
  518.                               clipboard.
  519.  
  520.             Shift-insert      Pastes from clipboard to screen.
  521.  
  522.             Home              Moves to beginning of line.
  523.  
  524.             End               Moves past last character in line.
  525.                                        7
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.           RUNTIME ERRORS
  541.  
  542.             While executing a program you have entered you may
  543.           receive a runtime error message.  The message will have
  544.           two numbers; the first being an error number and the
  545.           second being a runtime error address.  This manual
  546.           contains a list of error numbers.  The runtime error
  547.           address will show you what line had the error.
  548.  
  549.             Each time you compile your program BasicBasic creates a
  550.           file which shows the runtime address for each line.  You
  551.           can examine this file with the BasicBasic editor to find
  552.           which line contains the address the address at which the
  553.           runtime error occurs.  The file BasicBasic creates has the
  554.           extension .TMP.  For example if you compile the program
  555.           SAMPLE1.BAS, then BasicBasic will create the file
  556.           SAMPLE1.TMP, which will have the runtime addresses.
  557.  
  558.           (Occasionaly you might want to delete all .TMP files from
  559.           your BasicBasic directory to conserve disk space.)
  560.           
  561.  
  562.           TOO BIG
  563.  
  564.           If you write very large programs there may not be room in
  565.           memory to compile your program while the editor is
  566.           running.  If you receive an error message saying not
  567.           enough memory to compile you may need to exit the editor
  568.           and compile seperately.  See the section on Seperate
  569.           Compilation for instructions.
  570.  
  571.           IMPORTANT:  To run programs compiled with BasicBasic the
  572.           runtime module must be present.  For DOS this is the file
  573.           BBLIB14.EXE.
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.                                        8
  592.  
  593.  
  594.  
  595.  
  596.  
  597.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.           WINDOWS INSTRUCTIONS
  605.           -------------------------------------------------------
  606.  
  607.           BasicBasic allows you to write programs using the BASIC
  608.           programming language.  This programming language works the
  609.           same in DOS or Windows.  The BasicBasic editor which
  610.           allows you to enter your program is slightly different in
  611.           DOS and Windows.  This section contains specific
  612.           instructions on using the Windows version of BasicBasic.
  613.           The preceding section contains similar instructions for
  614.           DOS.
  615.  
  616.           (Note: If you do not want to use the BasicBasic editor,
  617.           you do not have to.  See the section on Seperate
  618.           Compilation for instructions on compiling programs entered
  619.           with another editor)
  620.  
  621.  
  622.           You may install the BasicBasic program in a program group.
  623.           The file you want to install is WBBE.EXE.  Alternately you
  624.           can select RUN from the program manager and execute
  625.           WBBE.EXE.
  626.  
  627.           Once started you will see a standard Windows editing
  628.           screen.  There is a menu bar at the top with available
  629.           choices.  To compile and run a program (such as
  630.           SAMPLE1.BAS) you would need to select OPEN from the file
  631.           menu and then COMPILE & RUN from the Build menu.  Remember
  632.           that you must enter the complete file name, including
  633.           extension (e.g. SAMPLE1.BAS).
  634.  
  635.           The best way to learn any editor is to use it.  The
  636.           BasicBasic editor is fairly straight-forward.  The  FILE
  637.           menu contains an Open command.  The MAKE menu contains
  638.           commands to compile and run your program.
  639.  
  640.           Here is a complete list of the Windows BasicBasic editor
  641.           functions.:
  642.  
  643.  
  644.             Insert Key         Toggles between Overtype/Insert modes
  645.  
  646.  
  647.           FILE MENU
  648.  
  649.             New               Closes any currently open file and
  650.                               clears the screen.  You will be
  651.                               prompted to save any changes.
  652.  
  653.             Open              Displays a box to allow you to open a
  654.                               file.  You may either type in the
  655.                               complete file name or TAB to a file
  656.                               list box and select file with the
  657.                                        9
  658.  
  659.  
  660.  
  661.  
  662.  
  663.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  664.  
  665.  
  666.  
  667.  
  668.  
  669.                               arrow keys.  After highlighting the
  670.                               file you want press ENTER.
  671.  
  672.             SaveAs            Allows you to save the text you are
  673.                               editing and specify a file name.
  674.  
  675.             Save              Saves the text you are editing to the
  676.                               same name you originally opened.
  677.  
  678.             Exit              Exits the program.  You will be
  679.                               prompted to save any changes.
  680.  
  681.  
  682.           EDIT MENU
  683.  
  684.             The edit menu allows you to manipulate text you have
  685.             selected.  You select text in the usual Windows fashion
  686.             by holding down the mouse button as you move over the
  687.             text you want to select.  Alternately you can use the
  688.             arrow keys with the SHIFT key held down.
  689.  
  690.  
  691.             Copy              Copies currently selected text to
  692.                               clipboard.
  693.  
  694.             Cut               If text is selected deletes all of
  695.                               selected text and transfers to
  696.                               clipboard.
  697.  
  698.             Paste      Pastes from clipboard to screen.
  699.                               
  700.  
  701.           SEARCH MENU
  702.  
  703.             Find              Displays a box to allow you to enter
  704.                               text to find.  Upper/lower case are
  705.                               ignored.  The search is from the
  706.                               current position in the file.  To
  707.                               search the entire file you must have
  708.                               the start of the file displayed on the
  709.                               screen.  The found string will be
  710.                               highlighted and the display altered to
  711.                               show the highlighted item on the first
  712.                               display line.  If no match is found a
  713.                               'BEEP' will be sounded.
  714.  
  715.             Find Next         Searches for the next occurence of the
  716.                               last search string you entered.
  717.  
  718.  
  719.           MAKE MENU
  720.  
  721.             Compile           Compiles your current source and makes
  722.                               an EXE file if there are no errors.
  723.                                       10
  724.  
  725.  
  726.  
  727.  
  728.  
  729.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  730.  
  731.  
  732.  
  733.  
  734.  
  735.                               Control is returned to BasicBasic when
  736.                               the compilation is complete.
  737.  
  738.             Compile & Run     Compiles your current source(only if
  739.                               required) and then executes the
  740.                               program.  If there are compilation
  741.                               errors the program will not be
  742.                               executed.  When your compiled program
  743.                               is run it's window will be made the
  744.                               top window, but the BasicBasic editor
  745.                               will continue to run.
  746.  
  747.           OPTIONS MENU
  748.  
  749.              In there are errors in compilation BasicBasic will
  750.              display an error windows at the bottom of the edit
  751.              windows.  You can scroll through this window to examine
  752.              errors.  Selecting an error in the error window will
  753.              cause the corresponding source line to become the first
  754.              line in the edit window.  The Options Menu contains an
  755.              item, 'Error Window' which will remove the error window
  756.              when you no longer need the errors displayed.
  757.  
  758.  
  759.           TRANSFER MENU
  760.  
  761.              The transfer menu contains one entry.  This is the
  762.              'Icon Editor'.  Using the $ICON metacommand you can
  763.              assign a Windows Icon to your program.  The icon editor
  764.              allows you to create the icon.  See the section on
  765.              'Program Icon' for more information.
  766.  
  767.  
  768.           RUNTIME ERRORS
  769.  
  770.             While executing a program you have entered you may
  771.           receive a runtime error message.  The message will have
  772.           two numbers; the first being an error number and the
  773.           second being a runtime error address.  This manual
  774.           contains a list of error numbers.  The runtime error
  775.           address will show you what line had the error.
  776.  
  777.             Each time you compile your program BasicBasic creates a
  778.           file which shows the runtime address for each line.  You
  779.           can examine this file with the BasicBasic editor to find
  780.           which line contains the address the address at which the
  781.           runtime error occurs.  The file BasicBasic creates has the
  782.           extension .TMP.  For example if you compile the program
  783.           SAMPLE1.BAS, then BasicBasic will create the file
  784.           SAMPLE1.TMP, which will have the runtime addresses.
  785.  
  786.           (Occasionaly you might want to delete all .TMP files from
  787.           your BasicBasic directory to conserve disk space.)
  788.           
  789.                                       11
  790.  
  791.  
  792.  
  793.  
  794.  
  795.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.           TOO BIG
  803.  
  804.           If you write very large programs there may not be room in
  805.           memory to compile your program while the editor is
  806.           running.  If you receive an error message saying not
  807.           enough memory to compile you may need to exit the editor
  808.           and compile seperately.  See the section of Seperate
  809.           Compilation for instructions.
  810.  
  811.           IMPORTANT:  To run programs compiled with BasicBasic the
  812.           runtime module must be present.  For Windows this is the
  813.           file WBBLIB14.EXE.
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                       12
  856.  
  857.  
  858.  
  859.  
  860.  
  861.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.           STATEMENT AND FUNCTION REFERENCE
  869.           -------------------------------------------------------
  870.  
  871.           Here is a brief description of available functions and
  872.           statements.  More detailed information on those not unique
  873.           to BasicBasic can be found in standard Basic reference
  874.           books.
  875.  
  876.  
  877.  
  878.           ABS(numericexpression)
  879.  
  880.             This function returns the absolute value of the numeric
  881.             expression.
  882.  
  883.  
  884.  
  885.           ADDSUBMENU  menunumber,stringexpression,keycode
  886.  
  887.             Addsubmenu adds an item to a pull down menu with the
  888.             text stringexpression.  When the user selects this menu
  889.             item the keycode will be returned at the next INKEY$
  890.             function call.  See the section 'Programming Menus' for
  891.             more details
  892.  
  893.  
  894.  
  895.           ASC(string expression)
  896.  
  897.             This function returns a numerical value which is the
  898.             ASCII code for the first character of string expression.
  899.  
  900.  
  901.  
  902.           ATN(numeric expression)
  903.  
  904.             This function returns the arctangent of a numeric
  905.             expression.
  906.  
  907.  
  908.  
  909.           BEEP
  910.  
  911.             This statement sounds the ASCII bell character.
  912.  
  913.  
  914.  
  915.           BITMAPC(filename,longinteger array)
  916.  
  917.             This function returns colors values for a disk file
  918.             device independent bitmap.
  919.  
  920.             e.g.     A=BITMAPC("C:\WINDOWS\CARS.BMP",COLORS&(0))
  921.                                       13
  922.  
  923.  
  924.  
  925.  
  926.  
  927.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.             Each element of the array COLORS& will contain one RGB
  935.             color value up to the total colors available (see
  936.             BITMAPH).  See the section BITMAPS for further
  937.             information.
  938.  
  939.  
  940.  
  941.           BITMAPH(filename,longinteger array)
  942.  
  943.  
  944.             This function returns the bitmap header from a file
  945.             device independent bitmap.
  946.  
  947.             e.g.   A=BITMAPC("C:\WINDOWS\CARS.BMP",HEADER&(0))
  948.  
  949.             The data returned are:
  950.  
  951.                 0 - size of bitmapinfoheader
  952.                 1 - width in pixels
  953.                 2 - height in pixels
  954.                 3 - always 1
  955.                 4 - color bits per pixel
  956.                 5 - compression flag
  957.                 6 - total bytes in image
  958.  
  959.             See the section BITMAPS for further information.
  960.  
  961.  
  962.  
  963.           CALL name [arguments]
  964.  
  965.             This statement transfers control to a BASIC SUB
  966.             procedure.  Arguments may be any valid BasicBasic data
  967.             type.  Arrays are specified with emply parenthesis.
  968.  
  969.             here is an example of a CALL statement.
  970.  
  971.                    a=2
  972.                    b=3
  973.                    call printsum(a,b)
  974.                    stop
  975.  
  976.                sub sum(x,y)
  977.                    print x+y
  978.                end sub
  979.  
  980.             The EXIT FUNCTION statement may be used to exit a
  981.             function at any time.  You may not transfer control out
  982.             of the function except with the END FUNCTION or EXIT
  983.             FUNCTION statements.
  984.  
  985.             In this version of BasicBasic procedures do not have
  986.             access to common variables.
  987.                                       14
  988.  
  989.  
  990.  
  991.  
  992.  
  993.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.           CBUTTON "name",keycode,0,"type",0,left,top,xsize,ysize,
  1005.                   forecolor,backcolor
  1006.  
  1007.             This command defines and creates a button on screen.
  1008.             This command is DOS and Windows compatible.  In screen
  1009.             mode 0 left,top,xsize,ysize are in character units.  In
  1010.             graphics screen modes these must be supplied in pixel
  1011.             units.  The name is the text which will be displayed in
  1012.             the button.  When you define a button you must define
  1013.             the keycode which will be returned when that button is
  1014.             pressed by the user.  Legal button types are "Radio",
  1015.             "Push" or "Invisible".  Left, top, xsize, ysize define
  1016.             the position and size of the button(in character
  1017.             position).  Radio buttons may have a foreground and
  1018.             background color defined.  If these are left 0 then the
  1019.             default colors will be used.  In DOS the colors are also
  1020.             used for Pushbuttons.
  1021.  
  1022.             When the user presses the button the indicated keycode
  1023.             will be returned to the INKEY$ function.  If a button is
  1024.             pressed while executing the INPUT command the input will
  1025.             be ended, but the keycode will not be returned until a
  1026.             subsequent INKEY$ function is called.  Instead of using
  1027.             the mouse to press the indicated button, the user can
  1028.             also press the keyboard key which returns the indicated
  1029.             keycode.
  1030.  
  1031.             Any key may be defined for a button.  See the section
  1032.             "Keyboard codes" for a list of codes recognized by
  1033.             BasicBasic.  As an example the uppercase letter 'A'
  1034.             would be the keycode 65.  Extended keycodes are
  1035.             indicated by adding 1000 to the second part of the code.
  1036.             For example F1 would be 1059, or F10 would be 1068.
  1037.  
  1038.               e.g. CBUTTON "Exit",1068,"Push",0,1,1,8,1,7,4
  1039.  
  1040.                    Creates a push button on the top line.  Because
  1041.                    it is a Push button the color values are ignored
  1042.                    in windows, but used in DOS.
  1043.  
  1044.             See RADIOON and RADIOOFF for instructions on
  1045.             checking/unchecking radio buttons.
  1046.  
  1047.             See the section "Programming Buttons" for more detail on
  1048.             programming buttons.
  1049.  
  1050.             Note that while CBUTTON creates a button it will not
  1051.             respond to the mouse button until the function MOUSEON
  1052.             has been issued.
  1053.                                       15
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.             SAMPLE5.BAS and SAMPLE6.BAS use the CBUTTON command.
  1067.  
  1068.  
  1069.  
  1070.           CHAIN  filespec
  1071.  
  1072.             This command transfers control from the current program
  1073.             to another program.  COMMON may be used to pass
  1074.             variables between programs.  Files are left open when
  1075.             transfering to another program.  See the section
  1076.             'Chaining and Common' for more details.
  1077.  
  1078.                 e.g.  CHAIN "TEST2.EXE"
  1079.  
  1080.  
  1081.  
  1082.           CHDIR drive$
  1083.  
  1084.             This statement changes the default directory for the
  1085.             specified drive.  CHDIR statement changes the default
  1086.             directory, but not the default drive.
  1087.  
  1088.  
  1089.  
  1090.           CHDRIVE drive$
  1091.  
  1092.             This statement changes the current drive to that given
  1093.             in the string expression drive$
  1094.  
  1095.  
  1096.  
  1097.           CHR$(numeric expression)
  1098.  
  1099.             This function returns the ASCII code for the numeric
  1100.             expression.  The returned code is one character.
  1101.  
  1102.  
  1103.  
  1104.           CIRCLE [STEP](x1,y),radius,[color],[start],[end],[aspect]
  1105.  
  1106.             This statement draws a circle, ellipse, or pie section
  1107.             on the graphics screen.  (x,y) are the screen
  1108.             coordinates of the center of the figure.  Radius is the
  1109.             radius in pixels.  Start and End are angles in radians.
  1110.             Omiting these results in a complete circle or ellipse.
  1111.             You may use Start,End to draw arcs or pie sections.  A
  1112.             complete circle has a start randian of 0 and an end
  1113.             radian of 6.2832.
  1114.  
  1115.             If start or end are negative the value is converted to a
  1116.             positive number for purposes of drawing the arc, but
  1117.             then a line is drawn from the center of the figure to
  1118.             the end point of the arc.  PIE figures may be draw in
  1119.                                       16
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.             this way.
  1132.  
  1133.               Example of a complete circle, radius 50, color blue
  1134.  
  1135.                       SCREEN 8
  1136.                       CIRCLE (100,100),50,1
  1137.  
  1138.               Example of pie figure, filled in
  1139.  
  1140.                       SCREEN 8
  1141.                       CIRCLE (100,100),50,1,-.01,-2
  1142.                       PAINT (102,98),1,1
  1143.  
  1144.             Aspect can be used to adjust the ratio of y radius to
  1145.             the x radius.  By default BasicBasic sets aspect to a
  1146.             number to create round circles for the type of screen
  1147.             being used.
  1148.  
  1149.  
  1150.  
  1151.           CLOSE #filenumber
  1152.  
  1153.             This statement terminates I/O to the indicated
  1154.             filenumber.  Only one number allowed for each CLOSE
  1155.             command.
  1156.  
  1157.  
  1158.  
  1159.           CLS
  1160.  
  1161.             This statement clears the screen.  If a scrollable area
  1162.             has been define the entire screen is still cleared.
  1163.  
  1164.  
  1165.  
  1166.           COLOR foreground,background
  1167.  
  1168.             The format of this statement varies depending on the
  1169.             screen mode you are in.
  1170.  
  1171.             MODE 0
  1172.  
  1173.               This statement sets the screen colors to the indicated
  1174.               foreground and background colors.  Color values are:
  1175.  
  1176.                0 - Black
  1177.                1 - Blue
  1178.                2 - Green
  1179.                3 - Cyan
  1180.                4 - Red
  1181.                5 - Magenta
  1182.                6 - Brown
  1183.                7 - White
  1184.                8 - Gray
  1185.                                       17
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.                9 - Light Blue
  1198.               10 - LIght Green
  1199.               11 - Light Cyan
  1200.               12 - Light Red
  1201.               13 - Light Magenta
  1202.               14 - Yellow
  1203.               15 - High intensity white
  1204.  
  1205.             Foreground values can be 0 through 15 and background
  1206.             values can be 0 through 15.
  1207.  
  1208.           MODE 8,9
  1209.  
  1210.             The first argument (foreground color) is a color
  1211.             attribute.  The second argument(background color) is a
  1212.             screen color.  For Windows programs see the section
  1213.             WINDOWS AND GRAPHICS for additional information on the
  1214.             COLOR statement.
  1215.  
  1216.           MODE 12
  1217.  
  1218.             Only one argument is used.  The first argument
  1219.             (foreground) color is a color attribute.  In this mode
  1220.             to change the background color for the entire screen use
  1221.             the PALETTE command to change the definition of color
  1222.             attribute 0.
  1223.  
  1224.           MODE 1000
  1225.  
  1226.             This mode is only supported under Windows.  The first
  1227.             argument (foreground) is a color attribute.  The second
  1228.             arguement (background) is a color attribute.  In this
  1229.             mode to change a palette color you must use the PALETTE
  1230.             command.
  1231.  
  1232.  
  1233.  
  1234.           COMMAND$
  1235.  
  1236.             This function returns the command line used to start the
  1237.             program.
  1238.  
  1239.               e.g.  TEST myfile.dat
  1240.  
  1241.               COMMAND$ would return:  myfile.dat
  1242.  
  1243.  
  1244.  
  1245.           COMMON  variablelist
  1246.  
  1247.             Common passes variables to a chained program.
  1248.             Variablelist is a list of variables and arrays whose
  1249.             contents will be preserved when Chaining to a new
  1250.             program.  Only 'blank' common is supported.  A blockname
  1251.                                       18
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.             is not allowed.  the SHARED attribute is not allowed.
  1264.             Arrays are indicated by blank parenthesis.  See the
  1265.             section 'Chaining and Common' for more details.
  1266.  
  1267.               e.g.  COMMON A,B,A$,B$()
  1268.  
  1269.  
  1270.  
  1271.           COMSTATI(comnum)
  1272.  
  1273.             This function returns the status of a communications
  1274.             port.  8 bits of data are returned.  These are defined
  1275.             as follows:
  1276.  
  1277.               bit 7 = Data Carrier Detect
  1278.                   6 = Ring Indicator
  1279.                   5 - Data Set Ready
  1280.                   4 - Clear to Sent
  1281.                   3 - Break Detect
  1282.                   2 - Framing Error
  1283.                   1 - Parity Error
  1284.                   0 - Overrun Error
  1285.  
  1286.               e.g.  a=COMSTATI(1)
  1287.  
  1288.  
  1289.  
  1290.           COPYBITS sbm,sx,sy,xlen,ylen,dbm,dx,dy,0
  1291.  
  1292.             This command is ignored under DOS.  This command copies
  1293.             the contents of one bitmap to another.  The parameter
  1294.             sbm is the source bitmap number and may be either 0, 1,
  1295.             or 2, where 0 is the screen and 1 and 2 are memory
  1296.             bitmaps previously created with the CREATEBITMAP
  1297.             command.  Similarly dbm is the destination bitmap
  1298.             number.  Sx, sy are the coordinates of the upper left
  1299.             corner of the source bitmap to be transfered.  Xlen, and
  1300.             ylen are the number of pixels to copy.  Dx, dy are the
  1301.             coordinates of the upper left corner of the destination.
  1302.  
  1303.             The following example copies a 100 by 100 pixel
  1304.             rectangle starting at 0,0 to a memory bitmap and then
  1305.             copies it back to the screen at x=200 and y=0.
  1306.  
  1307.                  sx=0
  1308.                  sy=0
  1309.                  dx=0
  1310.                  dy=0
  1311.                  copybits 0,sx,sy,100,100,1,dx,dy,0
  1312.                  dx=200
  1313.                  dy=0
  1314.                  copybits 1,sx,sy,100,100,0,dx,dy,0
  1315.  
  1316.  
  1317.                                       19
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.           COS(n)
  1332.  
  1333.             This function returns the cosine of an angle expressed
  1334.             in radians.
  1335.  
  1336.  
  1337.  
  1338.           CREATEBITMAP n,0,xsize,ysize
  1339.  
  1340.             This command is ignored under DOS.  Under Windows it
  1341.             creates a memory bitmap of the given size.  The first
  1342.             argument, n, may be either 1 or 2.  The second argument
  1343.             must always be a 0.  You can create a maximum of 2
  1344.             memory bitmaps.  Using the SELECTBITMAP command you can
  1345.             tell BasicBasic to route all screen output to a bitmap
  1346.             instead.  Then you can use the COPYBIT command to
  1347.             quickly place a complex graphic on the screen.
  1348.  
  1349.             If a SCREEN command is used in the program always use
  1350.             CREATEBITMAP after the SCREEN command!
  1351.  
  1352.             Here is an example of a createbitmap command:
  1353.  
  1354.                  pxsize=100
  1355.                  pysize=50
  1356.                  CREATEBITMAP 1,0,pxsize,pysize
  1357.  
  1358.             SAMPLEW4.BAS uses the CREATEBITMAP command.
  1359.  
  1360.  
  1361.  
  1362.           CREATE FONT
  1363.  
  1364.             Allows creation of fonts in Windows.  See section
  1365.             WINDOWS AND FONTS for a description of this command.
  1366.  
  1367.             SAMPLEW1.BAS, SAMPLEW2.BAS and SAMPLEW3.BAS use the
  1368.             CREATE FONT command.
  1369.  
  1370.  
  1371.  
  1372.           CSRLIN
  1373.  
  1374.             This function gets the current line position of the
  1375.             cursor(starting with 1).  In graphics mode 1000 the
  1376.             pixel line position is returned (starting with 0).
  1377.  
  1378.  
  1379.  
  1380.           CURDIR$[(drive$)]
  1381.  
  1382.             This function returns the path currently is use for the
  1383.                                       20
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.             specified drive.  If the optional parameter is omitted
  1396.             then the path for the currently selected drive is
  1397.             returned.
  1398.  
  1399.  
  1400.  
  1401.           DATA
  1402.  
  1403.             This statement is used in conjuction with the READ
  1404.             statement to input numeric or string constants.
  1405.  
  1406.  
  1407.  
  1408.           DATE$
  1409.  
  1410.             This function returns a string of ten characters
  1411.             corresponding to the current computer date.
  1412.  
  1413.  
  1414.  
  1415.           DBUTTON keycode
  1416.  
  1417.             This statement erases a button from the screen (using
  1418.             currently define colors) and disables input from it.
  1419.             The keycode should be the same as that used in the
  1420.             CBUTTON command.  See the section "Programming Buttons"
  1421.             for more information on buttons.
  1422.  
  1423.  
  1424.  
  1425.           DECLARE function name[(parameters)]
  1426.  
  1427.             The DECLARE statement defines a function before the
  1428.             actual function is created.  Before you can use a user
  1429.             function in your program you must either create the
  1430.             function (using the FUNCTION, END FUNCTION statements)
  1431.             or declare it with the DECLARE statement.  The DECLARE
  1432.             statement, therefore, allows you to put your user
  1433.             functions someplace else other than the start of our
  1434.             program.  The name of the function, type and number of
  1435.             parameters must the the same in the DECLARE statement as
  1436.             in the FUNCTION statement.
  1437.  
  1438.                         DECLARE ADD%(A%,B%0
  1439.  
  1440.                         I%=2
  1441.                         J%=3
  1442.                         PRINT ADD%(I%,J%)
  1443.                         STOP
  1444.  
  1445.                     FUNCTION ADD%(X%,Y%)
  1446.                        ADD%=X%+Y%
  1447.                     END FUNCTION
  1448.  
  1449.                                       21
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.           DIALOG A$(),x,y,xlen,ylen,id,Header String
  1464.  
  1465.             This statement executes a Dialog.  See the section
  1466.             "Programming Dialog Boxes" for details.  The array a$()
  1467.             contains text which defines the dialog box.  X, y, xlen,
  1468.             ylen are in pixel units in graphics screen modes and
  1469.             character units in screen mode 0.
  1470.  
  1471.  
  1472.  
  1473.           DIALOG$()
  1474.  
  1475.             This function returns information on a Dialog Control.
  1476.             See the section "Programming Dialog Boxes" for details.
  1477.  
  1478.             SAMPLE11.BAS uses the DIALOG$ command.
  1479.  
  1480.  
  1481.  
  1482.           DIM variable(subscripts),...
  1483.  
  1484.             Defines arrays.  There is no default array size of 10 in
  1485.             BasicBasic; every array must be defined.  SHARED is not
  1486.             supported.  Arrays may not be used as subscripts in a
  1487.             Dimension statement.
  1488.  
  1489.                 LEGAL Dimension
  1490.  
  1491.                    DIM A$(10,5)
  1492.                    DIM B%(A%)
  1493.  
  1494.                 ILLEGAL Dimension
  1495.  
  1496.                    DIM A$(B%(1,2),5)
  1497.  
  1498.  
  1499.  
  1500.  
  1501.           DIR$(path,[type])
  1502.               or
  1503.           DIR$
  1504.  
  1505.             This function returns file names.  If no type is
  1506.             specified or type is set to 0 then file names not
  1507.             including system and hidden will be returned.  If no
  1508.             path is specified then the next name using the previous
  1509.             search path will be returned.  Type may be set to a
  1510.             non-zero value to return the names of special classes of
  1511.             files.
  1512.  
  1513.                       type       file type
  1514.                        1         Read Only files
  1515.                                       22
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.                        2         Hidden files
  1528.                        3         System files
  1529.                        5         Directories
  1530.                        6         Archive bit set
  1531.  
  1532.           SAMPLE10.BAS uses the DIR$ command.
  1533.  
  1534.  
  1535.  
  1536.           DLEN (string)
  1537.  
  1538.             This function returns the length in pixels of a string.
  1539.             It is intended for use in Windows graphics mode but also
  1540.             works in DOS graphics mode.
  1541.  
  1542.  
  1543.  
  1544.           DO [UNTIL condition][UNTIL condition]
  1545.  
  1546.             This statement incombination with the LOOP statement
  1547.             repeats a series of statements while/until the condition
  1548.             is true.  A LOOP command must terminate the series of
  1549.             statements.  Alternately the while/until condition may
  1550.             be placed after the LOOP command.  In this case the
  1551.             true/false checking of the condition occurs AFTER the
  1552.             series of statements has been executed once.  Here are
  1553.             some examples:
  1554.  
  1555.  
  1556.                  I=0
  1557.                  DO WHILE I<5
  1558.                    PRINT I
  1559.                    I=I+1
  1560.                  LOOP
  1561.  
  1562.                  I=0
  1563.                  DO UNTIL I>4
  1564.                    PRINT I
  1565.                    I=I+1
  1566.                  LOOP
  1567.  
  1568.                  I=0
  1569.                  DO
  1570.                    PRINT I
  1571.                    I=I+1
  1572.                  LOOP WHILE I<6
  1573.  
  1574.                  I=0
  1575.                  DO
  1576.                    PRINT I
  1577.                    I=I+1
  1578.                  LOOP UNTIL I>3
  1579.  
  1580.             The EXIT DO statement may be used to exit from a
  1581.                                       23
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.             DO..LOOP series of statements.  Here is an example:
  1594.  
  1595.                  I=0
  1596.                  DO WHILE I<20000
  1597.                    IF INKEY$<>"" THEN EXIT DO
  1598.                    PRINT I
  1599.                    I=I+1
  1600.                  LOOP
  1601.  
  1602.  
  1603.  
  1604.           END SUB
  1605.  
  1606.             This statement is used at the end of a SUB procedure.
  1607.             See the CALL statement for an example.
  1608.  
  1609.  
  1610.  
  1611.           EOF(filenumber)
  1612.  
  1613.             This function tests for end-of-file.
  1614.  
  1615.  
  1616.  
  1617.           EXIT DO
  1618.  
  1619.             Statement allows exit of a DO..LOOP series.  See the
  1620.             description of the DO statement for an explanation.
  1621.  
  1622.  
  1623.  
  1624.           EXIT FUNCTION
  1625.  
  1626.             Statement allows exit of a user Function.  See the
  1627.             description of the FUNCTION statement for more details.
  1628.  
  1629.  
  1630.  
  1631.           EXIT SUB
  1632.  
  1633.             Statement allows exit of a user Procedure.  See the
  1634.             description of the SUB statement for more details.
  1635.  
  1636.  
  1637.  
  1638.           FIELD #filenumber,fieldwidth AS stringvariable...
  1639.  
  1640.             This statement allocates space for variables in
  1641.             random-access file buffer.  The filenumber is the number
  1642.             under which the file was opened.  Fieldwidth is a number
  1643.             indicating the length of the field and string variable
  1644.             is the name of the field.  Multiple fields can be
  1645.             defined at once.
  1646.  
  1647.                                       24
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.                e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  1660.                      FIELD #1,18 AS NAME$,18 AS ADDRESS$
  1661.                      LSET NAME$="FRED SMITH"
  1662.                      LSET ADDRESS$="1 MAIN STREET"
  1663.                      PUT #1,1
  1664.                      CLOSE #1
  1665.  
  1666.  
  1667.  
  1668.           FIX(numeric expression)
  1669.  
  1670.             This function returns the integer representation of the
  1671.             value in numeric expression.  -n.x returns n-1 if x>0.
  1672.  
  1673.  
  1674.  
  1675.           FONT(n)
  1676.  
  1677.             This function returns information about a Windows font.
  1678.             See the section WINDOWS AND FONTS for a complete
  1679.             description of this function
  1680.  
  1681.  
  1682.  
  1683.           FONT$(n)
  1684.  
  1685.             This function returns information about a Windows font.
  1686.             See the section WINDOWS AND FONTS for a complete
  1687.             description of this function.
  1688.  
  1689.  
  1690.  
  1691.           FOR..NEXT
  1692.  
  1693.           FOR counter=start TO end [STEP increment]
  1694.  
  1695.             Defines a program loop.
  1696.  
  1697.                 FOR I%=1 TO 100
  1698.                   PRINT I%
  1699.                 NEXT I%
  1700.  
  1701.  
  1702.  
  1703.           FREEMEM
  1704.  
  1705.             This function returns the amount of global memory
  1706.             available to other programs.
  1707.  
  1708.  
  1709.  
  1710.           FUNCTION name,[(Paramenter list)]
  1711.  
  1712.             This statement starts a user defined function.  User
  1713.                                       25
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.             defined functions can perform a series of instructions
  1726.             and then return a single value of type String, Float,
  1727.             Integer, or Long Integer.  A user defined function is
  1728.             used in an expression in the same way that a BasicBasic
  1729.             function is used.  Functions must be defined before they
  1730.             can be used. Typically all functions are defined at the
  1731.             start of a program.  They are not executed until called
  1732.             in an expression.
  1733.  
  1734.             name: The name of the function.  The name defines what
  1735.             type of value is returned from the function.  This name
  1736.             is assigned a value somewhere in the the function.
  1737.  
  1738.             parameter list: The list of variables that will be
  1739.             passed to the User Function.  Any changes to the
  1740.             parameters are not returned to the calling expression.
  1741.  
  1742.             Here is an example of a function which makes all
  1743.             characters in a string upper case.
  1744.  
  1745.                FUNCTION UPPER$(A$)
  1746.                  FOR I%=1 TO LEN(A$)
  1747.                   A%=ASC(MID$(A$,I%,1))
  1748.                   IF A%>=96 AND A%<=96+26 THEN
  1749.                     A%=A%-32
  1750.                     MID$(A$,I%,1)=CHR$(A%)
  1751.                   END IF
  1752.                  NEXT I%
  1753.                  UPPER$=A$
  1754.                END FUNCTION
  1755.  
  1756.                PRINT UPPER$("This will display in upper case.")
  1757.  
  1758.  
  1759.           The EXIT FUNCTION statement may be used to exit a function
  1760.           at any time.  You may not transfer control out of the
  1761.           function except with the END FUNCTION or EXIT FUNCTION
  1762.           statements.
  1763.  
  1764.           In this version of BasicBasic functions do not have access
  1765.           to common variables.
  1766.             
  1767.  
  1768.  
  1769.           GET (x1,y1)-(x2,y2),arrayname
  1770.  
  1771.             This statement gets a range of pixels from the graphics
  1772.             screen and puts them into an array.  The may be placed
  1773.             back on the screen using the PUT statement.  In
  1774.             BasicBasic only one set of pixels may be stored in each
  1775.             array and storing begins with the first element of the
  1776.             array.
  1777.  
  1778.                       e.g.
  1779.                                       26
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.                          DIM A%(100)
  1792.  
  1793.                          GET (100,100)-(109,109),A%
  1794.  
  1795.             It is important that you dimension the array large
  1796.             enough to hold the pixel data.
  1797.  
  1798.             You can calculate the space required as follows:
  1799.  
  1800.                size=int(((totalpixels*bits/pixel)+1)/8)+100
  1801.  
  1802.             Where size is in bytes.  Each element of an integer
  1803.             array takes up 2 bytes.
  1804.  
  1805.  
  1806.  
  1807.           GET #filenumber,recordnumber,variable$
  1808.  
  1809.             This statement allows input of data from RANDOM or
  1810.             BINARY files.
  1811.  
  1812.             For random files the record format and input/output
  1813.             buffer must previously have been assigned with a FIELD
  1814.             statement.  The following example would read in the
  1815.             first record of an existing random file which is defined
  1816.             to have a record length of 512 bytes, of which the first
  1817.             32 bytes are the first name and the second 32 bytes are
  1818.             the last name.  After the GET statement in the example
  1819.             is executed the data will be in the input buffer
  1820.             variables FIRST$ and LAST$.  After the file is closed
  1821.             the input buffer is cleared so data must be retrieved
  1822.             from the input buffer variables before closing the file.
  1823.  
  1824.                  OPEN "test.dat" FOR RANDOM AS #1 LEN = 512
  1825.                  FIELD #1,32 AS FIRST$,32 AS LAST$
  1826.                  TOPREC = 1
  1827.                  GET #1, TOPREC
  1828.                  IF EOF(1) THEN
  1829.                     PRINT "NO DATA IN FILE"
  1830.                  ELSE
  1831.                     SAVEFIRST$=FIRST$
  1832.                     SAVELAST$=LAST$
  1833.                  END IF
  1834.                  CLOSE #1
  1835.  
  1836.  
  1837.  
  1838.             For binary files recordnumber is an absolute byte
  1839.             position in the file.  Data will be input to variable$.
  1840.             Variable$ must be set up before an INPUT to be the same
  1841.             size as the desired number of characters to read.  The
  1842.             first byte of the file is number 1.
  1843.  
  1844.                OPEN "test.dat" FOR BINARY AS #1
  1845.                                       27
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.                FIRSTBYTE=1
  1858.                FIRST$=SPACE$(32)
  1859.                LAST$=SPACE$(32)
  1860.                GET #1, FIRSTBYTE,FIRST$
  1861.                FIRSTBYTE=FIRSTBYTE+32
  1862.                GET #1, FIRSTBYTE,LAST$
  1863.                CLOSE #1
  1864.  
  1865.  
  1866.  
  1867.           GOSUB label
  1868.  
  1869.             This statement causes a branch to a subroutine.
  1870.  
  1871.  
  1872.           GOTO label
  1873.  
  1874.             This statement causes a jump to another program
  1875.             location.
  1876.  
  1877.  
  1878.  
  1879.           IF...THEN...ELSE
  1880.  
  1881.             Permits conditional execution depending on evaluation of
  1882.             expression.
  1883.  
  1884.  
  1885.  
  1886.           INKEY$
  1887.  
  1888.             This function returns a character from the keyboard.
  1889.  
  1890.  
  1891.  
  1892.           INPUT[;]["promptstring"{;|,}] variablelist
  1893.  
  1894.             Executing this statement causes the program to pause and
  1895.             wait for input.  A promptstring may optionally be
  1896.             printed before pausing for input.  If a comma is used
  1897.             after the promptstring or if no prompt string is
  1898.             specified a question mark is displayed before waiting
  1899.             for input.  If INPUT is followed by a semicolon, then no
  1900.             carriage return line feed is performed after the Enter
  1901.             key is pressed.
  1902.  
  1903.  
  1904.  
  1905.           INPUT #filenumber,variablelist
  1906.  
  1907.             This statement reads items from an open file to the
  1908.             given variables.  When inputting data leading spaces
  1909.             will be ignored.
  1910.  
  1911.                                       28
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.           INPUT$(n,port)
  1926.  
  1927.             This function returns a string of n characters from a
  1928.             communications port.  If n characters are not available
  1929.             the function will WAIT for that many characters to
  1930.             arrive.  To avoid 'hanging up' your program use the LOC
  1931.             function to find how many characters are waiting.  If a
  1932.             communications error occurs the number of characters
  1933.             returned may be less than what you requested.  In this
  1934.             case use the function COMSTATI to determine what error
  1935.             occured.  See the section "Communications Programming"
  1936.             for more details.
  1937.  
  1938.  
  1939.  
  1940.           INSTR([start],expressiontosearch,searchforexpression)
  1941.  
  1942.             This function searches for the first occurence of
  1943.             searchforexpression in expressiontosearch and returns
  1944.             the position at which the match is found.  If no match
  1945.             is found then 0 is returned.
  1946.  
  1947.  
  1948.  
  1949.           INT(numericexpression)
  1950.  
  1951.             This function returns the largest integer less than or
  1952.             equal to numericexpression.
  1953.  
  1954.  
  1955.  
  1956.           KILL stringexpression
  1957.  
  1958.             This command deletes the file whose name is in
  1959.             stringexpression.
  1960.  
  1961.  
  1962.  
  1963.           LEFT$(stringexpression,n)
  1964.  
  1965.             This function returns a string of length n from the left
  1966.             part of stringexpression
  1967.  
  1968.  
  1969.  
  1970.           LEN(stringexpression)
  1971.  
  1972.             This function returns the number of characters in
  1973.             stringexpression.
  1974.  
  1975.  
  1976.  
  1977.                                       29
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.           LET
  1990.  
  1991.             May optionally be used before assignment statements.
  1992.             e.g. LET I=3
  1993.  
  1994.  
  1995.  
  1996.           LINE [STEP](x1,y1)-[STEP](x2,y2),[color],[B],[BF]
  1997.  
  1998.             This command draws a line, box, or filled box on the
  1999.             graphics screen.  The (x1,y1), (x2,y2) arguments are the
  2000.             end points of the line.  If a color is not specified the
  2001.             current foreground color will be used.  The 'B' option
  2002.             draws a box.  BF draws the box and paints the interior.
  2003.  
  2004.  
  2005.  
  2006.           LINE INPUT #,filenumber,stringvariable
  2007.  
  2008.             This statement inputs an entire line from a file.  Input
  2009.             continues until the next carriage return.
  2010.  
  2011.  
  2012.  
  2013.           LOADBITMAP filename,0,dx,dy,sx,sy,xsize,ysize,cv,xm,ym
  2014.  
  2015.             This statement loads and displays a bitmap.  The bitmap
  2016.             is displayed with the upper left screen coordinates at
  2017.             dx,dy.  sx,sy are the upper left bitmap coordinates.
  2018.             Xsize, ysize are the length in pixels of each dimension.
  2019.             If cv is set to 0 then all colors in the bitmap are
  2020.             converted to the closest defined color for the display.
  2021.             If set to 1 no conversion takes place.  Xm is an
  2022.             optional scaling factor in the x direction.  A positive
  2023.             number is used as a multiplier for the number of x bits;
  2024.             a negative number is used as a divider.  Xy is an
  2025.             optional scaling factor in the y direction.  A positive
  2026.             number is used as a multiplier and a negative number is
  2027.             used as a divider.
  2028.  
  2029.             See the section BITMAPS for further information.
  2030.  
  2031.  
  2032.  
  2033.           LOC(filenumber)
  2034.  
  2035.             This function returns the current absolute byte position
  2036.             within a file.  For a communications port it returns the
  2037.             number of received characters waiting in the receive
  2038.             buffer.
  2039.  
  2040.  
  2041.  
  2042.           LOCATE row,column,[cursor]
  2043.                                       30
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.             Positions the cursor on the screen.  If cursor is set to
  2057.             0 then the cursor is turned off.  In graphics mode 1000
  2058.             row, column are pixel positions (starting with 0) rather
  2059.             than character positions (starting with 1).
  2060.  
  2061.  
  2062.           
  2063.           LOOP [WHILE condition][UNTIL condition]
  2064.  
  2065.             Statement terminates a DO..LOOP series.  See the
  2066.             description of the DO statement for an explanation.
  2067.  
  2068.  
  2069.  
  2070.           LPRINT expressionlist [,|;]
  2071.  
  2072.             Prints the items in expression list.  See PRINT for a
  2073.             more complete description.
  2074.  
  2075.  
  2076.  
  2077.           LPRINT USING formatstring; expressionlist[,|;]
  2078.  
  2079.             The formatstring tells how to print the items in
  2080.             expressionlist.  See PRINT USING for a description of
  2081.             format string items.
  2082.  
  2083.  
  2084.  
  2085.           LSET stringvariable=string expression
  2086.  
  2087.             This command puts data into a random access file buffer.
  2088.             The buffer must be previously defined by a FIELD
  2089.             statement.  The data is left justified in the field.
  2090.  
  2091.               e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  2092.                     FIELD #1,18 AS NAME$,18 AS ADDRESS$
  2093.                     LSET NAME$="FRED SMITH"
  2094.                     LSET ADDRESS$="1 MAIN STRING"
  2095.                     PUT #1,4
  2096.                     CLOSE #1
  2097.  
  2098.  
  2099.  
  2100.           MAINMENU string1,string2...,string6,[bc,fc,gc,mc]
  2101.  
  2102.             This command defines the main menu bar.  Up to six menu
  2103.             names may be specified.  If less than six are defined,
  2104.             blank strings must be present.  See the section
  2105.             'Programming menus' for more detail.
  2106.  
  2107.             Under DOS, the optional numeric values bc,fc,gc,mc
  2108.             represent background color, foreground color, graycolor,
  2109.                                       31
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.             and the character code of the key which calls the menu
  2122.             bar respectively.  Under DOS if you use menus there are
  2123.             only 24 text lines remaining for use(lines 1-24).
  2124.  
  2125.               e.g. MAINMENU "File","Color","Options","","",""
  2126.  
  2127.                    MAINMENU "File","Color","","","","",7,1,4,1067
  2128.                      Defines a menu bar which under DOS would have a
  2129.                      background color of 7 and foreground color of 1
  2130.                      and which could be summoned by pressing F9.
  2131.  
  2132.             SAMPLE4.BAS uses the MAINMENU command.
  2133.  
  2134.  
  2135.  
  2136.           MENUITEMGRAY keycode
  2137.  
  2138.             DOS.  This command 'grays' a submenu item.  While gray
  2139.             the item cannot be selected by the user.  See the
  2140.             section 'Programming menus' for more detail.
  2141.  
  2142.  
  2143.  
  2144.           MENUITEMON keycode
  2145.  
  2146.             This command enables a submenu item.  When enable a user
  2147.             may select this menu item.
  2148.  
  2149.  
  2150.  
  2151.           MID$(stringexpression,n,length)
  2152.  
  2153.             This function returns a string composed of length
  2154.             characters starting with character n in
  2155.             stringexpression.
  2156.  
  2157.  
  2158.  
  2159.           MKDIR stringexpression
  2160.  
  2161.             This command creates a directory specified by
  2162.             stringexpression
  2163.  
  2164.  
  2165.  
  2166.           MOUSEB
  2167.  
  2168.             This function returns information on whether mouse
  2169.             buttons are pressed.  Bit 0 is 1 if left button is
  2170.             pressed.  Bit 1 is 1 if right button is pressed.  Bit 2
  2171.             is 1 if middle button is pressed.
  2172.  
  2173.               e.g.  b=mouseb
  2174.                     b=b and 2
  2175.                                       32
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.                     if b<>0 then
  2188.                       print "right button is pressed."
  2189.                     end if
  2190.  
  2191.             SAMPLE8.BAS uses the MOUSEB command
  2192.  
  2193.  
  2194.  
  2195.           MOUSEON
  2196.  
  2197.             This function intializes the mouse.  It returns a -1
  2198.             (true) if a mouse is present.  It returns 0 if no mouse
  2199.             is present.  This function must be issued before the
  2200.             mouse can be used in both DOS and Windows.
  2201.  
  2202.               e.g.  mouseflag=mouseon
  2203.  
  2204.  
  2205.  
  2206.           MOUSEX
  2207.  
  2208.             This function returns the x position of the mouse in
  2209.             character units (1 through 80) for screen mode 0 and in
  2210.             pixel units (0 through top) in all other screen modes.
  2211.  
  2212.               e.g. x=mousex
  2213.  
  2214.  
  2215.  
  2216.           MOUSEY
  2217.  
  2218.             This function returns the y position of the mouse in
  2219.             character units (1 through 25) for screen mode 0 and in
  2220.             pixel units (0 through top) in all other screen modes..
  2221.  
  2222.               e.g.  y=mousey
  2223.  
  2224.  
  2225.  
  2226.           ON CLOSE GOSUB line number
  2227.  
  2228.             This command is ignored under DOS.  This statement
  2229.             defines a subroutine which will be called if the user
  2230.             selects CLOSE from the system menu.  Most programs will
  2231.             not need to use this statement.  However, if you keep
  2232.             important data in in program variables, you may want to
  2233.             prevent the user from terminating your program without
  2234.             giving them an option to save the data.
  2235.  
  2236.             When you receive control because of a close command you
  2237.             can either save important data and stop or execute
  2238.             RETURN and your program will continue running.  Normally
  2239.             you should terminate as soon as possible after receiving
  2240.             control in your close routine.
  2241.                                       33
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.             Here is a simple example of how this statement could be
  2255.             used:
  2256.  
  2257.                      ON CLOSE GOSUB 1000
  2258.  
  2259.                      PRINT "Test of ON CLOSE statement...";
  2260.                      input z
  2261.  
  2262.                      stop
  2263.  
  2264.                 1000 INPUT "Do you want to quit ";a$
  2265.                      IF A$="Y" OR A$="y" THEN
  2266.                        STOP
  2267.                      END IF
  2268.                      RETURN
  2269.  
  2270.           It is important to be aware that Windows can call your ON
  2271.           CLOSE subroutine AT ANY TIME.  Be very careful about using
  2272.           global variables in an ON CLOSE subroutine.  Your main
  2273.           program may not expect them to be changed.
  2274.  
  2275.  
  2276.  
  2277.           ON PAINT GOSUB line number
  2278.  
  2279.             This statement defines a subroutine which handles screen
  2280.             updates.  This statement is ignored in DOS.  This
  2281.             statement is optional in Windows.  See the section on
  2282.             Windows and Graphics for more detail.
  2283.  
  2284.  
  2285.  
  2286.           OPEN filename FOR mode [ACCESS access] AS # [LEN=reclen]
  2287.  
  2288.             This command prepares the file filename for access as
  2289.             number #.  The filename can be a file name with or
  2290.             without a pathname.  Modes supported are INPUT, OUTPUT,
  2291.             APPEND, BINARY, RANDOM.  INPUT, OUTPUT, APPEND are for
  2292.             sequential files.  RANDOM is for random-access files
  2293.             with fixed length records.  BINARY can be used to access
  2294.             any byte of any file.
  2295.  
  2296.             Access types supported are READ, WRITE, or READ WRITE.
  2297.             This argument is optional and is only valid for BINARY
  2298.             and RANDOM files.  READ WRITE is the default.  If you
  2299.             specify READ you will get an error if you try to access
  2300.             a file marked as read-only by DOS.
  2301.  
  2302.             LEN is used for random access files.  It is the record
  2303.             length.  This argument is optional.  128 is the default.
  2304.  
  2305.             e.g.  OPEN "TEST.DAT" FOR INPUT AS #1
  2306.  
  2307.                                       34
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.             e.g.  OPEN "TEST.DAT" FOR RANDOM ACCESS READ AS #1
  2320.  
  2321.             e.g.  OPEN "TEST.DAT" FOR RANDOM ACCESS READ WRITE AS #1
  2322.  
  2323.             e.g.  OPEN "T.DAT" FOR RANDOM AS #1 LEN=128
  2324.  
  2325.             SAMPLEW2.BAS use the OPEN command.
  2326.  
  2327.  
  2328.  
  2329.           OPEN "COMn: speed,parity,data,stop" FOR RANDOM AS #n LEN=n
  2330.  
  2331.             This statement opens and initializes a communications
  2332.             port.  COM1 and COM2 are supported.  Supported speeds
  2333.             are 9600, 4800,2400,1200,and 300.  Parity may be either
  2334.             E,O,N, or M.  Data may be either 5,6,7, or 8.  Stop may
  2335.             be either 1, 1.5, or 2.  LEN is used to specify the size
  2336.             of the input buffer.  The default is 128 bytes.  For
  2337.             Windows programs a minimum of 2048 is suggested.
  2338.  
  2339.             Only PRINT # will output characters to an open
  2340.             communications port.  Only INPUT$ will receive
  2341.             characters from a port.
  2342.  
  2343.             Communications parameters may be omitted; however, their
  2344.             position must be marked by commas.  Default parameters
  2345.             are 300 baud, No parity, 8 data bits, and 1 stop bit.
  2346.  
  2347.               e.g. OPEN "COM1: 2400,E,7,1" for random as #1 len=2048
  2348.  
  2349.             See the section "Communications Programming" for more
  2350.             details.
  2351.  
  2352.             SAMPLE6.BAS use the OPEN COM command.
  2353.  
  2354.  
  2355.  
  2356.           OPENFILEREAD filterstr,namestr,directorystr,titlestr
  2357.  
  2358.             This statement executes a special Dialog which allows
  2359.             the user to input a file name for input.  See the
  2360.             section "Programming Dialog Boxes" for details.
  2361.  
  2362.             SAMPLE12.BAS and SAMPLEW4.BAS use the OPENFILEREAD
  2363.             command.
  2364.  
  2365.  
  2366.  
  2367.           OPENFILESAVE filterstr,namestr,directorystr,titlestr
  2368.  
  2369.             This statement executes a special Dialog which allows
  2370.             the user to input a file name for writing.  See the
  2371.             section "Programming Dialog Boxes" for details.
  2372.  
  2373.                                       35
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.           OSTYPE
  2390.  
  2391.             This function returns a number indicating what operating
  2392.             system the program is running under.
  2393.  
  2394.                    1 - DOS
  2395.                    2 - Windows 3.x
  2396.                    3 - ?
  2397.  
  2398.  
  2399.  
  2400.           PAINT [STEP](x,y),[paint],[border]
  2401.  
  2402.             This statement fills a graphics area with the color
  2403.             selected.  (x,y) is the first point filled.  It will be
  2404.             filled with the color specified by the attribute
  2405.             'paint', if supplied.  If not supplied the foreground
  2406.             color is used.  Coloring in all directions continues
  2407.             until the 'border' color is encountered.  If border
  2408.             color is not supplied the paint color is used.
  2409.  
  2410.  
  2411.  
  2412.           PALETTE attribute,color
  2413.  
  2414.             This statement allows you to change the default graphic
  2415.             colors provided by BasicBasic.  The usage of the
  2416.             attribute and color arguments depends on the screen mode
  2417.             you are in.  You can always find out your current screen
  2418.             mode using the SYSTEM function.  For Windows programs
  2419.             see the section on WINDOWS AND GRAPHICS for additional
  2420.             information on the PALETTE statement.  Here are the
  2421.             definition of the arguments for various screen modes:
  2422.             screen color.
  2423.  
  2424.             MODE 8
  2425.  
  2426.               Attribute determines which one of the 16 color
  2427.               attributes you want to redefine.  It is the attribute
  2428.               you select with the COLOR statement.  In this mode you
  2429.               have 16 colors to choose from (0 to 15).  See the
  2430.               COLOR statement for a listing of the colors.
  2431.  
  2432.             MODE 9
  2433.  
  2434.               Attribute determines which one of the 16 color
  2435.               attributes you want to redefine.  In this mode you
  2436.               have 64 colors to choose from (0 to 63).
  2437.  
  2438.             MODE 12
  2439.                                       36
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.               In this mode attribute determines which one of the 16
  2453.               color attributes you want to redefine.  In this mode
  2454.               the color value reflects an exact RGB definition of
  2455.               the color you want.  If you use a variable for color
  2456.               it must be of type long integer.
  2457.  
  2458.                 color= 65536 * blue + 256 * green + red
  2459.  
  2460.               Where blue, green, red can be from 0 to 255.
  2461.  
  2462.  
  2463.  
  2464.           POINT (x,y)
  2465.  
  2466.             This function returns the color of the specified
  2467.             graphics pixel.
  2468.  
  2469.  
  2470.  
  2471.           POS(0)
  2472.  
  2473.             This function returns the current column position of the
  2474.             cursor(starting with 1).  In graphics mode 1000 this
  2475.             function returns the pixel column (starting with 0).
  2476.  
  2477.  
  2478.  
  2479.           POSITION x1,y2,xlen,ylen
  2480.  
  2481.             This statement sizes and positions a window.  x1,y1 are
  2482.             the upper left of the window.  This statement is ignored
  2483.             in DOS.
  2484.  
  2485.  
  2486.  
  2487.           PRESET [STEP](x,y),[color]
  2488.  
  2489.             This command sets one pixel on the screen to the
  2490.             specified color.  By using the STEP prefix you can
  2491.             specify that the x,y coordinates are relative to the
  2492.             current position.  If no color is supplied the pixel is
  2493.             set to the background color.
  2494.  
  2495.  
  2496.  
  2497.           PRINT expressionlist [,|;]
  2498.  
  2499.             Prints the items in expression list.  PRINT with no
  2500.             expression results in a blank line being printed.  If
  2501.             the expression is followed by a semi-colon (;) the next
  2502.             print starts immediately following this one.  If the
  2503.             expression ends in a comma (,) the next print starts at
  2504.             the next print position.  Print positions are at columns
  2505.                                       37
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.             1, 15, 29, etc.
  2518.  
  2519.  
  2520.  
  2521.           PRINT USING formatstring; expressionlist[,|;]
  2522.  
  2523.             The formatstring tells how to print the items in
  2524.             expressionlist.  Any text may be in formatstring.
  2525.             BasicBasic only recognizes three format characters.
  2526.             These are pound sign (#)  comma (,) and period (.).
  2527.             Each time a number character is found (#) one item from
  2528.             the expression list will be printed.
  2529.  
  2530.                e.g. PRINT USING "The answer is: ###,###.##";number
  2531.  
  2532.  
  2533.  
  2534.           PRINT #filenumber,expressonlist
  2535.  
  2536.             Prints to a file or communications port the items in
  2537.             expression list.
  2538.  
  2539.  
  2540.  
  2541.           PSET [STEP](x,y),[color]
  2542.  
  2543.             This command sets one pixel on the screen to the
  2544.             specified color.  By using the STEP prefix you can
  2545.             specify that the x,y coordinates are relative to the
  2546.             current position.  If no color is supplied the pixel is
  2547.             set to the foreground color.
  2548.  
  2549.  
  2550.  
  2551.           PUT (x,y),arrayname,action
  2552.  
  2553.             This statement places pixels stored in an array onto the
  2554.             screen.  (x,y) is the upper left position.  The x and y
  2555.             length placed on the screen depends on the GET statement
  2556.             which stored the data into the array.
  2557.  
  2558.             The action may be one of the following:
  2559.  
  2560.                   XOR  - Combines the pixels in the array and those
  2561.                          on the screen using the XOR operator.
  2562.                          This is the most common action used for
  2563.                          motion since this automatically restores
  2564.                          the background when done twice.  XOR is
  2565.                          the default.
  2566.  
  2567.                  PSET  - Transfers data erasing what is already on
  2568.                          the screen.
  2569.  
  2570.                PRESET  - Inverts data and transfers to screen
  2571.                                       38
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.                          erasing what is already on the screen.
  2584.  
  2585.                   AND  - Masks screen image with data in array.
  2586.  
  2587.                    OR  - Superimposes data on existing screen.
  2588.  
  2589.             For Windows use see the section WINDOWS AND GRAPHICS for
  2590.             more information.
  2591.  
  2592.  
  2593.           PUT #filenumber,recordnumber,stringexpression
  2594.           PUT #filenumber,recordnumber
  2595.  
  2596.             This statement is used to output data to a file opened
  2597.             in either BINARY or RANDOM mode.
  2598.  
  2599.             In BINARY mode the string expression will be written to
  2600.             the file at the byte location given by recordnumber.
  2601.             Recordnumber is the absolute byte number to be written,
  2602.             where the first byte of the file is 1.
  2603.  
  2604.               e.g. A$=SPACE$(20)
  2605.                    PUT #1,100,A$  (writes 20 bytes starting at 100)
  2606.  
  2607.  
  2608.             In RANDOM mode the data in the output buffer will be
  2609.             written to the record number indicated.
  2610.  
  2611.               e.g. PUT #1,1    (writes to record 1)
  2612.  
  2613.  
  2614.  
  2615.           RADIOON keycode
  2616.  
  2617.             This command 'checks' the indicated Radio button.  See
  2618.             the section "Programming Buttons" for more information.
  2619.  
  2620.  
  2621.  
  2622.           RADIOOFF keycode
  2623.  
  2624.             This command 'unchecks' the indicated Radio button.  See
  2625.             the section "Programming Buttons" for more information.
  2626.  
  2627.  
  2628.  
  2629.           RANDOMIZE
  2630.  
  2631.             This statement initializes the random number generator.
  2632.             If you use the RND function you probably want to preceed
  2633.             it's use with the RANDOMIZE statement.  Otherwise
  2634.             everytime your program runs you will get the same
  2635.             sequence of 'random' numbers.  This statement has no
  2636.             arguments.
  2637.                                       39
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.           READ variablelist
  2653.  
  2654.             Inputs a value from a DATA statement.
  2655.  
  2656.  
  2657.  
  2658.           REM
  2659.  
  2660.             Denotes a comment line and is ignored by the compiler.
  2661.  
  2662.  
  2663.  
  2664.           RESTORE label
  2665.  
  2666.             Sets position that next READ statement will input data
  2667.             from.
  2668.  
  2669.  
  2670.  
  2671.           RETURN
  2672.  
  2673.             Returns program execution to location immediately after
  2674.             last GOSUB.
  2675.  
  2676.  
  2677.  
  2678.           RIGHT$(stringexpression,n)
  2679.  
  2680.             This function returns a string of length n from the
  2681.             right part of stringexpression
  2682.  
  2683.  
  2684.  
  2685.           RMDIR stringexpression
  2686.  
  2687.             This command removes the directory given by
  2688.             stringexpression.
  2689.  
  2690.  
  2691.  
  2692.           RND
  2693.  
  2694.             This function returns one in a sequence of random
  2695.             numbers between 0 and 1.
  2696.  
  2697.  
  2698.           SCREEN mode[,palette][,peflag]
  2699.  
  2700.             This statement selects the screen mode.  The actual
  2701.             screen mode available depends on your hardware.  The
  2702.             modes available in this version of BasicBasic are:
  2703.                                       40
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.              0 - Text Only.  This is the default.
  2717.  
  2718.              2 - 640-200 Graphics.  Black and white only.
  2719.                  80 x 25 text format. (CGA, EGA, VGA)
  2720.  
  2721.              8 - 640-200 Graphics.  16 colors and 16 attributes
  2722.                  80 x 25 text format (EGA,VGA)
  2723.  
  2724.              9 - 640-350 Graphics.  16 colors and 16 attributes
  2725.                  80 x 25 text format (EGA,VGA)
  2726.  
  2727.             12 - 640-480 Graphics.  256,000 colors and 16 attributes
  2728.                  80 x 30 text format (VGA)
  2729.  
  2730.             1000 - Special mode.  Supports whatever graphics
  2731.                  resolution Windows supports or, under DOS, the
  2732.                  highest resolution the monitor supports.  Under
  2733.                  Windows supports font generation  Issueing a SCREEN
  2734.                  1000 under DOS results in selection of the highest
  2735.                  available graphics mode (2, 8, 9 or 12).
  2736.  
  2737.             The Palette argument is ignored under DOS. Under Windows
  2738.             it allows you to select the special BasicBasic palette
  2739.             if set to 16, or to select the 'system palette' if set
  2740.             to 0.  If the Palette argument is omitted then the
  2741.             default is 0, use the system palette.  If hardware
  2742.             supports you can also set up to 256 for 256 color
  2743.             selection.  See the section WINDOWS AND GRAPHICS for
  2744.             more detail.
  2745.  
  2746.             The peflag argument is ignored under DOS.  Under Windows
  2747.             this flag can be set to 1 to prevent other programs from
  2748.             using palette entries supplied by your logical palette
  2749.             or 4 to specify that you do not want to use any palette
  2750.             entries supplied by other programs.  The default value
  2751.             is 0 and there is seldom a reason to change this.
  2752.  
  2753.             Here are examples of how the SCREEN command might be
  2754.             used under Windows.
  2755.  
  2756.                 SCREEN 8         -- system palette
  2757.                 SCREEN 8,0       -- system palette
  2758.                 SCREEN 8,16      -- special BasicBasic palette
  2759.                 SCREEN 1000,256  -- special BasicBasic palette
  2760.  
  2761.             Under Windows if you select 256 color mode on a machine
  2762.             with a palette size of 256, then Windows only allows you
  2763.             to change 236 of the palette entries.  Entries 0->9 and
  2764.             246->255 are fixed and may not be changed.  The fixed
  2765.             windows colors are different from the standard, default
  2766.             Basic Colors
  2767.  
  2768.             If you do not know the output capabilites of the machine
  2769.                                       41
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.             your program is going to run on, use the SETERRLEVEL
  2782.             command to determine if a screen mode has been
  2783.             successful.  Here is an example:
  2784.  
  2785.                     SETERRLEVEL 5
  2786.                     ERR=0
  2787.                     SCREEN 12
  2788.                     IF ERR>0 THEN
  2789.                       ERR=0
  2790.                       SCREEN 9
  2791.                       IF ERR>0 THEN
  2792.                         ERR=0
  2793.                         SCREEN 8
  2794.                         IF ERR>0 THEN
  2795.                           PRINT "GRAPHICS NOT AVAILABLE."
  2796.                           STOP
  2797.                         END IF
  2798.                       END IF
  2799.                     END IF
  2800.  
  2801.             The SCREEN command resets SCROLLAREA to entire screen.
  2802.  
  2803.             SAMPLE7.BAS uses the SCREEN command
  2804.  
  2805.  
  2806.  
  2807.  
  2808.           SCROLLAREA leftx,topy,rightx,bottomy
  2809.  
  2810.             This statement defines an area of the screen which is
  2811.             used for scrolling.  This allows you to create fixed
  2812.             text or buttons in one area of the screen while
  2813.             scrolling another area.  In screen modes less than 1000
  2814.             Leftx, topy, rightx, bottomy are in character units and
  2815.             are inclusive(starting with 1).  In screen mode 1000
  2816.             leftx, topy, rightx, bottomy are pixel units(starting
  2817.             with 0).
  2818.  
  2819.             Executing the CLS command will clear the entire screen,
  2820.             not just the scrollable area.  PRINT CHR$(12); will only
  2821.             clear the scrollable area.
  2822.  
  2823.  
  2824.  
  2825.           SELECTBITMAP bitmapnumber
  2826.  
  2827.             This command is ignored under DOS.  Under Windows this
  2828.             command assigns screen output to a memory bitmap or back
  2829.             to the screen again.  A bitmapnumber=0 signifies the
  2830.             screen; 1 or 2 signify one of the two possible memory
  2831.             bitmaps previously created with the CREATEBITMAP
  2832.             command.  DO NOT perform input operations, define
  2833.             buttons, or call Dialogs while a memory bitmap is
  2834.             selected!
  2835.                                       42
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.             The following example draws and fills rectangles on a
  2849.             memory bitmap and then copies it to the screen.
  2850.  
  2851.                  pxsize=100
  2852.                  pysize=100
  2853.                  createbitmap 1,0,pxsize,pysize
  2854.                  selectbitmap 1
  2855.                  c=1
  2856.                  for i=0 to 90 step 10
  2857.                    line (i,0)-(i+10,100),c,bf
  2858.                    c=c+1
  2859.                  next i
  2860.                  selectbitmap 0
  2861.                  copybits 0,0,0,100,100,1,0,0,0
  2862.  
  2863.  
  2864.  
  2865.           SETCOM comnum,"Speed,Parity,Databits,Stopbits,dtr,rts"
  2866.  
  2867.             This statement allows you to change communications
  2868.             parameters for an already opened communications port.
  2869.             Speed, Parity, Databits, and Stopbits are described in
  2870.             OPEN COM.  DTR may be either ON or OFF.  If ON then the
  2871.             output data terminal ready signal will be set high.  ON
  2872.             is the default.  RTS may be either 1 or 0.  If 1 then
  2873.             the output request to send is high.  1 is the default.
  2874.             Communications parameters not present will not be
  2875.             changed; however, a comma must mark their positions.
  2876.  
  2877.                e.g. SETCOM 1,",,7"
  2878.  
  2879.                      Sets number of data bits to 7.
  2880.  
  2881.                e.g. SETCOM 1,",,,,OFF"
  2882.  
  2883.                     Turns Data terminal read;y off.
  2884.  
  2885.             See the section "Communications Programming" for more
  2886.             information.
  2887.  
  2888.  
  2889.  
  2890.           SETERRLEVEL level
  2891.  
  2892.             This command defines what BasicBasic should do in case
  2893.             of runtime errors.  Level must be a number (not an
  2894.             expression or variable).  Level 7 causes execution to
  2895.             halted for all errors.  Level 5 causes execution to
  2896.             continue for recoverable errors.  In the latter case the
  2897.             global variable ERR is set to the error number.  ERR may
  2898.             be reset with the statement:  ERR=0.  ERR will be reset
  2899.             each time an error occurs so the program must check ERR
  2900.             immediately after statements which may produce errors.
  2901.                                       43
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.           SHELL [string]
  2917.  
  2918.             This command runs another program.  String may contain
  2919.             an optional command string to pass to the called
  2920.             program.
  2921.  
  2922.               e.g.   SHELL WRITE  MYFILE.WRI
  2923.  
  2924.               Would call the application WRITE and pass it the
  2925.               command string MYFILE.WRI.
  2926.  
  2927.  
  2928.  
  2929.           SIN(x)
  2930.  
  2931.             This function returns the sine of an angle expressed in
  2932.             radians.
  2933.  
  2934.  
  2935.  
  2936.           SOUND frequency,duration
  2937.  
  2938.             This command issues tones through the computer speaker.
  2939.             The frequency is the desired frequency in cycles per
  2940.             second(cps).  The duration is the multiple of the clock
  2941.             frequency (i.e. 18.2).
  2942.  
  2943.  
  2944.  
  2945.           SPACE$(N)
  2946.  
  2947.             Returns a string of n spaces.
  2948.  
  2949.  
  2950.  
  2951.           STOP
  2952.  
  2953.             Causes the program to cease execution.
  2954.  
  2955.  
  2956.  
  2957.           STOREBITMAP 0,filename,x,y,xsize,ysize,cv,0
  2958.  
  2959.             This statement stores the designated portion of the
  2960.             display to a bitmap file with the designated name.  X,y
  2961.             are the upper left screen coordinates.  If cv is set to
  2962.             1 then the file will be stored in run-length-encoded
  2963.             compressed format if possible.
  2964.  
  2965.             See the section BITMAPS for further information.
  2966.  
  2967.                                       44
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.           STR$(numericexpression)
  2982.  
  2983.            This function returns a string representation of the
  2984.            numbericexpression.
  2985.  
  2986.  
  2987.  
  2988.           STRING$(m,stringexpression)
  2989.  
  2990.             This function returns a string of length n.  This string
  2991.             is composed of the first character in stringexpression.
  2992.  
  2993.  
  2994.  
  2995.           SUB
  2996.  
  2997.             This statement is used at the beginning of a SUB
  2998.             procedure.  See the CALL statement for an example.
  2999.  
  3000.  
  3001.  
  3002.           SYSTEM (n)
  3003.  
  3004.             This function returns information on the screen
  3005.             depending on the value of n passed to it.  This
  3006.             information is of most use to Windows programs.
  3007.  
  3008.                 n       function returns
  3009.                ---    ----------------------------------
  3010.                 1     Maximum x allowed in a graphics program
  3011.                 2     Maximum y allowed in a graphics program
  3012.                 3     Actual maximum screen size x
  3013.                 4     Actual maximum screen size y
  3014.                 5     Maximum color attribute
  3015.                 6     Maximum 'background color' in COLOR statement
  3016.                 7     Current screen mode
  3017.                 8     Window left position
  3018.                 9     Window top position
  3019.                 10    Window x size
  3020.                 11    Window y size
  3021.                 12    Returns 1 if window is Active Window, 0
  3022.                       otherwise.  See WINDOWS AND GRAPHICS for
  3023.                       more information on uses of this value.
  3024.                 13    DOS major version number (e.g. 5)
  3025.                 14    DOS minor version number (e.g. 0)
  3026.                 15    Windows major version number (e.g. 3)
  3027.                 16    Windows minor version number (e.g. 1)
  3028.                 17    Hardware Palette Size
  3029.  
  3030.  
  3031.           TAB(numericexpression)
  3032.  
  3033.                                       45
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.             In PRINT or LPRINT statements positions output at column
  3046.             position given in numericexpression.
  3047.  
  3048.  
  3049.  
  3050.           TAN(x)
  3051.  
  3052.             This function returns the tangent of an angle expressed
  3053.             in radians.
  3054.  
  3055.  
  3056.  
  3057.           TIME$
  3058.  
  3059.             This function returns a string representation of the
  3060.             current system time.
  3061.  
  3062.  
  3063.  
  3064.           TIMER
  3065.  
  3066.             This function returns the number of seconds since
  3067.             midnight.
  3068.  
  3069.  
  3070.  
  3071.           UCASE$(stringexpression)
  3072.  
  3073.             This function converts all lower case characters in
  3074.             stringexpression to upper case and returns as new
  3075.             string.
  3076.  
  3077.  
  3078.  
  3079.           VAL(stringexpression)
  3080.  
  3081.             This function returns the numeric value of string
  3082.             stringexpression.
  3083.  
  3084.  
  3085.  
  3086.           WRITE #filenumber,expression list
  3087.  
  3088.             Write is performs the same way as Print with these
  3089.             exceptions:  1) Commas are inserted between all items;
  3090.             2) Strings are bracketed by quotation marks.
  3091.  
  3092.             BasicBasic does not support using the Write statement to
  3093.             display on the screen.
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.                                       46
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.           GRAPHICS PROGRAMMING FOR BEGINNERS
  3112.           -------------------------------------------------------
  3113.           
  3114.           This section will show you the basics of graphics
  3115.           programming in BasicBasic.  The examples given will work
  3116.           equally well running under DOS or Windows.
  3117.  
  3118.           Now here is your first graphics program:
  3119.  
  3120.                   SCREEN 2
  3121.                   LINE (0,0)-(400,100)
  3122.                   INPUT Z
  3123.  
  3124.           This program draws one diagonal line on the screen.  The
  3125.           key to graphics programming is the SCREEN command.  You
  3126.           must issue a SCREEN command to tell BasicBasic that you
  3127.           are going to do graphics.  Screen 2 puts your screen into
  3128.           a graphics mode with 640 dots (pixels) across and 200 dots
  3129.           down.  Each dot is either white or black.  Most of our
  3130.           examples will use SCREEN 8, which has the same number of
  3131.           dots, but 16 colors.  If you are running on a CGA display,
  3132.           SCREEN 2 is the only graphics mode available, so you will
  3133.           have to adjust these examples.
  3134.  
  3135.           The second line in our example contains the LINE
  3136.           statement.  The LINE statement will do much more than make
  3137.           lines.  It will also create boxes and fill them with a
  3138.           color if you want.  Here is another program:
  3139.  
  3140.                   SCREEN 8
  3141.                   LINE (0,0)-(400,100),4,B
  3142.                   INPUT Z
  3143.  
  3144.           This program puts the hardware into a 16 color mode and
  3145.           then creates a box with red lines.  The 'B' at the end of
  3146.           the statement is what tells it to make a box.  Notice that
  3147.           the diagonal line is not drawn on the screen.  Instead the
  3148.           end points in the statement are used as the opposing
  3149.           corners of the box.  The 4 specifies the color red.  You
  3150.           could also do the following:
  3151.  
  3152.                   SCREEN 8
  3153.                   LINE (0,0)-(400,100),4,BF
  3154.                   INPUT Z
  3155.  
  3156.           This program has 'BF' instead of 'B' in the LINE
  3157.           statement.  The 'BF' says to draw a box and then fill it
  3158.           with the same color.
  3159.  
  3160.           Of course you can also use a variable in place of the
  3161.           numeric constants we have used so far:
  3162.  
  3163.                   SCREEN 8
  3164.                   FOR I=0 TO 15
  3165.                                       47
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.                     X=I*10
  3178.                     Y=I*5
  3179.                     MYCOLOR=I
  3180.                     LINE (X,Y)-(X+10,Y+10),MYCOLOR,B
  3181.                   NEXT I
  3182.                   INPUT Z
  3183.  
  3184.           This creates a series of boxes.
  3185.  
  3186.           If you are tired of sharp corners try this:
  3187.  
  3188.                   SCREEN 8
  3189.                   CIRCLE (100,100),50,4
  3190.                   INPUT Z
  3191.  
  3192.           As you might expect this draws a circle.  The center of
  3193.           the circle is at 100,100; it has a radius of 50 and is
  3194.           drawn in red(the 4).  The CIRCLE statement will do much
  3195.           more than draw circles; it will also draw arcs and pie
  3196.           sections.  Try this:
  3197.  
  3198.                   SCREEN 8
  3199.                   CIRCLE (100,100),50,4,0,3.1416/2
  3200.                   INPUT Z
  3201.  
  3202.           This draws a quarter circle (an arc) starting to the right
  3203.           and finishing up at the top.  To do this we are added 2
  3204.           more arguments to the CIRCLE statement; 0 and 3.1416/2.
  3205.           These are the start and end angles in radians of the arc.
  3206.           There are 2pi radians in a circle.  Don't remember this
  3207.           from high school?  Just remember that 0 is to the right;
  3208.           3.1416/2 is up, 3.1416 is left, and 4.7124 is down.
  3209.  
  3210.           Putting a minus sign before the start and end angles cause
  3211.           BasicBasic to draw a pie section.
  3212.  
  3213.                   SCREEN 8
  3214.                   CIRCLE (100,100),50,4,-.01,-2
  3215.                   INPUT Z
  3216.  
  3217.           This draws a pie section slightly greater than a quarter
  3218.           circle.  The CIRCLE statement does not have a fill option
  3219.           like the LINE statement.  If you want to fill your pie
  3220.           section with a color you should use the PAINT statement.
  3221.           This is a very versatile statement.  You use it like this:
  3222.  
  3223.                   SCREEN 8
  3224.                   CIRCLE (100,100),50,4,-.01,-2
  3225.                   PAINT (102,98),4,4
  3226.                   INPUT Z
  3227.  
  3228.           Now we have a red pie section.  Paint starts filling the
  3229.           screen with color starting with the center point given and
  3230.           proceeding to the border color.  Notice that we made our
  3231.                                       48
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.           center point different than 100,100 to make sure it was
  3244.           inside the pie section we previously drew with the CIRCLE
  3245.           command.  We could have a blue pie section with red border
  3246.           with the following:
  3247.  
  3248.                   SCREEN 8
  3249.                   CIRCLE (100,100),50,4,-.01,-2
  3250.                   PAINT (102,98),1,4
  3251.  
  3252.           We will mention one last statement in this introductory
  3253.           discussion.  This is the PSET statement.  It allows you
  3254.           set individula pixels on the screen.
  3255.  
  3256.                   SCREEN 8
  3257.                   FOR I=1 TO 100
  3258.                     MYCOLOR=INT(RND*16)
  3259.                     X=INT(RND*640)
  3260.                     Y=INT(RND*200)
  3261.                     PSET (X,Y),MYCOLOR
  3262.                   NEXT I
  3263.                   INPUT Z
  3264.  
  3265.           The preceeding program 'splatters' 100 randomly placed
  3266.           pixels on the screen.  They also have random color.
  3267.  
  3268.           We won't discuss them here but other statements useful in
  3269.           graphics programming are:
  3270.  
  3271.                   PRESET
  3272.                   GET
  3273.                   PUT
  3274.                   COLOR
  3275.                   PALETTE
  3276.  
  3277.           Refer to the graphics programming examples SAMPLEG1.BAS,
  3278.           SAMPLEG2.BAS, SAMPLEG3.BAS and SAMPLEG4.BAS for more ideas
  3279.           on graphics programming.
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.                                       49
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.           PROGRAMMING BUTTONS
  3311.           -------------------------------------------------------
  3312.           
  3313.           Buttons can be used in either DOS or Windows.  Buttons do
  3314.           not require the presence of a mouse.  Here is an example
  3315.           of a valid create button command:
  3316.  
  3317.               CBUTTON "EXIT",1068,0,"Push",0,1,1,8,1,7,4
  3318.  
  3319.           Here is a description of each parameter:
  3320.  
  3321.             EXIT - This is the name displayed in the button
  3322.  
  3323.             1068 - This is keycode for F10 (User can either
  3324.                    use mouse to push button or press F10.
  3325.  
  3326.             0    - Reserved
  3327.  
  3328.             Push - Type of button.  'Radio' is the other type.
  3329.  
  3330.             0    - Reserved
  3331.  
  3332.             1    - Left position
  3333.  
  3334.             1    - Y position
  3335.  
  3336.             8    - x size (in characters)
  3337.  
  3338.             1    - y size (in characters)
  3339.  
  3340.             7    - foreground color (In Windows only used for Radio
  3341.                    buttons).
  3342.  
  3343.             4    - background color (In Windows only used for Radio
  3344.                    buttons).
  3345.  
  3346.           In DOS a push button will have text centered and if the
  3347.           defined text size is at least 2 characters smaller than
  3348.           the button size a line will be drawn around the outside.
  3349.  
  3350.           In graphics modes button position and size is given in
  3351.           pixel units rather than character units.
  3352.  
  3353.           Remember that if a mouse is going to be used it MUST be
  3354.           turned on with the MOUSEON function before it can be used
  3355.           to press a button.
  3356.  
  3357.           Here is an example of a small program which uses buttons:
  3358.  
  3359.                 A=MOUSEON
  3360.                 IF A=-1 THEN
  3361.                   CBUTTON "EXIT",1068,0,"PUSH",0,70,1,8,1,0,0
  3362.                 ELSE
  3363.                                       50
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.                   CBUTTON "F10-Exit",1068,0,"PUSH",0,70,1,10,1,0,0
  3376.                 END IF
  3377.                 INPUT Z
  3378.                 a$=INKEY$
  3379.                 PRINT LEN(A$)
  3380.  
  3381.             This program displays different text in the button
  3382.             depending on whether a mouse is present or not.
  3383.             Assuming there is a mouse this program will end under
  3384.             the following conditions:
  3385.  
  3386.                - User presses EXIT button with mouse
  3387.                - User presses F10 on keyboard
  3388.                - User presses ENTER key on keyboard.
  3389.  
  3390.             In the first two cases the print will show a length of 2
  3391.             for the length of A$ since the button keycode will be
  3392.             returned on the next INKEY$ after the INPUT is
  3393.             terminated.
  3394.  
  3395.           Once you have created a button you are responsible for NOT
  3396.           writing anything to that area of the screen.  If you do
  3397.           the button will be erased.  If you are using buttons and
  3398.           scrolling text on the screen make sure you use the
  3399.           SCROLLAREA command to protect the button area of the
  3400.           screen.
  3401.  
  3402.           INVISIBLE buttons can be particularly useful.  An
  3403.           invisible button does not appear on the screen, but a
  3404.           button push inside it's defined area will return it's
  3405.           keycode just as if it were.  This allows you to create
  3406.           your own special color buttons or input areas.  For
  3407.           instance you could have a series of INPUT statements in a
  3408.           program and each could be defined as an invisible button.
  3409.           When the user clicked on that input area you would get a
  3410.           unique keycode which would direct your program to the
  3411.           section of code which handles that input.
  3412.  
  3413.           Since buttons end INPUT commands you can also use
  3414.           invisible buttons to define any keys you want to end INPUT
  3415.           commands (e.g. UP ARROW or DOWN ARROW).
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.                                       51
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.           PROGRAMMING MENUS
  3443.           -------------------------------------------------------
  3444.           
  3445.           Under DOS menus may be either accessed by using the mouse
  3446.           (if present) or pressing the F10 key. (F10 is changeable,
  3447.           see the definition of MAINMENU command)  When using menus
  3448.           in DOS, always define menus BEFORE creating buttons.
  3449.           Also, be aware that using the PALETTE command when a menu
  3450.           bar is displayed may change the color of the menu bar or
  3451.           may it invisible.
  3452.  
  3453.           Menus support in BasicBasic is much like button support.
  3454.           When the user selects a menu item a defined keycode is
  3455.           returned to the Basic program.  Menu keycodes are returned
  3456.           only using the INKEY$ function call.  However, if the user
  3457.           selects a menu item while the program is waiting for input
  3458.           in an INPUT command the input command will be terminated
  3459.           just as if the user had pressed Enter.  Then on the next
  3460.           INKEY$ call the keycode for the menu item will be
  3461.           returned.
  3462.  
  3463.           KEYCODES:  Just as in buttons keycodes can be regular or
  3464.           extend keys.  Extended keys are indicated by adding 1000
  3465.           to the regular keycode.  F10 would be 1068.  See the
  3466.           Appendix 'Keyboard codes' for a complete list.
  3467.  
  3468.           The mouse must be enable with the MOUSEON command before
  3469.           any menu items will be recognized.
  3470.  
  3471.           Here is an example of a simple Windows program which
  3472.           utilizes menus.
  3473.  
  3474.                 y=mouseon
  3475.                 mainmenu "Color","","","","",""
  3476.                 addsubmenu 1,"Black",1059
  3477.                 addsubmenu 1,"White",1061
  3478.                 backcolor=0
  3479.                 menuitemgray 1059
  3480.              50
  3481.                 cls
  3482.                 color 1,backcolor
  3483.                 locate 10,30
  3484.                 print "Sample text..";
  3485.              100
  3486.                 a$=inkey$
  3487.                 if a$="" then goto 100
  3488.                 if len(a$)=1 then goto 100
  3489.                 if right$(a$,1)=chr$(59)
  3490.                   menuitemon 1060
  3491.                   menuitemgray 1059
  3492.                   backcolor=7
  3493.                   goto 50
  3494.                 elseif right$(a$,1)=chr$(60)
  3495.                                       52
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.                   menuitemon 1059
  3508.                   menuitemgray 1060
  3509.                   backcolor=0
  3510.                   goto 50
  3511.                 end if
  3512.                 goto 100
  3513.  
  3514.           This program defines one menu and then adds two items to
  3515.           it.  These menu items allow the user to clear the screen
  3516.           to either black or white.  The program disables the menu
  3517.           item for whatever color the screen currently is.
  3518.  
  3519.           The menu could be define in the following way also.
  3520.  
  3521.                   mainmenu "&Color","","","","",""
  3522.                   addsubmenu 1,"&Black",1059
  3523.                   addsubmenu 1,"&White",1061
  3524.  
  3525.           The apersand (&) allows you to define which character in
  3526.           the menu will be underlined which allows the user to
  3527.           select this item by pressing the ALT key and this letter.
  3528.           This IS NOT the keycode which will be returned to your
  3529.           program.  This keycode will always be the one given as the
  3530.           last parameter of the addsubmenu command.
  3531.  
  3532.           We could also define the menu like this:
  3533.  
  3534.                   mainmenu "&Color","","","","",""
  3535.                   addsubmenu 1,"&Black",1059
  3536.                   addsubmenu 1,"",0
  3537.                   addsubmenu 1,"&White",1061
  3538.  
  3539.           The 3rd line (addsubmenu 1,"",0) creates a line seperator
  3540.           in the menu bar.  It can not be selected by the user.
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.                                       53
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.           PROGRAMMING DIALOG BOXES
  3575.           -------------------------------------------------------
  3576.           
  3577.           Dialog Boxes are 'pop-up' boxes used to get information
  3578.           from the user.  Dialog Boxes are made up of one or more
  3579.           'Controls'.  A Control may be a pushbutton, radio button,
  3580.           check box, edit field or various other items.
  3581.  
  3582.           BasicBasic contains 3 types of Dialogs boxes: 1) File open
  3583.           for read; 2) File open for save; 3) User defined.
  3584.  
  3585.           Dialogs automatically preserve the original screen over
  3586.           which they are place.  The original screen is restored
  3587.           when the dialog closes.
  3588.  
  3589.           Under both DOS and Windows a user can selected and enter
  3590.           items in a Dialog box without a mouse.  Use the TAB key to
  3591.           move from item to item.  Arrow keys select items in a
  3592.           list.  Space bar sets/resets radio buttons and checkboxes.
  3593.           Pressing Enter exists the dialog box if on a pushbutton.
  3594.  
  3595.  
  3596.           FILE OPEN FOR READ DIALOG BOX:
  3597.  
  3598.           This dialog box is available under any version of DOS, but
  3599.           if running under Windows it is only available under
  3600.           Windows Version 3.1 or later.  (See the SYSTEM function
  3601.           for information on determining Windows version.)  This is
  3602.           a very easy to use dialog box which prompts the operator
  3603.           to select a file to be read from.  The format of the
  3604.           command is as follows:
  3605.  
  3606.              OPENFILEREAD filterstr,filenamestr,directorystr,title
  3607.  
  3608.           An example would be:
  3609.  
  3610.                  filter$="document"+chr$(0)+"*.doc"+chr$(0)+chr$(0)
  3611.                  filename$="readme.doc"
  3612.                  directory$="c:\windows"
  3613.                  title$="My open dialog"
  3614.                  OPENFILEREAD FILTER$,FILENAME$,DIRECTORY$,TITLE$
  3615.  
  3616.           Filter defines which file names will be display for the
  3617.           user.  Each filter is a pair of text strings seperated by
  3618.           a chr$(0) character.  The first string of the pair is a
  3619.           description of the filter and the second part is the
  3620.           filter (e.g. *.BAT).  You may have more than one filter;
  3621.           however, in DOS, only the first filter is used.
  3622.  
  3623.           Filename defines the default file (if any).
  3624.  
  3625.           Directory defines the default pathname (if any).
  3626.  
  3627.                                       54
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.           Title is an optional title for the dialog box.
  3640.  
  3641.           Upon leaving the dialog box the following functions return
  3642.           the result:
  3643.  
  3644.              DIALOG$(100) has the file name
  3645.              DIALOG$(101) has the pathname
  3646.              DIALOG$(102) is set to 1 if successful, 0 else
  3647.              DIALOG$(103) is set to 1 if Cancel button pressed
  3648.                           102 and 103 will both be zero if an
  3649.                           error occurs.
  3650.  
  3651.           If the dialog was successful then the default disk and
  3652.           directory will have been changed to the pathname returned
  3653.           in DIALOG$(101).  The path is returned for informational
  3654.           purposes only.
  3655.  
  3656.  
  3657.           FILE OPEN FOR WRITE DIALOG BOX:
  3658.  
  3659.           This dialog box is available under any version of DOS, but
  3660.           if running under Windows it is available only under
  3661.           Windows 3.1 or later.  This dialog box is similar to
  3662.           OPENFILEREAD.  The primary difference is that OPENFILEREAD
  3663.           requires that the file exist, while OPENFILEWRITE does
  3664.           not.
  3665.  
  3666.              OPENFILESAVE filterstr,filenamestr,directorystr,title
  3667.  
  3668.           An example would be:
  3669.  
  3670.                  filter$="document"+chr$(0)+"*.doc"+chr$(0)+chr$(0)
  3671.                  filename$="readme.doc"
  3672.                  directory$="c:\windows"
  3673.                  title$="My open dialog"
  3674.                  OPENFILEREAD FILTER$,FILENAME$,DIRECTORY$,TITLE$
  3675.  
  3676.  
  3677.           USER DEFINED DIALOG BOXES:
  3678.  
  3679.           To create and use a dialog box you must do the following
  3680.           steps:  1) Create a string array to hold Control
  3681.           information;  2) Define one control in each string array
  3682.           element;  3) Execute the dialog using the DIALOG
  3683.           statement;  4) Use information acquired in Dialog.
  3684.  
  3685.           The DIALOG statement looks like this:
  3686.  
  3687.             DIALOG, a$(),x,y,xlen,ylen,id,string name
  3688.  
  3689.             where:
  3690.  
  3691.               a$() = a string array
  3692.               x    = x position of upper left corner
  3693.                                       55
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.               y    = y position of upper left corner
  3706.               xlen = x length
  3707.               ylen = y length
  3708.               id   = unique identifier for control (1 -> 255)
  3709.               string name = Text to put at top of Dialog box
  3710.  
  3711.           X, y, xlen, ylen are in pixels in graphics mode or in
  3712.           character locations in text mode (SCREEN 0).
  3713.  
  3714.           An example would be:
  3715.  
  3716.             DIALOG  A$(0),10,10,200,100,100,"GET INFO"
  3717.  
  3718.           Each Control is then defined in one element of the string
  3719.           array.  The general format for controls is:
  3720.  
  3721.                controltype,x,y,xlen,ylen,id,text
  3722.  
  3723.           Commas between each element are required.
  3724.  
  3725.           An example would be:
  3726.  
  3727.              a$(0)="pushbutton,5,40,100,30,100,Exit"
  3728.  
  3729.              This would define a pushbutton labeled "Exit" which
  3730.              would be 100 units wide and 30 high.  It's origin would
  3731.              be 5 units from the left and 40 units from the top of
  3732.              the Dialog Box.  It would have identifier number 100.
  3733.              We could not use this identifier for any other Control.
  3734.  
  3735.           Controls defined in BasicBasic are:
  3736.  
  3737.                  pushbutton
  3738.                  radiobutton
  3739.                  checkbox
  3740.                  edit
  3741.                  ltext
  3742.                  group
  3743.                  ok
  3744.                  filename
  3745.                  filelist
  3746.                  filepath
  3747.  
  3748.  
  3749.           All Controls have the general format shown above for
  3750.           Pushbutton.  What follows is a description of each Control
  3751.           recognized and any special format needed to define it or
  3752.           any special way it is used.
  3753.  
  3754.           PUSHBUTTON:  Pushbuttons cause the Dialog to end.  You can
  3755.           use the DIALOG$ function to determine which pushbutton
  3756.           ended the Dialog.
  3757.  
  3758.           RADIOBUTTON: Radio buttons can be used to allow the user
  3759.                                       56
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.           to supply additional information.  Radiobuttons DO NOT end
  3772.           the dialog.  You can optionally set the state of a
  3773.           pushbutton when defining it:
  3774.  
  3775.                 a$(1)="RADIOBUTTON,10,10,200,30,101,YES,1"
  3776.  
  3777.              This defines a radio button at 10,10 with width 200 and
  3778.              height 30.  The control identifier is 101 and the text
  3779.              YES will be display in it.  The '1' at the end
  3780.              specifies that this button will be enabled at start.
  3781.              Omitting this number or making it '0' means the button
  3782.              is NOT enabled at start.
  3783.  
  3784.              Radio Buttons may be grouped.  In a group if one button
  3785.              is pushed all the rest are cleared.  BasicBasic
  3786.              considers Radiobuttons with consecutive id's to be part
  3787.              of a group.  The following three buttons are part of a
  3788.              group:
  3789.  
  3790.                 a$(1)="RADIOBUTTON,10,10,200,30,101,BLACK"
  3791.                 a$(2)="RADIOBUTTON,10,50,200,30,102,RED,1"
  3792.                 a$(3)="RADIOBUTTON,10,90,200,30,103,WHITE"
  3793.  
  3794.              In this group RED will be enabled at start.
  3795.  
  3796.           CHECKBOX: Check buttons are similar to Radio buttons
  3797.           except they may not be grouped and hence do not clear any
  3798.           other Checkbox when one is checked.
  3799.  
  3800.           EDIT: Edit fields allow the operator to input text.  The
  3801.           text string at the end of the definition is the default
  3802.           text entry.  To provide a label for an EDIT control you
  3803.           will have to use LTEXT defined later.
  3804.  
  3805.           LTEXT: Ltext displays static text left justified.  You may
  3806.           display text anywhere in the Dialog box and this is
  3807.           particulary used for providing a header for an Edit
  3808.           Control.  Here is an example:
  3809.  
  3810.              A$(1)="LTEXT,10,10,200,30,103,Enter Name"
  3811.  
  3812.           GROUP:  Group draws a box on the screen and provides a
  3813.           label at the top of the box.  It is particularly useful
  3814.           for providing a visual indicator of Radio button groups.
  3815.           An example to draw a box at 10,10 100 units wide by 50
  3816.           high would be:
  3817.  
  3818.              A$(1)="GROUP,10,10,100,50,101,Colors"
  3819.  
  3820.           OK: OK is a special pushbutton.  It is defined the same
  3821.           way as any pushbutton.  If you have an OK control defined
  3822.           then the dialog will end if the user presses 'Enter' at
  3823.           any Edit field.  It is required when using the following
  3824.           file controls.  Only one OK control may be in a Dialog.
  3825.                                       57
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.           FILENAME:  This is a special Edit field used for getting a
  3839.           file name.  It is used in conjuction with OK, FILELIST,
  3840.           and FILEPATH controls.  The text element is the default
  3841.           file name.  The presence of a FILENAME control means that
  3842.           the Dialog box will not terminate until a name of an
  3843.           existing file is entered or a pushbutton other than the OK
  3844.           control is pushed.
  3845.  
  3846.              a$(1)="filename,10,10,200,30,101,CONFIG.SYS"
  3847.  
  3848.           FILENAMEW: This functions just like FILENAME, except if
  3849.           this control is used no check to see if the file exists is
  3850.           made before the Dialog terminates.  Only one
  3851.           FILENAME/FILENAMEW may be used in a Dialog.
  3852.  
  3853.  
  3854.           FILELIST:  This defines a box which will contain a display
  3855.           of files.  It is used in conjuction with OK, FILENAME, and
  3856.           FILEPATH controls.  The text element contains the DOS file
  3857.           search string.  The user may use the mouse to select files
  3858.           which will automatically be placed in the FILENAME (or
  3859.           FILENAMEW) control.  Only one FILELIST may be in a Dialog.
  3860.  
  3861.              a$(1)="filelist,10,10,200,200,101,*.bmp"
  3862.  
  3863.           FILEPATH:  This defines a string which will DISPLAY the
  3864.           current directory path being accessed.  It is used in
  3865.           conjuction with OK, FILENAME, and FILELIST.  The text
  3866.           element is the default path.  Only one FILEPATH may be in
  3867.           a Dialog.
  3868.  
  3869.              a$(1)="filepath,10,10,200,30,101,c:\windows"
  3870.  
  3871.  
  3872.           COLOR: This can be used to change the default dialog
  3873.           colors in DOS only!  The order of the colors is:  dialog
  3874.           background color, dialog foreground color, dialog selected
  3875.           color, button foreground color, radio button background
  3876.           color, push button background color.
  3877.  
  3878.              a$(1)="COLOR,0,1,4,5,6,7"
  3879.  
  3880.  
  3881.  
  3882.           The following example shows a dialog box:
  3883.  
  3884.              rem go into graphics mode
  3885.              screen 2
  3886.  
  3887.              dim control$(100)
  3888.  
  3889.              rem define controls
  3890.              control$(0)="ltext,10,10,100,30,100,Name:"
  3891.                                       58
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.              control$(1)="edit,110,10,200,30,101,"
  3904.              control$(2)="ltext,10,50,100,30,102,Address:"
  3905.              control$(3)="edit,110,50,200,30,103,"
  3906.              control$(4)="pushbutton,10,110,50,30,104,Done"
  3907.              control$(5)="radiobutton,130,110,110,25,105,Type A,1"
  3908.              control$(6)="radiobutton,130,134,110,25,106,Type B"
  3909.              control$(7)="group,118,80,180,90,107,Personality Type"
  3910.              control$(8)="checkbox,10,174,100,30,108,Widgets"
  3911.              control$(9)="checkbox,130,174,100,30,109,Gadgets,1"
  3912.              control$(10)="checkbox,250,174,100,30,110,Doodads"
  3913.  
  3914.              rem call dialog
  3915.              dialog control$(0),11,10,10,350,210,"Client Info"
  3916.  
  3917.              rem display results of dialog
  3918.              print "name=";dialog$(101)
  3919.              print "address=";dialog$(103)
  3920.              print "done=";dialog$(104)
  3921.              print "radio 1=";dialog$(105)
  3922.              print "radio 2=";dialog$(106)
  3923.              print "widgets=";dialog$(108)
  3924.              print "gadgets=";dialog$(109)
  3925.              print "doodads=";dialog$(110)
  3926.  
  3927.              input z
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.                                       59
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.           PROGRAM ICON
  3971.           -------------------------------------------------------
  3972.  
  3973.           Windows programs may have an 'icon' associated with them.
  3974.           An icon is the little picture which is placed in a folder
  3975.           when a program is installed or which is displayed when a
  3976.           program is minimized.  BasicBasic programs have a default
  3977.           icon; but you may want to make your own.
  3978.  
  3979.           Icons are ignored in DOS.
  3980.  
  3981.           To add an icon to a program you must do two things:
  3982.  
  3983.             1. Create an icon.
  3984.  
  3985.                In Windows you can do this by selecting 'Icon Editor'
  3986.                from the Transfer menu.
  3987.  
  3988.                In DOS you can execute the icon editor by running the
  3989.                program BBICON.EXE. The editor requires a mouse.
  3990.  
  3991.             2. Tell the compiler to use your icon with the $ICON
  3992.                metacommand:
  3993.  
  3994.                      REM #ICON: 'MYFILE.ICO'
  3995.  
  3996.           BasicBasic contains a simple icon editor which allows you
  3997.           to create icons for use in your program.  The icons
  3998.           created will always be 32 by 32 pixels in size and have up
  3999.           to 16 colors.
  4000.  
  4001.           When first started the icon editor displays a white icon.
  4002.           You change the color of a pixel by putting the pointer
  4003.           over it and pressing the mouse button.  You select the
  4004.           color to use from the palette at the right of the screen.
  4005.           Pixel by pixel you create your icon until you are ready to
  4006.           save it using the File menu.  It is standard practice
  4007.           (though not required) to give an icon file the extension
  4008.           .ICO.
  4009.  
  4010.           Advanced Users:
  4011.  
  4012.           A Windows icon actually contains two 32 by 32 pixel
  4013.           bitmaps.  The primary bitmap tells the colors of the
  4014.           pixels.  This bitmap is the default bitmap displayed by
  4015.           the BasicBasic icon editor.
  4016.  
  4017.           The second bitmap tells Windows which pixels in the bitmap
  4018.           are transparent and which ones are opaque.  The default
  4019.           for a BasicBasic icon is all opaque.  You can access this
  4020.           second bitmap from the View menu.  The second bitmap is
  4021.           called the 'Mask' bitmap.  When viewing the mask bitmap
  4022.           each pixel may be either black (opaque) or white
  4023.                                       60
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.           (transparent).
  4036.  
  4037.           Keep in mind that if you make a transparent mask that the
  4038.           background will show through your icon.  If there is a
  4039.           color other than black in the corresponding color bitmap
  4040.           pixel, the color actually displayed will be a blend of the
  4041.           background color and the color you selected.
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.                                       61
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.           COMMUNICATIONS PROGRAMMING
  4103.           -------------------------------------------------------
  4104.           
  4105.           Here is a brief example of using a communications port.
  4106.  
  4107.             rem
  4108.             rem open communications port
  4109.             rem
  4110.             OPEN "COM1: 2400,N,8" FOR RANDOM AS #1 LEN=2048
  4111.  
  4112.           100
  4113.  
  4114.             rem
  4115.             rem get input from communications port
  4116.             rem
  4117.             t = LOC(1)
  4118.             IF t > 0 THEN
  4119.               a$=input$(t,1)
  4120.               if len(a$)>0 then
  4121.                 rem come here to display received characters
  4122.                 PRINT a$;
  4123.  
  4124.               ELSE
  4125.                 rem come here if some kind of comm error that kept
  4126.                 rem us from getting the waiting character.
  4127.  
  4128.               end if
  4129.  
  4130.             END IF
  4131.  
  4132.             rem
  4133.             rem get input from keyboard
  4134.             rem
  4135.  
  4136.             b$ = INKEY$
  4137.  
  4138.             IF b$ <> "" THEN
  4139.  
  4140.                 PRINT #1, b$;
  4141.  
  4142.             END IF
  4143.  
  4144.             GOTO 100
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.                                       62
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.           WINDOWS AND GRAPHICS
  4170.           -------------------------------------------------------
  4171.           
  4172.           In general programming graphics under Windows is the same
  4173.           as programming graphics under DOS.  However, because
  4174.           Windows mediates hardware access among different programs
  4175.           there are a few differences.
  4176.  
  4177.           COLORS
  4178.  
  4179.           Under DOS or Windows, BasicBasic provides a palette of 16
  4180.           colors.  Under DOS this palette is the hardware palette
  4181.           and you have full control to change them (depending on
  4182.           mode using either the COLOR or PALETTE statements).  Under
  4183.           Windows the palette is a 'logical' palette and only
  4184.           Windows controls where in the physical palette the logical
  4185.           palette entries are placed.  In addition, if you are
  4186.           running under standard VGA or less, Windows will not let
  4187.           you change the colors in the palette.  You are restricted
  4188.           to the 16 colors Windows defines.
  4189.  
  4190.           BasicBasic defaults to using the system palette.  This is
  4191.           a palette of 16 colors which Windows never changes.  This
  4192.           also means that your program cannot change them with the
  4193.           PALETTE or COLOR(in mode 8) commands.  If you want to
  4194.           change the standard colors you will have to use a
  4195.           'logical' palette.  In BasicBasic you do this using the
  4196.           SCREEN command.
  4197.  
  4198.           Using a logical palette has benefits and drawbacks.  As
  4199.           mentioned you can change the colors display.  This may be
  4200.           of use in animation.  However, there are serious
  4201.           drawbacks.  The PUT with any option except PSET will not
  4202.           work correctly.  This is explained below.  Also, when your
  4203.           program is not the 'active' window, Windows may remove
  4204.           your colors from the hardware palette resulting in some
  4205.           strange looking displays.  In addition, if this happens,
  4206.           the PAINT command may have completely unforseen
  4207.           consequences.  You can use the SYSTEM function to
  4208.           determine if your program is the active program.  When
  4209.           your program is active your colors will all be available
  4210.           for your use.
  4211.  
  4212.           Logical palettes do not support using the PUT graphics
  4213.           statement with the XOR, OR, or AND options.  If you use
  4214.           XOR the colors will not be as expected (though, as usual
  4215.           if you do 2 PUT statements with XOR the background will be
  4216.           restored).  The reason for this is that Windows may 'map'
  4217.           the logical palette entries to the physical palette anyway
  4218.           it likes.  If you must use XOR, use the default BasicBasic
  4219.           palette which is the system palette.
  4220.  
  4221.                                       63
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.           SCREEN MODES
  4235.  
  4236.           Under Windows you have access to the same screen modes as
  4237.           under DOS.  The COLOR and PALETTE statements work the same
  4238.           under DOS as under Windows.  In addition under Windows you
  4239.           have access to an additional screen mode: mode 1000.  In
  4240.           mode 1000 you are able to create new fonts.  Mode 1000
  4241.           gives you the highest possible graphics resolution.  Also
  4242.           the COLOR command is somewhat more flexible than under DOS
  4243.           screen modes.  The LOCATE and SCROLLAREA statements and
  4244.           functions POS, CSRLIN work differently in this mode.
  4245.  
  4246.           Also under Windows you have the option of specifying the
  4247.           size of the logical palette your program will have access
  4248.           to.  This is limited by the physical palette supported by
  4249.           your hardware.  Standard VGA supports only 16 palette
  4250.           entries.  Super VGA may (depending on memory) support up
  4251.           to 256 palette entries.  You could select 256 palette
  4252.           entires by using this command:
  4253.  
  4254.                       SCREEN 1000,256
  4255.  
  4256.           Windows actually only allows you to change 236 of the
  4257.           palette entries.  The other entries are defined by Windows
  4258.           as follows:
  4259.  
  4260.               0 - black          246 - cream
  4261.               1 - dark red       247 - lightish gray
  4262.               2 - dark green     248 - medium gray
  4263.               3 - dark yellow    249 - red
  4264.               4 - dark blue      250 - green
  4265.               5 - dark magenta   251 - yellow
  4266.               6 - dark cyan      252 - blue
  4267.               7 - light gray     253 - magenta
  4268.               8 - money green    254 - cyan
  4269.               9 - sky blue       255 - white
  4270.  
  4271.  
  4272.           NAKED WINDOWS
  4273.  
  4274.           When running under Windows you do not have exclusive
  4275.           access to the screen.  At any time your window may be
  4276.           hidden by another window appearing on the screen.  At some
  4277.           future time the operator may make your window reappear
  4278.           with the click of the mouse button.  When your window has
  4279.           been hidden and is then called to the front, Windows DOES
  4280.           NOT handle putting the contents of the window back in!
  4281.           All windows privides is the outline of the window.  This
  4282.           'naked' window must be filled in by either BasicBasic or
  4283.           your program.
  4284.  
  4285.           By default BasicBasic handles all window 'repainting'.
  4286.           BasicBasic remembers everything that your program sends to
  4287.                                       64
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.           the screen and when necessary repaints the window with
  4300.           this information.  In text mode (screen mode 0) a small
  4301.           buffer remembers each character on the screen.  In
  4302.           graphics mode BasicBasic maintains a larger buffer
  4303.           containing a duplicate of each pixel on the screen.  This
  4304.           buffer can take up quite a bit of space.(On a 640 x 200 16
  4305.           color display this requires 128,000 bytes).  Ordinarily
  4306.           you don't need to worry about this.  If your program isn't
  4307.           going to be in memory very long, or has a small window,
  4308.           who cares?
  4309.  
  4310.           If you are short of memory or have a very large window
  4311.           which is going to stay around all day you may not like
  4312.           this arrangement.  In this case you should use the ON
  4313.           PAINT statement.  This statement tells BasicBasic to NOT
  4314.           keep a copy of the display; that you are going to handle
  4315.           repainting when necessary.  Here is an example:
  4316.  
  4317.                  ON PAINT GOSUB 1000
  4318.                  SCREEN 8
  4319.                  sc=8
  4320.                  gosub drawmyscreen
  4321.           50
  4322.                  if inkey$="" then goto 50
  4323.                  STOP
  4324.  
  4325.           1000
  4326.                  gosub drawmyscreen
  4327.                  RETURN
  4328.  
  4329.           drawmyscreen:
  4330.                  if sc=0 then return
  4331.                  locate 1,1
  4332.                  print "Now is the time to draw circles..."
  4333.                  circle (50,50),25,4
  4334.                  circle (75,75),50,1
  4335.                  circle (400,50),40,2
  4336.                  circle (500,100),75,3
  4337.                  return
  4338.  
  4339.           Here are some rules to remember about using the ON PAINT
  4340.           statement:
  4341.  
  4342.             - Use it before your SCREEN statement.  BasicBasic
  4343.               creates the screen duplicate during the SCREEN
  4344.               statement. It will, if necessary, erase it during the
  4345.               ON PAINT statement, but why go to the bother.
  4346.  
  4347.             - NEVER use any input commands, file commands, com
  4348.               commands, etc in you ON PAINT handler.
  4349.  
  4350.             - Don't change variables in your ON PAINT handler that
  4351.               are used elsewhere in your program.  Remember that
  4352.               Windows ALWAYS calls your ON PAINT handler at the
  4353.                                       65
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.               WORST POSSIBLE TIME!
  4366.  
  4367.             - It is wise not to use the INPUT command in a program
  4368.               that has it's own ON PAINT handler.  BasicBasic will
  4369.               not rewrite what has been input so far.
  4370.  
  4371.             - Your ON PAINT handler may be called IMMEDIATELY after
  4372.               you issue the ON PAINT command.  Make sure you are
  4373.               ready.  Note the line IF SC=0 THEN RETURN in our
  4374.               example.  Try running this program without this line.
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.                                       66
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.           BITMAPS
  4433.           -------------------------------------------------------
  4434.  
  4435.           BasicBasic supports the loading and storing of device
  4436.           independent bitmap files as defined in Windows 3.
  4437.           BasicBasic supports bitmaps under EITHER DOS or Windows.
  4438.           You must be in graphics mode to load or store bitmaps.
  4439.           Windows (and SOME Windows applications) support a
  4440.           compressed bitmap format to save space.  BasicBasic also
  4441.           supports loading and store compressed bitmap files.
  4442.  
  4443.           A simple program to load a bitmap could be as follows (the
  4444.           file CARS.BMP is a standard bitmap file supplied with
  4445.           Windows).
  4446.  
  4447.                 screen 8
  4448.                 x=100
  4449.                 y=100
  4450.                 ffname$="c:\windows\cars.bmp"
  4451.                 loadbitmap ffname$,0,x,y,0,0,16,16,0,0,0
  4452.                 input z
  4453.  
  4454.           This example loads the upper left most 16 by 16 pixels of
  4455.           the bitmap and puts in on the screen starting at 100,100.
  4456.           If we had wanted to double the size of the graphic in the
  4457.           x direction we could have done the following load:
  4458.  
  4459.                 loadbitmap ffname$,0,x,y,0,0,16,16,0,2,0
  4460.  
  4461.           If we had wanted to skip every other line of pixels we
  4462.           could have done the following load:
  4463.  
  4464.                 loadbitmap ffname$,0,x,y,0,0,16,16,0,0,-2
  4465.  
  4466.           This would have loaded 16 lines of the bitmap, but only
  4467.           displayed every other one.
  4468.  
  4469.           BITMAPS AND COLORS
  4470.  
  4471.           With each device independent bitmap is stored information
  4472.           about the colors defined for that bitmap.  There may be
  4473.           information about 2 colors, 16 colors, 256 colors or
  4474.           16,777,216 colors.  BasicBasic supports the first 3 types
  4475.           of bitmaps.  The colors in the bitmap may or may not be
  4476.           the same as those defined in your current palette.  When
  4477.           you load a bitmap you might want to make sure that your
  4478.           palette has the colors necessary to correctly display the
  4479.           bitmap.  Alternately you can tell BasicBasic to attempt to
  4480.           match bitmap colors to your currently defined palette
  4481.           colors.  This is the easiest thing to do, though, it may
  4482.           not result in the best rendering of the graphic.
  4483.  
  4484.           In the examples we have used so far we have let BasicBasic
  4485.                                       67
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.           match colors for us.  We do this by setting the ninth
  4498.           parameter to 0.
  4499.  
  4500.                 cv=0
  4501.                 loadbitmap ffname$,0,x,y,0,0,16,16,cv,0,0
  4502.  
  4503.           We could also set cv to 1; in which case, BasicBasic would
  4504.           make no color correction and the existing palette colors
  4505.           would be used to display the bitmap.
  4506.  
  4507.           For maximum color compatibility you will want to load the
  4508.           colors from the bitmap and assign them you your logical
  4509.           palette.  The first step in this process is to determine
  4510.           how many colors the bitmap has defined.  You do this using
  4511.           the BITMAPH function.
  4512.  
  4513.             e.g.
  4514.                    dim a&(256)
  4515.                    a=bitmaph("C:\windows\cars.bmp",a&(0))
  4516.                    numcolorbits=a&(4)
  4517.                    if numcolorbits=2
  4518.                      print "2 colors defined"
  4519.                    elseif numcolorbits=4
  4520.                      print "16 colors defined"
  4521.                    elseif numcolorbits=8
  4522.                      print "256 colors defined"
  4523.                    else
  4524.                      print "colors explicitly defined for each bit"
  4525.                    end if
  4526.  
  4527.           You can determine how many colors can be displayed on your
  4528.           screen by using the SYSTEM function
  4529.  
  4530.                    maxcolors=system(5)
  4531.  
  4532.           If the bitmap has more colors than your screen can display
  4533.           then the best course to follow is to allow BasicBasic to
  4534.           convert colors for you.  If, on the other, hand you have
  4535.           enough room in your palette to display all the colors
  4536.           defined in the bitmap then you can load them using the
  4537.           BITMAPC function and assign them using the PALETTE
  4538.           command.
  4539.  
  4540.  
  4541.                  screen 8
  4542.  
  4543.                  dim a&(256)
  4544.  
  4545.                  ffname$="c:\windows\cars.bmp"
  4546.  
  4547.                  a=bitmaph(ffname$,a&(0))
  4548.                  x=0
  4549.                  y=0
  4550.                  pxsize=a&(1)
  4551.                                       68
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.                  pysize=a&(2)
  4564.                  colorbits=a&(4)
  4565.                  if colorbits=2
  4566.                     colors=2
  4567.                  elseif colorbits=4
  4568.                     colors=16
  4569.                  elseif colorbits=8
  4570.                     colors=256
  4571.                  else
  4572.                     print "bitmap not supported.."
  4573.                     stop
  4574.                  end if
  4575.                  maxcolors=system(5)
  4576.  
  4577.                  if (colors<=maxcolors)
  4578.                    a=bitmapc(ffname$,a&(0))
  4579.                    if colors>236 then
  4580.                     for i=10 to 246
  4581.                       palette i,a&(i)
  4582.                     next i
  4583.                    else
  4584.                     for i=0 to colors
  4585.                      palette i,a&(i)
  4586.                     next i
  4587.                    end if
  4588.                    cv=0
  4589.                  else
  4590.                    cv=1
  4591.                  end if
  4592.  
  4593.                  x=100
  4594.                  y=100
  4595.                  ymult=2
  4596.                  loadbitmap ffname$,0,x,y,0,0,16,16,cv,0,0
  4597.  
  4598.                  input z
  4599.  
  4600.           Note to Windows Users:  With a 256 color palette, Windows
  4601.           only allows 236 to be changed by the user.  The first 10
  4602.           and and last 10 are fixed.  This is why we only assign 236
  4603.           colors in the example above.
  4604.  
  4605.           STORING BITMAPS
  4606.  
  4607.           If you have a graphic displayed on the screen you can save
  4608.           it to a bitmap file using the STOREBITMAP command.  It
  4609.           will be saved in the same color resolution as your screen.
  4610.           You can optionally tell BasicBasic to store the file in
  4611.           compressed format to save space.  Note, however, that a
  4612.           complex picture with much fine detail may compress to a
  4613.           LARGER file than the original!  Also it will take longer
  4614.           to store a bitmap using compression, than without.
  4615.  
  4616.  
  4617.                                       69
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4624.  
  4625.  
  4626.  
  4627.  
  4628.  
  4629.                screen 8
  4630.                line (0,0)-(100,100),1
  4631.                x=0
  4632.                y=0
  4633.                pxsize=100
  4634.                pysize=100
  4635.                cp=1          : rem compress it
  4636.                storebitmap 0,ffname$,x,y,pxsize,pysize,cp,0
  4637.  
  4638.                input z
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.                                       70
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.           WINDOWS AND FONTS
  4697.           -------------------------------------------------------
  4698.  
  4699.           To create fonts in Windows you must have selected Screen
  4700.           mode 1000.  In this mode some statements and commands work
  4701.           differently.  LOCATE x,y now position by dot position,
  4702.           rather than character position.  POS and CSRLIN return the
  4703.           corresponding pixel position rather than character
  4704.           position.
  4705.  
  4706.           See the sample program SAMPLEF1.BAS for some examples of
  4707.           font creation.
  4708.  
  4709.           If you are going to create fonts you should NOT use the
  4710.           WINDOWS SIZE metacommand.  Instead use POSITION as
  4711.           necessary to adjust the size ofyour window.
  4712.  
  4713.           You may create up to 10 fonts, number 1 through 10.  Font
  4714.           number 0 is reserved for BasicBasic's default font.  You
  4715.           create a font using the CREATEFONT command.  Once you have
  4716.           created a font you must select it with the SELECTFONT
  4717.           command.  You may get information on the currently
  4718.           selected font using the FONT and FONT$ functions.
  4719.  
  4720.           The CREATEFONT statement has a lot of arguments.  However,
  4721.           it is not as complex to use as it looks.  Usually you are
  4722.           only interested in specifying one or two things about the
  4723.           font; such as height.  In this case you can set all other
  4724.           arguments to 0.  Below is a complete description of the
  4725.           CREATEFONT command.
  4726.  
  4727.           Argument P10 must be set to 3 (OEM Font) to use most of
  4728.           the built in Windows fonts!
  4729.  
  4730.           CREATEFONT
  4731.           p1,p2,p3,p4,p5,p6,p7,p8.p9.p10,p11.p12,p13,p14,p15$
  4732.  
  4733.             p1 = Font number to be created.
  4734.                  A number from 1 to 10.
  4735.             p2 = Font height (in pixels).
  4736.                  Desired height of characters.  This specifies the
  4737.                  line spacing.
  4738.             p3 = Font width
  4739.                  Desired width of characters.  Usually set to 0
  4740.             p4 = escapement
  4741.                  Which way the text goes.
  4742.                  0 - right
  4743.                  900 - up
  4744.                  1800 - right to left
  4745.                  2700 - down
  4746.             p5 = orientation
  4747.                  0 = Normal
  4748.                  900 = tipped 90 degrees to the left
  4749.                                       71
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4756.  
  4757.  
  4758.  
  4759.  
  4760.  
  4761.                  1800 = upside down
  4762.                  2700 = tipped 90 degrees to the right
  4763.             p6 = weight
  4764.                    0 = don't care
  4765.                  100 = thin
  4766.                  200 = extralight
  4767.                  300 = light
  4768.                  400 = normal
  4769.                  500 = medium
  4770.                  600 = semibold
  4771.                  700 = boldface
  4772.                  800 = extra bold
  4773.                  900 = heavy
  4774.             p7 = italic
  4775.                  When nonzero this specifies italics
  4776.             p8 = underline
  4777.                  When nonzero this specifies underlining
  4778.             p9 = strikeout
  4779.             p10 = character set
  4780.                   0 = ANSI character set
  4781.                   1 = SYMBOL character set
  4782.                   2 = Japanese Kanji
  4783.                   3 = OEM character set
  4784.           ->          Most Windows fonts are OEM fonts (e.g. script)
  4785.             p11 = output precision
  4786.                   Specifies how Windows should attempt to match
  4787.                   desired font sizes and characters with actual
  4788.                   fonts.  Not currently defined.  Make 0
  4789.             p12 = clip precision
  4790.                   Not currently defined.  Make 0.
  4791.             p13 = quality
  4792.                   Instruction to Windows on how to match fonts.
  4793.                   0 - Default Quality.  Don't make bigger that
  4794.                       desired.
  4795.                   1 - Draft Quality.
  4796.                   2 - Proof Quality.  This is the best quality,
  4797.                       but size may be smaller than desired.
  4798.             p14 = pitch and family
  4799.                   The two low order bits specify the pitch of the
  4800.                   font.
  4801.                     0 = Default
  4802.                     1 = Fixed pitch
  4803.                     2 = Variable
  4804.                   The four high order bits specify the font family.
  4805.                     0 = don't care
  4806.                     &H10 = Roman
  4807.                     &H20 = Swiss
  4808.                     &H30 = Modern
  4809.                     &H40 = Script
  4810.                     &H50 = Decorative
  4811.             p15$ = "face name"
  4812.                   This is the name of the typeface.  You do not need
  4813.                   to specify this.  If you do it takes priority over
  4814.                   any other options you specify (such as height).
  4815.                                       72
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.                   Examples of face names are COURIER, TMS RMN, etc.
  4828.  
  4829.           Here is an example of a CREATEFONT command which creates a
  4830.           font 60 pixels high.  All other parameters are left at
  4831.           default.
  4832.  
  4833.               CREATEFONT 1,60,0,0,0,0,0,0,0,0,0,0,0,0,""
  4834.  
  4835.           To print with this font you would first have to select it.
  4836.  
  4837.               SELECTFONT 1
  4838.  
  4839.  
  4840.           When you create a font Windows tries to match the
  4841.           characteristics you specify in the CREATEFONT command.  It
  4842.           may not be able to in all cases.  Perhaps you specify an
  4843.           incompatible height and width.  In these cases Windows
  4844.           gets as close as it can.  If some parameter is important
  4845.           to your application you should check to make sure the font
  4846.           you created meets your requirements.  Using the FONT
  4847.           function you can examine the selected font.
  4848.  
  4849.           FONT(n)
  4850.  
  4851.               n    returns
  4852.              ---   ----------------------------------------------
  4853.               1    character height
  4854.               2    Ascent
  4855.               3    Descent
  4856.               4    Internal Leading
  4857.               5    Extern Leading
  4858.               6    Average Character Width
  4859.               7    Maximum Character Width
  4860.               8    Weight
  4861.               9    Italic
  4862.               10   Underline
  4863.               11   Strikeout
  4864.               12   First character
  4865.               13   Last character
  4866.               14   Default character
  4867.               15   Break character
  4868.               16   Pitch and Family
  4869.               17   Character set
  4870.               18   Overhang
  4871.               19   Digitized Aspect x
  4872.               20   Digitized Aspect y
  4873.  
  4874.           There is another function which will return the face name.
  4875.  
  4876.           FONT$(n)
  4877.  
  4878.               n    returns
  4879.              ---   ----------------------------------------
  4880.               1    face name
  4881.                                       73
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.  
  4895.  
  4896.           If you need additional information on fonts (or Windows
  4897.           programming in general), a useful reference is 'Windows
  4898.           API Bible' by James L. Conger.
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.                                       74
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.           CHAINING AND COMMON
  4962.           -------------------------------------------------------
  4963.  
  4964.           Here are examples of two programs, CHAIN1 and CHAIN2,
  4965.           which pass variables back and forth in common.
  4966.  
  4967.  
  4968.               CHAIN1
  4969.  
  4970.                   common a,b,c,d$(),c()
  4971.                   if a=0 then
  4972.                     cls
  4973.                     a=1
  4974.                     dim d$(10)
  4975.                     dim c(20)
  4976.                     d$(5)="This is d$(5)"
  4977.                   end if
  4978.                   print "press any key to go to chain 2"
  4979.                 100
  4980.                   a$=inkey$
  4981.                   if a$="" then goto 100
  4982.                   chain "chain2.exe"
  4983.  
  4984.  
  4985.               CHAIN2
  4986.  
  4987.                   common a,b,c,d$(),c()
  4988.                   b=b+1
  4989.                   print "this is chain 2"
  4990.                   print "b=";b;
  4991.                   print d$(5)
  4992.                   input z
  4993.                   chain "chain1.exe"
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.                                       75
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.           BasicBasic Technical
  5027.           -------------------------------------------------------
  5028.  
  5029.           BasicBasic is intended to be a subset of Microsoft Basic.
  5030.           More statements and functions will be added with each
  5031.           release.  Depending on your religion you may or may not be
  5032.           happy to see that GOTO is supported.  BasicBasic's syntax
  5033.           is 'almost' the same as Microsoft's Basic.  Here are some
  5034.           known syntax differences:
  5035.  
  5036.                BasicBasic scans expressions from left to right the
  5037.                same as Microsoft Basic, however, BasicBasic checks
  5038.                all multiplies before divides and all minus signs
  5039.                before addition.
  5040.  
  5041.                BasicBasic does not support the underscore (_) line
  5042.                extension character.
  5043.  
  5044.           Most functions and statements have the same syntax as
  5045.           Microsoft Basic.  You should check the Statement and
  5046.           Function Reference section for details on syntax.
  5047.  
  5048.           Date types supported are integer (% suffix), long integer
  5049.           (& suffix), single precision (no suffix), and string ($
  5050.           suffix).  Double precision numbers are not supported in
  5051.           this version.
  5052.  
  5053.           BasicBasic does not support a standard array of size 10.
  5054.           Every array must be explicitly dimensioned with a DIM
  5055.           statement.
  5056.  
  5057.           CAPACITIES
  5058.  
  5059.              General limits:
  5060.  
  5061.                      Maximum number of arrays:  100
  5062.                              Total open files:  10
  5063.                            Total string space:  approx. 47000 chars.
  5064.                 Maximum character string size:  2048
  5065.                               Maximum Buttons:  40
  5066.  
  5067.              Windows only limits:
  5068.  
  5069.                                 Maximum menus:  6
  5070.                       Maximum Items in a menu:  10
  5071.                         Maximum Fonts Defined:  10
  5072.  
  5073.  
  5074.  
  5075.           RESERVED WORDS
  5076.  
  5077.           All names of statements and functions are reserved words
  5078.           and may not be used as variable names.  ERR is a special
  5079.                                       76
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.           case.  This is a system wide variable used to return error
  5092.           information to BasicBasic programs.  See the command
  5093.           SETERRLEVEL for more complete information.
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.  
  5105.  
  5106.  
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.                                       77
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5152.  
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.           WINDOWS METACOMMANDS
  5159.           -------------------------------------------------------
  5160.  
  5161.  
  5162.           BasicBasic contains several Metacommands to set Windows
  5163.           environment parameters.  These commands have no affect on
  5164.           execution of the program.  All Windows Metacommands have
  5165.           the following format:
  5166.  
  5167.                  REM WINDOWS command
  5168.  
  5169.           REM WINDOWS NAME name
  5170.  
  5171.           The window name which the program will display can be
  5172.           supplied.  The default is the same as the file name of the
  5173.           program.
  5174.  
  5175.                    e.g.   REM WINDOWS NAME investments
  5176.  
  5177.           SAMPLE3.BAS uses the WINDOWS NAME metacommand.
  5178.  
  5179.  
  5180.           REM WINDOWS size x1,y1,x2,y2
  5181.  
  5182.           This command allows you to define a portion of the normal
  5183.           DOS screen size as the area to be displayed in the Windows
  5184.           window.  This is useful if you have a program centered in
  5185.           the standard 80x25 DOS screen, but do not use much of the
  5186.           border area.  Regular scrolling may not work in windows if
  5187.           you define the window size as less than 80x25.  X1 is the
  5188.           left column, y1 is the top row, x2 is the right column,
  5189.           and y2 is the bottom row.  e.g.  Do NOT use this command
  5190.           if your are using the CREATEFONT command.
  5191.  
  5192.                    e.g.       REM WINDOWS SIZE 10,10,70,15
  5193.  
  5194.           SAMPLE2.BAS uses the WINDOWS SIZE metacommand.
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.                                       78
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.           METACOMMANDS
  5225.           -------------------------------------------------------
  5226.  
  5227.           metacommands are preceded by REM and a dollar sign.
  5228.  
  5229.  
  5230.           INCLUDE: 'filename'
  5231.  
  5232.             This metacommand allows you to include source from
  5233.             another file in the currently compiling file.  files may
  5234.             be nexted up to 10 levels deep.  File name MUST be
  5235.             enclosed in single quotes as shown.
  5236.  
  5237.               e.g.  REM $INCLUDE: 'moretext.asc'
  5238.  
  5239.  
  5240.           ICON: 'iconfilename'
  5241.  
  5242.             This metacommand allows you in specify a special ICON
  5243.             which will be attached to your application.  This icon
  5244.             will be used in Windows when your application is
  5245.             installed.
  5246.  
  5247.               e.g.  REM $ICON: 'SAMPLEW3.ICO'
  5248.  
  5249.             SAMPLEW3.BAS use the $ICON metacommand.
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.                                       79
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.           SEPERATE COMPILATION
  5290.           -------------------------------------------------------
  5291.  
  5292.           You may decide to compile your program outside the
  5293.           BasicBasic program development system environment.  Here
  5294.           are instructions for doing this.
  5295.  
  5296.  
  5297.  
  5298.           DOS
  5299.  
  5300.           To compile a program under DOS type BB.  When requested
  5301.           enter the file name you want to compile.  If no extension
  5302.           is given the compiler will assume .BAS.  You can also
  5303.           enter the file name you want to compile as part of the
  5304.           start command.
  5305.  
  5306.                 e.g.   BB SAMPLE1.BAS.
  5307.  
  5308.           The executable file created will have the same name as the
  5309.           source file.
  5310.  
  5311.           You may also tell BasicBasic to create a file with a list
  5312.           of runtime addresses.  This can be useful for debugging
  5313.           since an error during runtime will return a runtime
  5314.           address followed by an error number.  You do this by
  5315.           putting a /D on the command line.
  5316.  
  5317.                e.g.    BB SAMPLE1.BAS /D
  5318.  
  5319.           This will create a file SAMPLE1.TMP which will have a
  5320.           runtime address in front of each source line.
  5321.  
  5322.  
  5323.           WINDOWS
  5324.  
  5325.           Under Windows you must compile using the program WBB.EXE.
  5326.           You may install this in a group with the Program Manager
  5327.           or run WBB seperately.  When compile is completed you may
  5328.           either execute the program or restart to compile another
  5329.           program.
  5330.  
  5331.           IMPORTANT!  Whether you are compiling under DOS or Windows
  5332.           only one EXE file will be created.  This file will have
  5333.           the same name as the source file with an extension of
  5334.           .EXE.  This EXE file can be executed under either DOS or
  5335.           Windows as long as the appropriate runtime module is
  5336.           present (BBLIB14.EXE for DOS or WBBLIB14.EXE for Windows).
  5337.           If you are using graphics screens running under Windows
  5338.           you will also need the file WBB.FON.
  5339.  
  5340.  
  5341.           If you are running Windows 3.1 in 386 Enhanced Mode and
  5342.           using text only screens see the section on Default Windows
  5343.                                       80
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.           Font for important information on using different font
  5356.           sizes.
  5357.  
  5358.           
  5359.  
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.  
  5371.  
  5372.  
  5373.  
  5374.  
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381.  
  5382.  
  5383.  
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.                                       81
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.           
  5422.           DEFAULT WINDOWS FONT
  5423.           -------------------------------------------------------
  5424.           
  5425.           The following discussion is current for Windows Version
  5426.           3.1.  The concepts discussed are applicable for Version
  5427.           3.0, however, font file names are different for that
  5428.           version.  This section is only relevant when running in
  5429.           screen MODE 0 (the default).
  5430.  
  5431.           BasicBasic selects the OEM Fixed font closest in size to
  5432.           the system font size used in menus, buttons, etc.  If you
  5433.           desire a different font size when running a BasicBasic
  5434.           program you can select from available fonts in the System
  5435.           Menu.  You may also mark a given font size to be the new
  5436.           default for that program.
  5437.  
  5438.           Depending on how you configured your system there may be
  5439.           only one OEM font installed.  Windows 3.1 comes with an
  5440.           assortment of OEM fonts.  The file DOSAPP.FON contains the
  5441.           fonts used by Windows to run DOS in a window and are good
  5442.           for use with BasicBasic.  If this file is not in you
  5443.           windows system directory (e.g. WINDOWS\SYSTEM) then your
  5444.           can copy it from your distributions disks and then use the
  5445.           Control Panel Fonts accessory to install them (These fonts
  5446.           have the name 'MS-DOS CP 437').
  5447.  
  5448.           IMPORTANT INFORMATION FOR 386 ENHANCED MODE:  If you use
  5449.           the MS-DOS prompt in 386 Enhanced mode you will need to
  5450.           make a change in your SYSTEM.INI file to use multiple size
  5451.           fonts in BasicBasic.  As mentioned previously Windows does
  5452.           not normally permanently install the fonts from
  5453.           DOSAPP.FON.  As was indicated you can do this from the
  5454.           Control Panel Fonts accessory.  HOWEVER, you will find
  5455.           that each time you EXIT the MS-DOS prompt these fonts will
  5456.           be REMOVED from the system.  This is because Windows does
  5457.           not expect these fonts to be present and there is a
  5458.           control line in SYSTEM.INI which explicitly tells it to
  5459.           load and unload them when running the MS-DOS prompt.  Once
  5460.           you have installed these fonts you can keep Windows from
  5461.           un-installing them by removing the following line from the
  5462.           [386Enh] section of SYSTEM.INI:
  5463.  
  5464.                    WOAFONT=DOSAPP.FON
  5465.  
  5466.  
  5467.           FONTS AND BUTTONS: This discussion applies only to buttons
  5468.           which are defined by the user to be one line high.  If you
  5469.           select a font smaller than the system font for use in a
  5470.           BasicBasic program the text in any buttons you have would
  5471.           be too crowded in the button space available.   BasicBasic
  5472.           corrects this problem in one of two ways.  1) If you
  5473.           system font is only slightly larger than the font selected
  5474.           in BasicBasic then any text in the buttons will be made
  5475.                                       82
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.           all upper case so no 'descenders' will be outside the
  5488.           button area.  2) If the system font is quite a bit larger
  5489.           than the selected font then BasicBasic will not use the
  5490.           standard Windows button design.  Instead it will draw a
  5491.           'simplified' button which can hold the small text of the
  5492.           font.
  5493.           
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.                                       83
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.  
  5554.           ERROR MESSAGES
  5555.           -------------------------------------------------------
  5556.  
  5557.           Compile errors will give a description of the problem and
  5558.           display the line where the error occurred.
  5559.  
  5560.           Runtime errors are divided into two classes.  Fatal errors
  5561.           always cause execution of the program to cease.
  5562.           Recoverable errors cause program execution to cease if
  5563.           SETERRLEVEL is 7, overwise execution continues and the
  5564.           error number is placed in the system variable ERR.
  5565.           SETERRLEVEL 7 is the default.
  5566.  
  5567.           When runtime errors are displayed they are accompanied by
  5568.           a runtime address.  BasicBasic will output a list of
  5569.           runtime addresses for each statement.  These addresses
  5570.           will be contained in a file with the same name as the
  5571.           source file and an extension of .TMP.
  5572.  
  5573.           Fatal Errors:
  5574.  
  5575.                error number              description
  5576.                ------------              -----------
  5577.  
  5578.                   236         Out of memory
  5579.                   503         READ is attempting to read wrong kind
  5580.                               of data.
  5581.                   501
  5582.                   ...
  5583.                   522         Internal runtime errors.
  5584.                   523         Wrong number of array elements or
  5585.                               array not dimensioned.
  5586.                   524         Out of free space.
  5587.                   525         Out of string space.
  5588.                   526         Return without gosub
  5589.                   527         Not enough memory for menu
  5590.                   528         SUB without CALL
  5591.                   529         END SUB without CALL
  5592.                   530         Out of space for functions
  5593.                   531         SUB/CALL have different # of parms
  5594.  
  5595.  
  5596.           Recoverable Errors:
  5597.  
  5598.                   1000        Error attempting to open file
  5599.                   1001        Attempt to read past end of file
  5600.                   1002        File not open
  5601.                   1003        File read error (probably hardware)
  5602.                   1004        ASC function on empty string
  5603.                   1005        Divide by zero
  5604.                   1006        Out of data during READ
  5605.                   1007        File already open
  5606.                   1008        No available file control block
  5607.                                       84
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5614.  
  5615.  
  5616.  
  5617.  
  5618.  
  5619.                   1009        Error attempting to open file
  5620.                   1010        File mode error on read
  5621.                   1011        File mode error on write
  5622.                   1012        Bad file number
  5623.                   1013        Path not found
  5624.                   1014        RMDIR error
  5625.                   1015        MKDIR error
  5626.                   1016        KILL error
  5627.                   1017        FILE BUFFER ERROR
  5628.                   1018        INVALID FIELD DATA
  5629.                   1019        FIELD OVERFLOW
  5630.                   1020        FILE ERROR
  5631.                   1021        COMMUNICATIONS OPEN ERROR
  5632.                   1022        CREATE BUTTON ERROR
  5633.                   1023        BAD SCREEN MODE IN SCREEN COMMAND
  5634.                   1025        GRAPHICS GET ARRAY ERROR
  5635.                   1026        GRAPHICS PUT ARRAY ERROR
  5636.                   1027        CREATE FONT ERROR
  5637.                   1028        NOT IN CORRECT SCREEN MODE
  5638.                   1029        INVALID COLOR/COLOR ATTRIBUTE
  5639.                   1030        ILLEGAL FONT NUMBER
  5640.                   1031        FONT NOT DEFINE
  5641.                   1032        PALETTE NOT DEFINED
  5642.                   1033        BITMAP COMPRESS ERROR
  5643.                   1034        NOT ENOUGH MEMORY TO LOAD BITMAP
  5644.                   1035        UNKNOWN ERROR READING BITMAP
  5645.                   1036        UNKNOWN BITMAP TYPE
  5646.                   1037        ERROR STORING BITMAP FILE
  5647.                   1038        BITMAPH FAILURE
  5648.                   1039        NOT A BITMAP FILE
  5649.                   1040        CREATEBITMAP-NOT ENOUGH MEMORY
  5650.                   1041        SELECTBITMAP ERROR
  5651.                   1042        COPYBITS ERROR
  5652.                   1043        INVALID CONTROL IN DIALOG
  5653.                   1044        NOT ENOUGH MEMORY FOR DIALOG
  5654.                   1045        CHDIR ERROR
  5655.                   1046        CHDRIVE ERROR
  5656.                   1047        CREATEBITMAP DATA INVALID
  5657.                   1048        STRING TOO SHORT
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.  
  5673.                                       85
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.           KEYBOARD CODES
  5687.           -------------------------------------------------------
  5688.  
  5689.           The following table shows the key codes returned by the
  5690.           INKEY$ function.  These key codes are returned as 1 byte.
  5691.  
  5692.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  5693.                  KEY CODE        KEY CODE        KEY CODE
  5694.             ESC    27                       BKSP    8
  5695.             1      49        !     33       TAB     9
  5696.             2      50        @     64       ENTER   13
  5697.             3      51        #     35       SPACE   32
  5698.             4      52        $     36
  5699.             5      53        %     37
  5700.             6      54        ^     94
  5701.             7      55        &     38
  5702.             8      56        *     42
  5703.             9      57        (     40
  5704.             0      48        )     41
  5705.             -      45        _     95
  5706.             =      61        +     43
  5707.  
  5708.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  5709.                  KEY CODE        KEY CODE        KEY CODE
  5710.              A     65        a     97
  5711.              B     66        b     98
  5712.              C     67        c     99
  5713.              D     68        d     100
  5714.              E     69        e     101
  5715.              F     70        f     102
  5716.              G     71        g     103
  5717.              H     72        h     104
  5718.              I     73        i     105
  5719.              J     74        j     106
  5720.              K     75        k     107
  5721.              L     76        l     108
  5722.              M     77        m     109
  5723.              N     78        n     110
  5724.              O     79        o     111
  5725.              P     80        p     112
  5726.              Q     81        q     113
  5727.              R     82        r     114
  5728.              S     83        s     115
  5729.              T     84        t     116
  5730.              U     85        u     117
  5731.              V     86        v     118
  5732.              W     87        w     119
  5733.              X     88        x     120
  5734.              Y     89       y      121
  5735.              Z     90       z      122
  5736.  
  5737.  
  5738.  
  5739.                                       86
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.           The following table shows the extended key codes returned
  5752.           by the INKEY$ function.  These key codes are returned as 2
  5753.           characters.  In this case the first character will be 0.
  5754.           
  5755.                     KEY   DECIMAL
  5756.                           KEY CODE
  5757.                     ----  ------
  5758.                      F1    0 59
  5759.                      F2    0 60
  5760.                      F3    0 61
  5761.                      F4    0 62
  5762.                      F5    0 63
  5763.                      F6    0 64
  5764.                      F7    0 65
  5765.                      F8    0 66
  5766.                      F9    0 67
  5767.                      F10   0 68
  5768.  
  5769.                      CTRL-F1   0   94
  5770.                      CTRL-F2   0   95
  5771.                      CTRL-F3   0   96
  5772.                      CTRL-F4   0   97
  5773.                      CTRL-F5   0   98
  5774.                      CTRL-F6   0   99
  5775.                      CTRL-F7   0  100
  5776.                      CTRL-F8   0  101
  5777.                      CTRL-F9   0  102
  5778.                      CTRL-F10  0  103
  5779.                      SHIFT-F1  0   84
  5780.                      SHIFT-F2  0   85
  5781.                      SHIFT-F3  0   86
  5782.                      SHIFT-F4  0   87
  5783.                      SHIFT-F5  0   88
  5784.                      SHIFT-F6  0   89
  5785.                      SHIFT-F7  0   90
  5786.                      SHIFT-F8  0   91
  5787.                      SHIFT-F9  0   92
  5788.                      SHIFT-F10  0  93
  5789.                      HOME       0  71
  5790.                      UP ARROW   0  72
  5791.                      PGUP       0  73
  5792.                      LEFT ARROW 0  75
  5793.                      RIGHT ARR  0  77
  5794.                      END        0  79
  5795.                      DOWN ARROW 0  80
  5796.                      PGDN       0  81
  5797.                      INS        0  82
  5798.                      DEL        0  83
  5799.                      CTRL-HOME  0  119
  5800.                      CTRL-PGUP  0  132
  5801.                      CTRL-LEFT  0  115
  5802.                      CTRL-RIGHT 0  116
  5803.                      CTRL-END   0  117
  5804.                      CTRL-PGDN  0  118
  5805.                                       87
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.  
  5819.           Windows is a registered trademark of Microsoft
  5820.           Corporation.
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.                                       88
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.