home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / compiler / bb.txt < prev    next >
Text File  |  1993-11-15  |  201KB  |  6,872 lines

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