home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / WBB12.ZIP / BB.DOC next >
Text File  |  1992-09-10  |  101KB  |  3,697 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           BasicBasic is copyright (c) 1992 by Mark Davidsaver.  All
  8.           rights reserved.
  9.  
  10.  
  11.           ORDER INFORMATION
  12.           -------------------------------------------------------
  13.  
  14.           If you find BasicBasic useful registration is requested.
  15.           Through December 31, 1992, you will automatically receive
  16.           TWO updates for your registration fee.  The registration
  17.           fee is $30.00.  Please state the version of the software
  18.           that you currently have(if you have the most recent
  19.           version we begin your upgrades with the next release) and
  20.           whether 3 1/2 high density, 3 1/2 low density or  5 1/4
  21.           high density diskettes are needed.  Illinois residents add
  22.           6.25% sales tax.  Foreign orders in US funds only.
  23.           Foreign orders add $5.00 for extra postage.
  24.  
  25.           Send check or money order to:  Mark Davidsaver
  26.                                          213 S. Park Street
  27.                                          Bishop Hill, Il  61419
  28.  
  29.           or phone with MC/Visa orders to:  (309) 927-3303
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  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.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.                                TABLE OF CONTENTS
  76.  
  77.  
  78.                 Summary ................................ 2
  79.  
  80.                 Getting Started Quickly ................ 3
  81.  
  82.                 BasicBasic Basics ...................... 5
  83.  
  84.                 Windows Metacommands ................... 7
  85.  
  86.                 Metacommands ........................... 8
  87.  
  88.                 Statement and Function Reference ....... 9
  89.  
  90.                 Graphics Programming for Beginners .... 31
  91.  
  92.                 Programming Buttons ................... 36
  93.  
  94.                 Programming Menus ..................... 38
  95.  
  96.                 Communications Programming ............ 40
  97.  
  98.                 Windows and Graphics .................. 41
  99.  
  100.                 Windows and Fonts ..................... 44
  101.  
  102.                 Chaining and Common ................... 48
  103.  
  104.                 Default Windows Font................... 49
  105.                  (386 Enhanced Mode Font information)
  106.  
  107.                 Errors ................................ 51
  108.  
  109.                 Keyboard codes ........................ 53
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                       1
  128.  
  129.  
  130.  
  131.  
  132.  
  133.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.           SUMMARY
  141.           -------------------------------------------------------
  142.  
  143.           BasicBasic is an easy to program, Basic-like language for
  144.           DOS or Windows.  BasicBasic creates EXE files which can be
  145.           run under DOS or Windows.  BasicBasic supports both
  146.           graphics and text screens.  BasicBasic contains a subset
  147.           of Microsoft Basic as well as many new commands unique to
  148.           BasicBasic.
  149.  
  150.           BasicBasic is an easy way to develop small to medium size
  151.           programs without regard for which environment they will
  152.           run under.  BasicBasic supports mouse and buttons in both
  153.           DOS and Windows and Menus in Windows.  Several commands
  154.           from more advanced Basics are also included (such as the
  155.           DIR$ function and binary file I/O from Microsoft
  156.           Professional Basic).
  157.  
  158.           Programs written for BasicBasic can run under either DOS
  159.           or Windows.  The compiler, itself, may run under either
  160.           DOS or Windows.
  161.  
  162.           In addition to BasicBasic you will need a source editor
  163.           for the environment you are running under.  BasicBasic
  164.           accepts source from standard ASCII files.
  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.           ABS   ADDSUBMENU   ASC   ATN   BEEP   CBUTTON   CHAIN
  171.           CHR$   CIRCLE   CLOSE   CLS   COLOR   COMMON   COMSTATI
  172.           COS   CREATEFONT   CSRLIN   DATA  DATE$   DBUTTON  DIM
  173.           DIR$   DLEN   EOF   FIELD   FIX   FONT   FONT$   FOR..NEXT
  174.           FREEMEM   GET   GET #   GOSUB..RETURN   GOTO
  175.           IF..THEN..ELSE   INKEY$   INPUT   INPUT #   INPUT$   INSTR
  176.           INT   KILL   LEFT$   LEN   LET   LINE   LINE INPUT #   LOC
  177.           LOCATE   LSET   MAINMENU   MENUITEMGRAY   MENUITEMON
  178.           MID$   MKDIR   MOUSEB  MOUSEON   MOUSEX   MOUSEY   ONPAINT
  179.           OPEN   OPEN "COMn:"   PAINT   PALETTE   POINT   POS
  180.           POSITION   POINT   PRINT #   LPRINT   PRINT USING  PUT
  181.           PUT #   LPRINT USING   PRESET   PSET   OSTYPE   RADIOON
  182.           RADIOOFF   RANDOMIZE   READ   REM   RESTORE   RETURN
  183.           RIGHT$   RMDIR   RND   SCREEN   SCROLLAREA   SELECTFONT
  184.           SETERRLEVEL   SIN   SPACE$   STOP   STR$   STRING$
  185.           SYSTEM   TAB   TAN   TIME$  TIMER   UCASE$   VAL  WRITE #
  186.  
  187.           and the operators     +  -  /  *  \  ^  AND  OR
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                       2
  194.  
  195.  
  196.  
  197.  
  198.  
  199.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.           GETTING STARTED QUICKLY
  207.           -------------------------------------------------------
  208.  
  209.           The easiest way to run BasicBasic is to have all required
  210.           files in one directory.  If you are not going to be
  211.           running or compiling under either DOS or Windows you do
  212.           not need the files specific to them.  BasicBasic files
  213.           required for each operating environment are:
  214.  
  215.                      FILE        USE
  216.                      _____       __________________________________
  217.  
  218.                      BB.EXE   \_ required to compile under DOS
  219.                    BB12.STB   /
  220.  
  221.                 BBLIB12.EXE    _ runtime required to run application
  222.                                  under DOS
  223.  
  224.  
  225.                     WBB.EXE   \_ required to compile under Windows
  226.                    BB12.STB   /
  227.  
  228.                WBBLIB12.EXE    _ runtime required to run application
  229.                                  under Windows
  230.                     WBB.FON    - Fonts required to support graphics
  231.                                  screens under Windows.
  232.  
  233.           You may also want the provided sample programs.
  234.           (SAMPLE1.BAS, SAMPLE2.BAS, etc.)
  235.  
  236.           Before compiling a program you must have the Source in an
  237.           ASCII file.  Most word processors have an option to allow
  238.           reading/writing of ASCII files.  Windows Write, for
  239.           example, allows you to save in Text Only format which is
  240.           ASCII.  When opening ASCII files you must be sure to tell
  241.           Write to NOT convert file to Write format.
  242.  
  243.           Several sample programs are provided to let you get
  244.           started quickly.  The sample programs have file names of
  245.           the format SAMPLEnn.BAS.
  246.  
  247.             SAMPLE1.BAS
  248.             SAMPLE2.BAS\__ Basic examples using text screens
  249.             SAMPLE3.BAS/
  250.             SAMPLE4.BAS
  251.  
  252.             SAMPLEB1.BAS
  253.             SAMPLEB2.BAS __ Examples utilizing buttons
  254.             SAMPLEB3.BAS
  255.  
  256.             SAMPLEG1.BAS
  257.             SAMPLEG2.BAS\__ Graphic examples
  258.             SAMPLEG3.BAS/
  259.                                       3
  260.  
  261.  
  262.  
  263.  
  264.  
  265.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  266.  
  267.  
  268.  
  269.  
  270.  
  271.             SAMPLEG4.BAS
  272.  
  273.             SAMPLEM1.BAS -- Menu example
  274.  
  275.  
  276.           To compile a program under DOS type BB.  When requested
  277.           enter the file name you want to compile.  If no extension
  278.           is given the compiler will assume .BAS.  You can also
  279.           enter the file name you want to compile as part of the
  280.           start command.  e.g.   BB SAMPLE1.BAS.  The executable
  281.           file created will have the same name as the source file.
  282.  
  283.           Under Windows you must compile using the program WBB.EXE.
  284.           You may install this in a group with the Program Manager
  285.           or run WBB seperately.  When compile is completed you may
  286.           either execute the program or restart to compile another
  287.           program.
  288.  
  289.           IMPORTANT!  Whether you are compiling under DOS or Windows
  290.           only one EXE file will be created.  This file will have
  291.           the same name as the source file with an extenstion of
  292.           .EXE.  This EXE file can be executed under either DOS or
  293.           Windows as long as the appropriate runtime module is
  294.           present (BBLIB12.EXE for DOS or WBBLIB12.EXE for Windows).
  295.           If you are using graphics screens running under Windows
  296.           you will also need the file WBB.FON.
  297.  
  298.           DOS programs require the presence of BBLIB12.EXE to run
  299.           and Windows programs require the presence of WBBLIB12.EXE
  300.           to run.  If this runtime library file is not found an
  301.           error message will be returned (In Windows the absence of
  302.           WBBLIB12.EXE is indicated by 4 short beeps and the program
  303.           does not execute.  You might also get the 4 short beeps if
  304.           you are running a program directly from the compiler and
  305.           do not have enough memory.  In this case exit the compiler
  306.           and run the compiled program seperately.).
  307.  
  308.           If you are running Windows 3.1 in 386 Enhanced Mode and
  309.           using text only screens see the section on Default Windows
  310.           Font for important information on using different font
  311.           sizes.
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                       4
  326.  
  327.  
  328.  
  329.  
  330.  
  331.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.           BasicBasic Basics
  339.           -------------------------------------------------------
  340.  
  341.           BasicBasic is intended to be a subset of Microsoft Basic.
  342.           More statements and functions will be added with each
  343.           release.  Depending on your religion you may or may not be
  344.           happy to see that GOTO is supported.  BasicBasic's syntax
  345.           is 'almost' the same as Microsoft's Basic.  Here are some
  346.           known syntax differences:
  347.  
  348.                BasicBasic scans expressions from left to right the
  349.                same as Microsoft Basic, however, BasicBasic checks
  350.                all multiplies before divides and all minus signs
  351.                before addition.
  352.  
  353.                BasicBasic does not support the underscore (_) line
  354.                extension character.
  355.  
  356.           Most functions and statements have the same syntax as
  357.           Microsoft Basic.  You should check the Statement and
  358.           Function Reference section for details on syntax.
  359.  
  360.           Date types supported are integer (% suffix), long integer
  361.           (& suffix), single precision (no suffix), and string ($
  362.           suffix).  Double precision numbers are not supported in
  363.           this version.
  364.  
  365.           BasicBasic does not support a standard array of size 10.
  366.           Every array must be explicitly dimensioned with a DIM
  367.           statement.
  368.  
  369.           CAPACITIES
  370.  
  371.              General limits:
  372.  
  373.                      Maximum number of arrays:  100
  374.                              Total open files:  10
  375.                            Total string space:  approx. 47000 chars.
  376.                 Maximum character string size:  2048
  377.                               Maximum Buttons:  40
  378.  
  379.              Windows only limits:
  380.  
  381.                                 Maximum menus:  6
  382.                       Maximum Items in a menu:  10
  383.                         Maximum Fonts Defined:  10
  384.  
  385.  
  386.  
  387.           RESERVED WORDS
  388.  
  389.           All names of statements and functions are reserved words
  390.           and may not be used as variable names.  ERR is a special
  391.                                       5
  392.  
  393.  
  394.  
  395.  
  396.  
  397.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  398.  
  399.  
  400.  
  401.  
  402.  
  403.           case.  This is a system wide variable used to return error
  404.           information to BasicBasic programs.  See the command
  405.           SETERRLEVEL for more complete information.
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  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.                                       6
  458.  
  459.  
  460.  
  461.  
  462.  
  463.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.           WINDOWS METACOMMANDS
  471.           -------------------------------------------------------
  472.  
  473.  
  474.           BasicBasic contains several Metacommands to set Windows
  475.           environment parameters.  These commands have no affect on
  476.           execution of the program.  All Windows Metacommands have
  477.           the following format:
  478.  
  479.                  REM WINDOWS command
  480.  
  481.           REM WINDOWS NAME name
  482.  
  483.           The window name which the program will display can be
  484.           supplied.  The default is the same as the file name of the
  485.           program.
  486.                    e.g.   REM WINDOWS NAME investments
  487.  
  488.  
  489.           REM WINDOWS size x1,y1,x2,y2
  490.  
  491.           This command allows you to define a portion of the normal
  492.           DOS screen size as the area to be displayed in the Windows
  493.           window.  This is useful if you have a program centered in
  494.           the standard 80x25 DOS screen, but do not use much of the
  495.           border area.  Regular scrolling may not work in windows if
  496.           you define the window size as less than 80x25.  X1 is the
  497.           left column, y1 is the top row, x2 is the right column,
  498.           and y2 is the bottom row.  e.g.
  499.  
  500.                    e.g.       REM WINDOWS SIZE 10,10,70,15
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.                                       7
  524.  
  525.  
  526.  
  527.  
  528.  
  529.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.           METACOMMANDS
  537.           -------------------------------------------------------
  538.  
  539.           metacommands are preceded by REM and a dollar sign.
  540.  
  541.  
  542.           INCLUDE:
  543.  
  544.             This metacommand allows you to include source from
  545.             another file in the currently compiling file.  files may
  546.             be nexted up to 10 levels deep.
  547.  
  548.               e.g.  REM $INCLUDE: moretext.asc
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                       8
  590.  
  591.  
  592.  
  593.  
  594.  
  595.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.           STATEMENT AND FUNCTION REFERENCE
  603.           -------------------------------------------------------
  604.  
  605.           Here is a brief description of available functions and
  606.           statements.  More detailed information on those not unique
  607.           to BasicBasic can be found in standard Basic reference
  608.           books.
  609.  
  610.  
  611.  
  612.           ABS(numericexpression)
  613.  
  614.             This function returns the absolute value of the numeric
  615.             expression.
  616.  
  617.  
  618.  
  619.           ADDSUBMENU  menunumber,stringexpression,keycode
  620.  
  621.             This command is ignored in DOS.  Addsubmenu adds an item
  622.             to a pull down menu with the text stringexpression.
  623.             When the user selects this menu item the keycode will be
  624.             returned at the next INKEY$ function call.  See the
  625.             section 'Programming Menus' for more details
  626.  
  627.  
  628.  
  629.           ASC(string expression)
  630.  
  631.             This function returns a numerical value which is the
  632.             ASCII code for the first character of string expression.
  633.  
  634.  
  635.  
  636.           ATN(numeric expression)
  637.  
  638.             This function returns the arctangent of a numeric
  639.             expression.
  640.  
  641.  
  642.  
  643.           BEEP
  644.  
  645.             This statement sounds the ASCII bell character.
  646.  
  647.  
  648.  
  649.           CBUTTON "name",keycode,0,"type",0,left,top,xsize,ysize,
  650.                   forecolor,backcolor
  651.  
  652.             This command defines and creates a button on screen.
  653.             This command is DOS and Windows compatible.  In screen
  654.             mode 0 left,top,xsize,ysize are in character units.  In
  655.                                       9
  656.  
  657.  
  658.  
  659.  
  660.  
  661.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  662.  
  663.  
  664.  
  665.  
  666.  
  667.             graphics screen modes these must be supplied in pixel
  668.             units.  The name is the text which will be displayed in
  669.             the button.  When you define a button you must define
  670.             the keycode which will be returned when that button is
  671.             pressed by the user.  Legal button types are "Radio",
  672.             "Push" or "Invisible".  Left, top, xsize, ysize define
  673.             the position and size of the button(in character
  674.             position).  Radio buttons may have a foreground and
  675.             background color defined.  If these are left 0 then the
  676.             default colors will be used.  In DOS the colors are also
  677.             used for Pushbuttons.
  678.  
  679.             When the user presses the button the indicated keycode
  680.             will be returned to the INKEY$ function.  If a button is
  681.             pressed while executing the INPUT command the input will
  682.             be ended, but the keycode will not be returned until a
  683.             subsequent INKEY$ function is called.  Instead of using
  684.             the mouse to press the indicated button, the user can
  685.             also press the keyboard key which returns the indicated
  686.             keycode.
  687.  
  688.             Any key may be defined for a button.  See the section
  689.             "Keyboard codes" for a list of codes recognized by
  690.             BasicBasic.  As an example the uppercase letter 'A'
  691.             would be the keycode 65.  Extended keycodes are
  692.             indicated by adding 1000 to the second part of the code.
  693.             For example F1 would be 1059, or F10 would be 1068.
  694.  
  695.               e.g. CBUTTON "Exit",1068,"Push",0,1,1,8,1,7,4
  696.  
  697.                    Creates a push button on the top line.  Because
  698.                    it is a Push button the color values are ignored
  699.                    in windows, but used in DOS.
  700.  
  701.             See RADIOON and RADIOOFF for instructions on
  702.             checking/unchecking radio buttons.
  703.  
  704.             See the section "Programming Buttons" for more detail on
  705.             programming buttons.
  706.  
  707.             Note that while CBUTTON creates a button it will not
  708.             respond to the mouse button until the function MOUSEON
  709.             has been issued.
  710.  
  711.  
  712.  
  713.           CHAIN  filespec
  714.  
  715.             This command transfers control from the current program
  716.             to another program.  COMMON may be used to pass
  717.             variables between programs.  Files are left open when
  718.             transfering to another program.  See the section
  719.             'Chaining and Common' for more details.
  720.  
  721.                                       10
  722.  
  723.  
  724.  
  725.  
  726.  
  727.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  728.  
  729.  
  730.  
  731.  
  732.  
  733.                 e.g.  CHAIN "TEST2.EXE"
  734.  
  735.  
  736.  
  737.           CHR$(numeric expression)
  738.  
  739.             This function returns the ASCII code for the numeric
  740.             expression.  The returned code is one character.
  741.  
  742.  
  743.  
  744.           CIRCLE [STEP](x1,y),radius,[color],[start],[end],[aspect]
  745.  
  746.             This statement draws a circle, ellipse, or pie section
  747.             on the graphics screen.  (x,y) are the screen
  748.             coordinates of the center of the figure.  Radius is the
  749.             radius in pixels.  Start and End are angles in radians.
  750.             Omiting these results in a complete circle or ellipse.
  751.             You may use Start,End to draw arcs or pie sections.  A
  752.             complete circle has a start randian of 0 and an end
  753.             radian of 6.2832.
  754.  
  755.             If start or end are negative the value is converted to a
  756.             positive number for purposes of drawing the arc, but
  757.             then a line is drawn from the center of the figure to
  758.             the end point of the arc.  PIE figures may be draw in
  759.             this way.
  760.  
  761.               Example of a complete circle, radius 50, color blue
  762.  
  763.                       SCREEN 8
  764.                       CIRCLE (100,100),50,1
  765.  
  766.               Example of pie figure, filled in
  767.  
  768.                       SCREEN 8
  769.                       CIRCLE (100,100),50,1,-.01,-2
  770.                       PAINT (102,98),1,1
  771.  
  772.             Aspect can be used to adjust the ratio of y radius to
  773.             the x radius.  By default BasicBasic sets aspect to a
  774.             number to create round circles for the type of screen
  775.             being used.
  776.  
  777.  
  778.  
  779.           CLOSE #filenumber
  780.  
  781.             This statement terminates I/O to the indicated
  782.             filenumber.  Only one number allowed for each CLOSE
  783.             command.
  784.  
  785.  
  786.  
  787.                                       11
  788.  
  789.  
  790.  
  791.  
  792.  
  793.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  794.  
  795.  
  796.  
  797.  
  798.  
  799.           CLS
  800.  
  801.             This statement clears the screen.  If a scrollable area
  802.             has been define the entire screen is still cleared.
  803.  
  804.  
  805.  
  806.           COLOR foreground,background
  807.  
  808.             The format of this statement varies depending on the
  809.             screen mode you are in.
  810.  
  811.             MODE 0
  812.  
  813.               This statement sets the screen colors to the indicated
  814.               foreground and background colors.  Color values are:
  815.  
  816.                0 - Black
  817.                1 - Blue
  818.                2 - Green
  819.                3 - Cyan
  820.                4 - Red
  821.                5 - Magenta
  822.                6 - Brown
  823.                7 - White
  824.                8 - Gray
  825.                9 - Light Blue
  826.               10 - LIght Green
  827.               11 - Light Cyan
  828.               12 - Light Red
  829.               13 - Light Magenta
  830.               14 - Yellow
  831.               15 - High intensity white
  832.  
  833.             Foreground values can be 0 through 15 and background
  834.             values can be 0 through 15.
  835.  
  836.           MODE 8,9
  837.  
  838.             The first argument (foreground color) is a color
  839.             attribute.  The second argument(background color) is a
  840.             screen color.  For Windows programs see the section
  841.             WINDOWS AND GRAPHICS for additional information on the
  842.             COLOR statement.
  843.  
  844.           MODE 12
  845.  
  846.             Only one argument is used.  The first argument
  847.             (foreground) color is a color attribute.  In this mode
  848.             to change the background color for the entire screen use
  849.             the PALETTE command to change the definition of color
  850.             attribute 0.
  851.  
  852.           MODE 1000
  853.                                       12
  854.  
  855.  
  856.  
  857.  
  858.  
  859.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.             This mode is only supported under Windows.  The first
  867.             argument (foreground) is a color attribute.  The second
  868.             arguement (background) is a color attribute.  In this
  869.             mode to change a palette color you must use the PALETTE
  870.             command.
  871.  
  872.  
  873.  
  874.           COMMON  variablelist
  875.  
  876.             Common passes variables to a chained program.
  877.             Variablelist is a list of variables and arrays whose
  878.             contents will be preserved when Chaining to a new
  879.             program.  Only 'blank' common is supported.  A blockname
  880.             is not allowed.  the SHARED attribute is not allowed.
  881.             Arrays are indicated by blank parenthesis.  See the
  882.             section 'Chaining and Common' for more details.
  883.  
  884.               e.g.  COMMON A,B,A$,B$()
  885.  
  886.  
  887.  
  888.           COMSTATI(comnum)
  889.  
  890.             This function returns the status of a communications
  891.             port.  8 bits of data are returned.  These are defined
  892.             as follows:
  893.  
  894.               bit 7 = Data Carrier Detect
  895.                   6 = Ring Indicator
  896.                   5 - Data Set Ready
  897.                   4 - Clear to Sent
  898.                   3 - Break Detect
  899.                   2 - Framing Error
  900.                   1 - Parity Error
  901.                   0 - Overrun Error
  902.  
  903.               e.g.  a=COMSTATI(1)
  904.  
  905.  
  906.  
  907.           COS(n)
  908.  
  909.             This function returns the cosine of an angle expressed
  910.             in radians.
  911.  
  912.  
  913.  
  914.           CREATE FONT
  915.  
  916.             Allows creation of fonts in Windows.  See section
  917.             WINDOWS AND FONTS for a description of this command.
  918.  
  919.                                       13
  920.  
  921.  
  922.  
  923.  
  924.  
  925.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.           CSRLIN
  934.  
  935.             This function gets the current line position of the
  936.             cursor(starting with 1).  In graphics mode 1000 the
  937.             pixel line position is returned (starting with 0).
  938.  
  939.  
  940.  
  941.           DATA
  942.  
  943.             This statement is used in conjuction with the READ
  944.             statement to input numeric or string constants.
  945.  
  946.  
  947.  
  948.           DATE$
  949.  
  950.             This function returns a string of ten characters
  951.             corresponding to the current computer date.
  952.  
  953.  
  954.  
  955.           DBUTTON keycode
  956.  
  957.             This statement erases a button from the screen (using
  958.             currently define colors) and disables input from it.
  959.             The keycode should be the same as that used in the
  960.             CBUTTON command.  See the section "Programming Buttons"
  961.             for more information on buttons.
  962.  
  963.  
  964.  
  965.           DIM variable(subscripts),...
  966.  
  967.             Defines arrays.  There is no default array size of 10 in
  968.             BasicBasic.  Every array must be defined.  SHARED is not
  969.             supported.
  970.  
  971.  
  972.  
  973.           DIR$(path,[type])
  974.               or
  975.           DIR$
  976.  
  977.             This function returns file names.  If no type is
  978.             specified or type is set to 0 then file names not
  979.             including system and hidden will be returned.  If no
  980.             path is specified then the next name using the previous
  981.             search path will be returned.  Type may be set to a
  982.             non-zero value to return the names of special classes of
  983.             files.
  984.  
  985.                                       14
  986.  
  987.  
  988.  
  989.  
  990.  
  991.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  992.  
  993.  
  994.  
  995.  
  996.  
  997.                       type       file type
  998.                        1         Read Only files
  999.                        2         Hidden files
  1000.                        3         System files
  1001.                        5         Directories
  1002.                        6         Archive bit set
  1003.  
  1004.  
  1005.  
  1006.           DLEN (string)
  1007.  
  1008.             This function returns the length in pixels of a string.
  1009.             It is intended for use in Windows graphics mode but also
  1010.             works in DOS graphics mode.
  1011.  
  1012.  
  1013.  
  1014.           EOF(filenumber)
  1015.  
  1016.             This function tests for end-of-file.
  1017.  
  1018.  
  1019.  
  1020.           FIELD #filenumber,fieldwidth AS stringvariable...
  1021.  
  1022.             This statement allocates space for variables in
  1023.             random-access file buffer.  The filenumber is the number
  1024.             under which the file was opened.  Fieldwidth is a number
  1025.             indicating the length of the field and string variable
  1026.             is the name of the field.  Multiple fields can be
  1027.             defined at once.
  1028.  
  1029.                e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  1030.                      FIELD #1,18 AS NAME$,18 AS ADDRESS$
  1031.                      LSET NAME$="FRED SMITH"
  1032.                      LSET ADDRESS$="1 MAIN STREET"
  1033.                      PUT #1,1
  1034.                      CLOSE #1
  1035.  
  1036.  
  1037.  
  1038.           FIX(numeric expression)
  1039.  
  1040.             This function returns the integer representation of the
  1041.             value in numeric expression.  -n.x returns n-1 if x>0.
  1042.  
  1043.  
  1044.  
  1045.           FONT(n)
  1046.  
  1047.             This function returns information about a Windows font.
  1048.             See the section WINDOWS AND FONTS for a complete
  1049.             description of this function
  1050.  
  1051.                                       15
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.           FONT$(n)
  1066.  
  1067.             This function returns information about a Windows font.
  1068.             See the section WINDOWS AND FONTS for a complete
  1069.             description of this function.
  1070.  
  1071.  
  1072.  
  1073.           FOR..NEXT
  1074.  
  1075.           FOR counter=start TO end [STEP increment]
  1076.  
  1077.             Defines a program loop.
  1078.  
  1079.  
  1080.  
  1081.           FREEMEM
  1082.  
  1083.             This function returns the amount of global memory
  1084.             available to other programs.
  1085.  
  1086.  
  1087.           GET (x1,y1)-(x2,y2),arrayname
  1088.  
  1089.             This statement gets a range of pixels from the graphics
  1090.             screen and puts them into an array.  The may be placed
  1091.             back on the screen using the PUT statement.  In
  1092.             BasicBasic only one set of pixels may be stored in each
  1093.             array and storing begins with the first element of the
  1094.             array.
  1095.  
  1096.                       e.g.
  1097.                          DIM A%(100)
  1098.  
  1099.                          GET (100,100)-(109,109),A%
  1100.  
  1101.             It is important that you dimension the array large
  1102.             enough to hold the pixel data.
  1103.  
  1104.             You can calculate the space required as follows:
  1105.  
  1106.                size=int(((totalpixels*bits/pixel)+1)/8)+100
  1107.  
  1108.             Where size is in bytes.  Each element of an integer
  1109.             array takes up 2 bytes.
  1110.  
  1111.  
  1112.  
  1113.           GET #filenumber,recordnumber,variable$
  1114.  
  1115.             This statement allows input of data from BINARY files.
  1116.             Recordnumber is an absolute byte position in the file.
  1117.                                       16
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.             The first byte of the file is number 1.
  1130.  
  1131.  
  1132.  
  1133.           GOSUB label
  1134.  
  1135.             This statement causes a branch to a subroutine.
  1136.  
  1137.  
  1138.           GOTO label
  1139.  
  1140.             This statement causes a jump to another program
  1141.             location.
  1142.  
  1143.  
  1144.  
  1145.           IF...THEN...ELSE
  1146.  
  1147.             Permits conditional execution depending on evaluation of
  1148.             expression.
  1149.  
  1150.  
  1151.  
  1152.           INKEY$
  1153.  
  1154.             This function returns a character from the keyboard.
  1155.  
  1156.  
  1157.  
  1158.           INPUT[;]["promptstring"{;|,}] variablelist
  1159.  
  1160.             Executing this statement causes the program to pause and
  1161.             wait for input.  A promptstring may optionally be
  1162.             printed before pausing for input.  If a comma is used
  1163.             after the promptstring or if no prompt string is
  1164.             specified a question mark is displayed before waiting
  1165.             for input.  If INPUT is followed by a semicolon, then no
  1166.             carriage return line feed is performed after the Enter
  1167.             key is pressed.
  1168.  
  1169.  
  1170.  
  1171.           INPUT #filenumber,variablelist
  1172.  
  1173.             This statement reads items from an open file to the
  1174.             given variables.  When inputting data leading spaces
  1175.             will be ignored.
  1176.  
  1177.  
  1178.  
  1179.           INPUT$(n,port)
  1180.  
  1181.             This function returns a string of n characters from a
  1182.             communications port.  If n characters are not available
  1183.                                       17
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.             the function will WAIT for that many characters to
  1196.             arrive.  To avoid 'hanging up' your program use the LOC
  1197.             function to find how many characters are waiting.  If a
  1198.             communications error occurs the number of characters
  1199.             returned may be less than what you requested.  In this
  1200.             case use the function COMSTATI to determine what error
  1201.             occured.  See the section "Communications Programming"
  1202.             for more details.
  1203.  
  1204.  
  1205.  
  1206.           INSTR([start],expressiontosearch,searchforexpression)
  1207.  
  1208.             This function searches for the first occurence of
  1209.             searchforexpression in expressiontosearch and returns
  1210.             the position at which the match is found.  If no match
  1211.             is found then 0 is returned.
  1212.  
  1213.  
  1214.  
  1215.           INT(numericexpression)
  1216.  
  1217.             This function returns the largest integer less than or
  1218.             equal to numericexpression.
  1219.  
  1220.  
  1221.  
  1222.           KILL stringexpression
  1223.  
  1224.             This command deletes the file whose name is in
  1225.             stringexpression.
  1226.  
  1227.  
  1228.  
  1229.           LEFT$(stringexpression,n)
  1230.  
  1231.             This function returns a string of length n from the left
  1232.             part of stringexpression
  1233.  
  1234.  
  1235.  
  1236.           LEN(stringexpression)
  1237.  
  1238.             This function returns the number of characters in
  1239.             stringexpression.
  1240.  
  1241.  
  1242.  
  1243.           LET
  1244.  
  1245.             May optionally be used before assignment statements.
  1246.             e.g. LET I=3
  1247.  
  1248.  
  1249.                                       18
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.           LINE [STEP](x1,y1)-[STEP](x2,y2),[color],[B],[BF]
  1263.  
  1264.             This command draws a line, box, or filled box on the
  1265.             graphics screen.  The (x1,y1), (x2,y2) arguments are the
  1266.             end points of the line.  If a color is not specified the
  1267.             current foreground color will be used.  The 'B' option
  1268.             draws a box.  BF draws the box and paints the interior.
  1269.  
  1270.  
  1271.  
  1272.           LINE INPUT #,filenumber,stringvariable
  1273.  
  1274.             This statement inputs an entire line from a file.  Input
  1275.             continues until the next carriage return.
  1276.  
  1277.  
  1278.  
  1279.           LOC(filenumber)
  1280.  
  1281.             This function returns the current absolute byte position
  1282.             within a file.  For a communications port it returns the
  1283.             number of received characters waiting in the receive
  1284.             buffer.
  1285.  
  1286.  
  1287.  
  1288.           LOCATE row,column,[cursor]
  1289.  
  1290.             Positions the cursor on the screen.  If cursor is set to
  1291.             0 then the cursor is turned off.  In graphics mode 1000
  1292.             row, column are pixel positions (starting with 0) rather
  1293.             than character positions (starting with 1).
  1294.  
  1295.  
  1296.  
  1297.           LPRINT expressionlist [,|;]
  1298.  
  1299.             Prints the items in expression list.  See PRINT for a
  1300.             more complete description.
  1301.  
  1302.  
  1303.  
  1304.           LPRINT USING formatstring; expressionlist[,|;]
  1305.  
  1306.             The formatstring tells how to print the items in
  1307.             expressionlist.  See PRINT USING for a description of
  1308.             format string items.
  1309.  
  1310.  
  1311.  
  1312.           LSET stringvariable=string expression
  1313.  
  1314.             This command puts data into a random access file buffer.
  1315.                                       19
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.             The buffer must be previously defined by a FIELD
  1328.             statement.  The data is left justified in the field.
  1329.  
  1330.               e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  1331.                     FIELD #1,18 AS NAME$,18 AS ADDRESS$
  1332.                     LSET NAME$="FRED SMITH"
  1333.                     LSET ADDRESS$="1 MAIN STRING"
  1334.                     PUT #1,4
  1335.                     CLOSE #1
  1336.  
  1337.  
  1338.  
  1339.           MAINMENU stringexpression,stringexpression...
  1340.  
  1341.             This command is ignored in DOS.  This command defines
  1342.             the main menu bar for Windows.  Up to six sub menu names
  1343.             may be specified.  If less than six are defined, blank
  1344.             strings must be present.  See the section 'Programming
  1345.             menus' for more detail.
  1346.  
  1347.               e.g. MAINMENU "File","Color","Options","","",""
  1348.  
  1349.  
  1350.  
  1351.           MENUITEMGRAY keycode
  1352.  
  1353.             This command is ignored in DOS.  This command 'grays' a
  1354.             submenu item.  While gray the item cannot be selected by
  1355.             the user.  See the section 'Programming menus' for more
  1356.             detail.
  1357.  
  1358.  
  1359.  
  1360.           MENUITEMON keycode
  1361.  
  1362.             This command is ignored in DOS.  This command enables a
  1363.             submenu item.  When enable a user may select this menu
  1364.             item.
  1365.  
  1366.  
  1367.  
  1368.           MID$(stringexpression,n,length)
  1369.  
  1370.             This function returns a string composed of length
  1371.             characters starting with character n in
  1372.             stringexpression.
  1373.  
  1374.  
  1375.  
  1376.           MKDIR stringexpression
  1377.  
  1378.             This command creates a directory specified by
  1379.             stringexpression
  1380.  
  1381.                                       20
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.           MOUSEB
  1396.  
  1397.             This function returns information on whether mouse
  1398.             buttons are pressed.  Bit 0 is 1 if left button is
  1399.             pressed.  Bit 1 is 1 if right button is pressed.  Bit 2
  1400.             is 1 if middle button is pressed.
  1401.  
  1402.               e.g.  b=mouseb
  1403.                     b=b and 2
  1404.                     if b<>0 then
  1405.                       print "right button is pressed."
  1406.                     end if
  1407.  
  1408.  
  1409.  
  1410.           MOUSEON
  1411.  
  1412.             This function intializes the mouse.  It returns a -1
  1413.             (true) if a mouse is present.  It returns 0 if no mouse
  1414.             is present.  This function must be issued before the
  1415.             mouse can be used in both DOS and Windows.
  1416.  
  1417.               e.g.  mouseflag=mouseon
  1418.  
  1419.  
  1420.  
  1421.           MOUSEX
  1422.  
  1423.             This function returns the x position of the mouse in
  1424.             character units (1 through 80) for screen mode 0 and in
  1425.             pixel units (0 through top) in all other screen modes.
  1426.  
  1427.               e.g. x=mousex
  1428.  
  1429.  
  1430.  
  1431.           MOUSEY
  1432.  
  1433.             This function returns the y position of the mouse in
  1434.             character units (1 through 25) for screen mode 0 and in
  1435.             pixel units (0 through top) in all other screen modes..
  1436.  
  1437.               e.g.  y=mousey
  1438.  
  1439.  
  1440.  
  1441.           ON PAINT line number
  1442.  
  1443.             This statement defines a subroutine which handles screen
  1444.             updates.  This statement is ignored in DOS.  This
  1445.             statement is optional in Windows.  See the section on
  1446.             Windows and Graphics for more detail.
  1447.                                       21
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.           OPEN filename FOR mode [ACCESS access] AS # [LEN=reclen]
  1463.  
  1464.             This command prepares the file filename for access as
  1465.             number #.  The filename can be a file name with or
  1466.             without a pathname.  Modes supported are INPUT, OUTPUT,
  1467.             APPEND, BINARY, RANDOM.  INPUT, OUTPUT, APPEND are for
  1468.             sequential files.  RANDOM is for random-access files
  1469.             with fixed length records.  BINARY can be used to access
  1470.             any byte of any file.
  1471.  
  1472.             Access types supported are READ, WRITE, or READ WRITE.
  1473.             This argument is optional and is only valid for BINARY
  1474.             and RANDOM files.  READ WRITE is the default.  If you
  1475.             specify READ you will get an error if you try to access
  1476.             a file marked as read-only by DOS.
  1477.  
  1478.             LEN is used for random access files.  It is the record
  1479.             length.  This argument is optional.  128 is the default.
  1480.  
  1481.             e.g.  OPEN "TEST.DAT" FOR INPUT AS #1
  1482.  
  1483.             e.g.  OPEN "TEST.DAT" FOR RANDOM ACCESS READ AS #1
  1484.  
  1485.             e.g.  OPEN "TEST.DAT" FOR RANDOM ACCESS READ WRITE AS #1
  1486.  
  1487.             e.g.  OPEN "T.DAT" FOR RANDOM AS #1 LEN=128
  1488.  
  1489.  
  1490.  
  1491.           OPEN "COMn: speed,parity,data,stop" FOR RANDOM AS #n LEN=n
  1492.  
  1493.             This statement opens and initializes a communications
  1494.             port.  COM1 and COM2 are supported.  Supported speeds
  1495.             are 9600, 4800,2400,1200,and 300.  Parity may be either
  1496.             E,O,N, or M.  Data may be either 5,6,7, or 8.  Stop may
  1497.             be either 1, 1.5, or 2.  LEN is used to specify the size
  1498.             of the input buffer.  The default is 128 bytes.  For
  1499.             Windows programs a minimum of 2048 is suggested.
  1500.  
  1501.             Only PRINT # will output characters to an open
  1502.             communications port.  Only INPUT$ will receive
  1503.             characters from a port.
  1504.  
  1505.             Communications parameters may be omitted; however, their
  1506.             position must be marked by commas.  Default parameters
  1507.             are 300 baud, No parity, 8 data bits, and 1 stop bit.
  1508.  
  1509.               e.g. OPEN "COM1: 2400,E,7,1" for random as #1 len=2048
  1510.  
  1511.             See the section "Communications Programming" for more
  1512.             details.
  1513.                                       22
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.           OSTYPE
  1529.  
  1530.             This function returns a number indicating what operating
  1531.             system the program is running under.
  1532.  
  1533.                    1 - DOS
  1534.                    2 - Windows 3.x
  1535.                    3 - ?
  1536.  
  1537.  
  1538.  
  1539.           PAINT [STEP](x,y),[paint],[border]
  1540.  
  1541.             This statement fills a graphics area with the color
  1542.             selected.  (x,y) is the first point filled.  It will be
  1543.             filled with the color specified by the attribute
  1544.             'paint', if supplied.  If not supplied the foreground
  1545.             color is used.  Coloring in all directions continues
  1546.             until the 'border' color is encountered.  If border
  1547.             color is not supplied the paint color is used.
  1548.  
  1549.  
  1550.  
  1551.           PALETTE attribute,color
  1552.  
  1553.             This statement allows you to change the default graphic
  1554.             colors provided by BasicBasic.  The usage of the
  1555.             attribute and color arguments depends on the screen mode
  1556.             you are in.  You can always find out your current screen
  1557.             mode using the SYSTEM function.  For Windows programs
  1558.             see the section on WINDOWS AND GRAPHICS for additional
  1559.             information on the PALETTE statement.  Here are the
  1560.             definition of the arguments for various screen modes:
  1561.             screen color.
  1562.  
  1563.             MODE 8
  1564.  
  1565.               Attribute determines which one of the 16 color
  1566.               attributes you want to redefine.  It is the attribute
  1567.               you select with the COLOR statement.  In this mode you
  1568.               have 16 colors to choose from (0 to 15).  See the
  1569.               COLOR statement for a listing of the colors.
  1570.  
  1571.             MODE 9
  1572.  
  1573.               Attribute determines which one of the 16 color
  1574.               attributes you want to redefine.  In this mode you
  1575.               have 64 colors to choose from (0 to 63).
  1576.  
  1577.             MODE 12
  1578.  
  1579.                                       23
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.               In this mode attribute determines which one of the 16
  1592.               color attributes you want to redefine.  In this mode
  1593.               the color value reflects an exact RGB definition of
  1594.               the color you want.  If you use a variable for color
  1595.               it must be of type long integer.
  1596.  
  1597.                 color= 65536 * blue + 256 * green + red
  1598.  
  1599.               Where blue, green, red can be from 0 to 255.
  1600.  
  1601.  
  1602.  
  1603.           POINT (x,y)
  1604.  
  1605.             This function returns the color of the specified
  1606.             graphics pixel.
  1607.  
  1608.  
  1609.  
  1610.           POS(0)
  1611.  
  1612.             This function returns the current column position of the
  1613.             cursor(starting with 1).  In graphics mode 1000 this
  1614.             function returns the pixel column (starting with 0).
  1615.  
  1616.  
  1617.  
  1618.           POSITION x1,y2,xlen,ylen
  1619.  
  1620.             This statement sizes and positions a window.  x1,y1 are
  1621.             the upper left of the window.  This statement is ignored
  1622.             in DOS.
  1623.  
  1624.  
  1625.  
  1626.           PRESET [STEP](x,y),[color]
  1627.  
  1628.             This command sets one pixel on the screen to the
  1629.             specified color.  By using the STEP prefix you can
  1630.             specify that the x,y coordinates are relative to the
  1631.             current position.  If no color is supplied the pixel is
  1632.             set to the background color.
  1633.  
  1634.  
  1635.  
  1636.           PRINT expressionlist [,|;]
  1637.  
  1638.             Prints the items in expression list.  PRINT with no
  1639.             expression results in a blank line being printed.  If
  1640.             the expression is followed by a semi-colon (;) the next
  1641.             print starts immediately following this one.  If the
  1642.             expression ends in a comma (,) the next print starts at
  1643.             the next print position.  Print positions are at columns
  1644.             1, 15, 29, etc.
  1645.                                       24
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.           PRINT USING formatstring; expressionlist[,|;]
  1661.  
  1662.             The formatstring tells how to print the items in
  1663.             expressionlist.  Any text may be in formatstring.
  1664.             BasicBasic only recognizes three format characters.
  1665.             These are pound sign (#)  comma (,) and period (.).
  1666.             Each time a number character is found (#) one item from
  1667.             the expression list will be printed.
  1668.  
  1669.                e.g. PRINT USING "The answer is: ###,###.##";number
  1670.  
  1671.  
  1672.  
  1673.           PRINT #filenumber,expressonlist
  1674.  
  1675.             Prints to a file or communications port the items in
  1676.             expression list.
  1677.  
  1678.  
  1679.  
  1680.           PSET [STEP](x,y),[color]
  1681.  
  1682.             This command sets one pixel on the screen to the
  1683.             specified color.  By using the STEP prefix you can
  1684.             specify that the x,y coordinates are relative to the
  1685.             current position.  If no color is supplied the pixel is
  1686.             set to the foreground color.
  1687.  
  1688.  
  1689.  
  1690.           PUT (x,y),arrayname,action
  1691.  
  1692.             This statement places pixels stored in an array onto the
  1693.             screen.  (x,y) is the upper left position.  The x and y
  1694.             length placed on the screen depends on the GET statement
  1695.             which stored the data into the array.
  1696.  
  1697.             The action may be one of the following:
  1698.  
  1699.                   XOR  - Combines the pixels in the array and those
  1700.                          on the screen using the XOR operator.
  1701.                          This is the most common action used for
  1702.                          motion since this automatically restores
  1703.                          the background when done twice.  XOR is
  1704.                          the default.
  1705.  
  1706.                  PSET  - Transfers data erasing what is already on
  1707.                          the screen.
  1708.  
  1709.                PRESET  - Inverts data and transfers to screen
  1710.                          erasing what is already on the screen.
  1711.                                       25
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.                   AND  - Masks screen image with data in array.
  1725.  
  1726.                    OR  - Superimposes data on existing screen.
  1727.  
  1728.             For Windows use see the section WINDOWS AND GRAPHICS for
  1729.             more information.
  1730.  
  1731.  
  1732.           PUT #filenumber,recordnumber,stringexpression
  1733.           PUT #filenumber,recordnumber
  1734.  
  1735.             This statement is used to output data to a file opened
  1736.             in either BINARY or RANDOM mode.
  1737.  
  1738.             In BINARY mode the string expression will be written to
  1739.             the file at the byte location given by recordnumber.
  1740.             Recordnumber is the absolute byte number to be written,
  1741.             where the first byte of the file is 1.
  1742.  
  1743.               e.g. A$=SPACE$(20)
  1744.                    PUT #1,100,A$  (writes 20 bytes starting at 100)
  1745.  
  1746.  
  1747.             In RANDOM mode the data in the output buffer will be
  1748.             written to the record number indicated.
  1749.  
  1750.               e.g. PUT #1,1    (writes to record 1)
  1751.  
  1752.  
  1753.  
  1754.           RADIOON keycode
  1755.  
  1756.             This command 'checks' the indicated Radio button.  See
  1757.             the section "Programming Buttons" for more information.
  1758.  
  1759.  
  1760.  
  1761.           RADIOOFF keycode
  1762.  
  1763.             This command 'unchecks' the indicated Radio button.  See
  1764.             the section "Programming Buttons" for more information.
  1765.  
  1766.  
  1767.  
  1768.           RANDOMIZE
  1769.  
  1770.             This statement initializes the random number generator.
  1771.             If you use the RND function you probably want to preceed
  1772.             it's use with the RANDOMIZE statement.  Otherwise
  1773.             everytime your program runs you will get the same
  1774.             sequence of 'random' numbers.  This statement has no
  1775.             arguments.
  1776.  
  1777.                                       26
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.           READ variablelist
  1792.  
  1793.             Inputs a value from a DATA statement.
  1794.  
  1795.  
  1796.  
  1797.           REM
  1798.  
  1799.             Denotes a comment line and is ignored by the compiler.
  1800.  
  1801.  
  1802.  
  1803.           RESTORE label
  1804.  
  1805.             Sets position that next READ statement will input data
  1806.             from.
  1807.  
  1808.  
  1809.  
  1810.           RETURN
  1811.  
  1812.             Returns program execution to location immediately after
  1813.             last GOSUB.
  1814.  
  1815.  
  1816.  
  1817.           RIGHT$(stringexpression,n)
  1818.  
  1819.             This function returns a string of length n from the
  1820.             right part of stringexpression
  1821.  
  1822.  
  1823.  
  1824.           RMDIR stringexpression
  1825.  
  1826.             This command removes the directory given by
  1827.             stringexpression.
  1828.  
  1829.  
  1830.  
  1831.           RND
  1832.  
  1833.             This function returns one in a sequence of random
  1834.             numbers between 0 and 1.
  1835.  
  1836.  
  1837.           SCREEN mode[,palette]
  1838.  
  1839.             This statement selects the screen mode.  The actual
  1840.             screen mode available depends on your hardware.  The
  1841.             modes available in this version of BasicBasic are:
  1842.  
  1843.                                       27
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.              0 - Text Only.  This is the default.
  1856.  
  1857.              2 - 640-200 Graphics.  Black and white only.
  1858.                  80 x 25 text format. (CGA, EGA, VGA)
  1859.  
  1860.              8 - 640-200 Graphics.  16 colors and 16 attributes
  1861.                  80 x 25 text format (EGA,VGA)
  1862.  
  1863.              9 - 640-350 Graphics.  16 colors and 16 attributes
  1864.                  80 x 25 text format (EGA,VGA)
  1865.  
  1866.             12 - 640-480 Graphics.  256,000 colors and 16 attributes
  1867.                  80 x 30 text format (VGA)
  1868.  
  1869.             1000 - Special Window mode.  Supports whatever graphics
  1870.                    resolution Window supports.  Supports custom
  1871.                    fonts.  Issueing a SCREEN 1000 under DOS results
  1872.                    in selection of the highest available graphics
  1873.                    mode (2, 8, 9 or 12).
  1874.  
  1875.             The Palette argument is ignored under DOS. Under Windows
  1876.             it allows you to select the special BasicBasic palette
  1877.             if set to 16, or to select the 'system palette' if set
  1878.             to 0.  If the Palette argument is omitted then the
  1879.             default is 0, use the system palette.  See the section
  1880.             WINDOWS AND GRAPHICS for more detail.
  1881.  
  1882.             Here are examples of how the SCREEN command might be
  1883.             used under Windows.
  1884.  
  1885.                 SCREEN 8    -- system palette
  1886.                 SCREEN 8,0  -- system palette
  1887.                 SCREEN 8,16 -- special BasicBasic palette
  1888.  
  1889.             If you do not know the output capabilites of the machine
  1890.             your program is going to run on, use the SETERRLEVEL
  1891.             command to determine if a screen mode has been
  1892.             successful.  Here is an example:
  1893.  
  1894.                     SETERRLEVEL 5
  1895.                     ERR=0
  1896.                     SCREEN 12
  1897.                     IF ERR>0 THEN
  1898.                       ERR=0
  1899.                       SCREEN 9
  1900.                       IF ERR>0 THEN
  1901.                         ERR=0
  1902.                         SCREEN 8
  1903.                         IF ERR>0 THEN
  1904.                           PRINT "GRAPHICS NOT AVAILABLE."
  1905.                           STOP
  1906.                         END IF
  1907.                       END IF
  1908.                     END IF
  1909.                                       28
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.             The SCREEN command resets SCROLLAREA to entire screen.
  1923.  
  1924.  
  1925.  
  1926.  
  1927.           SCROLLAREA leftx,topy,rightx,bottomy
  1928.  
  1929.             This statement defines an area of the screen which is
  1930.             used for scrolling.  This allows you to create fixed
  1931.             text or buttons in one area of the screen while
  1932.             scrolling another area.  In screen modes less than 1000
  1933.             Leftx, topy, rightx, bottomy are in character units and
  1934.             are inclusive(starting with 1).  In screen mode 1000
  1935.             leftx, topy, rightx, bottomy are pixel units(starting
  1936.             with 0).
  1937.  
  1938.             Executing the CLS command will clear the entire screen,
  1939.             not just the scrollable area.  PRINT CHR$(12); will only
  1940.             clear the scrollable area.
  1941.  
  1942.  
  1943.  
  1944.           SETCOM comnum,"Speed,Parity,Databits,Stopbits,dtr,rts"
  1945.  
  1946.             This statement allows you to change communications
  1947.             parameters for an already opened communications port.
  1948.             Speed, Parity, Databits, and Stopbits are described in
  1949.             OPEN COM.  DTR may be either ON or OFF.  If ON then the
  1950.             output data terminal ready signal will be set high.  ON
  1951.             is the default.  RTS may be either 1 or 0.  If 1 then
  1952.             the output request to send is high.  1 is the default.
  1953.             Communications parameters not present will not be
  1954.             changed; however, a comma must mark their positions.
  1955.  
  1956.                e.g. SETCOM 1,",,7"
  1957.  
  1958.                      Sets number of data bits to 7.
  1959.  
  1960.                e.g. SETCOM 1,",,,,OFF"
  1961.  
  1962.                     Turns Data terminal read;y off.
  1963.  
  1964.             See the section "Communications Programming" for more
  1965.             information.
  1966.  
  1967.  
  1968.  
  1969.           SETERRLEVEL level
  1970.  
  1971.             This command defines what BasicBasic should do in case
  1972.             of runtime errors.  Level must be a number (not an
  1973.             expression or variable).  Level 7 causes execution to
  1974.             halted for all errors.  Level 5 causes execution to
  1975.                                       29
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.             continue for recoverable errors.  In the latter case the
  1988.             global variable ERR is set to the error number.  ERR may
  1989.             be reset with the statement:  ERR=0.  ERR will be reset
  1990.             each time an error occurs so the program must check ERR
  1991.             immediately after statements which may produce errors.
  1992.  
  1993.  
  1994.  
  1995.           SIN(x)
  1996.  
  1997.             This function returns the sine of an angle expressed in
  1998.             radians.
  1999.  
  2000.  
  2001.  
  2002.           SPACE$(N)
  2003.  
  2004.             Returns a string of n spaces.
  2005.  
  2006.  
  2007.  
  2008.           STOP
  2009.  
  2010.             Causes the program to cease execution.
  2011.  
  2012.  
  2013.  
  2014.           STR$(numericexpression)
  2015.  
  2016.            This function returns a string representation of the
  2017.            numbericexpression.
  2018.  
  2019.  
  2020.  
  2021.           STRING$(m,stringexpression)
  2022.  
  2023.             This function returns a string of length n.  This string
  2024.             is composed of the first character in stringexpression.
  2025.  
  2026.  
  2027.  
  2028.           SYSTEM (n)
  2029.  
  2030.             This function returns information on the screen
  2031.             depending on the value of n passed to it.  This
  2032.             information is of most use to Windows programs.
  2033.  
  2034.                 n       function returns
  2035.                ---    ----------------------------------
  2036.                 1     Maximum x allowed in a graphics program
  2037.                 2     Maximum y allowed in a graphics program
  2038.                 3     Actual maximum screen size x
  2039.                 4     Actual maximum screen size y
  2040.                 5     Maximum color attribute
  2041.                                       30
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.                 6     Maximum 'background color' in COLOR statement
  2054.                 7     Current screen mode
  2055.                 8     Window left position
  2056.                 9     Window top position
  2057.                 10    Window x size
  2058.                 11    Window y size
  2059.                 12    Returns 1 if window is Active Window, 0
  2060.                       otherwise.  See WINDOWS AND GRAPHICS for
  2061.                       more information on uses of this value.
  2062.  
  2063.  
  2064.  
  2065.           TAB(numericexpression)
  2066.  
  2067.             In PRINT or LPRINT statements positions output at column
  2068.             position given in numericexpression.
  2069.  
  2070.  
  2071.  
  2072.           TAN(x)
  2073.  
  2074.             This function returns the tangent of an angle expressed
  2075.             in radians.
  2076.  
  2077.  
  2078.  
  2079.           TIME$
  2080.  
  2081.             This function returns a string representation of the
  2082.             current system time.
  2083.  
  2084.  
  2085.  
  2086.           TIMER
  2087.  
  2088.             This function returns the number of seconds since
  2089.             midnight.
  2090.  
  2091.  
  2092.  
  2093.           UCASE$(stringexpression)
  2094.  
  2095.             This function converts all lower case characters in
  2096.             stringexpression to upper case and returns as new
  2097.             string.
  2098.  
  2099.  
  2100.  
  2101.           VAL(stringexpression)
  2102.  
  2103.             This function returns the numeric value of string
  2104.             stringexpression.
  2105.  
  2106.  
  2107.                                       31
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.           WRITE #filenumber,expression list
  2121.  
  2122.             Write is performs the same way as Print with these
  2123.             exceptions:  1) Commas are inserted between all items;
  2124.             2) Strings are bracketed by quotation marks.
  2125.  
  2126.             BasicBasic does not support using the Write statement to
  2127.             display on the screen.
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.                                       32
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.           GRAPHICS PROGRAMMING FOR BEGINNERS
  2186.           -------------------------------------------------------
  2187.           
  2188.           This section will show you the basics of graphics
  2189.           programming in BasicBasic.  The examples given will work
  2190.           equally well running under DOS or Windows.
  2191.  
  2192.           Now here is your first graphics program:
  2193.  
  2194.                   SCREEN 2
  2195.                   LINE (0,0)-(400,100)
  2196.                   INPUT Z
  2197.  
  2198.           This program draws one diagonal line on the screen.  The
  2199.           key to graphics programming is the SCREEN command.  You
  2200.           must issue a SCREEN command to tell BasicBasic that you
  2201.           are going to do graphics.  Screen 2 puts your screen into
  2202.           a graphics mode with 640 dots (pixels) across and 200 dots
  2203.           down.  Each dot is either white or black.  Most of our
  2204.           examples will use SCREEN 8, which has the same number of
  2205.           dots, but 16 colors.  If you are running on a CGA display,
  2206.           SCREEN 2 is the only graphics mode available, so you will
  2207.           have to adjust these examples.
  2208.  
  2209.           The second line in our example contains the LINE
  2210.           statement.  The LINE statement will do much more than make
  2211.           lines.  It will also create boxes and fill them with a
  2212.           color if you want.  Here is another program:
  2213.  
  2214.                   SCREEN 8
  2215.                   LINE (0,0)-(400,100),4,B
  2216.                   INPUT Z
  2217.  
  2218.           This program puts the hardware into a 16 color mode and
  2219.           then creates a box with red lines.  The 'B' at the end of
  2220.           the statement is what tells it to make a box.  Notice that
  2221.           the diagonal line is not drawn on the screen.  Instead the
  2222.           end points in the statement are used as the opposing
  2223.           corners of the box.  The 4 specifies the color red.  You
  2224.           could also do the following:
  2225.  
  2226.                   SCREEN 8
  2227.                   LINE (0,0)-(400,100),4,BF
  2228.                   INPUT Z
  2229.  
  2230.           This program has 'BF' instead of 'B' in the LINE
  2231.           statement.  The 'BF' says to draw a box and then fill it
  2232.           with the same color.
  2233.  
  2234.           Of course you can also use a variable in place of the
  2235.           numeric constants we have used so far:
  2236.  
  2237.                   SCREEN 8
  2238.                   FOR I=0 TO 15
  2239.                                       33
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.                     X=I*10
  2252.                     Y=I*5
  2253.                     MYCOLOR=I
  2254.                     LINE (X,Y)-(X+10,Y+10),MYCOLOR,B
  2255.                   NEXT I
  2256.                   INPUT Z
  2257.  
  2258.           This creates a series of boxes.
  2259.  
  2260.           If you are tired of sharp corners try this:
  2261.  
  2262.                   SCREEN 8
  2263.                   CIRCLE (100,100),50,4
  2264.                   INPUT Z
  2265.  
  2266.           As you might expect this draws a circle.  The center of
  2267.           the circle is at 100,100; it has a radius of 50 and is
  2268.           drawn in red(the 4).  The CIRCLE statement will do much
  2269.           more than draw circles; it will also draw arcs and pie
  2270.           sections.  Try this:
  2271.  
  2272.                   SCREEN 8
  2273.                   CIRCLE (100,100),50,4,0,3.1416/2
  2274.                   INPUT Z
  2275.  
  2276.           This draws a quarter circle (an arc) starting to the right
  2277.           and finishing up at the top.  To do this we are added 2
  2278.           more arguments to the CIRCLE statement; 0 and 3.1416/2.
  2279.           These are the start and end angles in radians of the arc.
  2280.           There are 2pi radians in a circle.  Don't remember this
  2281.           from high school?  Just remember that 0 is to the right;
  2282.           3.1416/2 is up, 3.1416 is left, and 4.7124 is down.
  2283.  
  2284.           Putting a minus sign before the start and end angles cause
  2285.           BasicBasic to draw a pie section.
  2286.  
  2287.                   SCREEN 8
  2288.                   CIRCLE (100,100),50,4,-.01,-2
  2289.                   INPUT Z
  2290.  
  2291.           This draws a pie section slightly greater than a quarter
  2292.           circle.  The CIRCLE statement does not have a fill option
  2293.           like the LINE statement.  If you want to fill your pie
  2294.           section with a color you should use the PAINT statement.
  2295.           This is a very versatile statement.  You use it like this:
  2296.  
  2297.                   SCREEN 8
  2298.                   CIRCLE (100,100),50,4,-.01,-2
  2299.                   PAINT (102,98),4,4
  2300.                   INPUT Z
  2301.  
  2302.           Now we have a red pie section.  Paint starts filling the
  2303.           screen with color starting with the center point given and
  2304.           proceeding to the border color.  Notice that we made our
  2305.                                       34
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.           center point different than 100,100 to make sure it was
  2318.           inside the pie section we previously drew with the CIRCLE
  2319.           command.  We could have a blue pie section with red border
  2320.           with the following:
  2321.  
  2322.                   SCREEN 8
  2323.                   CIRCLE (100,100),50,4,-.01,-2
  2324.                   PAINT (102,98),1,4
  2325.  
  2326.           We will mention one last statement in this introductory
  2327.           discussion.  This is the PSET statement.  It allows you
  2328.           set individula pixels on the screen.
  2329.  
  2330.                   SCREEN 8
  2331.                   FOR I=1 TO 100
  2332.                     MYCOLOR=INT(RND*16)
  2333.                     X=INT(RND*640)
  2334.                     Y=INT(RND*200)
  2335.                     PSET (X,Y),MYCOLOR
  2336.                   NEXT I
  2337.                   INPUT Z
  2338.  
  2339.           The preceeding program 'splatters' 100 randomly placed
  2340.           pixels on the screen.  They also have random color.
  2341.  
  2342.           We won't discuss them here but other statements useful in
  2343.           graphics programming are:
  2344.  
  2345.                   PRESET
  2346.                   GET
  2347.                   PUT
  2348.                   COLOR
  2349.                   PALETTE
  2350.  
  2351.           Refer to the graphics programming examples SAMPLEG1.BAS,
  2352.           SAMPLEG2.BAS, SAMPLEG3.BAS and SAMPLEG4.BAS for more ideas
  2353.           on graphics programming.
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.                                       35
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.           PROGRAMMING BUTTONS
  2385.           -------------------------------------------------------
  2386.           
  2387.           Buttons can be used in either DOS or Windows.  Buttons do
  2388.           not require the presence of a mouse.  Here is an example
  2389.           of a valid create button command:
  2390.  
  2391.               CBUTTON "EXIT",1068,0,"Push",0,1,1,8,1,7,4
  2392.  
  2393.           Here is a description of each parameter:
  2394.  
  2395.             EXIT - This is the name displayed in the button
  2396.  
  2397.             1068 - This is keycode for F10 (User can either
  2398.                    use mouse to push button or press F10.
  2399.  
  2400.             0    - Reserved
  2401.  
  2402.             Push - Type of button.  'Radio' is the other type.
  2403.  
  2404.             0    - Reserved
  2405.  
  2406.             1    - Left position
  2407.  
  2408.             1    - Y position
  2409.  
  2410.             8    - x size (in characters)
  2411.  
  2412.             1    - y size (in characters)
  2413.  
  2414.             7    - foreground color (In Windows only used for Radio
  2415.                    buttons).
  2416.  
  2417.             4    - background color (In Windows only used for Radio
  2418.                    buttons).
  2419.  
  2420.           In DOS a push button will have text centered and if the
  2421.           defined text size is at least 2 characters smaller than
  2422.           the button size a line will be drawn around the outside.
  2423.  
  2424.           In graphics modes button position and size is given in
  2425.           pixel units rather than character units.
  2426.  
  2427.           Remember that if a mouse is going to be used it MUST be
  2428.           turned on with the MOUSEON function before it can be used
  2429.           to press a button.
  2430.  
  2431.           Here is an example of a small program which uses buttons:
  2432.  
  2433.                 A=MOUSEON
  2434.                 IF A=-1 THEN
  2435.                   CBUTTON "EXIT",1068,0,"PUSH",0,70,1,8,1,0,0
  2436.                 ELSE
  2437.                                       36
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.                   CBUTTON "F10-Exit",1068,0,"PUSH",0,70,1,10,1,0,0
  2450.                 END IF
  2451.                 INPUT Z
  2452.                 a$=INKEY$
  2453.                 PRINT LEN(A$)
  2454.  
  2455.             This program displays different text in the button
  2456.             depending on whether a mouse is present or not.
  2457.             Assuming there is a mouse this program will end under
  2458.             the following conditions:
  2459.  
  2460.                - User presses EXIT button with mouse
  2461.                - User presses F10 on keyboard
  2462.                - User presses ENTER key on keyboard.
  2463.  
  2464.             In the first two cases the print will show a length of 2
  2465.             for the length of A$ since the button keycode will be
  2466.             returned on the next INKEY$ after the INPUT is
  2467.             terminated.
  2468.  
  2469.           Once you have created a button you are responsible for NOT
  2470.           writing anything to that area of the screen.  If you do
  2471.           the button will be erased.  If you are using buttons and
  2472.           scrolling text on the screen make sure you use the
  2473.           SCROLLAREA command to protect the button area of the
  2474.           screen.
  2475.  
  2476.           INVISIBLE buttons can be particularly useful.  An
  2477.           invisible button does not appear on the screen, but a
  2478.           button push inside it's defined area will return it's
  2479.           keycode just as if it were.  This allows you to create
  2480.           your own special color buttons or input areas.  For
  2481.           instance you could have a series of INPUT statements in a
  2482.           program and each could be defined as an invisible button.
  2483.           When the user clicked on that input area you would get a
  2484.           unique keycode which would direct your program to the
  2485.           section of code which handles that input.
  2486.  
  2487.           Since buttons end INPUT commands you can also use
  2488.           invisible buttons to define any keys you want to end INPUT
  2489.           commands (e.g. UP ARROW or DOWN ARROW).
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                                       37
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.           PROGRAMMING MENUS
  2517.           -------------------------------------------------------
  2518.           
  2519.           Menus are not supported in DOS.  Menu commands are ignored
  2520.           when running under DOS.
  2521.  
  2522.           Menus support in BasicBasic is much like button support.
  2523.           When the user selects a menu item a defined keycode is
  2524.           returned to the Basic program.  Menu keycodes are returned
  2525.           only using the INKEY$ function call.  However, if the user
  2526.           selects a menu item while the program is waiting for input
  2527.           in an INPUT command the input command will be terminated
  2528.           just as if the user had pressed Enter.  Then on the next
  2529.           INKEY$ call the keycode for the menu item will be
  2530.           returned.
  2531.  
  2532.           KEYCODES:  Just as in buttons keycodes can be regular or
  2533.           extend keys.  Extended keys are indicated by adding 1000
  2534.           to the regular keycode.  F10 would be 1068.  See the
  2535.           Appendix 'Keyboard codes' for a complete list.
  2536.  
  2537.           The mouse must be enable with the MOUSEON command before
  2538.           any menu items will be recognized.
  2539.  
  2540.           Here is an example of a simple Windows program which
  2541.           utilizes menus.
  2542.  
  2543.                 y=mouseon
  2544.                 mainmenu "Color","","","","",""
  2545.                 addsubmenu 1,"Black",1059
  2546.                 addsubmenu 1,"White",1061
  2547.                 backcolor=0
  2548.                 menuitemgray 1059
  2549.              50
  2550.                 cls
  2551.                 color 1,backcolor
  2552.                 locate 10,30
  2553.                 print "Sample text..";
  2554.              100
  2555.                 a$=inkey$
  2556.                 if a$="" then goto 100
  2557.                 if len(a$)=1 then goto 100
  2558.                 if right$(a$,1)=chr$(59)
  2559.                   menuitemon 1060
  2560.                   menuitemgray 1059
  2561.                   backcolor=7
  2562.                   goto 50
  2563.                 elseif right$(a$,1)=chr$(60)
  2564.                   menuitemon 1059
  2565.                   menuitemgray 1060
  2566.                   backcolor=0
  2567.                   goto 50
  2568.                 end if
  2569.                                       38
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.                 goto 100
  2582.  
  2583.           This program defines one menu and then adds two items to
  2584.           it.  These menu items allow the user to clear the screen
  2585.           to either black or white.  The program disables the menu
  2586.           item for whatever color the screen currently is.
  2587.  
  2588.           The menu could be define in the following way also.
  2589.  
  2590.                   mainmenu "&Color","","","","",""
  2591.                   addsubmenu 1,"&Black",1059
  2592.                   addsubmenu 1,"&White",1061
  2593.  
  2594.           The apersand (&) allows you to define which character in
  2595.           the menu will be underlined which allows the user to
  2596.           select this item by pressing the ALT key and this letter.
  2597.           This IS NOT the keycode which will be returned to your
  2598.           program.  This keycode will always be the one given as the
  2599.           last parameter of the addsubmenu command.
  2600.  
  2601.           We could also define the menu like this:
  2602.  
  2603.                   mainmenu "&Color","","","","",""
  2604.                   addsubmenu 1,"&Black",1059
  2605.                   addsubmenu 1,"",0
  2606.                   addsubmenu 1,"&White",1061
  2607.  
  2608.           The 3rd line (addsubmenu 1,"",0) creates a line seperator
  2609.           in the menu bar.  It can not be selected by the user.
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.                                       39
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.           COMMUNICATIONS PROGRAMMING
  2649.           -------------------------------------------------------
  2650.           
  2651.           Here is a brief example of using a communications port.
  2652.  
  2653.             rem
  2654.             rem open communications port
  2655.             rem
  2656.             OPEN "COM1: 2400,N,8" FOR RANDOM AS #1 LEN=2048
  2657.  
  2658.           100
  2659.  
  2660.             rem
  2661.             rem get input from communications port
  2662.             rem
  2663.             t = LOC(1)
  2664.             IF t > 0 THEN
  2665.               a$=input$(t,1)
  2666.               if len(a$)>0 then
  2667.                 rem come here to display received characters
  2668.                 PRINT a$;
  2669.  
  2670.               ELSE
  2671.                 rem come here if some kind of comm error that kept
  2672.                 rem us from getting the waiting character.
  2673.  
  2674.               end if
  2675.  
  2676.             END IF
  2677.  
  2678.             rem
  2679.             rem get input from keyboard
  2680.             rem
  2681.  
  2682.             b$ = INKEY$
  2683.  
  2684.             IF b$ <> "" THEN
  2685.  
  2686.                 PRINT #1, b$;
  2687.  
  2688.             END IF
  2689.  
  2690.             GOTO 100
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.                                       40
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.           WINDOWS AND GRAPHICS
  2716.           -------------------------------------------------------
  2717.  
  2718.           In general programming graphics under Windows is the same
  2719.           as programming graphics under DOS.  However, because
  2720.           Windows mediates hardware access among different programs
  2721.           there are a few differences.
  2722.  
  2723.           COLORS
  2724.  
  2725.           Under DOS or Windows, BasicBasic provides a palette of 16
  2726.           colors.  Under DOS this palette is the hardware palette
  2727.           and you have full control to change them (depending on
  2728.           mode using either the COLOR or PALETTE statements).  Under
  2729.           Windows the palette is a 'logical' palette and only
  2730.           Windows controls where in the physical palette the logical
  2731.           palette entries are placed.  In addition, if you are
  2732.           running under standard VGA or less, Windows will not let
  2733.           you change the colors in the palette.  You are restricted
  2734.           to the 16 colors Windows defines.
  2735.  
  2736.           BasicBasic defaults to using the system palette.  This is
  2737.           a palette of 16 colors which Windows never changes.  This
  2738.           also means that your program cannot change them with the
  2739.           PALETTE or COLOR(in mode 8) commands.  If you want to
  2740.           change the standard colors you will have to use a
  2741.           'logical' palette.  In BasicBasic you do this using the
  2742.           SCREEN command.
  2743.  
  2744.           Using a logical palette has benefits and drawbacks.  As
  2745.           mentioned you can change the colors display.  This may be
  2746.           of use in animation.  However, there are serious
  2747.           drawbacks.  The PUT with any option except PSET will not
  2748.           work correctly.  This is explained below.  Also, when your
  2749.           program is not the 'active' window, Windows may remove
  2750.           your colors from the hardware palette resulting in some
  2751.           strange looking displays.  In addition, if this happens,
  2752.           the PAINT command may have completely unforseen
  2753.           consequences.  You can use the SYSTEM function to
  2754.           determine if your program is the active program.  When
  2755.           your program is active your colors will all be available
  2756.           for your use.
  2757.  
  2758.           Logical palettes do not support using the PUT graphics
  2759.           statement with the XOR, OR, or AND options.  If you use
  2760.           XOR the colors will not be as expected (though, as usual
  2761.           if you do 2 PUT statements with XOR the background will be
  2762.           restored).  The reason for this is that Windows may 'map'
  2763.           the logical palette entries to the physical palette anyway
  2764.           it likes.  If you must use XOR, use the default BasicBasic
  2765.           palette which is the system palette.
  2766.  
  2767.                                       41
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.           SCREEN MODES
  2781.  
  2782.           Under Windows you have access to the same screen modes as
  2783.           under DOS.  The COLOR and PALETTE statements work the same
  2784.           under DOS as under Windows.  In addition under Windows you
  2785.           have access to an additional screen mode: mode 1000.  In
  2786.           mode 1000 you are able to create new fonts.  Mode 1000
  2787.           gives you the highest possible graphics resolution.  Also
  2788.           the COLOR command is somewhat more flexible than under DOS
  2789.           screen modes.  The LOCATE and SCROLLAREA statements and
  2790.           functions POS, CSRLIN work differently in this mode.
  2791.  
  2792.  
  2793.           NAKED WINDOWS
  2794.  
  2795.           When running under Windows you do not have exclusive
  2796.           access to the screen.  At any time your window may be
  2797.           hidden by another window appearing on the screen.  At some
  2798.           future time the operator may make your window reappear
  2799.           with the click of the mouse button.  When your window has
  2800.           been hidden and is then called to the front, Windows DOES
  2801.           NOT handle putting the contents of the window back in!
  2802.           All windows privides is the outline of the window.  This
  2803.           'naked' window must be filled in by either BasicBasic or
  2804.           your program.
  2805.  
  2806.           By default BasicBasic handles all window 'repainting'.
  2807.           BasicBasic remembers everything that your program sends to
  2808.           the screen and when necessary repaints the window with
  2809.           this information.  In text mode (screen mode 0) a small
  2810.           buffer remembers each character on the screen.  In
  2811.           graphics mode BasicBasic maintains a larger buffer
  2812.           containing a duplicate of each pixel on the screen.  This
  2813.           buffer can take up quite a bit of space.(On a 640 x 200 16
  2814.           color display this requires 128,000 bytes).  Ordinarily
  2815.           you don't need to worry about this.  If your program isn't
  2816.           going to be in memory very long, or has a small window,
  2817.           who cares?
  2818.  
  2819.           If you are short of memory or have a very large window
  2820.           which is going to stay around all day you may not like
  2821.           this arrangement.  In this case you should use the ON
  2822.           PAINT statement.  This statement tells BasicBasic to NOT
  2823.           keep a copy of the display; that you are going to handle
  2824.           repainting when necessary.  Here is an example:
  2825.  
  2826.                  ON PAINT GOSUB 1000
  2827.                  SCREEN 8
  2828.                  sc=8
  2829.                  gosub drawmyscreen
  2830.           50
  2831.                  if inkey$="" then goto 50
  2832.                  STOP
  2833.                                       42
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.           1000
  2847.                  gosub drawmyscreen
  2848.                  RETURN
  2849.  
  2850.           drawmyscreen:
  2851.                  is sc=0 then return
  2852.                  locate 1,1
  2853.                  print "Now is the time to draw circles..."
  2854.                  circle (50,50),25,4
  2855.                  circle (75,75),50,1
  2856.                  circle (400,50,40,2
  2857.                  circle (500,100,75,3
  2858.                  return
  2859.  
  2860.           Here are some rules to remember about using the ON PAINT
  2861.           statement:
  2862.  
  2863.             - Use it before your SCREEN statement.  BasicBasic
  2864.               creates the screen duplicate during the SCREEN
  2865.               statement. It will, if necessary, erase it during the
  2866.               ON PAINT statement, but why go to the bother.
  2867.  
  2868.             - NEVER use any input commands, file commands, com
  2869.               commands, etc in you ON PAINT handler.
  2870.  
  2871.             - Don't change variables in your ON PAINT handler that
  2872.               are used elsewhere in your program.  Remember that
  2873.               Windows ALWAYS calls your ON PAINT handler at the
  2874.               WORST POSSIBLE TIME!
  2875.  
  2876.             - It is wise not to use the INPUT command in a program
  2877.               that has it's own ON PAINT handler.  BasicBasic will
  2878.               not rewrite what has been input so far.
  2879.  
  2880.             - Your ON PAINT handler may be called IMMEDIATELY after
  2881.               you issue the ON PAINT command.  Make sure you are
  2882.               ready.  Note the line IF SC=0 THEN RETURN in our
  2883.               example.  Try running this program without this line.
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.                                       43
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.           WINDOWS AND FONTS
  2914.           -------------------------------------------------------
  2915.  
  2916.           To create fonts in Windows you must have selected Screen
  2917.           mode 1000.  In this mode some statements and commands work
  2918.           differently.  LOCATE x,y now position by dot position,
  2919.           rather than character position.  POS and CSRLIN return the
  2920.           corresponding pixel position rather than character
  2921.           position.
  2922.  
  2923.           You may create up to 10 fonts, number 1 through 10.  Font
  2924.           number 0 is reserved for BasicBasic's default font.  You
  2925.           create a font using the CREATEFONT command.  Once you have
  2926.           created a font you must select it with the SELECTFONT
  2927.           command.  You may get information on the currently
  2928.           selected font using the FONT and FONT$ functions.
  2929.  
  2930.           The CREATEFONT statement has a lot of arguments.  However,
  2931.           it is not as complex to use as it looks.  Usually you are
  2932.           only interested in specifying one or two things about the
  2933.           font; such as height.  In this case you can set all other
  2934.           arguments to 0.  Below is a complete description of the
  2935.           CREATEFONT command.
  2936.  
  2937.           CREATEFONT
  2938.           p1,p2,p3,p4,p5,p6,p7,p8.p9.p10,p11.p12,p13,p14,p15$
  2939.  
  2940.             p1 = Font number to be created.
  2941.                  A number from 1 to 10.
  2942.             p2 = Font height (in pixels).
  2943.                  Desired height of characters.  This specifies the
  2944.                  line spacing.
  2945.             p3 = Font width
  2946.                  Desired width of characters.  Usually set to 0
  2947.             p4 = escapement
  2948.                  Which way the text goes.
  2949.                  0 - right
  2950.                  900 - up
  2951.                  1800 - right to left
  2952.                  2700 - down
  2953.             p5 = orientation
  2954.                  0 = Normal
  2955.                  900 = tipped 90 degrees to the left
  2956.                  1800 = upside down
  2957.                  2700 = tipped 90 degrees to the right
  2958.             p6 = weight
  2959.                    0 = don't care
  2960.                  100 = thin
  2961.                  200 = extralight
  2962.                  300 = light
  2963.                  400 = normal
  2964.                  500 = medium
  2965.                                       44
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.                  600 = semibold
  2978.                  700 = boldface
  2979.                  800 = extra bold
  2980.                  900 = heavy
  2981.             p7 = italic
  2982.                  When nonzero this specifies italics
  2983.             p8 = underline
  2984.                  When nonzero this specifies underlining
  2985.             p9 = strikeout
  2986.             p10 = character set
  2987.                   0 = ANSI character set
  2988.                   1 = SYMBOL character set
  2989.                   2 = Japanese Kanji
  2990.                   3 = OEM character set
  2991.           ->          Most Windows fonts are OEM fonts (e.g. script)
  2992.             p11 = output precision
  2993.                   Specifies how Windows should attempt to match
  2994.                   desired font sizes and characters with actual
  2995.                   fonts.  Not currently defined.  Make 0
  2996.             p12 = clip precision
  2997.                   Not currently defined.  Make 0.
  2998.             p13 = quality
  2999.                   Instruction to Windows on how to match fonts.
  3000.                   0 - Default Quality.  Don't make bigger that
  3001.                       desired.
  3002.                   1 - Draft Quality.
  3003.                   2 - Proof Quality.  This is the best quality,
  3004.                       but size may be smaller than desired.
  3005.             p14 = pitch and family
  3006.                   The two low order bits specify the pitch of the
  3007.                   font.
  3008.                     0 = Default
  3009.                     1 = Fixed pitch
  3010.                     2 = Variable
  3011.                   The four high order bits specify the font family.
  3012.                     0 = don't care
  3013.                     &H10 = Roman
  3014.                     &H20 = Swiss
  3015.                     &H30 = Modern
  3016.                     &H40 = Script
  3017.                     &H50 = Decorative
  3018.             p15$ = "face name"
  3019.                   This is the name of the typeface.  You do not need
  3020.                   to specify this.  If you do it takes priority over
  3021.                   any other options you specify (such as height).
  3022.                   Examples of face names are COURIER, TMS RMN, etc.
  3023.  
  3024.           Here is an example of a CREATEFONT command which creates a
  3025.           font 60 pixels high.  All other parameters are left at
  3026.           default.
  3027.  
  3028.  
  3029.  
  3030.  
  3031.                                       45
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.               CREATEFONT 1,60,0,0,0,0,0,0,0,0,0,0,0,0,""
  3044.  
  3045.           To print with this font you would first have to select it.
  3046.  
  3047.               SELECTFONT 1
  3048.  
  3049.  
  3050.           When you create a font Windows tries to match the
  3051.           characteristics you specify in the CREATEFONT command.  It
  3052.           may not be able to in all cases.  Perhaps you specify an
  3053.           incompatible height and width.  In these cases Windows
  3054.           gets as close as it can.  If some parameter is important
  3055.           to your application you should check to make sure the font
  3056.           you created meets your requirements.  Using the FONT
  3057.           function you can examine the selected font.
  3058.  
  3059.           FONT(n)
  3060.  
  3061.               n    returns
  3062.              ---   ----------------------------------------------
  3063.               1    character height
  3064.               2    Ascent
  3065.               3    Descent
  3066.               4    Internal Leading
  3067.               5    Extern Leading
  3068.               6    Average Character Width
  3069.               7    Maximum Character Width
  3070.               8    Weight
  3071.               9    Italic
  3072.               10   Underline
  3073.               11   Strikeout
  3074.               12   First character
  3075.               13   Last character
  3076.               14   Default character
  3077.               15   Break character
  3078.               16   Pitch and Family
  3079.               17   Character set
  3080.               18   Overhang
  3081.               19   Digitized Aspect x
  3082.               20   Digitized Aspect y
  3083.  
  3084.           There is another function which will return the face name.
  3085.  
  3086.           FONT$(n)
  3087.  
  3088.               n    returns
  3089.              ---   ----------------------------------------
  3090.               1    face name
  3091.  
  3092.  
  3093.  
  3094.           If you need additional information on fonts (or Windows
  3095.           programming in general), a useful reference is 'Windows
  3096.           API Bible' by James L. Conger.
  3097.                                       46
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                                       47
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.           CHAINING AND COMMON
  3178.           -------------------------------------------------------
  3179.  
  3180.           Here are examples of two programs, CHAIN1 and CHAIN2,
  3181.           which pass variables back and forth in common.
  3182.  
  3183.  
  3184.               CHAIN1
  3185.  
  3186.                   common a,b,c,d$(),c()
  3187.                   if a=0 then
  3188.                     cls
  3189.                     a=1
  3190.                     dim d$(10)
  3191.                     dim c(20)
  3192.                     d$(5)="This is d$(5)"
  3193.                   end if
  3194.                   print "press any key to go to chain 2"
  3195.                 100
  3196.                   a$=inkey$
  3197.                   if a$="" then goto 100
  3198.                   chain "chain2.exe"
  3199.  
  3200.  
  3201.               CHAIN2
  3202.  
  3203.                   common a,b,c,d$(),c()
  3204.                   b=b+1
  3205.                   print "this is chain 2"
  3206.                   print "b=";b;
  3207.                   print d$(5)
  3208.                   input z
  3209.                   chain "chain1.exe"
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.                                       48
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.           
  3242.           DEFAULT WINDOWS FONT
  3243.           -------------------------------------------------------
  3244.  
  3245.           The following discussion is current for Windows Version
  3246.           3.1.  The concepts discussed are applicable for Version
  3247.           3.0, however, font file names are different for that
  3248.           version.  This section is only relevant when running in
  3249.           screen MODE 0 (the default).
  3250.  
  3251.           BasicBasic selects the OEM Fixed font closest in size to
  3252.           the system font size used in menus, buttons, etc.  If you
  3253.           desire a different font size when running a BasicBasic
  3254.           program you can select from available fonts in the System
  3255.           Menu.  You may also mark a given font size to be the new
  3256.           default for that program.
  3257.  
  3258.           Depending on how you configured your system there may be
  3259.           only one OEM font installed.  Windows 3.1 comes with an
  3260.           assortment of OEM fonts.  The file DOSAPP.FON contains the
  3261.           fonts used by Windows to run DOS in a window and are good
  3262.           for use with BasicBasic.  If this file is not in you
  3263.           windows system directory (e.g. WINDOWS\SYSTEM) then your
  3264.           can copy it from your distributions disks and then use the
  3265.           Control Panel Fonts accessory to install them (These fonts
  3266.           have the name 'MS-DOS CP 437').
  3267.  
  3268.           IMPORTANT INFORMATION FOR 386 ENHANCED MODE:  If you use
  3269.           the MS-DOS prompt in 386 Enhanced mode you will need to
  3270.           make a change in your SYSTEM.INI file to use multiple size
  3271.           fonts in BasicBasic.  As mentioned previously Windows does
  3272.           not normally permanently install the fonts from
  3273.           DOSAPP.FON.  As was indicated you can do this from the
  3274.           Control Panel Fonts accessory.  HOWEVER, you will find
  3275.           that each time you EXIT the MS-DOS prompt these fonts will
  3276.           be REMOVED from the system.  This is because Windows does
  3277.           not expect these fonts to be present and there is a
  3278.           control line in SYSTEM.INI which explicitly tells it to
  3279.           load and unload them when running the MS-DOS prompt.  Once
  3280.           you have installed these fonts you can keep Windows from
  3281.           un-installing them by removing the following line from the
  3282.           [386Enh] section of SYSTEM.INI:
  3283.  
  3284.                    WOAFONT=DOSAPP.FON
  3285.  
  3286.  
  3287.           FONTS AND BUTTONS: This discussion applies only to buttons
  3288.           which are defined by the user to be one line high.  If you
  3289.           select a font smaller than the system font for use in a
  3290.           BasicBasic program the text in any buttons you have would
  3291.           be too crowded in the button space available.   BasicBasic
  3292.           corrects this problem in one of two ways.  1) If you
  3293.           system font is only slightly larger than the font selected
  3294.           in BasicBasic then any text in the buttons will be made
  3295.                                       49
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.           all upper case so no 'descenders' will be outside the
  3308.           button area.  2) If the system font is quite a bit larger
  3309.           than the selected font then BasicBasic will not use the
  3310.           standard Windows button design.  Instead it will draw a
  3311.           'simplified' button which can hold the small text of the
  3312.           font.
  3313.           
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.                                       50
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.           ERROR MESSAGES
  3375.           -------------------------------------------------------
  3376.  
  3377.           Compile errors will give a description of the problem and
  3378.           display the line where the error occurred.
  3379.  
  3380.           Runtime errors are divided into two classes.  Fatal errors
  3381.           always cause execution of the program to cease.
  3382.           Recoverable errors cause program execution to cease if
  3383.           SETERRLEVEL is 7, overwise execution continues and the
  3384.           error number is placed in the system variable ERR.
  3385.           SETERRLEVEL 7 is the default.
  3386.  
  3387.           When runtime errors are displayed they are accompanied by
  3388.           a runtime address.  The compiler will optionally output a
  3389.           list of runtime addresses for each statement.  These
  3390.           addresses will be contained in a file with the same name
  3391.           as the source file and an extension of .TMP.  In Windows
  3392.           you select debug output by selecting the Debug Output box.
  3393.           In the DOS version of the compiler you select debug output
  3394.           by putting a /D in the command line (e.g. BB MYPROG /D).
  3395.  
  3396.           Fatal Errors:
  3397.  
  3398.                error number              description
  3399.                ------------              -----------
  3400.  
  3401.                   236         Out of memory
  3402.                   503         READ is attempting to read wrong kind
  3403.                               of data.
  3404.                   501
  3405.                   ...
  3406.                   522         Internal runtime errors.
  3407.                   523         Wrong number of array elements or
  3408.                               array not dimensioned.
  3409.                   524         Out of free space.
  3410.                   525         Out of string space.
  3411.  
  3412.           Recoverable Errors:
  3413.  
  3414.                   1000        Error attempting to open file
  3415.                   1001        Attempt to read past end of file
  3416.                   1002        File not open
  3417.                   1003        File read error (probably hardware)
  3418.                   1004        ASC function on empty string
  3419.                   1005        Divide by zero
  3420.                   1006        Out of data during READ
  3421.                   1007        File already open
  3422.                   1008        No available file control block
  3423.                   1009        Error attempting to open file
  3424.                   1010        File mode error on read
  3425.                   1011        File mode error on write
  3426.                   1012        Bad file number
  3427.                                       51
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.                   1013        Path not found
  3440.                   1014        RMDIR error
  3441.                   1015        MKDIR error
  3442.                   1016        KILL error
  3443.                   1017        FILE BUFFER ERROR
  3444.                   1018        INVALID FIELD DATA
  3445.                   1019        FIELD OVERFLOW
  3446.                   1020        FILE ERROR
  3447.                   1021        COMMUNICATIONS OPEN ERROR
  3448.                   1022        CREATE BUTTON ERROR
  3449.                   1023        BAD SCREEN MODE IN SCREEN COMMAND
  3450.                   1025        GRAPHICS GET ARRAY ERROR
  3451.                   1026        GRAPHICS PUT ARRAY ERROR
  3452.                   1027        CREATE FONT ERROR
  3453.                   1028        NOT IN CORRECT SCREEN MODE
  3454.                   1029        INVALID COLOR/COLOR ATTRIBUTE
  3455.                   1030        ILLEGAL FONT NUMBER
  3456.                   1031        FONT NOT DEFINE
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.                                       52
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.  
  3506.           KEYBOARD CODES
  3507.           -------------------------------------------------------
  3508.  
  3509.           The following table shows the key codes returned by the
  3510.           INKEY$ function.  These key codes are returned as 1 byte.
  3511.  
  3512.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  3513.                  KEY CODE        KEY CODE        KEY CODE
  3514.             ESC    27                       BKSP    8
  3515.             1      49        !     33       TAB     9
  3516.             2      50        @     64       ENTER   13
  3517.             3      51        #     35       SPACE   32
  3518.             4      52        $     36
  3519.             5      53        %     37
  3520.             6      54        ^     94
  3521.             7      55        &     38
  3522.             8      56        *     42
  3523.             9      57        (     40
  3524.             0      48        )     41
  3525.             -      45        _     95
  3526.             =      61        +     43
  3527.  
  3528.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  3529.                  KEY CODE        KEY CODE        KEY CODE
  3530.              A     65        a     97
  3531.              B     66        b     98
  3532.              C     67        c     99
  3533.              D     68        d     100
  3534.              E     69        e     101
  3535.              F     70        f     102
  3536.              G     71        g     103
  3537.              H     72        h     104
  3538.              I     73        i     105
  3539.              J     74        j     106
  3540.              K     75        k     107
  3541.              L     76        l     108
  3542.              M     77        m     109
  3543.              N     78        n     110
  3544.              O     79        o     111
  3545.              P     80        p     112
  3546.              Q     81        q     113
  3547.              R     82        r     114
  3548.              S     83        s     115
  3549.              T     84        t     116
  3550.              U     85        u     117
  3551.              V     86        v     118
  3552.              W     87        w     119
  3553.              X     88        x     120
  3554.              Y     89       y      121
  3555.              Z     90       z      122
  3556.  
  3557.  
  3558.  
  3559.                                       53
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.           The following table shows the extended key codes returned
  3572.           by the INKEY$ function.  These key codes are returned as 2
  3573.           characters.  In this case the first character will be 0.
  3574.           
  3575.                     KEY   DECIMAL
  3576.                           KEY CODE
  3577.                     ----  ------
  3578.                      F1    0 59
  3579.                      F2    0 60
  3580.                      F3    0 61
  3581.                      F4    0 62
  3582.                      F5    0 63
  3583.                      F6    0 64
  3584.                      F7    0 65
  3585.                      F8    0 66
  3586.                      F9    0 67
  3587.                      F10   0 68
  3588.  
  3589.                      CTRL-F1   0   94
  3590.                      CTRL-F2   0   95
  3591.                      CTRL-F3   0   96
  3592.                      CTRL-F4   0   97
  3593.                      CTRL-F5   0   98
  3594.                      CTRL-F6   0   99
  3595.                      CTRL-F7   0  100
  3596.                      CTRL-F8   0  101
  3597.                      CTRL-F9   0  102
  3598.                      CTRL-F10  0  103
  3599.                      SHIFT-F1  0   84
  3600.                      SHIFT-F2  0   85
  3601.                      SHIFT-F3  0   86
  3602.                      SHIFT-F4  0   87
  3603.                      SHIFT-F5  0   88
  3604.                      SHIFT-F6  0   89
  3605.                      SHIFT-F7  0   90
  3606.                      SHIFT-F8  0   91
  3607.                      SHIFT-F9  0   92
  3608.                      SHIFT-F10  0  93
  3609.                      HOME       0  71
  3610.                      UP ARROW   0  72
  3611.                      PGUP       0  73
  3612.                      LEFT ARROW 0  75
  3613.                      RIGHT ARR  0  77
  3614.                      END        0  79
  3615.                      DOWN ARROW 0  80
  3616.                      PGDN       0  81
  3617.                      INS        0  82
  3618.                      DEL        0  83
  3619.                      CTRL-HOME  0  119
  3620.                      CTRL-PGUP  0  132
  3621.                      CTRL-LEFT  0  115
  3622.                      CTRL-RIGHT 0  116
  3623.                      CTRL-END   0  117
  3624.                      CTRL-PGDN  0  118
  3625.                                       54
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.           Windows is a registered trademark of Microsoft
  3640.           Corporation.
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.                                       55
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.