home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / compiler / asic / asic.doc next >
Text File  |  1994-03-01  |  312KB  |  9,638 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.        +--------------------------------------------------------------------+
  7.        |                                                                    |
  8.        |                            A S I C (tm) 4.00                       |
  9.        |                           "Its Almost Basic"                       |
  10.        |                                                                    |
  11.        |                                                                    |
  12.        |                                                                    |
  13.        |                             Copyright 1993                         |
  14.        |                                   by                               |
  15.        |                             80/20 Software                         |
  16.        |                                                                    |
  17.        |                          All Rights Reserved                       |
  18.        +--------------------------------------------------------------------+
  19.        |  ASIC 4.00 is provided as shareware.  Under the shareware          |
  20.        |  concept,  you can test a program before you buy it. If you find   |
  21.        |  it suitable for your needs and make use of this program, you are  |
  22.        |  expected to send a $20 registration fee.                          |
  23.        |                                                                    |
  24.        |  Feel free to distribute this software to others.  However, you    |
  25.        |  may not charge for the distribution of this software to others    |
  26.        |  nor may you alter the software or this documentation.             |
  27.        |                                                                    |
  28.        |  Registered users of any version of ASIC will receive a diskette   |
  29.        |  containing the current version of ASIC, plus may purchase future  |
  30.        |  updates at half of the normal registration price.  A printed      |
  31.        |  manual is available to registered users for an additional $10.00. |
  32.        |                                                                    |
  33.        |  For further ordering information, please see the file ORDER.FRM,  |
  34.        |  included with ASIC.                                               |
  35.        +--------------------------------------------------------------------+
  36.        |                                                                    |
  37.        |     Please send registration fees and suggestions to:              |
  38.        |                                                                    |
  39.        |                             80/20 Software                         |
  40.        |                             P.O. Box 2952                          |
  41.        |                             Raleigh, NC  27602-2952                |
  42.        |                                                                    |
  43.        |                                                                    |
  44.        |     Please mention the version of ASIC in any correspondence       |
  45.        |                       (This is ASIC Version 4.00)                  |
  46.        +--------------------------------------------------------------------+
  47.        |    You can also send questions/comments on GEnie and Compuserve    |
  48.        |     via EMAIL:                                                     |
  49.        |                                                                    |
  50.        |                     Compuserve      73065,1302                     |
  51.        |                     GEnie           D.VISTI                        |
  52.        |                                                                    |
  53.        +--------------------------------------------------------------------+
  54.        |                                                                    |
  55.        |  DISCLAIMER:  This software is provided "as is" without warranty   |
  56.        |  of any kind, either expressed or implied.                         |
  57.        |                                                                    |
  58.        |  Your registration fee entitles you to use this software on a      |
  59.        |  single computer.  Site licenses are available, write for details. |
  60.        |                                                                    |
  61.        |  ASIC is a trademark of 80/20 Software                             |
  62.        +--------------------------------------------------------------------+
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                                         A S I C
  69.                                    Table of Contents
  70.  
  71.          Chapter Title
  72.  
  73.             1.   Getting Started                         Page 5
  74.                       Introduction                       Page 5
  75.                       Installation                       Page 6
  76.             2.   Tutorial                                Page 7
  77.             3.   Integrated Editor/Compiler Environment  Page 13
  78.                       Introduction                       Page 13
  79.                       ASIC Screen Contents               Page 13
  80.                       Menu Bar Processing                Page 13
  81.                       Mouse Usage                        Page 14
  82.                       Getting Help                       Page 15
  83.                            Menu Help                     Page 15
  84.                            Keyword Help                  Page 15
  85.                       File Menu                          Page 16
  86.                            Open                          Page 16
  87.                            DOS Shell                     Page 16
  88.                            Save                          Page 16
  89.                            Save As                       Page 16
  90.                            Exit                          Page 16
  91.                       Edit Menu                          Page 17
  92.                            Begin Block                   Page 17
  93.                            End Block                     Page 17
  94.                            Search                        Page 17
  95.                            Replace                       Page 17
  96.                            Delete Block                  Page 17
  97.                            Move Block                    Page 18
  98.                            Copy Block                    Page 18
  99.                            Search Again                  Page 18
  100.                       Compile Menu                       Page 18
  101.                            Compile Program               Page 18
  102.                            Full Program Listing          Page 19
  103.                            Printer Output                Page 19
  104.                            Symbol Table                  Page 19
  105.                            Extended Math                 Page 19
  106.                            Decimal Math                  Page 20
  107.                            Debugging Code                Page 20
  108.                            View Compile Errors           Page 20
  109.                            Write Options To Disk         Page 21
  110.                       Advanced Options Sub-Menu          Page 21
  111.                            COM Output File               Page 21
  112.                            EXE Output File               Page 21
  113.                            OBJ Output File               Page 22
  114.                            Stack Size                    Page 22
  115.                            Object Names                  Page 23
  116.                            Library Names                 Page 23
  117.                            LINK.EXE Path                 Page 23
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.                                        Page - 1
  126.  
  127.  
  128.  
  129.  
  130.                              Table of Contents (Continued)
  131.  
  132.          Chapter Title
  133.  
  134.             3.   Integrated Editor/Compiler Environment (Continued)
  135.  
  136.                       Run Menu                           Page 24
  137.                            Run Your Program              Page 24
  138.                            Breakpoint Toggle             Page 24
  139.                            Trace                         Page 24
  140.                            Modify Variable               Page 25
  141.                            Watch Variable                Page 25
  142.                            Unwatch Variable              Page 25
  143.                            Abort Execution               Page 25
  144.                            Clear All Break/Watch         Page 25
  145.                            Program Arguments             Page 26
  146.                            Swap To User Screen           Page 26
  147.                       Status Line                        Page 26
  148.                       Edit Window                        Page 28
  149.                       Keyboard Usage                     Page 28
  150.             4    Using the Debugger                      Page 29
  151.                       Introduction                       Page 29
  152.                       Debugger Tutorial                  Page 29
  153.                       Debugger Tips                      Page 35
  154.             5.   Command-Line Compiler Options           Page 37
  155.                       Command Line Syntax                Page 37
  156.                       Compiler Options                   Page 38
  157.                       Compiler Examples                  Page 42
  158.                       Program Project File               Page 43
  159.             6.   Language Elements                       Page 44
  160.                       Character Set                      Page 44
  161.                       Constants, Variables, and Labels   Page 46
  162.                       Variables vs. Constants            Page 49
  163.                       Conversion Between Numeric Formats Page 50
  164.             7.   Keyword Reference                       Page 52
  165.                       ABS                                Page 52
  166.                       ASC                                Page 52
  167.                       BEEP                               Page 53
  168.                       BLOAD                              Page 54
  169.                       BSAVE                              Page 55
  170.                       CALL                               Page 56
  171.                       CHDIR                              Page 59
  172.                       CHR$                               Page 60
  173.                       CLOSE                              Page 60
  174.                       CLS                                Page 61
  175.                       CODE                               Page 61
  176.                       COLOR                              Page 62
  177.                       COMMAND$                           Page 63
  178.                       COMSTAT                            Page 64
  179.                       CSRLIN                             Page 65
  180.                       DATA                               Page 66
  181.                       DATE$                              Page 67
  182.                       DEFSEG                             Page 67
  183.                       DIM                                Page 68
  184.                       END                                Page 68
  185.                       ENVIRON$                           Page 69
  186.                       FILEPOS                            Page 70
  187.  
  188.                                        Page - 2
  189.  
  190.  
  191.  
  192.  
  193.                              Table of Contents (Continued)
  194.  
  195.          Chapter Title
  196.  
  197.             7.   Keyword Reference (Continued)
  198.  
  199.                       FIND                               Page 72
  200.                       FOR/NEXT                           Page 74
  201.                       GETDIR                             Page 75
  202.                       GOSUB                              Page 76
  203.                       GOTO                               Page 76
  204.                       IF/THEN/ELSE/ENDIF                 Page 77
  205.                       INKEY$                             Page 79
  206.                       INP                                Page 79
  207.                       INPUT                              Page 80
  208.                       INPUT#                             Page 82
  209.                       INSTR                              Page 84
  210.                       INT86                              Page 85
  211.                       KILL                               Page 87
  212.                       LCASE$                             Page 87
  213.                       LEFT$                              Page 88
  214.                       LEN                                Page 88
  215.                       LOCATE                             Page 89
  216.                       LPRINT                             Page 90
  217.                       LTRIM$                             Page 91
  218.                       MID$                               Page 91
  219.                       MKDIR                              Page 92
  220.                       MOD                                Page 92
  221.                       NAME                               Page 93
  222.                       OPEN                               Page 93
  223.                       OPENCOM                            Page 94
  224.                       OUT                                Page 95
  225.                       PEEK                               Page 95
  226.                       POINT                              Page 96
  227.                       POKE                               Page 97
  228.                       POS                                Page 97
  229.                       PRESET                             Page 98
  230.                       PRINT                              Page 99
  231.                       PRINT#                             Page 100
  232.                       PSET                               Page 102
  233.                       RANDOMIZE                          Page 102
  234.                       READ                               Page 103
  235.                       RECEIVE                            Page 104
  236.                       REM                                Page 105
  237.                       RESTORE                            Page 105
  238.                       RETURN                             Page 106
  239.                       RIGHT$                             Page 106
  240.                       RMDIR                              Page 107
  241.                       RND                                Page 108
  242.                       RTRIM$                             Page 109
  243.                       RUN                                Page 110
  244.                       SCREEN                             Page 111
  245.                       SEND                               Page 112
  246.                       SOUND                              Page 112
  247.                       SPACE$                             Page 113
  248.                       STR$                               Page 113
  249.                       STRING$                            Page 114
  250.  
  251.                                        Page - 3
  252.  
  253.  
  254.  
  255.  
  256.                              Table of Contents (Continued)
  257.  
  258.          Chapter Title
  259.  
  260.             7.   Keyword Reference (Continued)
  261.  
  262.                       TIME$                              Page 115
  263.                       TIMER                              Page 116
  264.                       UCASE$                             Page 117
  265.                       VAL                                Page 117
  266.                       VARPTR                             Page 118
  267.                       WHILE/WEND                         Page 118
  268.                       WIDTH                              Page 119
  269.                       ZBIT                               Page 119
  270.                       ZMODE                              Page 120
  271.             8.   Compatibility with BASICA/GWBASIC       Page 121
  272.             9.   Technical Details/Tips                  Page 124
  273.                       Compiler Limits                    Page 124
  274.                       Compiler Operation                 Page 125
  275.                       Memory Optimization                Page 125
  276.                       Performance Optimization           Page 126
  277.                       Debugger Limits                    Page 127
  278.                       Debugger Operation                 Page 127
  279.                       Debugger Overhead                  Page 127
  280.                       Storage Formats                    Page 128
  281.                       Memory Map - COM File              Page 130
  282.                       Memory Map - EXE File              Page 131
  283.             10.  Mixed Language Programming              Page 133
  284.                       Overview                           Page 133
  285.                       Developing Assembler Routines      Page 133
  286.                       Assembling Your Subroutine         Page 134
  287.                       Developing the Calling ASIC Progrm Page 134
  288.                       Building the Executable Program    Page 134
  289.                       Other Link Options                 Page 136
  290.                       Debugging                          Page 136
  291.             11.  Error Messages                          Page 137
  292.                       Compiler Errors                    Page 137
  293.                       Fatal Errors                       Page 137
  294.                       Non-Fatal Warnings                 Page 144
  295.                       Run Time Errors                    Page 149
  296.                       System ERROR Code Values           Page 150
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.                                        Page - 4
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.                                         A S I C
  323.  
  324.                                        Chapter 1
  325.  
  326.                                     Getting Started
  327.  
  328.  
  329.  
  330.                                      INTRODUCTION
  331.  
  332.             Welcome to ASIC!
  333.  
  334.             ASIC is a "BASIC" programming language compiler for IBM PCs and
  335.        compatibles.  It includes an integrated full screen editor, from which
  336.        you can edit, compile, and debug your programs.  Or, at your option, you
  337.        can use your own text editor, and compile your programs from the MS DOS
  338.        command line.
  339.  
  340.             ASIC supports a large subset of BASICA and GWBASIC.  It supports
  341.        over 80 BASIC statements, decimal, integer and string variables and
  342.        arrays.  It will compile your programs at high speed, and the code it
  343.        generates is fast and compact.  The syntax of each ASIC statement is
  344.        generally a valid subset of the syntax used by BASICA and GWBASIC
  345.        (exceptions are noted in Chapter 8.)
  346.  
  347.             All you need to get started is:
  348.  
  349.                  1)  ASIC
  350.                  2)  IBM PC or 100% Compatible
  351.                  3)  405k Available Memory
  352.                  4)  Two floppy disk drives
  353.                           <or>
  354.                      One hard disk drive and one floppy disk drive
  355.  
  356.             Optional:
  357.  
  358.                  1) Microsoft Compatible Mouse
  359.  
  360.  
  361.             The first step is to install ASIC as described below.  Then,
  362.        proceed to Chapter 2 for a brief ASIC tutorial.  Following that you can
  363.        read the remainder of the documentation straight through, or refer to it
  364.        as you need it.  Have Fun!
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.                                        Page - 5
  378.  
  379.  
  380.  
  381.  
  382.                                      INSTALLATION
  383.  
  384.        To conserve disk space, ASIC files are shipped in compressed format.
  385.        So, before you can run ASIC, you must first install it using the ASIC
  386.        INSTALL.EXE program.  To do so, follow the instructions below.  Commands
  387.        you type are listed in ALL CAPS .  Where you see <ENTER>, you should
  388.        press the <ENTER> key on your keyboard.
  389.  
  390.        If you are installing to a 3 1/2" diskette or a 1.2 megabyte 5 1/4"
  391.        diskette, you will need 1 blank formatted diskette.  If you are
  392.        installing to a 360k diskette, you will need 2 formatted diskettes for a
  393.        full install (or 1 formatted diskette if you opt to not install the
  394.        documentation).  If you are installing to a hard disk, about 500k bytes
  395.        are required for a full install (about 150k is required for a minimal
  396.        install).  To install:
  397.  
  398.        1)   Insert your ASIC diskette into your floppy drive.
  399.  
  400.        2)   If the ASIC diskette is in drive A, type:         A:  <ENTER>
  401.             If the ASIC diskette is in drive B, type:         B:  <ENTER>
  402.  
  403.        3)   Change the default directory by typing:      CD \  <ENTER>
  404.  
  405.        4)   Run the ASIC INSTALL.EXE program by typing:  INSTALL <ENTER>
  406.  
  407.  
  408.        The ASIC install program will prompt you for the information it needs.
  409.        You will be asked for the following information:
  410.  
  411.        1)  The drive and directory containing the ASIC installation files.
  412.        2)  The drive and directory you want ASIC installed to.
  413.  
  414.        You will be offered the option of installing (or not installing) the
  415.        ASIC documentation files and sample programs.  It is recommended that
  416.        you install all options.  Note:  If you do not install the documentation
  417.        files, the online help function will not be available.  If you are
  418.        installing to a 360k 5-1/4" floppy diskette, the online help function
  419.        will not be available inside the integrated editor.
  420.  
  421.        You may rerun the INSTALL program later to install options that you
  422.        skipped the first time.
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.                                        Page - 6
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.                                         A S I C
  449.  
  450.                                        Chapter 2
  451.  
  452.                                        Tutorial
  453.  
  454.  
  455.        ASIC programs look very much like regular "BASIC" programs which you are
  456.        probably already familiar with.  The one very noticeable difference is
  457.        that ASIC programs have no line numbers.  Let's take a look at a very
  458.        simple program written both in GWBASIC/BASICA and in ASIC:
  459.  
  460.             GWBASIC/BASICA                          ASIC
  461.             -------------------------+----------------------------------
  462.                                      |
  463.             10  I=I+1                |  ADDONE:  I=I+1
  464.             20  PRINT I              |         PRINT I
  465.             30  IF I<100 THEN 10     |         IF I<100 THEN ADDONE:
  466.             -------------------------+----------------------------------
  467.  
  468.             Both of these programs do the same thing.  They display the numbers
  469.        from 1 to 100.  However, notice that ASIC allows you to use descriptive
  470.        labels (ADDONE) instead of a line number (10).  These labels can be up
  471.        to 80 characters long!  Also note that the ASIC  "PRINT" and "IF"
  472.        statements were indented only for increased program readability.  The
  473.        ASIC program could just as well have been written as:
  474.  
  475.                                          ASIC
  476.                             ------------------------------
  477.                                  ADDONE:I=I+1
  478.                                  PRINT I
  479.                                  IF I<100 THEN ADDONE:
  480.                             ------------------------------
  481.  
  482.             We could have made our variable names longer.  Instead of "I" we
  483.        could have chosen "SECONDS" or "VELOCITY", or some other name up to 80
  484.        characters in total.  In ASIC, variable names, labels, and string
  485.        constants can all be up to 80 characters in length.
  486.  
  487.             Well, now that we've seen a basic ASIC program, let's try to enter
  488.        and run a slightly larger program.  The program we will be working with
  489.        will print the message "HELLO yourname" in 256 color combinations.  If
  490.        you have a monochrome display card, don't worry, the program will work,
  491.        but instead of seeing different colors you'll see characters with
  492.        different attributes, such as blinking, underlined, etc.
  493.  
  494.             Let's get started.  If you haven't done so already, install ASIC as
  495.        described in Chapter 1.  Now then, writing an ASIC program involves
  496.        these three steps.
  497.  
  498.             1.  Write your program.
  499.             2.  Compile your program.
  500.             3.  Run/Test your Program.
  501.  
  502.  
  503.                                        Page - 7
  504.  
  505.  
  506.  
  507.  
  508.             These three steps can all be performed from within the ASIC
  509.        Integrated Environment.  Before we proceed with our "Hello yourname"
  510.        Program, let's go over some conventions.
  511.  
  512.  
  513.             In the following section:
  514.  
  515.             FLOPPY TYPE-->      Means that only 2-floppy disk system users
  516.                                 should type this line.
  517.  
  518.             HARD TYPE-->        Means that only hard disk system users
  519.                                 should type this line.
  520.  
  521.             TYPE-->             Means that both floppy and hard disk users
  522.                                 should type this line.
  523.  
  524.             X>                  This is a representation of the prompt from
  525.                                 PC-DOS or MS-DOS.  Floppy Disk Users will
  526.                                 actually see "A>" for a prompt.  Hard Disk
  527.                                 Users will see "C>" for a prompt.
  528.  
  529.             <enter>             Means that you should press the <enter>
  530.                                 or <return> key on your keyboard.
  531.  
  532.             <?>                 Text enclosed between the "<" and the ">"
  533.                                 symbols indicate a key to type.  Don't type
  534.                                 the "<" or ">" symbols.  For example, if the
  535.                                 tutorial lists "<F1>", your should press the
  536.                                 "F1" key on your keyboard.
  537.  
  538.        NOTE:  Floppy Disk users need to insert their ASIC Compiler diskette in
  539.        Drive A: at this point, and a blank diskette in Drive B:  (See the
  540.        Installation section for more information)
  541.  
  542.        The tutorial uses the keyboard for all commands, but includes a few
  543.        notes on mouse usage.  For more information on using the mouse with ASIC
  544.        see the "MOUSE USAGE" section in Chapter 3.
  545.  
  546.        Let's begin:
  547.  
  548.  
  549.             FLOPPY TYPE-->      A: <enter>
  550.             HARD TYPE-->        CD C:\ASIC <enter>
  551.  
  552.        The computer should respond:
  553.  
  554.                                 X>
  555.  
  556.        Now enter the command to invoke ASIC:
  557.  
  558.             TYPE-->             ASIC <enter>
  559.  
  560.        You are now in ASIC.  The top line is the Menu Bar.  The bottom line is
  561.        the Status Line.  Chapter 3 describes this in more detail.  For now,
  562.        we'll just describe a couple of features on these lines.
  563.  
  564.  
  565.  
  566.                                        Page - 8
  567.  
  568.  
  569.  
  570.  
  571.        The status line indicates that the current mode is "INSERT".  This means
  572.        that any characters you type on a line will be inserted between the
  573.        existing characters.  If you press the <INS> key on the keypad, ASIC
  574.        will toggle to its other mode, OVERSTRIKE.  In this mode, when you type
  575.        a character, it overlays the character that was there before.  Each time
  576.        you press the <INS> key, ASIC will toggle between the INSERT and
  577.        OVERSTRIKE modes.
  578.  
  579.        You can open the menus listed on the "Menu Bar" by holding down the ALT
  580.        key while typing the Red Capitalized letter of the menu you wish to
  581.        open.  For example, to open the File menu, press <ALT><F>.  Try it now:
  582.  
  583.             TYPE-->    <Alt><F>
  584.  
  585.        The "File" menu will pop open.  You can select a menu option from that
  586.        menu by typing the capitalized letter of the option, or by using the
  587.        arrow keys on your keypad to highlight the option you want and then
  588.        pressing <enter>.
  589.  
  590.                  MOUSE USERS:  If you have a mouse, you can open a
  591.                  menu by clicking the left mouse button on the menu
  592.                  name.  For example, to open the "File" menu,
  593.                  position the mouse pointer anywhere on the word
  594.                  "File", and click the left button.
  595.  
  596.        If you are not sure what the menu option will do, you can press <F1> and
  597.        ASIC will display some help information for the highlighted menu option.
  598.        When you opened the File menu, the first option on that menu, "Open" was
  599.        highlighted.  Let's get some help on "Open":
  600.  
  601.             TYPE-->    <F1>
  602.  
  603.        ASIC will display some help information on "Open".  Let's close the help
  604.        window now:
  605.  
  606.             TYPE-->    <ESC>
  607.  
  608.        The help window will close.  The <ESC> key will always let you escape
  609.        from any menu or help screen in ASIC, without taking any action.
  610.  
  611.                  MOUSE USERS:  To close a menu you can click the
  612.                  right mouse button.  In fact, you can always use the
  613.                  right mouse button to cancel an option, instead of
  614.                  pressing the <ESC> key, if you prefer.
  615.  
  616.         Let's also close the file menu for now:
  617.  
  618.             TYPE-->    <ESC>
  619.  
  620.        The "File" menu should have closed.  By the way, in addition to the menu
  621.        help, ASIC provides additional online help.  If you need general ASIC
  622.        help, press the <F1> key for a quick summary of some of ASIC's features:
  623.  
  624.             TYPE-->    <F1>
  625.  
  626.  
  627.  
  628.  
  629.                                        Page - 9
  630.  
  631.  
  632.  
  633.  
  634.        ASIC will display some general help.  From this screen, we can also
  635.        retrieve additional information about BASIC statements such as PRINT or
  636.        GOSUB.  Let's bring up an index of these statements.
  637.  
  638.             TYPE-->    <F1>
  639.  
  640.        ASIC has opened a help index screen.  From this screen we can use the
  641.        arrow keys to highlight any ASIC keyword and obtain more information for
  642.        that keyword by then pressing enter.  We won't do that now, but don't
  643.        forget that this screen is available. Chapter 3 of the ASIC Reference
  644.        Manual describes all of the online "HELP" features available in ASIC and
  645.        provides a full description of the ASIC Editor Commands which are
  646.        available.  Exit the help menu:
  647.  
  648.             TYPE-->    <ESC>
  649.  
  650.        Entering a program in ASIC is simplicity itself.  We'll simply type in
  651.        each line, pressing <enter> at the end of each line.  If you make a
  652.        typing mistake, just use the arrow keys to move to the error, and type
  653.        in the correction.  Use the <DEL> or <Backspace> keys to delete any
  654.        unwanted characters from the screen.
  655.  
  656.        Make sure the status line says "Mode: Insert".  This is the default mode
  657.        in ASIC.  If it doesn't, press the <INS> key until it does.  Now let's
  658.        enter our program (the program below intentionally contains an invalid
  659.        ASIC statement.  We'll correct the line later in the tutorial, for now,
  660.        type in the program exactly as it's listed below):
  661.  
  662.             TYPE-->        CLS  <enter>
  663.             TYPE-->        PRINT "Please enter your name"; <enter>
  664.             TYPE-->        INPUT YOURNAME$  <enter>
  665.             TYPE-->        FOR I=1 TO 16  <enter>
  666.             TYPE-->            FOR J=1 TO 16  <enter>
  667.             TYPE-->                COLOR I,J <enter>
  668.             TYPE-->                PRINT "HELLO "; <enter>
  669.             TYPE-->                PRINT YOURNAME$; <enter>
  670.             TYPE-->            NEXT J <enter>
  671.             TYPE-->        NEXT I <enter>
  672.             TYPE-->        CLS <enter>
  673.             TYPE-->        THE END <enter>
  674.  
  675.        There, that was easy.  Now, let's compile our program.  To do it, we'll
  676.        open the "Compile" menu, and select the "Compile program" option:
  677.  
  678.             TYPE-->       <ALT><C>
  679.  
  680.        The "Compile" menu will pop open.  The first option, "Compile program"
  681.        can be selected by typing the option letter which is capitalized "C", or
  682.        by moving the highlight bar to this option and pressing the <enter> key.
  683.        Since the highlight bar is already on this option, let's just press
  684.        <enter>:
  685.  
  686.                  MOUSE USERS: To select an option with the mouse,
  687.                  position the mouse pointer on the option name and
  688.                  click the left mouse button.
  689.  
  690.             TYPE-->       <enter>
  691.  
  692.                                        Page - 10
  693.  
  694.  
  695.  
  696.  
  697.        Since we didn't specify a file name when we invoked ASIC, ASIC will now
  698.        ask for a file name (so it can save your program before calling the
  699.        compiler):
  700.  
  701.             FLOPPY TYPE-->      B:TUTOR.ASI  <enter>
  702.             HARD TYPE-->        TUTOR.ASI <enter>
  703.  
  704.        Note that ASIC requires that your programs be stored in files ending
  705.        with the extension ".ASI".  Had we entered "TUTOR" for our program name,
  706.        ASIC would have appended the letters ".ASI" for us.  If we tried to
  707.        provide a different extension, such as "TUTOR.SRC", ASIC would display
  708.        an error message.
  709.  
  710.        Once you select the "Compile program" option, you'll see the ASIC
  711.        compiler screen appear.  It will display a count of the lines compiled,
  712.        and when it is done, it will return to the ASIC editor.
  713.  
  714.        If ASIC detected any errors, it will display the first error message at
  715.        the bottom of the editor screen.  It will also highlight the line in
  716.        your program which is in error.  In this case the line "THE END" was
  717.        flagged with the error message "Syntax Error".  Of course, that line
  718.        should have been entered simply as "END".
  719.  
  720.        That should be easy enough to fix.  Let's exit the error menu by
  721.        pressing the <ESC> key:
  722.  
  723.             TYPE-->      <ESC>
  724.  
  725.        The error menu has disappeared, and our cursor is now on the erroneous
  726.        line.  To fix the line:
  727.  
  728.             TYPE-->      <DEL><DEL><DEL><DEL>
  729.  
  730.        That should do it.  The last line of our program should now read "END".
  731.        Before we continue, let's assume we knew the name of the END command,
  732.        but could not remember the proper syntax for it.  ASIC provides an
  733.        online lookup for each ASIC statement.  With the cursor positioned
  734.        somewhere on the word "END":
  735.  
  736.             TYPE-->      <Ctl><F1>
  737.  
  738.        ASIC should have opened a help window describing the "END" statement.
  739.        To return to your program press the <ESC> key.
  740.  
  741.             TYPE-->      <ESC>
  742.  
  743.        The help window should have disappeared and you should see your program
  744.        displayed again.  Let's recompile the program:
  745.  
  746.             TYPE-->      <ALT><C>
  747.             TYPE-->      <enter>
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.                                        Page - 11
  756.  
  757.  
  758.  
  759.  
  760.  
  761.        This time you should see the message "No Compiler Errors". If you
  762.        didn't, check your spelling and recompile the program until you receive
  763.        this message.  Press <ESC> to remove the "No Compiler Errors" Window.
  764.  
  765.        Now let's run the program.  To do so, we'll open the "Run" menu, and
  766.        select the "Run your program" option.
  767.  
  768.             TYPE-->      <ALT><R>
  769.             TYPE-->      <r>
  770.  
  771.        This time, we just entered the capitalized letter from the menu option
  772.        "Run your program".  Your computer screen should now prompt you to
  773.        "Please enter your name?".  Go ahead and enter your name now:
  774.  
  775.             TYPE-->      yourname  <enter>
  776.  
  777.        You should see "HELLO yourname" printed in various color combinations,
  778.        and then the ASIC editor screen will reappear.  Well, that's all there
  779.        is to writing, compiling, and running an ASIC program.  Now, to exit
  780.        ASIC, open the "File" menu and select the "eXit" option.
  781.  
  782.             TYPE-->      <ALT><F>
  783.             TYPE-->      <X>
  784.  
  785.        You should see your MS DOS prompt once again.  By the way, now that
  786.        you've successfully compiled the program, you can execute it directly
  787.        from MS DOS.  Let's try it:
  788.  
  789.             HARD TYPE-->     TUTOR <enter>
  790.             FLOPPY TYPE-->   B:TUTOR <enter>
  791.  
  792.        Well, that's a brief introduction to ASIC!  Next, you might want to read
  793.        Chapter 3, "Integrated Editor/Compiler Environment" to learn about the
  794.        many other features available in the ASIC editor.  Following this you
  795.        should read Chapter 4 which explains how to use the ASIC Debugger.
  796.        Chapter 4 includes another short tutorial in which you debug a program.
  797.  
  798.             The remaining chapters provide reference material which you can
  799.        either read, or just refer to as needed.  Chapter 5 explains how to
  800.        compile programs directly from the command line of DOS.  Chapters 6-8
  801.        describe the BASIC statements which are supported by ASIC.  Chapter 9
  802.        provides some technical information about ASIC.  Chapter 10 explains how
  803.        to call assembly language object modules from an ASIC program.  Chapter
  804.        11 provides more descriptive information for ASIC error messages.
  805.  
  806.        Hope you enjoy programming in ASIC!
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.                                        Page - 12
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.                                         A S I C
  827.  
  828.                                        Chapter 3
  829.  
  830.                               Integrated Editor/Compiler
  831.                                       Environment
  832.  
  833.  
  834.                                      INTRODUCTION
  835.  
  836.             The ASIC integrated environment lets you edit, save, compile, and
  837.        debug your ASIC programs without ever leaving ASIC!  This chapter will
  838.        explain the usage of the integrated environment.
  839.  
  840.  
  841.                                  ASIC SCREEN CONTENTS
  842.  
  843.             ASIC divides the screen into three parts.  The top line is called
  844.        the "Menu Bar".  All of the menus available to you are listed on this
  845.        line.  The bottom line is called the "Status Line".  It continuously
  846.        displays some important program information.  The middle 23 lines are
  847.        the "Edit Window".  This is the section of the screen where you can make
  848.        changes or additions to your program.
  849.  
  850.                                   MENU BAR PROCESSING
  851.  
  852.        Currently, there are four menus available.  The "File" menu allows you
  853.        to load/save your existing program files to/from disk.  It is also used
  854.        to exit ASIC.  The "Edit" menu contains various editing commands which
  855.        are available.  The "Compile" menu is used to compile your program, set
  856.        compiler options, and to view compiler errors.  The "Run" menu allows
  857.        you to run your programs, and test them using the ASIC debugger.
  858.  
  859.             To open a menu, hold down the <ALT> key and type the first letter
  860.        of the menu.  The menu will pop down and display the options available
  861.        on that menu.  If you want to close the menu without taking any action,
  862.        press the <ESC> key.  If you wish to open a different menu without first
  863.        closing the current menu, press the left or right arrow keys.
  864.  
  865.             Otherwise, to select an option, type the capitalized letter of the
  866.        menu option.  For example, on the "File" menu, to select the "eXit"
  867.        option, type an "X" or an "x".  Another way to select an option is to
  868.        move the "Highlighted Bar" down to the option you wish to select, and
  869.        press the <enter> key.
  870.  
  871.             Some functions may be accessed outside of the menus with short cut
  872.        keys.  For example, the "eXit    <ALT-X>" function in the file menu can
  873.        be selected by holding down the ALT key and tapping the "x" key.  The
  874.        short cut keys are listed on the menus following the option name (they
  875.        are enclosed in brackets as in <F2> or <ALT-X>).  Not all menu options
  876.        have short cut keys.  Note that these short cut keys do not operate when
  877.        a menu is open.  (A list of these short cut keys is presented later in
  878.        this chapter in the Keyboard Usage Section).
  879.  
  880.  
  881.                                        Page - 13
  882.  
  883.  
  884.  
  885.  
  886.  
  887.                                       MOUSE USAGE
  888.  
  889.             If you are familiar with other Mouse Programs, such as Microsoft
  890.        Windows, you will find that you will use the mouse in much the same way
  891.        in ASIC.
  892.  
  893.             Menus can be opened by moving the mouse pointer to a menu name on
  894.        the menu bar, and clicking the left mouse button.  Once the menu is open
  895.        you can select an option by positioning the mouse pointer on the desired
  896.        option, and clicking the left mouse button.  To close a menu without
  897.        selecting an option, click the right button.
  898.  
  899.             A new feature added to several screens, is the "scroll bar".
  900.        Scroll bars let you scroll through lists of items in screen window. A
  901.        vertical scroll bar appears on the right side of the main editor window
  902.        (and on the file open, save, and some help screens).  At the top of the
  903.        scroll bar is a small arrow that points upwards.  At the bottom of the
  904.        scroll bar is a small arrow that points downwards.  Between the two
  905.        arrows is a small square, called a slider.
  906.  
  907.             At the bottom of the main edit window there is also a horizontal
  908.        scroll bar, that lets you scroll the edit buffer left and right.
  909.  
  910.             To use the scroll bar, click the left mouse button on one of the
  911.        arrows to scroll the contents of a window by one line.   Click on the
  912.        shaded area between the arrows to scroll a page at a time.  You can also
  913.        "drag" the slider to any position on the scroll bar to scroll the window
  914.        to the same relative position.  To drag the slider, position the mouse
  915.        pointer on the slider, hold down the left mouse button, and move the
  916.        mouse pointer to the desired position on the scroll bar.  Once at the
  917.        desired position, release the mouse button.
  918.  
  919.             To select a block of text in the editor, position the mouse pointer
  920.        on the first line in the block you wish to select.  Press and HOLD the
  921.        left mouse button until the first line is highlighted.  Continue holding
  922.        the left mouse button down, and drag the mouse pointer to the ending
  923.        line of the block.  When you reach the last line you want to include in
  924.        the block, release the left mouse button.
  925.  
  926.             When responding to dialog box messages, the left mouse button is
  927.        the same as pressing  <ENTER>, and the right mouse button is the same as
  928.        press the <ESC> key.
  929.  
  930.             To get context sensitive help for menu options or ASIC keywords,
  931.        press and briefly HOLD the right mouse button.
  932.  
  933.             To position the keyboard cursor, move the mouse pointer to the
  934.        desired location in the edit window, and click the left mouse button.
  935.        The cursor will move to the mouse pointer location.
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.                                        Page - 14
  945.  
  946.  
  947.  
  948.  
  949.                                      GETTING HELP
  950.  
  951.  
  952.        ASIC provides "online" help within the integrated environment to assist
  953.        you with keyboard usage, menu options, and ASIC keywords.  This section
  954.        tells you how to access this online help.
  955.  
  956.        General Help
  957.  
  958.        General describes the usage of the keyboard in ASIC.  Keyboard keys
  959.        which perform ASIC functions are described in this section.  Access
  960.        general help by pressing Function key <F1>.  Pressing <F1> a second time
  961.        will display an ASIC keyword index.  You can get additional help on
  962.        individual ASIC keywords from this screen.  This information includes a
  963.        description of what the keyword does, and the keyword syntax.
  964.  
  965.                  MOUSE USERS:  You can select help by positioning the
  966.                  mouse pointer on  the "F1=Help"  option on the menu
  967.                  bar, and clicking the left mouse button.
  968.  
  969.        Menu Help
  970.  
  971.        If you open a menu, but you are not sure what a certain menu option
  972.        does, you may display a description of the highlighted menu option by
  973.        pressing the <F1> key.  Doing so will open a help window which describes
  974.        the menu option.  Press <ESC> to exit the help screen and return to the
  975.        menu.
  976.  
  977.                  MOUSE USERS:  You can get help for a menu option with the
  978.                  mouse as follows.  Position the mouse pointer on the menu
  979.                  option, and press and briefly HOLD the right mouse button.
  980.  
  981.  
  982.        Keyword Help
  983.  
  984.        Can't remember the syntax for a particular ASIC keyword?  Well, help is
  985.        just a keystroke away.  Position the cursor on the keyword in the edit
  986.        buffer.  Then, hold down the <Ctl> key and press the <F1> key.
  987.        ASIC will display a description of the keyword, and describe proper
  988.        syntax for that keyword.  For example, if you tried to compile a
  989.        program, but received a syntax error on the keyword "PRINT" in your
  990.        program, you could obtain help on the "PRINT" statement by using the
  991.        arrow keys to position the cursor anywhere on the word "PRINT" and then
  992.        pressing <Ctl-F1>.  If ASIC cannot find the keyword (eg, say the cursor
  993.        was positioned on a variable called "APPLES", which is not an ASIC
  994.        keyword), then ASIC will display a list of valid keywords.  Use the
  995.        cursor keys to highlight one of these keywords and press <enter> to
  996.        retrieve help for the highlighted keyword.  You may also access this
  997.        keyword help list by pressing the <F1> key twice from within the editor.
  998.  
  999.                  MOUSE USERS:  You can also get keyword help using the mouse.
  1000.                  Position the mouse pointer on the keyword, and press and
  1001.                  briefly HOLD the right mouse button.
  1002.  
  1003.             Now let's describe the options available on each menu.
  1004.  
  1005.  
  1006.  
  1007.                                        Page - 15
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.                                        FILE MENU
  1015.  
  1016.        "Open...   <F3>" Option
  1017.  
  1018.             This option allows you to open an existing ASIC file and load it
  1019.        into the ASIC edit buffer where you can modify it.  If you select this
  1020.        option another window will open to ask you the file name.  If you don't
  1021.        wish to open a file, you can press <ESC> to close the menu without
  1022.        taking any action.  Otherwise, enter an ASIC file name, and press the
  1023.        <enter> key.  There is a second way to select a file to open, if the
  1024.        file already exists. You can select the file name from the list
  1025.        displayed, by using the arrow keys or mouse to scroll through the list
  1026.        of file names.  To select a file from the list, press <ENTER>, or
  1027.        position the mouse pointer on the file name, and click the left mouse
  1028.        button.  This option may also be selected outside of the menu by
  1029.        pressing the <F3> key.
  1030.  
  1031.        "Dos shell" Option
  1032.  
  1033.             This option allows you to temporarily exit to MS DOS to execute one
  1034.        or more DOS commands or other programs.  When you are ready to return to
  1035.        ASIC, type EXIT <enter>.
  1036.  
  1037.        "Save   <F2>" Option
  1038.  
  1039.             This option allows you to write the changes you've made to your
  1040.        program back to the file.  Changes you enter in the ASIC editor are made
  1041.        to memory only.  You must select this option before your changes will
  1042.        become permanent.  Note:  Your file is saved to disk automatically
  1043.        whenever you compile it or run it, if the file has been modified.  This
  1044.        option may also be selected outside the menu by pressing the <F2> key.
  1045.  
  1046.        "save As..." Option
  1047.  
  1048.             This option will allow you to write the changes you've made to the
  1049.        program in the edit buffer to a new file.  You will be prompted to
  1050.        provide ASIC with a new file name.  If  you want to overlay an existing
  1051.        file, you can select the file name from the list displayed by using the
  1052.        arrow keys or mouse to scroll through the list of file names.  To select
  1053.        a file from the list, press <ENTER>, or position the mouse pointer on
  1054.        the file name, and click the left mouse button.  BE CAREFUL--WHEN YOU
  1055.        SELECT A FILE FROM THE LIST, YOU ARE TELLING ASIC TO OVERLAY AN EXISTING
  1056.        FILE.
  1057.  
  1058.        "eXit   <Alt-X>" Option
  1059.  
  1060.             This option will allow you to exit from ASIC back to MS DOS.  ASIC
  1061.        will ask you if you wish to save your file before you exit.  This option
  1062.        may be selected outside this menu by pressing <ALT-X>.
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.                                        Page - 16
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.                                        EDIT MENU
  1078.  
  1079.        "Begin block" Option
  1080.  
  1081.             This option will allow you to mark the beginning of a block of text
  1082.        for use with the block delete, copy, and move commands.  To mark a block
  1083.        of text, move the cursor to the first line of the block, and then select
  1084.        this option.  The beginning line of the block will be highlighted on the
  1085.        screen.  Next, move the cursor to the ending line of the block, and
  1086.        select the "End block" option from this menu.  All of the lines in the
  1087.        block will be highlighted.  This block of lines can now be "moved",
  1088.        "copied", or "deleted" using the block commands.  If you have a mouse,
  1089.        you can select text without using the "Begin Block" and "End Block"
  1090.        options.  To select a block of text with the mouse, position the mouse
  1091.        pointer on the first line in the block, press and HOLD the left mouse
  1092.        button until the line is highlighted, and (while continuing to hold down
  1093.        the left mouse button) drag the mouse pointer to the ending line of the
  1094.        block.  Once you reach the ending line of the block, you may release the
  1095.        left mouse button.  The block should be highlighted on the screen.
  1096.  
  1097.        "End block" Option
  1098.  
  1099.             This option will allow you to mark the end of a block of text.
  1100.        Refer to the "Begin block" Option for more information.
  1101.  
  1102.        "Search..." Option
  1103.  
  1104.             This option allows you to locate a string of characters in the edit
  1105.        buffer.  When you select this option, ASIC will ask you for a search
  1106.        string which can be up to 30 characters in length.  ASIC will then
  1107.        search forward from the current line until it finds the string or
  1108.        reaches the end of the edit buffer.  If it finds the string, the cursor
  1109.        will be placed on the line containing the string.
  1110.  
  1111.        "Replace..." Option
  1112.  
  1113.             This option will allow you to replace one or more occurrences of a
  1114.        string of characters with another set of characters.  When you select
  1115.        this option, ASIC will ask you for a search string which can be up to 30
  1116.        characters in length.  ASIC will then ask you for the string of
  1117.        characters which is to replace the search string.  Finally, ASIC will
  1118.        ask you to specify how many occurrences of this search string are to be
  1119.        replaced (from 1-9999).  ASIC will search forward from the current line,
  1120.        and briefly display each line as it modifies it.  If it reaches the end
  1121.        of the edit buffer before it has replaced the number of occurrences
  1122.        you've specified, ASIC will display an "End of Buffer" message, and
  1123.        stop.
  1124.  
  1125.        "Delete block" Option
  1126.  
  1127.             This option will delete a block of lines.  Refer to the "Begin
  1128.        block" option for information on marking a block of lines.  If you
  1129.        haven't marked a block of lines, selecting this option will have no
  1130.        effect.
  1131.  
  1132.  
  1133.                                        Page - 17
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.                                  EDIT MENU (Continued)
  1141.  
  1142.        "Move block" Option
  1143.  
  1144.             This option will move a block of lines to a new location in the
  1145.        edit buffer.  Refer to the "Begin block" option for information on
  1146.        marking a block of lines.  If you don't mark a block of lines, selecting
  1147.        this option will have no effect.  Once you have marked a block of lines,
  1148.        move the cursor to the location in the edit buffer where you want the
  1149.        lines moved. Selecting the "Move block" option will result in the block
  1150.        of lines being deleted from their current location, and moved to the
  1151.        buffer at the line following the cursor.  ASIC will not overlay lines,
  1152.        it will insert enough blank space to hold the relocated text.
  1153.  
  1154.        "Copy block" Option
  1155.  
  1156.             This option is the same as the "Move block" option, with one
  1157.        exception.  After moving the block, ASIC does NOT delete the original
  1158.        block of lines.  Use this option to clone a block of text.  Refer to the
  1159.        "Begin block" option for information on marking a block of text.
  1160.  
  1161.        "search Again <CTL-L>" Option
  1162.  
  1163.             This option will allow you to search for the next occurrence of the
  1164.        last string you searched for with the "Search" Option, without retyping
  1165.        the previous search string.  This option may also be selected outside of
  1166.        the Edit Menu by pressing <CTL-L>.
  1167.  
  1168.  
  1169.                                      COMPILE MENU
  1170.  
  1171.        "Compile program <F10>" Option
  1172.  
  1173.             Use this option to have ASIC compile the program which is currently
  1174.        loaded in the edit buffer.  If the compile is successful, ASIC will
  1175.        display the message "No Compiler Errors".  Otherwise, it will display
  1176.        the first error message (see "View compile errors" option).  ASIC will
  1177.        automatically save your program before calling the compiler.  This
  1178.        option may also be selected outside of the menu by pressing function key
  1179.        <F10>.
  1180.  
  1181.        "Advanced options" Option
  1182.  
  1183.             Select this option to bring up a menu of compiler options for the
  1184.        advanced ASIC user.
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.                                        Page - 18
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.                                COMPILE MENU (Continued)
  1204.  
  1205.        "Full program listing" Option
  1206.  
  1207.             This menu option, and the next six options are used to toggle
  1208.        various compiler options on or off.  When the option is on, you will see
  1209.        a "check mark" symbol next to the option.  This compiler option will
  1210.        cause ASIC to display each source line as it compiles it.  This option
  1211.        will slow down the compile, but since ASIC also writes these lines to a
  1212.        listing file, this option can be used to create a compile listing.  The
  1213.        compile listing will be contained in a file called "progname.LST", where
  1214.        "progname" is the name of your program.
  1215.  
  1216.        "Printer output" Option
  1217.  
  1218.             This menu option will toggle the "Printer output" compiler option
  1219.        on or off.  When the option is on, you will see a "check mark" symbol
  1220.        next to the option name.  This compiler option will cause compiler
  1221.        messages to be printed on your printer.
  1222.  
  1223.        "Symbol table" Option
  1224.  
  1225.             This menu option will toggle the "Symbol table" compiler option on
  1226.        or off.  When the option is on, you will see a "check mark" symbol next
  1227.        to the option name.  This compiler option will cause ASIC to create a
  1228.        symbol table file called "progname.SYM", where "progname" is the name of
  1229.        your program.  The symbol table is a list of all variables, labels, and
  1230.        internally created compiler addresses.
  1231.  
  1232.        "Extended math" Option
  1233.  
  1234.             By default, ASIC will permit regular integer variables. These
  1235.        variables are very efficient and only require two bytes (or characters)
  1236.        of memory storage.  However, these integers can only hold numbers in the
  1237.        range of -32767 to +32767.  For many programs this is sufficient.
  1238.        However, there may be cases when you want to represent larger integer
  1239.        values.  Because of this, ASIC provides a "long" integer data type.  The
  1240.        long integer requires four bytes of memory storage.  However, it can
  1241.        hold a much larger range of numbers.  A long integer can store numbers
  1242.        in the range of -2,147,483,647 to +2,147,483,647.  When you need to use
  1243.        long integers in your program, you need to turn on this option, so that
  1244.        ASIC can generate the proper code.  When the option is on, you will see
  1245.        a "check mark" symbol next to the option name.  If this option is not
  1246.        turned on and your program contains long integers, ASIC will generate a
  1247.        compiler error.  If this happens, just turn this option on, and re-
  1248.        compile your program.  To "create" a long integer variable or constant,
  1249.        simply append the "&" character to the variable name or constant
  1250.        value(eg, SAMPLEVAR& or 123456&).  For further information on using long
  1251.        integers, refer to Chapter 6, "Language Elements", of the ASIC Manual.
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.                                        Page - 19
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.                                COMPILE MENU (Continued)
  1267.  
  1268.        "decimal Math" Option
  1269.  
  1270.             Select this option if your program needs to perform decimal math.
  1271.        When the option is on, you will see a "check mark" symbol next to the
  1272.        option name.  When you select this option, ASIC generates supporting
  1273.        code for your program which supports the "Decimal" variable type.
  1274.        Decimal variables may be identified by adding a "@" symbol following the
  1275.        variable name. (eg, BALANCE@).  "Decimal" type variables can contain
  1276.        numbers in the range of +999,999,999,999.99999 to
  1277.        -999,999,999,999.99999.  Unlike floating point numbers in GWBASIC or
  1278.        BASICA, ASIC "Decimal" variables do not exhibit rounding errors.  Full
  1279.        precision is maintained through all 5 decimal places (digits following
  1280.        the fifth decimal place are truncated).  For further information on
  1281.        using decimal variables, refer to Chapter 6, "Language Elements", of the
  1282.        ASIC Manual.  If this option is not turned on and your program contains
  1283.        decimal variables or constants, ASIC will generate a compiler error.  If
  1284.        this happens, just turn this option on, and re-compile your program.
  1285.  
  1286.        "Debugging code" Option
  1287.  
  1288.             This menu option will toggle the "Debugging code" compiler option
  1289.        on or off.  When the option is on, you will see a "check mark" symbol
  1290.        next to the option name.  This compiler option will cause ASIC to
  1291.        generate code required by the ASIC debugger to allow you to set
  1292.        breakpoints, single step through your program, and view/modify program
  1293.        variables.  This option is "on" by default in the integrated
  1294.        environment.  You should leave this option on while you are debugging
  1295.        your program.  When you have everything working properly, you should
  1296.        turn it "off" and recompile your program.  This will reduce the size of
  1297.        your program slightly, and will make it run faster (of course, you can't
  1298.        use the debugger with it, since there is no debugging information
  1299.        available to ASIC any more.  If you need to debug your program again,
  1300.        just recompile with the this option turned "on" again).
  1301.  
  1302.        "View compile errors" Option
  1303.  
  1304.             When you wish to examine the errors from a previous compile of your
  1305.        program, select this option.  If no errors exist, ASIC will so inform
  1306.        you.  Otherwise, ASIC will display the first error message at the bottom
  1307.        of the screen, and it will highlight the line of your program which
  1308.        corresponds to that error.  If you wish to correct the program line,
  1309.        press the <ESC> key.  The cursor will be positioned at the beginning of
  1310.        that program line.  You may also view subsequent compiler errors by
  1311.        pressing the <ENTER> key instead of the <ESC> key.
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.                                        Page - 20
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.                                COMPILE MENU (Continued)
  1330.  
  1331.        "Write options to disk" Option
  1332.  
  1333.             Writes current compiler options to a file called ASIC.CFG.  When
  1334.        you enter ASIC, ASIC always reads options from this file.  Note that
  1335.        when you open a program, ASIC first checks for a "progname.PRJ" file.
  1336.        The ".PRJ" file ,if found, will override ASIC.CFG.  Since ASIC
  1337.        automatically creates/updates the ".PRJ" file whenever you save a
  1338.        program, normally the only time that the ASIC.CFG options will be used
  1339.        is when you enter the editor with a new file.  Once you save a program
  1340.        the first time, ASIC creates the custom ".PRJ" file for the program.
  1341.        Think of the ASIC.CFG file, then, as the default options for new
  1342.        programs.
  1343.  
  1344.  
  1345.                                    ADVANCED OPTIONS
  1346.                               (SUBMENU OF "COMPILE" MENU)
  1347.  
  1348.             When you select the "Advanced options" option from the "Compile"
  1349.        menu, this sub-menu will be displayed.  These give the advanced
  1350.        programmer the ability to tell ASIC how to produce the compiler output
  1351.        files.
  1352.  
  1353.        "Com output file" Option
  1354.  
  1355.             This option, the "Exe output file", and the "Obj output file"
  1356.        options allow you to tell ASIC what type of output file to produce when
  1357.        compiling.  Only one of these three options may be selected at the same
  1358.        time.  The option that is currently selected will be preceded with a
  1359.        small dot.  This option is the default option.  When you select this
  1360.        option, ASIC will produce a ".COM" output file.  This file can contain a
  1361.        maximum of 64k bytes of program code and data.
  1362.  
  1363.        "Exe output file" Option
  1364.  
  1365.             This option, the "Com output file", and the "Obj output file"
  1366.        options allow you to tell ASIC what type of output file to produce when
  1367.        compiling.  Only one of these three options may be selected at the same
  1368.        time.  The option that is currently selected will be preceded with a
  1369.        small dot.  When you select this option, ASIC will produce a ".EXE"
  1370.        output file.  This output file can contain up to 64k program code, 64k
  1371.        program data, and 64k stack.  ASIC does not produce an intermediate OBJ
  1372.        file, and ASIC uses its internal linker.  Unlike the "Obj output file"
  1373.        option, ASIC does not use the DOS LINK command to produce the EXE file,
  1374.        and no OBJ file is created when using this option.  Turn this option on
  1375.        when:  1) you want to compile large programs, 2) you want to minimize
  1376.        the amount of memory required when your program runs, or 3) you want  to
  1377.        adjust the program stack size.  The only drawback to this option, is
  1378.        that the EXE file is slightly larger on disk than the COM file, and that
  1379.        ASIC only asks DOS for the amount of memory your program needs.  With
  1380.        COM files, DOS gives your program all available memory.  Note:  If you
  1381.        compile a program with this option turned off, and then turn this option
  1382.        on, be sure to recompile your program.
  1383.  
  1384.  
  1385.                                        Page - 21
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.                              ADVANCED OPTIONS (Continued)
  1393.  
  1394.        "Obj output file" Option
  1395.  
  1396.             This option, the "Exe output file" option, and the "Com output
  1397.        file" option allow you to tell ASIC what type of output file to produce
  1398.        when compiling.  Only one of these three options may be selected at the
  1399.        same time.  The option that is currently selected will be preceded with
  1400.        a small dot.  When you select this option, ASIC will produce a ".OBJ"
  1401.        output file that is in the standard MS DOS LINK format.  This file is
  1402.        not directly executable.  First, it must be "LINK"ed into a ".EXE" file.
  1403.        ASIC will attempt to call the MS DOS LINK program for you. To do so, it
  1404.        must be able to locate the "LINK.EXE" program (provided with MS DOS).
  1405.        It will search for this file in the current directory, and the "C:\DOS"
  1406.        subdirectory.  If it can't find the file there, it will not be able to
  1407.        link your program.  ASIC does provide a new option, to let you specify
  1408.        the location of the LINK.EXE program (see "Link.EXE path" option).  You
  1409.        may be wondering why you'd want to go through all of the bother of using
  1410.        this option, when you could create an EXE file directly using the "EXE
  1411.        output file" option.  Well, normally you will want to use the "EXE
  1412.        output file" option.  But, the "OBJ output file option provides one
  1413.        important advantage.  Using this option, you can use the CALL SUB
  1414.        statement in your programs, and you can tell ASIC to link in other OBJ
  1415.        files (created with an assembler) with your ASIC program.  See chapter
  1416.        10, "Mixed Language Programming", of the ASIC manual for more
  1417.        information.  Also, refer to the "obJect names..." option, the "liBrary
  1418.        name..." option, and the "Link.exe path..." option on this same menu.
  1419.  
  1420.        "Stack size..." Option
  1421.  
  1422.             This option will allow you to adjust the size of the stack that
  1423.        ASIC generates for your program.  When you select this option, you will
  1424.        be prompted for the number of bytes to allocate to the stack in your
  1425.        program.  If you select a number that is too small for your program's
  1426.        needs, the results when you attempt to run your program will be
  1427.        unpredictable.  The ASIC defaults are 2000 bytes (4000 bytes in
  1428.        debugging mode).  Note that if you compile with debugging mode on and
  1429.        specify a stack size of less than 4000 bytes, ASIC will ignore your
  1430.        stack size and continue to use 4000 bytes.  This option has no effect
  1431.        when you are using the "Com output file" option.
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.                                        Page - 22
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.                              ADVANCED OPTIONS (Continued)
  1456.  
  1457.        "obJect names..." Option
  1458.  
  1459.             This option allows you to identify other object file names that
  1460.        ASIC should pass to the DOS LINK.EXE program.  This option is ignored by
  1461.        the compiler unless you are compiling with the "Obj output file" Option.
  1462.        When you select this option, ASIC will prompt you for a list of object
  1463.        names.  Each object file name should be separated from each other by a
  1464.        "+" sign.  For example, to identify OBJECT1.OBJ and OBJECT2.OBJ you
  1465.        would enter:  OBJECT1.OBJ+OBJECT2.OBJ for the object names.  Since the
  1466.        LINKer expects the file extensions to be ".OBJ", you can omit the
  1467.        extension as long as it is ".OBJ".  For example, we could have entered:
  1468.        OBJECT1+OBJECT2.  By default, the linker will assume that the object
  1469.        files will be in the current directory, so if they're somewhere else, be
  1470.        sure to include the full path, as in:
  1471.        C:\OBJECT\OBJECT1+C:\OBJECT\OBJECT2.  Refer to the "Mixed Language
  1472.        Programming" chapter of the ASIC Manual for more information.
  1473.  
  1474.        "liBrary names..." Option
  1475.  
  1476.             This option allows you to identify object program libraries (such
  1477.        as those built with the Microsoft LIB command) that ASIC should pass to
  1478.        the DOS LINK.EXE program.  This option is ignored by the compiler unless
  1479.        you are compiling with the "Obj output file" Option.  When you select
  1480.        this option, ASIC will prompt you for a list of library file names.
  1481.        Each library file name should be separated from each other by a "+"
  1482.        sign.  For example, to identify LIB1.LIB and LIB2.LIB you would enter:
  1483.        LIB1.LIB+LIB2.LIB for the library names.  Since the LINKer expects the
  1484.        file extensions to be ".LIB", you can omit the extension as long as it
  1485.        is ".LIB".  For example, we could have entered:  LIB1+LIB2.  By default,
  1486.        the linker will assume that the library file will be in the current
  1487.        directory, so if the libraries are elsewhere, be sure to include the
  1488.        full path, as in:  C:\LIB\LIB1+C:\LIB\LIB2 for example.  Refer to the
  1489.        "Mixed Language Programming" Chapter of the ASIC Manual for more
  1490.        information.
  1491.  
  1492.        "Link.exe path..." Option
  1493.  
  1494.             This option is used to tell ASIC where to find the MS DOS LINK.EXE
  1495.        program.  This option is ignored by the compiler, unless you are using
  1496.        the "Obj output file" Option.  When you use the "Obj output file"
  1497.        Option, ASIC utilizes the LINK.EXE program, which is provided with MS
  1498.        DOS, to link your ASIC program and additional object files into an MS
  1499.        DOS EXE file.  If you do not provide a path, ASIC will attempt to find
  1500.        LINK.EXE under the current directory, and under the "C:\DOS" directory
  1501.        (if applicable).  If it can't find the program in either place, the EXE
  1502.        file will not be built.  When you select this option, you will be
  1503.        prompted to enter the directory in which ASIC may find the LINK.EXE
  1504.        program.  For example, if you determined that the LINK.EXE program is
  1505.        stored under "C:\UTIL" on your hard disk, you would enter:  C:\UTIL for
  1506.        this option.  On future compiles, ASIC will look for the LINK.EXE file
  1507.        in the "C:\UTIL" directory.  Instead of using this option, you may also
  1508.        copy the LINK.EXE file to your ASIC directory.
  1509.  
  1510.  
  1511.                                        Page - 23
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                                        RUN MENU
  1517.  
  1518.             The "Using the ASIC Debugger" Chapter has additional information on
  1519.        the debugger and it's options.  You may wish to refer to it, should you
  1520.        need more information than is provided below.
  1521.  
  1522.        "Run your program <F5>" Option
  1523.  
  1524.             After you have successfully compiled your program, you can select
  1525.        this option to cause ASIC to load and execute your program.  After your
  1526.        program ENDs, ASIC will return you to the editor.  ASIC will save the
  1527.        edit buffer before loading and executing your program.  If you are
  1528.        running a program containing debugging code, this option will cause ASIC
  1529.        to run your program up to the first breakpoint it encounters, or through
  1530.        the end of your program if you haven't set any breakpoints.  If you are
  1531.        already "paused" at a breakpoint, selecting this option will cause your
  1532.        program to resume execution at the statement following the breakpoint,
  1533.        and run up to the next breakpoint or to the end of your program, if no
  1534.        further breakpoints are encountered.  This option may also be selected
  1535.        outside of the "Run menu" by pressing function key <F5>.
  1536.  
  1537.        "Breakpoint toggle <F9>" Option
  1538.  
  1539.             If you have compiled your program with the "Debugging code" option
  1540.        turned on, you may use this option to set breakpoints.  You can have up
  1541.        to 20 breakpoints active at a time.  When you run your program with
  1542.        breakpoints set, ASIC will pause your program when it tries to execute a
  1543.        line on which you have set a breakpoint.  At this time, you can view or
  1544.        modify variables, or view the screen output produced by your program.
  1545.        You can then resume program execution by selecting the "Run your
  1546.        program" option from the run menu.  If you select this option and the
  1547.        current statement in the edit buffer already has a breakpoint set, then
  1548.        the breakpoint for that source statement will be removed (toggled off).
  1549.        Lines at which you have set a breakpoint will be displayed in reverse
  1550.        video.  Also, when you run your program and ASIC stops at a breakpoint,
  1551.        ASIC will display the next line to execute in reverse video on the
  1552.        second line of the screen with a red background (underlined if you have
  1553.        a monochrome system).  This option may also be selected outside of the
  1554.        "Run" Menu by pressing function key <F9>.
  1555.  
  1556.        "Trace <F8>" Option
  1557.  
  1558.             If you have compiled your program with the "Debugging code" option
  1559.        turned on, you may use this option to execute your program one statement
  1560.        at a time.  After you select this option, ASIC will execute the next
  1561.        program statement in your program, and pause, displaying the next line
  1562.        which will be executed in reverse video with a red background
  1563.        (underlined if you have a monochrome system).  At this time, you can
  1564.        view or modify variables, or view the screen output produced by your
  1565.        program.  You can then resume program execution by selecting the "Run
  1566.        your program" option from the run menu, or by selecting the "Trace"
  1567.        option again.  This option may also be selected outside of the "Run"
  1568.        Menu by pressing function key <F8>.
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.                                        Page - 24
  1575.  
  1576.  
  1577.  
  1578.  
  1579.                                  RUN MENU (Continued)
  1580.  
  1581.        "Modify variable..." Option
  1582.  
  1583.             If you have compiled your program with the "Debugging code" option
  1584.        turned on, you may use this option to modify the contents of variables
  1585.        in your program while your program is paused at a breakpoint or
  1586.        following a "Trace" command.  When you select this option, ASIC will ask
  1587.        you for the variable name.  After you enter the variable name, ASIC will
  1588.        ask you for the new value to be stored in the variable.  If the variable
  1589.        is an array, ASIC will ask you which element of the array to modify.
  1590.  
  1591.        "Watch variable... <F6>" Option
  1592.  
  1593.             If you have compiled your program with the "Debugging code" option
  1594.        turned on, you may use this option to view the contents of variables in
  1595.        your program, while your program is paused at a breakpoint or following
  1596.        a "Trace" command.  After you enter the variable name, ASIC will open a
  1597.        "Watch" window at the bottom of the screen showing you the variable name
  1598.        and the current value.  As you continue execution of your program and
  1599.        reach a new breakpoint, the values of variables will be updated to
  1600.        reflect their new values.  In this way you can watch the changing values
  1601.        of variables in your program without inserting "PRINT variablename"
  1602.        statements in your program.  Up to 10 variables may be watched at a
  1603.        time.  If you enter a variable name which is an array, ASIC will ask you
  1604.        which element of the array you wish to watch.  This option may also be
  1605.        selected outside of the "Run" Menu by pressing function key <F6>.
  1606.  
  1607.        "Unwatch variable... <F7>" Option
  1608.  
  1609.             If you have compiled your program with the "Debugging code" option
  1610.        turned on, you may use this option to remove variables from the "Watch"
  1611.        window (see previous option).  When you select this option, you will be
  1612.        asked for a variable name to remove from the window.  If the variable is
  1613.        an array, you will also be asked which element of the array.  ASIC will
  1614.        then remove the variable from the watch window, and resize the window
  1615.        accordingly.  Since only 10 variables may be watched concurrently, you
  1616.        may need to remove variables which are no longer needed from the "Watch"
  1617.        Window using this command.  This option may also be selected outside of
  1618.        the "Run" Menu by pressing function key <F7>.
  1619.  
  1620.        "Abort execution" Option
  1621.  
  1622.             If you are running your program, and it is paused at a breakpoint,
  1623.        you may select this option to abort the execution of your program.  Your
  1624.        program will be terminated immediately.
  1625.  
  1626.        "Clear all break/watch" Option
  1627.  
  1628.             If you have set breakpoints or watch variable options, you may use
  1629.        this option to remove all of them at once, instead of removing them one
  1630.        at a time using the "Toggle breakpoint" or "Unwatch variable" options.
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.                                        Page - 25
  1638.  
  1639.  
  1640.  
  1641.  
  1642.                                  RUN MENU (Continued)
  1643.  
  1644.        "Program arguments..." Option
  1645.  
  1646.             This option allows you to pass command line arguments to your
  1647.        programs, which may be retrieved by your program using the COMMAND$
  1648.        statement.  If you are testing outside the integrated environment, you
  1649.        would normally specify the command line arguments by typing
  1650.        "progname arguments".  However, in the integrated environment, since
  1651.        ASIC is executing your program for you, this option is a means to pass
  1652.        the "arguments" to your program as if they had been typed on the command
  1653.        line following your program name.
  1654.  
  1655.        "Swap to user screen <F4>" Option
  1656.  
  1657.             Whenever ASIC pauses your program at a breakpoint, it saves the
  1658.        screen created by your program in a memory buffer.  You may select this
  1659.        option to view your program screen output.  When you are done viewing
  1660.        your program's output, press a key to return to viewing the ASIC editor.
  1661.        This function may also be selected outside the "Run" Menu by pressing
  1662.        the <F4> function key.
  1663.  
  1664.  
  1665.                                       STATUS LINE
  1666.  
  1667.             The bottom line of the ASIC screen is called the "Status Line".  As
  1668.        it's name implies, it is used to display various types of status
  1669.        information.  At the left of the status line "FILE: xxxxxxxx.xxx" will
  1670.        display the name of the file which is currently loaded in the edit
  1671.        buffer.  If you haven't opened a file yet, the file name will be blank.
  1672.  
  1673.  
  1674.             After the file name is the "File Modified Indicator".  If you have
  1675.        entered any changes in the edit buffer, and have not saved them to disk,
  1676.        an "*" will appear to indicate this.  If the edit buffer has not been
  1677.        modified since the last save to disk, no "*" will be present.
  1678.  
  1679.             The next piece of information is "Mode:".  Mode will always display
  1680.        one of two values:  "Insert" or "Ovrstr".  In "Insert" mode, any
  1681.        characters you type in the edit buffer will be inserted at the cursor
  1682.        position, and the characters to the right of the cursor will be shifted
  1683.        to the right by one.  In "Ovrstr" mode, any characters you type in the
  1684.        edit buffer will overlay (and thus destroy) the character at the cursor
  1685.        position.  You can change back and forth between these two modes by
  1686.        pressing the <INS> key on your keypad.
  1687.  
  1688.             To the right of "Mode:" ASIC displays how many thousands of bytes
  1689.        are still available for use by ASIC.   You will see this number decrease
  1690.        as you add more lines to your programs.
  1691.  
  1692.             The "Line: nnnn" status indicator, will identify which line of the
  1693.        file is being displayed.  For example, if the display reads "Line: 100",
  1694.        the line containing the cursor is the 100th line in the file. When ASIC
  1695.        is reading or writing your program to/from disk, it will display a
  1696.        running total of the number of records read/written in this field.
  1697.  
  1698.  
  1699.  
  1700.                                        Page - 26
  1701.  
  1702.  
  1703.  
  1704.  
  1705.                                 STATUS LINE (Continued)
  1706.  
  1707.  
  1708.             The "Row:" and "Col:" numbers identify the relative position of the
  1709.        cursor within the "Edit Window".
  1710.  
  1711.  
  1712.                                       EDIT WINDOW
  1713.  
  1714.             The edit window is the area of the screen where your program is
  1715.        displayed.  It displays up to 21 lines of your program at a time.  You
  1716.        can use the keys described below to manipulate the text in this window.
  1717.  
  1718.  
  1719.                                     KEYBOARD USAGE
  1720.  
  1721.             Most keys on the keyboard behave in ASIC just as you'd expect.  The
  1722.        key usages which might not be obvious are described here.
  1723.  
  1724.        <ESC>          Exit from any menu without taking any action.
  1725.  
  1726.        <TAB>          Move the cursor to the next "tab stop".  Tab stops in
  1727.                       ASIC are fixed at every fourth column (4,8,12,etc).
  1728.  
  1729.        <HOME>         Move the cursor to the beginning of the current line.
  1730.  
  1731.        <END>          Move the cursor to the first blank character following
  1732.                       the last non-blank character on the current line.
  1733.  
  1734.        <DEL>          Delete the character at the cursor position.
  1735.  
  1736.        <INS>          Toggle between Insert and Overstrike Modes.
  1737.  
  1738.        <PGUP>         Display the previous "page" of the edit buffer.
  1739.  
  1740.        <PGDN>         Display the next "page" of the edit buffer.
  1741.  
  1742.        <Ctl-PGUP>     Display the first "page" of the edit buffer.
  1743.  
  1744.        <Ctl-PGDN>     Display the last "page" in the edit buffer.
  1745.  
  1746.        <Backspace>    Delete the character to the left of the cursor
  1747.                       position, and move the cursor one column to the left.
  1748.        <Up Arrow>     Moves cursor up one line.
  1749.  
  1750.        <Down Arrow>   Moves cursor down one line.
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.                                        Page - 27
  1764.  
  1765.  
  1766.  
  1767.  
  1768.                               KEYBOARD USAGE (Continued)
  1769.  
  1770.  
  1771.        <Left Arrow>   Moves cursor left one column.
  1772.  
  1773.        <Right Arrow>  Moves cursor right one column.
  1774.  
  1775.        <Ctl-LfArrow>  Moves cursor left one word.
  1776.  
  1777.        <Ctl-RtArrow>  Moves cursor right one word.
  1778.  
  1779.        <Ctl-L>        Repeats the last "Search" command.  See Edit Menu
  1780.                       Section of this chapter for more information.
  1781.  
  1782.        <Alt-A>        Add a line following the line containing the cursor.
  1783.  
  1784.        <Alt-D>        Delete the line containing the cursor.
  1785.  
  1786.        <Alt-I>        Insert a line before the line containing the cursor.
  1787.  
  1788.        <Alt-X>        Exit ASIC.
  1789.  
  1790.        <F1>           Displays a help screen.
  1791.  
  1792.        <CTL-F1>       Displays help information for the keyword located at
  1793.                       the cursor position.
  1794.  
  1795.        <F2>           Saves the edit buffer to disk.
  1796.  
  1797.        <F3>           Load a new file into the edit buffer.
  1798.  
  1799.        <F4>           Swaps the display to the output from your program
  1800.                       temporarily.  See Run Menu Section of this chapter for
  1801.                       more information.
  1802.  
  1803.        <F5>           Runs your program.  See Run Menu Section of this
  1804.                       chapter for more information.
  1805.  
  1806.        <F6>           Add a variable to the "Watch" Window.  See Run Menu
  1807.                       Section of this chapter for more information.
  1808.  
  1809.        <F7>           Remove a variable from the "Watch" Window.  See Run
  1810.                       Menu Section of this chapter for more information.
  1811.  
  1812.        <F8>           Execute a single statement of your program.  See Run
  1813.                       Menu Section of this chapter for more information.
  1814.  
  1815.        <F9>           Toggle breakpoint on/off at the current edit buffer
  1816.                       line.  See Run Menu Section of this chapter for more
  1817.                       information.
  1818.  
  1819.        <F10>          Compile your program.  See Compile Menu Section of
  1820.                       this chapter for more information.
  1821.  
  1822.        <enter>        In Insert mode, pressing <enter> is identical to
  1823.                       pressing <Alt-A>.  In OvrStr mode, pressing <enter>
  1824.                       is identical to pressing the <Down Arrow> key.
  1825.  
  1826.                                        Page - 28
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.                                         A S I C
  1835.  
  1836.                                        Chapter 4
  1837.  
  1838.                                   Using the Debugger
  1839.  
  1840.  
  1841.  
  1842.                                      INTRODUCTION
  1843.  
  1844.             The source level debugger in ASIC's integrated programming
  1845.        environment helps you debug your programs by allowing you to "peek"
  1846.        inside them as they're running.  You can single step through your
  1847.        programs, or select places in the program where you wish execution to
  1848.        pause by setting breakpoints.  Then, while the program is paused, you
  1849.        can view or modify any of your program's variables, and also examine the
  1850.        screen output created by your program.
  1851.  
  1852.             All of the debugger's commands can be selected from the run menu,
  1853.        and they are described in the "RUN MENU" Section of Chapter 3,
  1854.        "Integrated Editor/Compiler Environment".  Many of the debugger commands
  1855.        may be selected outside the "Run" menu, by pressing a function key (eg,
  1856.        <F5>,<F6>,etc).  A complete list of the function keys available is
  1857.        contained in Chapter 3, in the "KEYBOARD USAGE" Section.
  1858.  
  1859.             This chapter explains how to use the debugger with a short tutorial
  1860.        which guides you through a sample debugging session.  The tutorial is
  1861.        followed by a reference section which you should read after completing
  1862.        the tutorial.
  1863.  
  1864.                                    DEBUGGER TUTORIAL
  1865.  
  1866.             The debugger tutorial follows the same format as the general
  1867.        tutorial in chapter 2.  You should complete (or at least review) the
  1868.        general tutorial before taking the debugger tutorial.
  1869.  
  1870.             This tutorial will use a program file provided with your ASIC
  1871.        compiler package called "DBGTUTOR.ASI".  If you are running from a hard
  1872.        disk, make sure it is in the ASIC directory.  If you are running from a
  1873.        two-floppy system, make sure it is on the diskette in drive b:, with the
  1874.        compiler in drive a:.
  1875.  
  1876.        NOTE:  Floppy disk users should verify that the ASIC compiler diskette
  1877.        is in drive A: and the "DBGTUTOR.ASI" disk is in drive b: before
  1878.        proceeding.
  1879.  
  1880.        Let's get started:
  1881.  
  1882.             FLOPPY TYPE-->      A: <enter>
  1883.                                 ASIC B:DBGTUTOR <enter>
  1884.  
  1885.             HARD TYPE-->        C: <enter>
  1886.                                 CD C:\ASIC <enter>
  1887.                                 ASIC DBGTUTOR <enter>
  1888.  
  1889.                                        Page - 29
  1890.  
  1891.  
  1892.  
  1893.  
  1894.        You should be in ASIC now, and you should see a source program.  The
  1895.        first few lines should contain:
  1896.  
  1897.                            dim scores(10)
  1898.                            data 55,33,877,99,44,101,21,88,105,1
  1899.                            rem DBGTUTOR.ASI
  1900.                                 .
  1901.                                 . (etc)
  1902.                                 .
  1903.  
  1904.        This sample program will sort an array of 10 scores into ascending
  1905.        sequence.  It uses a simple "bubble" sort algorithm.  The "bubble" sort
  1906.        algorithm simply steps through each element of the array and compares it
  1907.        to its next higher neighbor.  If its neighbor's value is less than its
  1908.        own, the two values are swapped.  It is necessary to execute this
  1909.        process N-1 times where N= number of items to sort.  Here's why.  Let's
  1910.        say the lowest value to be sorted was "1" and it is in array element
  1911.        "10" (assume 10 numbers will be sorted).  The first swapping pass will
  1912.        result in the "1" being swapped from element 10 to element 9 of the
  1913.        array.  An additional 8 passes through the array are necessary to move
  1914.        the "1" to array element number 1.  This algorithm gets its name,
  1915.        because the process of moving the elements has been compared to that of
  1916.        bubbles slowly rising to the surface.
  1917.  
  1918.        This program has a list of ten scores to be sorted.  Line 5 of the
  1919.        program will read the ten scores to an array called "Scores", and also
  1920.        print the original values (before the sort) to the screen.  Then two
  1921.        loops will execute at statements 8 and 9 in the program to perform the
  1922.        bubble sort as described above.  Finally, after the sort is complete,
  1923.        the sorted values will be displayed.
  1924.  
  1925.        First, let's compile the program.  When we plan to use the debugger, we
  1926.        must set the "Debugging code" option on.  This is done on the Compile
  1927.        Menu.  However, the default in the integrated environment is "Debugging
  1928.        code" on.  Let's take a look to be sure:
  1929.  
  1930.  
  1931.             TYPE-->        <Alt><c>
  1932.  
  1933.        The compile menu should pop open, and you should see a check mark next
  1934.        to the "Debugging code" option.  If you don't, press the letter "D", and
  1935.        a check mark should appear.  Once you've verified that the option is on,
  1936.        we can compile the program.  Notice that there is an <F10> next to the
  1937.        option.  Instead of opening this menu and selecting the "Compile"
  1938.        option, we could have pressed <F10>.  Let's try it.  First, let's close
  1939.        the menu (Function keys don't work inside a menu):
  1940.  
  1941.             TYPE-->        <ESC>
  1942.  
  1943.        The menu should have closed.  Now let's compile using the function key:
  1944.  
  1945.             TYPE-->        <F10>
  1946.  
  1947.        You should see the compiler screen pop up, and compile the program.  No
  1948.        errors should be detected.  Now we're ready to test the program.  First,
  1949.        let's set a breakpoint so we can easily view the screen output, Use the
  1950.  
  1951.  
  1952.                                        Page - 30
  1953.  
  1954.  
  1955.  
  1956.  
  1957.        down arrow key to position the cursor on line 20 (the line number is
  1958.        displayed on the ASIC status line).  Line 20 should contain an "END"
  1959.        statement.  Let's open the run menu and set a breakpoint:
  1960.  
  1961.  
  1962.             TYPE-->        <Alt><r>
  1963.                            <b>
  1964.  
  1965.        The "END" statement should now be displayed in reverse video.  That
  1966.        tells us that a breakpoint has been set there.  Did you notice that the
  1967.        breakpoint option on the menu also had a function key listed.  We could
  1968.        set a breakpoint without opening a menu, by pressing <F9> instead.  Now
  1969.        that we've set a breakpoint, let's run the program and see how it works:
  1970.  
  1971.             TYPE-->        <Alt><r>
  1972.                            <r>
  1973.  
  1974.        Note that we could have pressed the short cut key of <F5> to run the
  1975.        program instead of selecting the option from the menu.  At this point
  1976.        our program is running, but is paused at the breakpoint we set on line
  1977.        20.  When you reach a breakpoint, ASIC will position the breakpointed
  1978.        line on the second line of the edit window, highlighted in red (or
  1979.        underlined, if you have a monochrome system). ASIC has interrupted the
  1980.        program before it executed the line with the breakpoint, in this case
  1981.        "END".  Let's take a look at the screen output of the program to see if
  1982.        it worked:
  1983.  
  1984.             TYPE-->        <Alt><r>
  1985.                            <s>
  1986.  
  1987.        Note we could also select the "Swap" function by pressing <F4> without
  1988.        opening a menu.  You should now see the output from the program on the
  1989.        screen.  It should look something like:
  1990.  
  1991.        Original Scores:
  1992.            55    33   877    99    44   101    21    88   105     1
  1993.        Sorting...
  1994.        Here are the sorted scores:
  1995.            33    55    99    44   101    21    88   105     1   877
  1996.  
  1997.        Well, that doesn't look quite right.  Maybe we can use the debugger to
  1998.        figure out what went wrong.  First, let's allow the program to run to
  1999.        completion (remember, we're paused at a breakpoint on the "END"
  2000.        statement).  Swap back to the ASIC screen from the user screen by
  2001.        pressing any key:
  2002.  
  2003.             TYPE-->        <enter>
  2004.  
  2005.        You should see the editor screen again.  Now let's tell ASIC to resume
  2006.        program execution:
  2007.  
  2008.             TYPE-->        <Alt><r>
  2009.                            <r>
  2010.  
  2011.        ASIC has executed the END statement, and our program has terminated.
  2012.        You should see the message "Program Terminated Normally (0)".  (The "0"
  2013.        is the return code set by the program.  You can set return codes in your
  2014.  
  2015.                                        Page - 31
  2016.  
  2017.  
  2018.  
  2019.  
  2020.        programs using the END statement.  Refer to Chapter 7 for details.).
  2021.        Now we'll set another breakpoint in the program.  Move the cursor to
  2022.        line 7 (the status line should now say LINE: 7) using the arrow keys.
  2023.        The cursor should now be positioned on the statement which says:  PRINT
  2024.        "Sorting...".  Set a breakpoint here:
  2025.  
  2026.             TYPE-->        <F9>
  2027.  
  2028.        The source statement should now appear in reverse video.  We used the
  2029.        shortcut key <F9> to set the breakpoint this time, but you could have
  2030.        opened the Run Menu, and selected the Breakpoint option and done the
  2031.        same thing.  Let's remove the breakpoint:
  2032.  
  2033.             TYPE-->        <F9>
  2034.  
  2035.        Line 7 should no longer be highlighted.  The same command is used to
  2036.        turn breakpoints on or off for a source line.  ASIC just checks to see
  2037.        if a breakpoint is already set at that source line when you select the
  2038.        breakpoint command.  If one is set, it "toggles" it off (ie removes it),
  2039.        otherwise, it "toggles" it on (ie sets a breakpoint).  This exercise was
  2040.        just to show you how to remove a breakpoint, let's go ahead and set it
  2041.        again:
  2042.  
  2043.             TYPE-->        <F9>
  2044.  
  2045.        Line 7 should be highlighted again (the breakpoint is set).
  2046.        It might be nice to see what's in some of our program's variables, so
  2047.        let's "watch" some variables.  Open the Run Menu, select the Watch
  2048.        command, and tell ASIC you want to watch variable "I".
  2049.  
  2050.             TYPE-->        <Alt><r>
  2051.                            <w>
  2052.                            i<enter>
  2053.  
  2054.        ASIC should have opened a "Watch" window at the bottom of the screen.
  2055.        You should see the variable name "I" at the left, followed by a ":".
  2056.        Following the ":" is the current value of that variable.  The number
  2057.        there now doesn't really mean anything, since our program is not
  2058.        running.  But once the we start the program, this number should
  2059.        represent the actual value of the variable "I".
  2060.  
  2061.        Let's watch a few more variables: j, j1, and scores(1).  This time,
  2062.        we'll use the shortcut key for the watch command:
  2063.  
  2064.             TYPE-->        <F6>
  2065.                            j<enter>
  2066.  
  2067.        Variable "J" should now be in the watch window.
  2068.  
  2069.             TYPE-->        <F6>
  2070.                            j1<enter>
  2071.  
  2072.        Variable "J1" should now be in the watch window.  When we watch
  2073.        "scores", we'll also have to tell ASIC which element we want to watch by
  2074.        entering a subscript, since "scores" is an array.  First ASIC will
  2075.        prompt you for the variable name.  Type it, without the subscript.  ASIC
  2076.        will prompt you for the numeric subscript.
  2077.  
  2078.                                        Page - 32
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.             TYPE-->        <F6>
  2086.                            scores<enter>
  2087.                            <1><enter>
  2088.  
  2089.        Scores(1) should now be in the watch window.  Now we're ready to run the
  2090.        program again:
  2091.  
  2092.             TYPE-->        <F5>
  2093.  
  2094.        Again we selected the short cut key, you could have selected the "Run
  2095.        your program" option from the "Run" Menu.  The second line of the edit
  2096.        screen should show the PRINT "Sorting..." statement (highlighted in red,
  2097.        or underlined if you have a monochrome monitor).  The variables in the
  2098.        watch window should have the following values:
  2099.  
  2100.             I:    11
  2101.             J:     0
  2102.             J1:     0
  2103.             SCORES(1):    55
  2104.  
  2105.        Let's execute the next statement by using the Trace command:
  2106.  
  2107.             TYPE-->        <Alt><r>
  2108.                            <t>
  2109.  
  2110.        ASIC has executed the PRINT "Sorting..." statement and has paused
  2111.        execution on the "FOR I" statement on line 8 of the program.  Since the
  2112.        PRINT statement did not modify any variables, the numbers in the watch
  2113.        window should remain unchanged.  Let's Trace one more statement, this
  2114.        time, we'll use the short cut key:
  2115.  
  2116.             TYPE-->        <F8>
  2117.  
  2118.        ASIC has executed the "FOR I" statement on line 8, and is now paused on
  2119.        statement "FOR J" on line 9 of the program.  Something looks wrong
  2120.        though.  Even though we executed the first "FOR I" statement, the
  2121.        variable "I" still contains "11".  It should contain "1".  If you look
  2122.        at line 8, you'll see that the FOR statement was mistyped, it reads:
  2123.        "FOR I = I to 9", instead of "FOR I=1 to 9".  Since the program also
  2124.        used variable "I" to READ the data into the array, "I" still contains
  2125.        the value "11".  Since "11" is greater than the "TO" value of the "FOR"
  2126.        loop, the FOR loop on line 8 is executed only 1 time instead of 9 times.
  2127.        That's why the data is not being fully sorted.  With the ASIC debugger,
  2128.        we can continue testing without recompiling, by modifying the value of
  2129.        "I" to "1", so we can see if the rest of our logic is correct.  If
  2130.        changing "I" to "1" works, then we can go back and modify the "FOR"
  2131.        statement and recompile the program to correct the program permanently.
  2132.        Modify the value of "I" to "1":
  2133.  
  2134.             TYPE-->        <Alt><r>
  2135.                            <m>
  2136.                            i<enter>
  2137.                            <1><enter>
  2138.  
  2139.  
  2140.  
  2141.                                        Page - 33
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.        The watch window should now show the value of "I" as 1.  We can resume
  2148.        program execution at this point by selecting the "Run your program"
  2149.        option.  We'll use the short cut key again:
  2150.  
  2151.             TYPE-->        <F5>
  2152.  
  2153.        ASIC should pause the program at the next breakpoint, which is on line
  2154.        20.  This statement contains the "END" command.  Now let's see if the
  2155.        program worked, by swapping to the user screen:
  2156.  
  2157.             TYPE-->        <F4>
  2158.  
  2159.        Again, we used the short cut key.  You should see the following on your
  2160.        screen:
  2161.  
  2162.        Original Scores:
  2163.            55    33   877    99    44   101    21    88   105     1
  2164.        Sorting...
  2165.        Here are the sorted scores:
  2166.             1    21    33    44    55    88    99   101   105   877
  2167.  
  2168.        It looks like the program worked.  Let's return to the editor screen.
  2169.  
  2170.             TYPE-->        <enter>
  2171.  
  2172.        Now we could press <F5> to resume execution and in this case terminate,
  2173.        since the END statement is the next one to execute.  But let's look at
  2174.        another way to terminate a program.  While at a breakpoint, you can
  2175.        select the "Abort your program" option, which instructs ASIC to
  2176.        terminate your program immediately, without executing any more of your
  2177.        program.  Let's try it:
  2178.  
  2179.             TYPE-->        <Alt><r>
  2180.                            <a>
  2181.  
  2182.        ASIC should display the message "Program Terminated Normally (0)".  At
  2183.        this point, we'll just exit from ASIC, but normally, you would fix the
  2184.        FOR statement using the editor, save the file, recompile the program,
  2185.        and retest it to make sure the "bug" is really fixed.
  2186.  
  2187.             TYPE-->        <Alt><f>
  2188.                            <x>
  2189.  
  2190.        You should be back at the DOS prompt now.  That concludes the brief
  2191.        introduction to the ASIC debugger.  The rest of this chapter provides
  2192.        some additional reference material for the debugger.  Chapter 3 provides
  2193.        additional information about each of the debugging commands.
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.                                        Page - 34
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.                                      DEBUGGER TIPS
  2211.  
  2212.        1)  WHEN YOU ARE DONE DEBUGGING YOUR PROGRAM, YOU SHOULD RECOMPILE
  2213.            WITH THE "DEBUGGING CODE" OPTION TURNED OFF. Although your program
  2214.            can run from the DOS command line with debugging code present, it
  2215.            will increase the program size and execution times.  Recompiling
  2216.            with the "Debugging code" option off will insure your programs
  2217.            will be smaller and faster.
  2218.  
  2219.        2)  Remember that the default option on the command line compiler is
  2220.            "Debugging code" off.  The default option in the integrated
  2221.            environment is "Debugging code" on.
  2222.  
  2223.        3)  Breakpoints/Watches are automatically cleared when you
  2224.            OPEN or COMPILE a file.
  2225.  
  2226.        4)  If you change source lines in a program while a program
  2227.            is running, without recompiling, source statements will
  2228.            not match executable code.  Abort the running program
  2229.            and recompile after making code changes.
  2230.  
  2231.        5)  Breakpoints are set in the edit buffer relative to the
  2232.            beginning of the buffer.  If you insert/delete lines in
  2233.            the buffer, the breakpoints will still be set at the
  2234.            same relative line number from the beginning of the
  2235.            buffer.
  2236.  
  2237.        6)  ASIC takes over the INT 3 Interrupt vector for debugging
  2238.            purposes. It re-installs the default vector when you
  2239.            exit ASIC.
  2240.  
  2241.        7)  You must compile with the "Debugging code" option to use
  2242.            source level debugging.
  2243.  
  2244.        8)  If you wish to run a program from the beginning again
  2245.            while its already running,  select the "Abort your
  2246.            program" option from the Run menu.  Then, select the
  2247.            "Run your program" option.
  2248.  
  2249.        9)  If you select the Abort option from the Run menu, your
  2250.            program's files will NOT be closed gracefully.  That
  2251.            is, data in the buffers will not be flushed to disk.
  2252.  
  2253.        10) You may still run a program in the integrated environment that
  2254.            has been compiled without the Debugging code option.  You just
  2255.            won't be able to use the debugging commands (eg,
  2256.            Breakpoints/Watches).
  2257.  
  2258.        11) Toggling a breakpoint on/off will clear any block of
  2259.            text you had previously marked for editing (eg, MOVE,
  2260.            COPY).
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.                                        Page - 35
  2268.  
  2269.  
  2270.  
  2271.  
  2272.                                DEBUGGER TIPS (Continued)
  2273.  
  2274.        12) When modifying array variables, make sure that the
  2275.            subscript you specify is valid.  For example, if you
  2276.            "DIM A(10)", make sure the subscript you specify is in
  2277.            the range of 0 to 10.  ASIC does not check the range of
  2278.            a subscript.  If you specify a subscript that exceeds
  2279.            the valid range for that variable, your program may
  2280.            crash.
  2281.  
  2282.        13) You can pass arguments to programs using the "Arguments"
  2283.            option on the Run Menu.  You may retrieve these options
  2284.            in your program with the COMMAND$ statement.  Using the
  2285.            "Arguments" option is equivalent to specifying arguments
  2286.            following the program name, when you run your program
  2287.            from the DOS command line.
  2288.  
  2289.        14) The compiler allows variable names up to 80 characters in
  2290.            length.  The debugger only uses the first 30 characters of a
  2291.            variable name.  When the debugger finds two variables whose names
  2292.            are not unique within 30 characters, it will always select the
  2293.            first one it finds (this applies to the Watch/Unwatch/Modify
  2294.            Variables commands).
  2295.  
  2296.        15) ASIC will allow you to set a breakpoint on a "FOR" statement.
  2297.            However, you should be aware that the source statement containing
  2298.            the "FOR" is executed only once (to initialize the loop).  When
  2299.            the "NEXT" statement executes, control transfers back to the line
  2300.            following the "FOR", instead of the "FOR".  For example, in the
  2301.            following code fragment:
  2302.  
  2303.             FOR I = 1 TO 3           <---Executes 1 time to initialize loop
  2304.                  PRINT I             <---Executes 3 times
  2305.                  A=A+1               <---Executes 3 times
  2306.             NEXT I                   <---Executes 3 times, loops back to
  2307.                                          "PRINT I", not to "FOR I= 1 TO 3"
  2308.  
  2309.        16)  Because a single machine language instruction could span multiple
  2310.             CODE statements, ASIC does not allow breakpoints on CODE
  2311.             statements.
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.                                        Page - 36
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.                                         A S I C
  2339.  
  2340.                                        Chapter 5
  2341.  
  2342.                              Command Line Compiler Options
  2343.  
  2344.  
  2345.                                   COMMAND LINE SYNTAX
  2346.  
  2347.  
  2348.        Invoke the command line version of the compiler as follows:
  2349.  
  2350.  
  2351.             ASICC filename option1 option2 option3[...optionN]
  2352.  
  2353.                       or
  2354.  
  2355.             ASICC filename.PRJ option1 option2 option3[...optionN]
  2356.  
  2357.  
  2358.             Where:  filename    is the name of the source program or project
  2359.                                 file to be compiled.  Source files must have
  2360.                                 the file extension ".ASI", although the
  2361.                                 extension may be omitted from the command line.
  2362.  
  2363.             filename.PRJ        Project files may be specified instead of a
  2364.                                 source file name.  These have a ".PRJ"
  2365.                                 extension, and the ".PRJ" extension must be
  2366.                                 typed if you want ASIC to use the project file
  2367.                                 for the compile. Specifying a project file
  2368.                                 tells ASIC to look for a project file (created
  2369.                                 by the integrated environment), and use the
  2370.                                 options from this file during the compile.
  2371.                                 ASIC will then strip off the ".PRJ" extension
  2372.                                 and try to compile a file with the same
  2373.                                 filename as the ".PRJ" file, but with a ".ASI"
  2374.                                 extension.
  2375.  
  2376.             optionN             specifies any options desired.  No options are
  2377.                                 required, but more than one can be specified as
  2378.                                 long as you insert a space between each one.
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.                                        Page - 37
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.                                    COMPILER OPTIONS
  2401.  
  2402.  
  2403.  
  2404.        The following compiler switches are currently available for ASIC:
  2405.  
  2406.        Switch    Description
  2407.  
  2408.        B/xxx          BUILD--Use this option to specify the type of output file
  2409.                       ASIC is to produce.  The "xxx" on this option should be
  2410.                       one of the following:
  2411.  
  2412.                       xxx= COM       <--produce .COM file
  2413.                            EXE       <--produce .EXE file
  2414.                            OBJ       <--produce .EXE file via OBJ file
  2415.                                           using DOS LINK command
  2416.                                           optionally linking with
  2417.                                           other OBJ or LIB files.
  2418.  
  2419.                       Default:  ASIC will generate a ".COM" output file.
  2420.  
  2421.  
  2422.        C              CONTINUE--ASIC will not pause after messages are issued,
  2423.                       but will continue compiling.
  2424.  
  2425.                       Default:  ASIC will pause after each error message.
  2426.                       Compilation will resume after you press a key.
  2427.  
  2428.        D              DISKLIST--ASIC will echo all screen messages to a disk
  2429.                       file named "progname.LST".  The format is the same
  2430.                       produced by    PRINTLIST.  This allows you to compile at
  2431.                       higher speed, and print the source listing later from the
  2432.                       disk file via the DOS print spooler.
  2433.  
  2434.                       Default:  ASIC does not produce a ".LST" file.
  2435.  
  2436.  
  2437.        DEC            DECIMAL MATH--ASIC will enable the Decimal Math Option.
  2438.                       When this option is selected, you may specify decimal
  2439.                       numbers (eg, BALANCE@, 123.456789, etc) which can hold
  2440.                       numbers in the range +/-999,999,999,999.99999.  This
  2441.                       option does increase the size of your ".COM" or ".EXE"
  2442.                       file.
  2443.  
  2444.                       Default:  ASIC does not enable the Decimal Math Option.
  2445.  
  2446.  
  2447.        E              EMATH--ASIC will enable the Extended Math Option.  When
  2448.                       this option is selected, you may specify long integers
  2449.                       (eg, VELOCITY&, 123456789&, etc) which can hold a larger
  2450.                       range of values (+2,147,483,647 to -2,147,483,647).  This
  2451.                       option does increase the size of your ".COM" or ".EXE"
  2452.                       file by a couple of hundred bytes.
  2453.  
  2454.                       Default:  ASIC does not enable the Extended Math Option.
  2455.  
  2456.                                        Page - 38
  2457.  
  2458.  
  2459.  
  2460.  
  2461.                              COMPILER OPTIONS (Continued)
  2462.  
  2463.  
  2464.        Switch    Description
  2465.  
  2466.        L              LIST ALL--ASIC will list each source line as it compiles
  2467.                       it.
  2468.  
  2469.                       Default:  ASIC will list only source lines with compile
  2470.                       errors.
  2471.  
  2472.                       Comment:  Use of this switch will slow compile speeds
  2473.                       slightly due to the additional screen I/O.
  2474.  
  2475.  
  2476.        LIB=xxx        LINK LIBRARY--Specifies libraries that ASIC should pass
  2477.                       to the DOS LINKer.  This option is ONLY used by ASIC when
  2478.                       you compile with the "B/OBJ" option.  It is ignored when
  2479.                       you compile with the "B/COM" or "B/EXE" options.  A link
  2480.                       library is usually used to store commonly used
  2481.                       subroutines in OBJECT format.  You can create assembly
  2482.                       language subroutines for ASIC, and store them in a
  2483.                       library using the Borland TLIB Program or the Microsoft
  2484.                       LIB Program.  The "xxx" should specify one or more
  2485.                       library file specs with each library spec separated with
  2486.                       a "+" character.  See the "Mixed Language Programming"
  2487.                       chapter of the ASIC manual for more information.
  2488.  
  2489.                       Examples:
  2490.  
  2491.                            LIB=C:\ASIC\MATH.LIB
  2492.  
  2493.                            LIB=C:\DOS\MISC.LIB+C:\LIB\COMMON
  2494.  
  2495.                       The first example shows a single library spec for
  2496.                       MATH.LIB library.  The second example shows how to
  2497.                       include more than one library--MISC.LIB and COMMON.LIB
  2498.                       libraries.
  2499.  
  2500.                       Comments:  When specifying libraries, you may omit the
  2501.                       file extension, if it is ".LIB".
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.                                        Page - 39
  2520.  
  2521.  
  2522.  
  2523.  
  2524.                              COMPILER OPTIONS (Continued)
  2525.  
  2526.  
  2527.        Switch    Description
  2528.  
  2529.  
  2530.        LNK=xxx        LINKer LOCATION--Specifies the location of the DOS
  2531.                       LINK.EXE program to ASIC.  This option is ONLY used when
  2532.                       compiling with the "B/OBJ" option. Unless the LINK.EXE
  2533.                       which is provided with MS DOS is located in the default
  2534.                       ASIC directory, ASIC may not be able to locate the
  2535.                       program, and will thus be unable to LINK your program to
  2536.                       create a ".EXE" file.  The LINK.EXE should be included on
  2537.                       your MS DOS distribution disks (if it is not already in
  2538.                       your DOS directory). "xxx" should specify a file path.
  2539.                       For more information on this option see the "Mixed
  2540.                       Languages Programming" Chapter of the ASIC Manual.
  2541.  
  2542.                       Example:
  2543.  
  2544.                            LNK=C:\DOS3
  2545.  
  2546.                       Default:  By default, ASIC will attempt to locate the
  2547.                       linker in the default directory.  If it can't find the
  2548.                       LINK.EXE file there, it tries to find it under the
  2549.                       "C:\DOS" directory.  If it can't find it there, it gives
  2550.                       up and issues an error message.
  2551.  
  2552.  
  2553.        OBJ=xxx        ADDITIONAL OBJECT FILES--Specifies a list of additional
  2554.                       object files that ASIC should link with the main object
  2555.                       file.  This option is ONLY used by ASIC when you are
  2556.                       compiling with the "B/OBJ" option.  You do not need to
  2557.                       include the name of your ASIC program here, that is done
  2558.                       automatically by ASIC.  When you compile with this
  2559.                       option, ASIC creates an OBJ file which can be linked
  2560.                       using the DOS LINKer.  Optionally, you can included "CALL
  2561.                       SUB" statements in your program which reference
  2562.                       separately compiled OBJ files.  This option allows you to
  2563.                       pass other object file names to the DOS LINKer to resolve
  2564.                       these external references.  The "xxx" parameter should
  2565.                       include file specs for one or more object files with a
  2566.                       "+" character separating each object file.  See the
  2567.                       "Mixed Language Programming" Chapter of the ASIC Manual
  2568.                       for more details.
  2569.  
  2570.                       Examples:
  2571.  
  2572.                            OBJ=C:\ASIC\MYSUB.OBJ
  2573.                            OBJ=C:\LIB\SUB1.OBJ+C:\OBJ\SUB2
  2574.  
  2575.                       The first example specifies a single object to be passed
  2576.                       to the linker.  The second example illustrates two object
  2577.                       files: SUB1.OBJ and SUB2.OBJ.
  2578.  
  2579.                       Comments:  The file extension may be omitted if it is
  2580.                       ".OBJ".
  2581.  
  2582.                                        Page - 40
  2583.  
  2584.  
  2585.  
  2586.  
  2587.                              COMPILER OPTIONS (Continued)
  2588.  
  2589.  
  2590.        Switch    Description
  2591.  
  2592.  
  2593.        P              PRINTLIST--ASIC will echo all messages which appear on
  2594.                       the screen to the printer. Output to the printer will be
  2595.                       paged with header lines identifying the program name, and
  2596.                       the date/time compiled.
  2597.  
  2598.                       Default:  ASIC will not send any messages to the printer
  2599.  
  2600.                       Comments: Even though output to the printer is buffered,
  2601.                       this option will slow compile speeds considerably.  The
  2602.                       compiler typically compiles only as fast as your printer
  2603.                       can print the messages.  An alternative to this switch is
  2604.                       the DISKLIST option.
  2605.  
  2606.  
  2607.        S              SYMTAB--ASIC will produce a formatted Symbol Table in a
  2608.                       file named "progname.SYM".  The symbol table contains a
  2609.                       list of all variables, labels, and internally created
  2610.                       compiler addresses.
  2611.  
  2612.                       Default:  ASIC does not produce a ".SYM" file.
  2613.  
  2614.  
  2615.        STK=n          STACK SIZE--Specifies the size of the stack that you wish
  2616.                       ASIC to create.  This option is ignored when you are
  2617.                       using the "B/COM" option.  "n" equals the size of the
  2618.                       stack you want in bytes.
  2619.  
  2620.                       Default:  By default, ASIC sets the stack size to 2000
  2621.                       bytes (4000 bytes if you are compiling with debugging
  2622.                       mode).
  2623.  
  2624.                       Examples:
  2625.  
  2626.                            STK=512
  2627.  
  2628.                       In the above example, the stack size would be set to 512
  2629.                       bytes.
  2630.  
  2631.                       Comments:  The default stack sizes that ASIC provides are
  2632.                       normally adequate, however, they may be larger than your
  2633.                       program may need.  If you are interested in minimizing
  2634.                       your program's memory usage, you may experiment with the
  2635.                       STK option, however, setting the size too small can cause
  2636.                       unpredictable results.  This option is recommended only
  2637.                       for experienced ASIC users.  The stack size must be in
  2638.                       the range 16 to 32767.  ASIC will not allow you to create
  2639.                       a stack size smaller than 4000 bytes when compiling with
  2640.                       debugging mode on.  If you specify a smaller value in
  2641.                       this instance, ASIC will override it with a size of 4000.
  2642.  
  2643.  
  2644.  
  2645.                                        Page - 41
  2646.  
  2647.  
  2648.  
  2649.  
  2650.                              COMPILER OPTIONS (Continued)
  2651.  
  2652.  
  2653.        Switch    Description
  2654.  
  2655.        X              DEBUG--ASIC will generate debugging code in the ".COM" or
  2656.                       ".EXE" file and a ".DBG" file for use by the integrated
  2657.                       environment debugger.
  2658.  
  2659.                       Default:  ASIC does not generate debugging information.
  2660.  
  2661.                       Comment:  If you are running from the integrated
  2662.                       environment, ASIC sets this option on by default.  You
  2663.                       may turn it off in the Compile menu, should you so
  2664.                       desire.
  2665.  
  2666.  
  2667.                                    COMPILE EXAMPLES
  2668.  
  2669.  
  2670.        Example 1:     Compile "MYFILE.ASI" with default compiler options:
  2671.  
  2672.  
  2673.                       ASICC MYFILE
  2674.  
  2675.  
  2676.        Example 2:     Compile "MYPROG.ASI", Listing all source lines, writing a
  2677.                       compile listing to a disk file for printing later.  The
  2678.                       listing file will be called "MYPROG.LST":
  2679.  
  2680.                       ASICC MYPROG L D
  2681.  
  2682.  
  2683.        Example 3:     Compile "FILEX.ASI", don't pause for any errors, and
  2684.                       print the errors on the printer:
  2685.  
  2686.                       ASICC FILEX C P
  2687.  
  2688.  
  2689.        Example 4:     Compile "CRUNCH.ASI" and allow long (32 bit) integer
  2690.                       numbers:
  2691.  
  2692.                       ASICC CRUNCH E
  2693.  
  2694.  
  2695.        Example 5:     Compile "BIGPROG.ASI" and create a ".EXE" format output
  2696.                       file:
  2697.  
  2698.                       ASICC BIGPROG B/EXE
  2699.  
  2700.        Example 6:     Compile "SAMPLE.ASI" and create a ".EXE" format output
  2701.                       file, with a stack size of 2500 bytes.
  2702.  
  2703.                       ASICC SAMPLE B/EXE STK=2500
  2704.  
  2705.  
  2706.  
  2707.  
  2708.                                        Page - 42
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.                              COMPILE EXAMPLES (Continued)
  2716.  
  2717.        Example 7:     Here's a more complex example, which demonstrates the
  2718.                       use of the B/OBJ build options.  Assume we have a program
  2719.                       called "MAIN.ASI" which calls three assembly language
  2720.                       subroutines, called "A", "B", and "C".  Subroutine "A" is
  2721.                       stored in file "A.OBJ".  Subroutines "B" and "C" are
  2722.                       stored in a library called "ASMSUB.LIB".  The DOS
  2723.                       LINK.EXE file is contained in the subdirectory "C:\UTIL".
  2724.                       Here is the ASICC command to compile MAIN.ASI and link in
  2725.                       the subroutines called using "CALL SUB" in the MAIN.ASI
  2726.                       program:
  2727.  
  2728.                       ASICC MAIN B/OBJ OBJ=A LIB=ASMSUB LNK=C:\UTIL
  2729.  
  2730.  
  2731.                                  PROGRAM PROJECT FILE
  2732.  
  2733.             The ASIC integrated environment automatically stores compile
  2734.        options for each program in a file called "progname.PRJ".  Whenever you
  2735.        compile from the integrated editor, ASIC will always check for this
  2736.        file, and set compile options based on the file.
  2737.  
  2738.             Since MS DOS has a restriction of 128 characters for a command
  2739.        line, you may find it useful to use the integrated environment to set
  2740.        your compile options for a program, even if you are not using the
  2741.        environment for editing.  This is especially true when you are using the
  2742.        "B/OBJ" option, where you frequently may be passing many parameters.
  2743.        Then, you may type the program project file name instead of the program
  2744.        source file name when compiling from the command line and ASIC will use
  2745.        the options from the ".PRJ" file for that compile.
  2746.  
  2747.             You may still specify additional compile line options when
  2748.        compiling using the ".PRJ" file option.  In this case, the option from
  2749.        the command line will override any corresponding option from the ".PRJ"
  2750.        file.
  2751.  
  2752.             Although the ".PRJ" file is a standard DOS text file, it is
  2753.        recommended that you not edit this file using a text editor--if
  2754.        incorrectly modified, compiler results may be unpredictable.
  2755.  
  2756.             Example:
  2757.  
  2758.                  ASICC myfile.prj LIB=NEWLIB
  2759.  
  2760.             In this example, all options set in the "MYFILE.PRJ" file will be
  2761.        read and used by the ASIC command line compiler, except for the "LIB"
  2762.        option which was specified on the command line.  For this compile, ASIC
  2763.        will set the LIB option to "NEWLIB" irregardless of what the LIB option
  2764.        was set to in the project file.  ASIC will then try to compile a source
  2765.        file called "MYFILE.ASI".
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.                                        Page - 43
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.                                         A S I C
  2780.  
  2781.                                        Chapter 6
  2782.  
  2783.                                    Language Elements
  2784.  
  2785.  
  2786.  
  2787.                                      CHARACTER SET
  2788.  
  2789.  
  2790.        Symbol         Description
  2791.  
  2792.          *            Multiplication
  2793.                       Example: A=B*C  (multiply B by C, store result in A)
  2794.  
  2795.          /            Division
  2796.                       Example: A=B/C  (divide B by C, store result in A)
  2797.  
  2798.          +            Addition
  2799.                       Example: A=B+C  (add C to B, store result in A)
  2800.  
  2801.          +            String Concatenation
  2802.                       Example: A$="AB"+"C"   (A$ will contain "ABC")
  2803.  
  2804.          =            Assignment
  2805.                       Example: A=1    (A will be assigned the value 1)
  2806.  
  2807.          =            Equality testing
  2808.                       Example: IF A=1 THEN QUIT:  (If the value stored in
  2809.                            A equals 1 goto label QUIT)
  2810.  
  2811.          <            Less than testing
  2812.                       Example:  IF A<1 THEN QUIT:  (If the value stored in
  2813.                            A is less than 1 goto label QUIT)
  2814.  
  2815.          >            Greater than testing
  2816.                       Example:  IF A<1 THEN QUIT:  (If the value stored in
  2817.                            A is greater than 1 goto label QUIT)
  2818.  
  2819.          -            Subtraction
  2820.                       Example: A=B-C   (Subtract C from B, store result in A)
  2821.  
  2822.          "            String Delimiter
  2823.                       Example: A$="the string is inside quote marks"
  2824.  
  2825.          ()           Parenthesis -- Ignored by ASIC
  2826.  
  2827.          ;            Suppress Carriage Return/Line Feed with PRINT/LPRINT
  2828.  
  2829.          #            Used to identify file usage with PRINT#/INPUT#
  2830.  
  2831.  
  2832.  
  2833.  
  2834.                                        Page - 44
  2835.  
  2836.  
  2837.  
  2838.  
  2839.                                CHARACTER SET (Continued)
  2840.  
  2841.        Symbol         Description
  2842.  
  2843.          ,            Comma,  Ignored by ASIC
  2844.  
  2845.          $            Distinguishes a String Variable from an Integer.
  2846.                       Example:    ABC$   <---- String Variable
  2847.                       Example:    ABC    <---- Integer Variable
  2848.  
  2849.          :            Distinguishes a Label from a variable name.
  2850.                       Example:    START:    <---Label name
  2851.  
  2852.          &            Distinguishes a "long" (32 bit) integer from a normal
  2853.                       integer (16 bit) variable or constant.  Normal integers
  2854.                       can hold numbers in the range +32,767 to -32,767.  Long
  2855.                       integers can hold numbers in the range +2,147,483,647
  2856.                       to -2,147,483,647.  Note:  You must compile with the
  2857.                       "Extended Math" Option enabled to use long integers.
  2858.                       Example:    APPLES&   <--Long Integer Variable
  2859.                       Example:    ORANGES   <--Normal Integer Variable
  2860.                       Example:    123457&   <--Long Integer Constant
  2861.                       Example:    1234      <--Short Integer Constant
  2862.  
  2863.          @            Distinguishes a "decimal" (64 bit) variable or constant
  2864.                       from a normal integer (16 bit) variable or constant.
  2865.                       Decimal numbers can be in the range
  2866.                       +999,999,999,999.99999 to -999,999,999,999.99999.  Note:
  2867.                       You must compile with the "Decimal Math" option enabled
  2868.                       to use decimal numbers.
  2869.                       Example:  APPLES@   <--Decimal Variable
  2870.                       Example:  1234.567  <--Decimal Constant
  2871.                       Example:  123@      <--Decimal Constant
  2872.                       Example:  1.2@      <--Decimal Constant
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.                                        Page - 45
  2898.  
  2899.  
  2900.  
  2901.  
  2902.                            CONSTANTS, VARIABLES, AND LABELS
  2903.  
  2904.  
  2905.        ASIC supports the following data types:
  2906.  
  2907.             Decimal Constants        Integer Constants
  2908.             Decimal Variables        Integer Variables
  2909.             Decimal Arrays           Integer Arrays
  2910.  
  2911.             String Constants         Long Integer Constants
  2912.             String Variables         Long Integer Variables
  2913.             String Arrays            Long Integer Arrays
  2914.  
  2915.  
  2916.        Integer constants may be specified in decimal (base 10), hexidecimal
  2917.        (base 16), or binary (base 2).  The following describes the restrictions
  2918.        for each data type.
  2919.  
  2920.        DECIMAL CONSTANTS   Range     +999,999,999,999.99999 to
  2921.                                      -999,999,999,999.99999
  2922.  
  2923.                            Example:        105.1
  2924.  
  2925.        DECIMAL VARIABLE    Described by a variable name beginning with a
  2926.                            letter, followed by up to 78 additional letters
  2927.                            or numbers, terminated with an "@" symbol.  It
  2928.                            may contain a number in the range of
  2929.                            +/-999,999,999,999.99999
  2930.  
  2931.                            Example:       INTEREST@
  2932.  
  2933.        DECIMAL ARRAY       Described by a variable name beginning with a
  2934.                            letter, followed by up to 78 additional letters
  2935.                            or numbers, terminated by an "@" symbol.  This
  2936.                            is followed by an integer variable or constant
  2937.                            for the dimension of the array.  Arrays must be
  2938.                            dimensioned at the beginning of the program.  See
  2939.                            the DIM statement.
  2940.  
  2941.                            Example:       SALES@(YEAR)
  2942.  
  2943.        INTEGER CONSTANTS   Range  +32767 to -32767
  2944.  
  2945.                            Example:       -26
  2946.  
  2947.        INTEGER VARIABLE    Described by a variable name beginning with a
  2948.                            letter, followed by up to 79 additional letters
  2949.                            or numbers.  It may contain a number in the range
  2950.                            +32767 to -32767.
  2951.  
  2952.                            Example:       VELOCITY1
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.                                        Page - 46
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.                      CONSTANTS, VARIABLES, AND LABELS (Continued)
  2968.  
  2969.        INTEGER ARRAY       Described by a variable name beginning with a
  2970.                            letter, followed by up to 79 additional letters
  2971.                            or numbers.  This name is followed by an
  2972.                            integer variable or constant for the dimension
  2973.                            of the array.  Arrays must be dimensioned at the
  2974.                            beginning of the program.  See the DIM statement.
  2975.  
  2976.                            Example:       GROWTH (YEAR)
  2977.  
  2978.        LONG INTEGER        Range  +2,147,483,647 to -2,147,483,647
  2979.        CONSTANTS
  2980.                            Example:       3234457&
  2981.  
  2982.        LONG INTEGER        Described by a variable name beginning with a
  2983.        VARIABLE            letter, followed by up to 78 additional letters or
  2984.                            numbers terminated with a "&".  Can contain
  2985.                            numbers in the range +2,147,483,647 to
  2986.                            -2,147,483,647.
  2987.  
  2988.                            Example:       VELOCITY1&
  2989.  
  2990.        LONG INTEGER        Described by a variable name beginning with a
  2991.        ARRAY               letter, followed by up to 78 additional letters or
  2992.                            numbers, terminated with a "&".  This name is
  2993.                            followed by an integer variable or constant for
  2994.                            the dimension of the array.  Arrays must be
  2995.                            dimensioned at the beginning of the program.
  2996.                            See the DIM statement.
  2997.  
  2998.                            Example:       GALAXY& (BILLIONSOF)
  2999.  
  3000.        HEXIDECIMAL         Hexidecimal constants are constants which are
  3001.        CONSTANT            stated in base 16 instead of base 10 like normal
  3002.                            constants.  These may be specified wherever you
  3003.                            can specify a integer constant.  Hexidecimal
  3004.                            constants in ASIC must be prefixed by "&hex". This
  3005.                            prefix should be immediately followed by a valid
  3006.                            normal or long integer constant.  Hex constants
  3007.                            may contain up to 8 hexidecimal digits for long
  3008.                            constants, and 4 hexidecimal digits for normal
  3009.                            constants.
  3010.  
  3011.                            Example:  &hexB000   <--equivalent to -20400
  3012.  
  3013.                            Example:  &hexB&     <--equivalent to 11&
  3014.  
  3015.                            Example:  &hexFFFFFFFF&  <--equivalent to -1&
  3016.  
  3017.                            Example:  &hexB000&  <--equivalent to 45056&
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.                                        Page - 47
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.                      CONSTANTS, VARIABLES, AND LABELS (Continued)
  3031.  
  3032.        BINARY CONSTANT     Binary constants are constants which are stated in
  3033.                            base 2 instead of base 10 like normal constants.
  3034.                            These may be specified wherever you can specify a
  3035.                            integer constant.  Binary constants in ASIC must
  3036.                            be prefixed by "&bin".  This prefix should be
  3037.                            immediately followed by a valid normal or long
  3038.                            integer constant.  Binary constants may contain
  3039.                            up to 32 binary digits for long constants or 16
  3040.                            binary digits for normal constants.
  3041.  
  3042.                            Example:  &bin10         <--equivalent to 2
  3043.  
  3044.                            Example:  &bin10101011&  <--equivalent to 171&
  3045.  
  3046.        STRING CONSTANT     A group of 0-80 characters enclosed by quotation
  3047.                            marks.
  3048.  
  3049.                            Example:       "This is a String Constant"
  3050.  
  3051.        STRING VARIABLE     Described by a variable name which begins with a
  3052.                            letter, followed by up to 78 additional
  3053.                            letters or numbers, terminated with a "$".
  3054.                            Can contain 0-80 characters.
  3055.  
  3056.                            Example:       ADDRESS$
  3057.  
  3058.        STRING ARRAY        Described by a variable name which begins with a
  3059.                            letter, followed by up to 78 additional letters or
  3060.                            numbers, followed by a $, followed by an integer
  3061.                            variable or constant enclosed in parenthesis
  3062.                            representing the subscript.  Arrays must be
  3063.                            dimensioned at the beginning of the program.
  3064.                            See the DIM statement.
  3065.  
  3066.  
  3067.                            Example:       STATE$(50)
  3068.  
  3069.        LABEL               A Label is a location in your program you wish
  3070.                            to transfer to.  It must begin with a letter,
  3071.                            and it may contain up to 78 additional letters
  3072.                            or numbers.  It must be terminated with a ":".
  3073.  
  3074.                            Example:       START:
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.                                        Page - 48
  3087.  
  3088.  
  3089.  
  3090.  
  3091.                                 VARIABLES VS. CONSTANTS
  3092.  
  3093.  
  3094.        In general, ASIC will allow the use of either variables, arrays, or
  3095.        constants as operands to any program statement.  For example:
  3096.  
  3097.  
  3098.                       PRINT CASH
  3099.                       PRINT 20
  3100.                       PRINT A(10)
  3101.  
  3102.        All three of the above examples are valid.  The only case where a
  3103.        constant cannot be used, is where the value is being modified.  For
  3104.        example:
  3105.  
  3106.                  A = A + B           <----VALID
  3107.                  17 = A + C          <----INVALID
  3108.  
  3109.        Of course you must specify the correct data type for the ASIC keyword.
  3110.        For example:
  3111.  
  3112.                  A = ABS("HELLO")    <----INVALID
  3113.  
  3114.  
  3115.        This statement is invalid because you cannot take the absolute value of
  3116.        a string!
  3117.  
  3118.        There are a few ASIC statements which will accept only integer constants
  3119.        for some operands (DIM, OPEN, PRINT#, INPUT#).  Refer to the individual
  3120.        statement for more information.
  3121.  
  3122.        There is a restriction on the use of subscripts for Arrays.  A subscript
  3123.        for an array cannot be another array,.  For example:
  3124.  
  3125.  
  3126.                  A(I(1))             <----INVALID
  3127.                  A(I)                <----VALID
  3128.  
  3129.        Finally, decimal variables or constants cannot be used as subscripts:
  3130.  
  3131.                  A@(1.1)             <----INVALID
  3132.                  A@(B@)              <----INVALID
  3133.                  A@(1)               <----VALID
  3134.                  A@(A)               <----VALID
  3135.                  A@(A&)              <----VALID
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.                                        Page - 49
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.         CONVERSION BETWEEN NUMERIC FORMATS (INTEGER, LONG INTEGER AND DECIMAL)
  3158.  
  3159.  
  3160.        Decimal numbers, long integers, or normal integers may be used on any
  3161.        ASIC statement in any combination.  Consequently, in the "Keyword
  3162.        Reference" Chapter of this is manual, operands are identified only as
  3163.        "number".  "Number" in this context should be interpreted as meaning
  3164.        that the operand for that statement can be any of the following: integer
  3165.        constant, integer variable, integer array, long integer constant, long
  3166.        integer variable, long integer array, decimal constant, decimal
  3167.        variable, or decimal array.  Exceptions, if any, are noted in the
  3168.        documentation for the statement.
  3169.  
  3170.        If you do mix decimal number, long integers, or regular integers in a
  3171.        statement, you should be aware of how ASIC converts between the formats.
  3172.        The following rules apply:
  3173.  
  3174.             1)  If a long integer variable or constant is being stored in a
  3175.                 normal integer variable, the long integer (32 bit) number 
  3176.                 will ALWAYS convert correctly to a normal integer (16 bit) 
  3177.                 value provided the long integer variable contains a number
  3178.                 which will fit in a normal integer (ie, within the range of
  3179.                 +32767 to -32767).  If, however, the number is outside of
  3180.                 this range, ASIC will truncate it to make it fit in a normal
  3181.                 integer.  This truncation will cause some surprising (but
  3182.                 predictable) answers.  For example if "A&" contained the
  3183.                 value "50000&", and the following ASIC statement was executed
  3184.                 "A=A&", then the value of "A" would be "-15536".  The reason
  3185.                 that the overflow results in such a strange number is due to
  3186.                 the way the IBM PC stores numbers in binary format and is too
  3187.                 complicated to describe here.  The important thing
  3188.                 to remember is, for ASIC to convert from long integers to
  3189.                 normal integers correctly, the value in the long integer
  3190.                 should be in the range of +32767 to -32767.
  3191.  
  3192.             2)  If a normal integer variable or constant is being stored in
  3193.                 a long integer variable, ASIC will always convert the number
  3194.                 correctly.
  3195.  
  3196.             3)  If a decimal number is stored in a normal or long integer, the
  3197.                 fractional component of the number will be discarded, and the
  3198.                 remaining integer value will be stored in the normal or long
  3199.                 integer.  The result will be truncated if necessary to fit.
  3200.                 For example, after the statement "A=12345.67890" is executed,
  3201.                 variable "A" would contain the value "12345".  As another
  3202.                 example, after the statement, "A=50000.12345" is executed,
  3203.                 variable "A" would contain the value "-15536".  The reason
  3204.                 that the overflow results in such a strange number is due to
  3205.                 the way the IBM PC stores numbers in binary format and is too
  3206.                 complicated to describe here.  The important thing
  3207.                 to remember is, for ASIC to convert from decimal numbers to
  3208.                 integers correctly, the value of the decimal number should be
  3209.                 within the range for the target variable type.
  3210.  
  3211.  
  3212.                                        Page - 50
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.             4)  If a long or normal integer is stored in a decimal variable,
  3219.                 ASIC will always convert the number correctly.
  3220.  
  3221.             5)  IMPORTANT NOTE:  When performing math with a mixture of decimal
  3222.                 and integer variables, ASIC automatically converts the operands
  3223.                 to the storage type of the result BEFORE computing the result,
  3224.                 and the math function called will be based on the variable type
  3225.                 of the result.  GWBASIC/BASICA floating point, on the other
  3226.                 hand, converts the operands to the most precise format of the
  3227.                 operand types to the RIGHT of the equal sign and compute the
  3228.                 results based on the longest type to the right of the equal
  3229.                 sign, before scaling the result.  This can be illustrated with
  3230.                 the following examples:
  3231.  
  3232.                  ASIC                     GWBASIC/BASICA
  3233.  
  3234.                  A@=2*2.6 = 5.2           A#=2%*2.6 = 5.2
  3235.                  B=2*2.6= 4               B%=2%*2.6 = 5
  3236.                  B&=500 * 500=250000      B&=500% * 500%= OVERFLOW
  3237.                  B&=500& * 500&=250000    B&=500& * 500&=250000
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.                                        Page - 51
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.                                         A S I C
  3283.  
  3284.                                        Chapter 7
  3285.  
  3286.                                    Keyword Reference
  3287.  
  3288.  
  3289.  
  3290.  
  3291.                                           ABS
  3292.  
  3293.        Format:        number1 = ABS (number2)
  3294.  
  3295.        Description:
  3296.  
  3297.             This function returns the absolute value of number2 which is then
  3298.        stored in number1.
  3299.  
  3300.        Example:
  3301.  
  3302.                  A = ABS (-7)
  3303.  
  3304.        After execution of this statement, "A" will contain 7.
  3305.  
  3306.  
  3307.  
  3308.                                           ASC
  3309.  
  3310.        Format:        number1 = ASC (string1)
  3311.  
  3312.        Description:
  3313.  
  3314.             This function returns the ASCII value of the first character of
  3315.        string1, storing the result in number1.
  3316.  
  3317.        Example:
  3318.  
  3319.                  A = ASC("123")
  3320.  
  3321.        After execution of this statement "A" would contain 49, which the is
  3322.        ASCII value of "1".
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.                                        Page - 52
  3339.  
  3340.  
  3341.  
  3342.  
  3343.                                          BEEP
  3344.  
  3345.        Format:        BEEP
  3346.  
  3347.        Description:
  3348.  
  3349.             This statement will cause a short "beep" to be produced on the PC
  3350.        speaker.
  3351.  
  3352.        Example:
  3353.  
  3354.                  IF A>99 THEN
  3355.                       BEEP
  3356.                       PRINT "Number is too big!"
  3357.                       A=99
  3358.                  ENDIF
  3359.  
  3360.        The preceding program fragment will check to see if variable "A"
  3361.        contains a value less than 100.  If it does not, it will produce a short
  3362.        "beep", display a message, and set the value of "A" to 99.
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.                                        Page - 53
  3402.  
  3403.  
  3404.  
  3405.  
  3406.                                          BLOAD
  3407.  
  3408.        Format:        BLOAD string1, number1, number2
  3409.  
  3410.        Description:
  3411.  
  3412.             This function loads data previously saved by BSAVE from a file to
  3413.        memory.  String1 should be the name of the file previously created by
  3414.        BSAVE.  Number1 should be the memory offset to load the data to.
  3415.        Number2 should be the number of bytes to read from the file (in the
  3416.        range of 1 to 32767).  If DEFSEG has been set, it will be used as the
  3417.        data segment, otherwise, the default ASIC data segment will be used.
  3418.  
  3419.        Example:
  3420.  
  3421.                  DEFSEG = &hexB800
  3422.                  BLOAD "SAVED.DAT" 0 100
  3423.  
  3424.        After execution of these statements 100 bytes will be read from the file
  3425.        "SAVED.DAT" and stored in memory start at 0 bytes from the start of the
  3426.        override data segment (which in this case happens to point to the
  3427.        beginning of video memory for a CGA card).  Assuming a CGA card was
  3428.        present, the first 50 characters on the screen would contain data read
  3429.        from the file (don't forget that each screen character is represented by
  3430.        two bytes data and attribute, that's why only 50 characters will be
  3431.        displayed, assuming you are not in graphics mode).
  3432.  
  3433.        Comments:
  3434.  
  3435.             THIS FUNCTION IS RECOMMENDED ONLY FOR ADVANCED PROGRAMMERS.  THIS
  3436.        STATEMENT WILL ALLOW YOU TO OVERLAY ANY AREA OF MEMORY, AND IT IS VERY
  3437.        EASY TO ACCIDENTALLY OVERLAY YOUR PROGRAM OR THE MEMORY USED BY DOS.
  3438.  
  3439.             If ASIC detects an error executing this command, it will set the
  3440.        system ERROR variable.  These error codes are listed in the Error
  3441.        Messages Chapter of the ASIC Manual
  3442.  
  3443.             This statement is slightly different from GWBASIC/BASICA in that
  3444.        you must specify how many bytes to read from the file.  Also, the memory
  3445.        offset is not stored in the file by BSAVE, so you must specify the
  3446.        offset as number1 in ASIC.  Offset is optional in GWBASIC/BASICA.
  3447.  
  3448.             ASIC uses a slightly different file format than GWBASIC/BASICA,
  3449.        however, it is relatively easy to convert the GWBASIC/BASICA to ASIC
  3450.        format.  GWBASIC/BASICA files have a seven byte header that ASIC does
  3451.        not have.  If you strip off these 7 bytes and rewrite the file, ASIC
  3452.        should be able to process the file.
  3453.  
  3454.        See also:
  3455.  
  3456.             DEFSEG,BSAVE
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.                                        Page - 54
  3465.  
  3466.  
  3467.  
  3468.  
  3469.                                          BSAVE
  3470.  
  3471.        Format:        BSAVE string1, number1, number2
  3472.  
  3473.        Description:
  3474.  
  3475.             This statement writes the block of memory beginning at offset
  3476.        number1 from the start of the data segment for a length of number2 bytes
  3477.        to the file specified by string1.  This data may be later loaded by
  3478.        BLOAD.  If DEFSEG has been set, it will be used as the data segment,
  3479.        otherwise, the default ASIC data segment will be used.
  3480.        Number2 should be in the range of 1 to 32767.
  3481.  
  3482.        Example:
  3483.  
  3484.                  DEFSEG = &hexB800
  3485.                  BSAVE "SAVED.DAT" 0 4000
  3486.  
  3487.        After execution of these statements 4000 bytes at offset 0 bytes from
  3488.        the start of the override data segment (which in this case happens to
  3489.        point to the beginning of video memory for a CGA card) will be written
  3490.        to the file "SAVED.DAT".  Assuming a CGA card was present, the current
  3491.        screen would be saved to disk, assuming you are not in graphics mode.
  3492.  
  3493.        Comments:
  3494.  
  3495.             If ASIC detects an error executing this command, it will set the
  3496.        system ERROR variable.  These error codes are listed in the Error
  3497.        Messages Chapter of the ASIC Manual.
  3498.  
  3499.        See also:
  3500.  
  3501.             DEFSEG,BLOAD
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.                                        Page - 55
  3528.  
  3529.  
  3530.  
  3531.  
  3532.                                          CALL
  3533.  
  3534.        Format:        CALL (string1,string2)                       <-Format 1
  3535.                       CALL SUB (stringconstant1,[arg1,...,argN])   <-Format 2
  3536.  
  3537.        Description:
  3538.  
  3539.             Depending on the format that you select, this statement can be used
  3540.        to perform two different functions.  Format 1 is used to load and
  3541.        execute another program (in .EXE, .COM format).  Format 2 is used when
  3542.        you have compiled a subroutine in a .OBJ file, and wish to incorporate
  3543.        this routine in an ASIC program, and CALL it as a subroutine.  Notice
  3544.        the difference between these two approaches.  In format 1, execution of
  3545.        your ASIC program is suspended, and a new .EXE or .COM file is loaded
  3546.        from disk and executed.  When the .EXE or .COM program terminates, your
  3547.        ASIC program resumes execution.  With format 2, however, the subroutine
  3548.        itself is bound into your ASIC program with the DOS linker, so that when
  3549.        you call it, no disk access is required, and the overhead of the call is
  3550.        much lower.
  3551.  
  3552.             When using format 1, this statement can be used to load and execute
  3553.        other programs compiled with ASIC or another compiler.  String1
  3554.        represents the name of the program to execute.  String2 contains any
  3555.        arguments to be passed to the program (it may be NULL, ie "").  If an
  3556.        error occurs when ASIC attempts to call the program, it will set the
  3557.        system ERROR variable to 255.  Otherwise, the ERROR variable will be set
  3558.        to the value of the return code of the called program (which is 0 unless
  3559.        the called program specifies otherwise).
  3560.  
  3561.             Format 2 is used to call a separately compiled subroutine, that
  3562.        uses the BASIC (or PASCAL) parameter passing conventions.  You could use
  3563.        this to call a subroutine that you had written in assembler.  When using
  3564.        this format,  you must compile using the OBJ output option.  ASIC will
  3565.        produce an OBJ format output file, that can be linked with the standard
  3566.        DOS linker.  When you compile within the integrated environment, ASIC
  3567.        automatically calls the DOS linker for you, when the OBJ option is
  3568.        selected.  With this format, stringconstant1 must be a string constant
  3569.        that contains the name of the subroutine to be called.  The remaining
  3570.        fields (arg1 through argN) are optional, but if specified, they must be
  3571.        variables or constants.  These arguments will be passed to the called
  3572.        subroutine using the stack.  These arguments will be passed "by
  3573.        reference", which means that a pointer to the variable will be passed,
  3574.        instead of the value contained in the variable.  This means that the
  3575.        subroutine you call can modify the values of the ASIC variables passed.
  3576.  
  3577.        (See Chapter 10, Mixed Language Programming, of the ASIC manual, for
  3578.        more information on using format 2).
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.                                        Page - 56
  3591.  
  3592.  
  3593.  
  3594.  
  3595.                                    CALL (Continued)
  3596.  
  3597.        Example 1: (format 1)
  3598.  
  3599.                  CALL ("MYPROG.COM","")
  3600.                  REM other code follows
  3601.  
  3602.        This statement would cause ASIC to load and execute the program
  3603.        "MYPROG.COM".  No arguments will be passed to the program.  When MYPROG
  3604.        terminates, the calling program will regain control on the line
  3605.        following the call, in this case the "REM" statement.
  3606.  
  3607.        Example 2: (format 1)
  3608.  
  3609.                  CALL ("COMMAND.COM"," /C WP.BAT")
  3610.  
  3611.        In this example, a ".BAT" type file is executed called "WP.BAT".  To run
  3612.        ".BAT" files, it is necessary to load a copy of COMMAND.COM as shown
  3613.        above (COMMAND.COM contains the DOS code required to load and execute
  3614.        ".BAT" files).  Using this format, you can also run some "built in" DOS
  3615.        commands such as DIR or SORT.  Using CALL with this format, is similar
  3616.        to using the GWBASIC/BASICA SHELL command.
  3617.  
  3618.        Example 3: (format 2)
  3619.  
  3620.                  CALL SUB ("mysub",A,A$,1)
  3621.  
  3622.        In this example, a subroutine "mysub" is being called.  Three arguments
  3623.        are being passed to the subroutine, "A", "A$" and "1".  You must set the
  3624.        compiler output option to OBJ, and specify "MYSUB.OBJ" in the LINK
  3625.        options subroutine list.  The arguments will be passed to the subprogram
  3626.        on the stack in the order:   A,A$,1.
  3627.  
  3628.  
  3629.        Comments:
  3630.  
  3631.             Format 1:
  3632.  
  3633.             When using format 1, string1 must contain the FULL pathname of the
  3634.        program (ie,"\directory\progname.COM") only if the program is NOT in the
  3635.        current directory.  You must include the file extension on the file name
  3636.        (for example, use "MYPROG.COM" instead of just "MYPROG", or use
  3637.        "MYPROG.EXE" instead of "MYPROG").
  3638.  
  3639.             If you wish to pass arguments to the program build it as follows:
  3640.  
  3641.                  YOURPARM$ = "arguments"
  3642.                  N = LEN(YOURPARM$)
  3643.                  A$ = CHR$(N)
  3644.                  A$ = A$ + YOURPARM$
  3645.                  B$ = CHR$(13)
  3646.                  A$ = A$ + B$
  3647.                  CALL "progname" a$
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.                                        Page - 57
  3654.  
  3655.  
  3656.  
  3657.  
  3658.                                    CALL (Continued)
  3659.  
  3660.             The above creates an argument list according to the strict DOS
  3661.        calling rules, however, you can just create the arguments in a string,
  3662.        and precede them with a leading space.  This will work for arguments up
  3663.        to 32 characters in length (space character is ASCII 32).  You might
  3664.        want to try this short cut first, and only resort to the full formal
  3665.        approach if you have problems with it, or need to specify longer
  3666.        arguments:
  3667.  
  3668.                  CALL "progname" " arguments"
  3669.  
  3670.             It is recommended (but not required) that you compile your program
  3671.        using the EXE format (instead of the COM format) when your program uses
  3672.        format 1, since an EXE program will release more memory when calling the
  3673.        program.  This will allow you to call a slightly larger program than is
  3674.        possible with the COM format.
  3675.  
  3676.             Format 2:
  3677.  
  3678.             When using format 2 , the following considerations apply.  First,
  3679.        remember that the arguments you pass to the subroutine must match the
  3680.        arguments the subroutine expects to receive.  For example, if you pass a
  3681.        single integer to the subroutine, the subroutine had better expect to
  3682.        receive a single integer, or the results will be unpredictable.  Second,
  3683.        since all arguments are passed by reference, all arguments can be
  3684.        modified by the called routine.  Be aware that if you pass a constant
  3685.        such as "1" to the routine and it modifies the value to "2", that ASIC
  3686.        will now use the value "2" for the constant value of "1" wherever "1" is
  3687.        referenced your program.  For example, suppose you wrote a subroutine
  3688.        called ADD that added the value of argument 2 to the value of argument 1
  3689.        and stored the result in argument 1:
  3690.  
  3691.                  CALL SUB ("ADD", 1,33)
  3692.                  PRINT "1=";
  3693.                  PRINT 1
  3694.                  END
  3695.  
  3696.                       Program output is:
  3697.  
  3698.                            1=34
  3699.  
  3700.        Instead, you would want to code the program as follows:
  3701.  
  3702.  
  3703.                  A=1
  3704.                  CALL SUB ("ADD",A,1)
  3705.                  PRINT "A=";
  3706.                  PRINT A
  3707.                  PRINT "1=";
  3708.                  PRINT 1
  3709.                  END
  3710.  
  3711.                       Program output is:
  3712.  
  3713.                            A=34
  3714.                            1=1
  3715.  
  3716.                                        Page - 58
  3717.  
  3718.  
  3719.  
  3720.  
  3721.                                    CALL (Continued)
  3722.  
  3723.        CAUTION:
  3724.  
  3725.             IF YOU CALL A ".BAT" FILE AND DO NOT LOAD A COPY OF COMMAND.COM,
  3726.        THE RESULTS ARE UNPREDICTABLE (SEE ABOVE FOR AN EXAMPLE OF HOW TO CALL
  3727.        BAT FILE).
  3728.  
  3729.             You may use the debugger with programs which contain "CALL"
  3730.        statements.  However, the programs you call should not themselves
  3731.        contain debugging code.  For example, if A.ASI calls B.ASI, then make
  3732.        sure you compile B.ASI with the "Debugging Code" option OFF before you
  3733.        try to debug program A.ASI.  Failure to do so will cause the debugger to
  3734.        behave erratically.  This also applies to programs you write using other
  3735.        compilers, since they also use the same interrupt as ASIC (INT 3).
  3736.  
  3737.        See also:
  3738.  
  3739.             RUN,COMMAND$
  3740.  
  3741.  
  3742.  
  3743.                                          CHDIR
  3744.  
  3745.        Format:        CHDIR string1
  3746.  
  3747.        Description:
  3748.  
  3749.             This statement will change the current directory to that specified
  3750.        in string1.  If an error occurs when ASIC executes this command, it will
  3751.        set the System ERROR variable.  A list of possible error codes is listed
  3752.        in the Error Messages Chapter of the ASIC Manual.
  3753.  
  3754.        Example:
  3755.  
  3756.             CHDIR "\DOS"
  3757.             IF ERROR = 0 THEN NOERROR:
  3758.  
  3759.        If Drive "C" was the current drive, then this statement would change the
  3760.        current directory to "C:\DOS".
  3761.  
  3762.             CHDIR "C:\DOS"
  3763.  
  3764.        This statement would change the current directory on drive C to "C:\DOS"
  3765.        whether or not drive C is the current drive. It would NOT change the
  3766.        default drive to "C".  Note that DOS retains a current directory for
  3767.        each disk drive on your computer.
  3768.  
  3769.        See also:
  3770.  
  3771.             MKDIR, RMDIR
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.                                        Page - 59
  3780.  
  3781.  
  3782.  
  3783.  
  3784.                                          CHR$
  3785.  
  3786.        Format:        string1 = CHR$(number1)
  3787.  
  3788.        Description:
  3789.  
  3790.             This function converts an integer in the range of 0-255 to an
  3791.        ASCII character, and stores in string1.
  3792.  
  3793.        Example:
  3794.  
  3795.                  A$ = CHR$(49)
  3796.  
  3797.        After execution of this statement, "A$" will contain "1", since "1" is
  3798.        represented by ASCII 49.
  3799.  
  3800.        Comments:
  3801.  
  3802.                  If number1 is outside the range 0-255, then the least
  3803.        significant byte of the integer is converted to string1.
  3804.  
  3805.  
  3806.  
  3807.                                          CLOSE
  3808.  
  3809.        Format:        CLOSE number1
  3810.  
  3811.        Description:
  3812.  
  3813.             This function closes the file number identified by number1.  If an
  3814.        error is returned by DOS, the system variable "ERROR" will be > 0.
  3815.  
  3816.        Example:
  3817.  
  3818.                  CLOSE 1
  3819.                  IF ERROR > 0 THEN CHECKERROR:
  3820.  
  3821.        After successful execution of the CLOSE statement, the file previously
  3822.        opened as file 1 will be closed.  If an error is returned by DOS, the
  3823.        ERROR variable will be set by ASIC to a non-zero value.
  3824.  
  3825.        Comments:
  3826.  
  3827.             IF YOU FAIL TO CLOSE AN OPEN FILE (WHICH WAS OPENED FOR WRITING),
  3828.        YOU MAY LOSE DATA, SINCE FILE I/O IS BUFFERED, AND THE LAST BUFFER MAY
  3829.        NOT HAVE BEEN FLUSHED.
  3830.  
  3831.             Also, number1 may only be a constant with the value of 1-3.
  3832.  
  3833.        See Also:
  3834.  
  3835.             OPEN,PRINT#,INPUT#
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.                                        Page - 60
  3843.  
  3844.  
  3845.  
  3846.  
  3847.                                           CLS
  3848.  
  3849.        Format:        CLS
  3850.  
  3851.        Description:
  3852.  
  3853.             This function clears the screen.
  3854.  
  3855.        Example:
  3856.  
  3857.             CLS
  3858.  
  3859.        After execution of the above statement, the screen will be cleared.
  3860.  
  3861.  
  3862.  
  3863.                                          CODE
  3864.  
  3865.        Format:        CODE number1[,number2...numberN]
  3866.  
  3867.        Description:
  3868.  
  3869.             This function may be used to insert machine language code directly
  3870.        into your program.  Number1 through numberN should be integer constants
  3871.        in the range of 0-255.  At least one number must be specified, however,
  3872.        ASIC will allow up to 30 per CODE statement.
  3873.  
  3874.        Example:
  3875.                  CODE 205,5
  3876.  
  3877.        This statement represent the machine code generated from the assembly
  3878.        language statement "INT 5".  INT 5 is the BIOS routine which will print
  3879.        the screen to the printer.  After execution of these statements in your
  3880.        program, the current screen contents would be printed on your printer.
  3881.  
  3882.        Comments:
  3883.  
  3884.             THIS STATEMENT IS INTENDED FOR ADVANCED PROGRAMMERS.  THIS
  3885.        STATEMENT IS VERY POWERFUL, AND IF YOU DON'T UNDERSTAND MACHINE LANGUAGE
  3886.        YOU COULD EASILY CRASH YOUR PROGRAM.
  3887.  
  3888.             When you use this statement, be sure to save the contents of the
  3889.        following 8088 registers if you plan to modify them, and restore them
  3890.        before returning to ASIC.  Otherwise the results may be unpredictable.
  3891.        Registers:  DS/CS/ES/SS.  Also, make sure you clean up the stack before
  3892.        you return (ie, if you push a value to the stack, make sure you pop it
  3893.        before you return to ASIC)  Failure to do so, will almost certainly
  3894.        cause your program to crash.
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.                                        Page - 61
  3906.  
  3907.  
  3908.  
  3909.  
  3910.                                          COLOR
  3911.  
  3912.        Format:        COLOR number1,number2
  3913.  
  3914.        Description:
  3915.  
  3916.             This function is used to set the foreground and background screen
  3917.        colors.  The foreground color is specified in number1, the background
  3918.        color in number2.
  3919.  
  3920.                       Valid Colors:       Foreground     Background
  3921.                                           ----------     ----------
  3922.                       Black                    0              0
  3923.                       Blue                     1              1
  3924.                       Green                    2              2
  3925.                       Cyan                     3              3
  3926.                       Red                      4              4
  3927.                       Magenta                  5              5
  3928.                       Brown                    6              6
  3929.                       White                    7              7
  3930.                       Dark Gray                8
  3931.                       Light Blue               9
  3932.                       Light Green              10
  3933.                       Light Cyan               11
  3934.                       Light Red                12
  3935.                       Light Magenta            13
  3936.                       Yellow                   14
  3937.                       Bright White             15
  3938.  
  3939.                  Note:   Colors 8-15 when specified for background color
  3940.                            result in blinking text.
  3941.  
  3942.        Example:
  3943.  
  3944.                  COLOR 4,8
  3945.  
  3946.        After execution of this statement, future characters written to the
  3947.        screen will be Blinking Red on a Black Background.
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.                                        Page - 62
  3969.  
  3970.  
  3971.  
  3972.  
  3973.                                        COMMAND$
  3974.  
  3975.        Format:        string1 = COMMAND$
  3976.  
  3977.        Description:
  3978.  
  3979.             This statements retrieves any command line arguments that were
  3980.        entered and stores them in string1.
  3981.  
  3982.        Example:
  3983.                  If your program was invoked with:       MYPROG XXX
  3984.  
  3985.                  And if your program MYPROG.ASI contained the following:
  3986.  
  3987.                       A$=COMMAND$
  3988.                       A$=LTRIM$(A$)
  3989.                       IF A$="" THEN
  3990.                            PRINT "Enter File Name ";
  3991.                            INPUT A$
  3992.                       ENDIF
  3993.                       OPEN "I", 1, A$
  3994.  
  3995.  
  3996.             The above example would open file "XXXX" for input.  If the user
  3997.        had invoked the program by typing "MYPROG" with no parameters, then the
  3998.        program would prompt for the file name to open.
  3999.  
  4000.        Comments:
  4001.  
  4002.             In the integrated environment, you can specify command line
  4003.        arguments on the "Run" Menu.
  4004.  
  4005.             This statement is an extension over BASICA/GWBASIC.
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.                                        Page - 63
  4032.  
  4033.  
  4034.  
  4035.  
  4036.                                         COMSTAT
  4037.  
  4038.        Format:        number1 = COMSTAT (number2)
  4039.  
  4040.        Description:
  4041.  
  4042.             This statement returns the status of a com port.  Number2 should
  4043.        contain "0" for COM1, or "1" for COM2.  The status of that COM port is
  4044.        returned in number1.  Each bit in number1 represents a different piece
  4045.        of information.  These are described in the table below.  Note that you
  4046.        may test if a bit is on/off using the ZBIT command.
  4047.  
  4048.        Example:
  4049.  
  4050.             PORTSTAT = COMSTAT (0)
  4051.             DATAREADY = ZBIT(8,PORTSTAT)
  4052.             IF DATAREADY = 1 THEN GORECEIVE:
  4053.  
  4054.        These statements do the following.  The first retrieves the status of
  4055.        COM1 to the variable PORTSTAT.  The second checks to see if bit 8 is on,
  4056.        DATAREADY will contain 1 if so, otherwise it will contain 0.  Since Bit
  4057.        8 is used to determine if data is waiting to be received from the port,
  4058.        if DATAREADY = 1 then the program will transfer to the label GORECEIVE:
  4059.        which would contain code to RECEIVE data from the port.
  4060.  
  4061.        Comments:
  4062.  
  4063.             Status Codes Returned by COMSTAT (Meaning when set to 1)
  4064.  
  4065.             Bit 0     Delta clear-to-send
  4066.                 1     Delta data-set-ready
  4067.                 2     Trailing-edge ring detector
  4068.                 3     Delta receive line signal detect
  4069.                 4     Clear-to-send
  4070.                 5     Data-set-ready
  4071.                 6     Ring Indicator
  4072.                 7     Received line signal detect
  4073.                 8     Data Ready
  4074.                 9     Overrun error
  4075.                10     Parity error
  4076.                11     Framing error
  4077.                12     Break-detect error
  4078.                13     Transfer holding register empty
  4079.                14     Transfer shift-register empty
  4080.                15     Time-out error
  4081.  
  4082.  
  4083.        See also:
  4084.  
  4085.             OPENCOM,SEND,RECEIVE
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.                                        Page - 64
  4095.  
  4096.  
  4097.  
  4098.  
  4099.                                         CSRLIN
  4100.  
  4101.        Format:        number1 = CSRLIN
  4102.  
  4103.        Description:
  4104.  
  4105.             This function returns row of the cursor.
  4106.  
  4107.        Example:
  4108.  
  4109.                       LOCATE 10,20
  4110.                       A = CSRLIN
  4111.  
  4112.        The locate command will have positioned the cursor in row 10, column 20.
  4113.        After execution of the CSRLIN statement, "A" will contain the value of
  4114.        10.
  4115.  
  4116.        See also:
  4117.  
  4118.             POS
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.                                        Page - 65
  4158.  
  4159.  
  4160.  
  4161.  
  4162.                                          DATA
  4163.  
  4164.        Format:        DATA constant1[,constant2,...,constantn]
  4165.  
  4166.        Description:
  4167.  
  4168.             This statement is used store integer, decimal and string constants
  4169.        in memory for later retrieval by READ statements.  At least one constant
  4170.        must be specified, although multiples of each type are permitted.
  4171.  
  4172.        Example:
  4173.  
  4174.             DATA 1,"APPLE",2&,"ORANGES",1.2345
  4175.  
  4176.  
  4177.             READ A
  4178.             READ A$
  4179.             READ B&
  4180.             READ B$
  4181.             READ C@
  4182.  
  4183.        The above statements are equivalent of entering the following code:
  4184.  
  4185.             A=1
  4186.             A$="APPLE"
  4187.             B&=2&
  4188.             B$="ORANGES"
  4189.             C@=1.2345
  4190.  
  4191.        Comments:
  4192.  
  4193.             All DATA Statements must be placed at the beginning of the program,
  4194.        before all other statement types, except DIM or REM statements (or blank
  4195.        lines).  DIM statements, if specified, must precede all other statements
  4196.        including DATA statements except REM statements (or blank lines).  As
  4197.        long as you follow these rules, you may specify an unlimited number of
  4198.        DATA statements.
  4199.  
  4200.             GWBASIC/BASICA does not require quotes around string constants in
  4201.        some instances.  ASIC always requires quotes around string constants.
  4202.  
  4203.        See also:
  4204.  
  4205.             READ,RESTORE
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.                                        Page - 66
  4221.  
  4222.  
  4223.  
  4224.  
  4225.                                          DATE$
  4226.  
  4227.        Format:        string1 = DATE$
  4228.  
  4229.        Description:
  4230.  
  4231.             This function returns the value of the system date in the format of
  4232.        "MM-DD-YYYY".
  4233.  
  4234.        Example:
  4235.  
  4236.             A$=DATE$
  4237.             PRINT A$
  4238.  
  4239.        After executing these statements, the date stored in the PC
  4240.         System Clock will be displayed on the screen.
  4241.  
  4242.  
  4243.        Comments:
  4244.  
  4245.  
  4246.             Note:  if the date printed is wrong, you have probably not set the
  4247.        system clock.  Most older XTs and PCs do not have a battery to preserve
  4248.        the DATE and TIME in the system clock, so you have to set them each time
  4249.        you power up the PC.  Most ATs and newer PCs have a battery backup, so
  4250.        that the date is preserved for you.
  4251.  
  4252.             Unlike GWBASIC/BASICA, you cannot set the system date with DATE$,
  4253.        however, you can set the system date from DOS by typing DATE.
  4254.  
  4255.        See also:
  4256.  
  4257.             TIME$, TIMER
  4258.  
  4259.  
  4260.  
  4261.                                         DEFSEG
  4262.  
  4263.        Format:        DEFSEG = number1
  4264.  
  4265.             This function is used to alter the default data segment used when
  4266.        peeking and poking data with PEEK and POKE statements.  DEFSEG, PEEK,
  4267.        and especially POKE are not recommended for beginners.  If number1 =-1,
  4268.        then the data segment address is set back to the ASIC default data
  4269.        segment address.
  4270.  
  4271.        Example:
  4272.  
  4273.             DEFSEG = -1
  4274.  
  4275.        Execution of the above statement would reset the default data segment to
  4276.        the default ASIC data segment.
  4277.  
  4278.        See also:
  4279.  
  4280.             PEEK, POKE, BLOAD, BSAVE
  4281.  
  4282.  
  4283.                                        Page - 67
  4284.  
  4285.  
  4286.  
  4287.  
  4288.                                           DIM
  4289.  
  4290.        Format:        DIM variable(integer1)
  4291.  
  4292.  
  4293.        Description:
  4294.  
  4295.             This statement will create one dimensional arrays.  An integer,
  4296.        decimal or string variable name must be specified in variable.  Integer1
  4297.        contains the number of elements in the array.
  4298.  
  4299.        Example:
  4300.  
  4301.                  DIM A(10)
  4302.                  DIM A&(20)
  4303.                  DIM A$(5)
  4304.                  DIM A@(3)
  4305.  
  4306.        In this example an array of 10 normal integer variables is defined, an
  4307.        array of 20 long integer variables is defined, an array of 5 string
  4308.        variables is defined and an array of 3 decimal variables is defined.
  4309.  
  4310.        Comments:
  4311.  
  4312.             On the DIM statement, number1 may only be a constant.  Also, DIM
  4313.        statements must appear before all other statement types in the program
  4314.        except REM statements (or blank lines).
  4315.  
  4316.  
  4317.  
  4318.                                           END
  4319.  
  4320.        Format:        END [(number1)]
  4321.  
  4322.        Description:
  4323.  
  4324.             This statement causes your program to terminate and return to DOS,
  4325.        optionally setting a return code.  Number1 may be optionally specified
  4326.        to set the return code.  If omitted, ASIC uses a return code of zero by
  4327.        default.
  4328.  
  4329.        Example:
  4330.  
  4331.                  END
  4332.  
  4333.        In this example, the program will terminate and return to DOS with a
  4334.        return code of zero.
  4335.  
  4336.                  END (20)
  4337.  
  4338.        In this example, the program will terminate and return to DOS with a
  4339.        return code of "20".
  4340.  
  4341.        Comments:
  4342.  
  4343.             The optional return code is an extension over GWBASIC/BASICA.
  4344.  
  4345.  
  4346.                                        Page - 68
  4347.  
  4348.  
  4349.  
  4350.  
  4351.                                        ENVIRON$
  4352.  
  4353.        Format:        string1 = ENVIRON$(number1)
  4354.  
  4355.        Description:
  4356.  
  4357.             This statement will retrieve DOS environment strings.  Number1
  4358.        identifies which string to retrieve.  If found, the string is placed in
  4359.        string1.  If not found, a NULL string (length=0) is stored in string1.
  4360.  
  4361.        Example:
  4362.  
  4363.             FOR I=1 TO 5
  4364.                  A$=ENVIRON$(I)
  4365.                  PRINT A$
  4366.             NEXT I
  4367.  
  4368.        The above example will retrieve the first five DOS environment strings
  4369.        and display them.
  4370.  
  4371.        Comments:
  4372.  
  4373.             If the requested DOS environment string entry is greater than 80
  4374.        characters in length, ASIC will truncate it at 80 characters.
  4375.        Environment strings may be set in DOS using the SET command.
  4376.        Environment strings are one way of passing information to your program.
  4377.        Refer to your MS DOS Manual for more information.  Common uses of this
  4378.        command are to retrieve the user's PATH statement, or the COMSPEC
  4379.        variable.
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.                                        Page - 69
  4410.  
  4411.  
  4412.  
  4413.  
  4414.                                         FILEPOS
  4415.  
  4416.        Format:        number1 = FILEPOS (number2,number3)    <--Format 1
  4417.                       number1 = FILEPOS (number2,EOF)        <--Format 2
  4418.                       number1 = FILEPOS (number2,CURRENT)    <--Format 3
  4419.  
  4420.        Description:
  4421.  
  4422.             This statement is used to set or retrieve the read/write position
  4423.        for files opened in Random mode.  In all three formats, number2 is the
  4424.        file number of the file.  This file number must have been previously
  4425.        opened for Random mode by the OPEN statement.  Format 1 is used to set
  4426.        the current read/write position of the file specified by number2.
  4427.        Number3 should be the offset (in bytes) from the start of the file.
  4428.        Format 2 is used to set a read/write position of a random file to the
  4429.        end of the file.  Format 3 is used to retrieve the current read/write
  4430.        position (as a byte offset from the beginning of the file) of the file.
  4431.        In all cases, if an error occurs, the system ERROR variable will be set.
  4432.        A list of these codes is contained in the Error Codes Chapter of the
  4433.        ASIC Manual.  If no error occurs, then number1 will be set to the
  4434.        current read/write position of the file.
  4435.  
  4436.        Example 1:
  4437.  
  4438.             A&=FILEPOS(1, 100)
  4439.  
  4440.        This example assumes that file 1 was previously opened for RANDOM I/O
  4441.        using the OPEN statement.  After execution of this statement, the
  4442.        read/write position of file number 1 will be set to 100.  Subsequent
  4443.        PRINT # statements would write to the file starting at position 101.
  4444.  
  4445.        Example 2:
  4446.  
  4447.             A&=FILEPOS(1,EOF)
  4448.  
  4449.        This example assumes that file 1 was previously opened for RANDOM I/O
  4450.        using the OPEN statement.  After execution of this statement, the
  4451.        read/write position of file number 1 will be set to the end of the file.
  4452.        Subsequent PRINT # operations to this file will result in data being
  4453.        appended to this file.
  4454.  
  4455.        Example 3:
  4456.  
  4457.             A&=FILEPOS(1,CURRENT)
  4458.  
  4459.        This example assumes that file 1 was previously opened for RANDOM I/O
  4460.        using the OPEN statement.  After execution of this statement, the
  4461.        current read/write position of file number 1 will retrieved and stored
  4462.        in A&.  The read/write position of file number 1 will NOT be altered
  4463.        after execution of this statement.
  4464.  
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.                                        Page - 70
  4473.  
  4474.  
  4475.  
  4476.  
  4477.                                   FILEPOS (Continued)
  4478.  
  4479.        Comments:
  4480.  
  4481.             If you wish to use this command with files larger than 32767 bytes,
  4482.        you should use long integer or decimal numbers with this statement.  If
  4483.        you set the read/write position past the physical end of file and
  4484.        attempt to read from the file, you will receive an error on the INPUT#
  4485.        command.  If you set the read/write position past the end of file and
  4486.        issue a PRINT# command, the data will be correctly written at the
  4487.        position you specified.
  4488.  
  4489.        See also:
  4490.  
  4491.             OPEN, INPUT#, PRINT#, CLOSE
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.  
  4515.  
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.                                        Page - 71
  4536.  
  4537.  
  4538.  
  4539.  
  4540.                                          FIND
  4541.  
  4542.        Format:        string1=FIND FIRST (string2,number1)
  4543.                       string1=FIND CONTINUE
  4544.  
  4545.        Description:
  4546.  
  4547.             The FIND command is used to search the current file directory for
  4548.        file(s) which match a search string.  This command has two versions.
  4549.        FIND FIRST must be used to establish a new search and retrieve the first
  4550.        matching file name.  Thereafter, the FIND CONTINUE will retrieve
  4551.        additional file names which match the search string.  When performing
  4552.        the FIND FIRST, string2 should contain the full or partial file name to
  4553.        be searched for.  This string can be up to 8 alphanumeric characters
  4554.        optionally followed by a period and up to 3 alphanumeric characters for
  4555.        the file extension.  Standard DOS wild cards "*" and "?" may be included
  4556.        in the search string.  Number1 is used to specify a file attribute.  If
  4557.        number1 is "0", then all normal files in the directory will be searched.
  4558.        (A normal file is one in which the hidden, system, volume label, or
  4559.        directory attribute bit is NOT set).  Setting various bits (see table
  4560.        below) of number1 ON will expand the search to include normal files,
  4561.        plus those whose attributes have been specified in number1.  If a
  4562.        matching file name is found, then it will be stored in string1.  If an
  4563.        error occurs, then the system ERROR variable will be set.  A list of
  4564.        ERROR codes is contained in the ERROR code chapter of the ASIC Manual.
  4565.        After the initial FIND FIRST has been performed, you may search for
  4566.        additional files which match the search string and attribute by issuing
  4567.        a FIND CONTINUE statement.
  4568.  
  4569.        Search Attributes bits (number1)
  4570.        --------------------------------
  4571.  
  4572.        BIT
  4573.  
  4574.        0    Not Used
  4575.        1    Hidden
  4576.        2    System
  4577.        3    Volume Label
  4578.        4    Subdirectory
  4579.        5-7  Not Used
  4580.  
  4581.        Note that these attributes can all be specified simultaneously.  For
  4582.        example, to specify both hidden and system, use an attribute value of
  4583.        &bin00000110 (in binary) or 6 (in decimal).
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.                                        Page - 72
  4599.  
  4600.  
  4601.  
  4602.  
  4603.                                    FIND (Continued)
  4604.  
  4605.        Example:
  4606.  
  4607.                  SEARCH$="*.ASI"
  4608.                  ATTRIB=0
  4609.                  FILENAME$=FIND FIRST (SEARCH$,ATTRIB)
  4610.                  IF ERROR>0 THEN DONE:
  4611.                  PRINT A$
  4612.             LOOP:FILENAME$=FIND CONTINUE
  4613.                  IF ERROR>0 THEN DONE:
  4614.                  PRINT A$
  4615.                  GOTO LOOP
  4616.             DONE: PRINT "ALL MATCHING FILES DISPLAYED"
  4617.             END
  4618.  
  4619.        After execution of the above statements, all of the files with a file
  4620.        extension of ".ASI" in the current directory will be displayed on the
  4621.        screen.
  4622.  
  4623.        Comments:
  4624.  
  4625.             If you execute a FIND CONTINUE without executing a FIND FIRST, then
  4626.        the results are unpredictable.  Additional information is retrieved by
  4627.        the FIND command besides the file name.  Advanced programmers can also
  4628.        find additional information using the PEEK command starting at offset
  4629.        149 (from the default ASIC data segment).  Do not modify this data.  If
  4630.        you do so, the results are unpredictable.
  4631.  
  4632.  
  4633.        Additional File Information
  4634.        ---------------------------
  4635.  
  4636.        Address   Size (bytes)   Description
  4637.  
  4638.  
  4639.        149       1              File Attribute
  4640.        150       2              File Time Stamp
  4641.        152       2              File Date Stamp
  4642.        154       4              File Size (bytes)
  4643.  
  4644.  
  4645.        See also:
  4646.  
  4647.             NAME, KILL, GETDIR, CHDIR, MKDIR, RMDIR
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.                                        Page - 73
  4662.  
  4663.  
  4664.  
  4665.  
  4666.                                        FOR/NEXT
  4667.  
  4668.        Format:        FOR number1 = number2 to number3
  4669.                       NEXT number1
  4670.  
  4671.        Description:
  4672.  
  4673.             These two statements are used to create a loop, so that you can
  4674.        execute a portion of your program a certain number of times.  All of the
  4675.        code between the FOR and the NEXT statement will be executed a certain
  4676.        number of times, but at least once.  The actual number of times the loop
  4677.        executes is dependent on number1/number2/number3. When the FOR statement
  4678.        is encountered in your program, number1 is assigned the value of
  4679.        number2.  Then the statements up to the matching NEXT statement is
  4680.        executed one time.  Then, 1 is added to number1, and number1 is compared
  4681.        to number3.  If number1 is greater than number3 then the control passes
  4682.        to the statement following NEXT.  Otherwise, the program loops back up
  4683.        to the statement following the FOR statement.
  4684.  
  4685.        Example:
  4686.  
  4687.                  FOR I = 1 TO 2
  4688.                       FOR J = 3 TO 5
  4689.                            PRINT I;
  4690.                            PRINT J
  4691.                       NEXT J
  4692.                  NEXT I
  4693.                  PRINT "AFTER THE LOOP";
  4694.                  PRINT I;
  4695.                  PRINT J;
  4696.  
  4697.        Execution of this section of code would result in the following
  4698.        printout:
  4699.  
  4700.                  1    3
  4701.                  1    4
  4702.                  1    5
  4703.                  2    3
  4704.                  2    4
  4705.                  2    5
  4706.                  AFTER THE LOOP    3    6
  4707.  
  4708.        Comments:
  4709.  
  4710.             Unlike BASICA/GWBASIC, ASIC FOR/NEXT loops execute at least 1 time.
  4711.        For example, the value "HELLO" will be printed in the following example.
  4712.        It wouldn't have been in BASICA/GWBASIC.
  4713.  
  4714.                  FOR I = 1 TO 0
  4715.                       PRINT "HELLO"
  4716.                  NEXT I
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.                                        Page - 74
  4725.  
  4726.  
  4727.  
  4728.  
  4729.                                  FOR/NEXT (Continued)
  4730.  
  4731.             Unlike GWBASIC/BASICA, arrays may be used for number1 and number2.
  4732.        However, if number3 is an array, element zero will be used, regardless
  4733.        of the subscript you specify.
  4734.  
  4735.             Loops which range from a negative to positive number are not
  4736.        supported (for performance reasons).  Such loops will terminate after 1
  4737.        iteration.  For example, "FOR I =-10 to 10" will loop once.
  4738.  
  4739.             ASIC will allow you to modify the value of number3, while
  4740.        GWBASIC/BASICA ignores changes.
  4741.  
  4742.                  J=1
  4743.                  FOR I=1 TO J
  4744.                       J=2
  4745.                  NEXT I
  4746.  
  4747.             The above loop will execute one time in GWBASIC/BASICA, but it will
  4748.        execute two times in ASIC.
  4749.  
  4750.             Also note:  The storage type of number3 must be the same as
  4751.        number1.  For example, if "number1" is a decimal variable, then
  4752.        "number3" must be a decimal variable--it may not be an integer variable.
  4753.  
  4754.  
  4755.  
  4756.                                         GETDIR
  4757.  
  4758.        Format:        string1=GETDIR (number1)
  4759.  
  4760.        Description:
  4761.  
  4762.             This statement is used to retrieve the current DOS directory.
  4763.        Number1 should be set to "0" to obtain the directory for the current
  4764.        drive, "1" for the "A" drive, "2" for the "B" drive, etc.  If the
  4765.        statement is unsuccessful, the system ERROR variable will be set.  A
  4766.        complete list of ERROR codes is contained in the Error Code Chapter of
  4767.        the ASIC Manual.  The directory string will be stored in string1.  The
  4768.        directory string will not contain the drive letter, or the first "\".
  4769.        Thus, if the current directory on the specified drive was "C:\ASIC",
  4770.        then GETDIR would return "ASIC".  If the current directory was the root
  4771.        (eg, "C:\"), then GETDIR would return a NULL string ("").
  4772.  
  4773.        Example:
  4774.  
  4775.             A$=GETDIR(0)
  4776.  
  4777.        After execution of this statement, the variable A$ will contain the name
  4778.        of current directory on the current disk drive.
  4779.  
  4780.        See also:
  4781.  
  4782.             FIND, MDKIR, RMDIR, CHDIR
  4783.  
  4784.  
  4785.  
  4786.  
  4787.                                        Page - 75
  4788.  
  4789.  
  4790.  
  4791.  
  4792.                                          GOSUB
  4793.  
  4794.        Format:        GOSUB label1
  4795.  
  4796.        Description:
  4797.  
  4798.             This statement "calls" a subroutine called "label1".  This
  4799.        subroutine must contain a "RETURN".  After the subroutine is executed,
  4800.        control is returned to the next statement following the GOSUB.
  4801.  
  4802.        Example:
  4803.  
  4804.                  GOSUB PRINTIT:
  4805.                  PRINT "All Done!"
  4806.                  END
  4807.                  PRINTIT:  PRINT "It"
  4808.                  RETURN
  4809.  
  4810.        After execution of this code the screen would contain:
  4811.  
  4812.                  It
  4813.                  All Done!
  4814.  
  4815.  
  4816.  
  4817.                                          GOTO
  4818.  
  4819.        Format:        GOTO label1
  4820.  
  4821.        Description:
  4822.  
  4823.             This statement transfers program execution to the statement
  4824.        identified by label1.
  4825.  
  4826.        Example:
  4827.  
  4828.                  GOTO SKIPIT:
  4829.                  PRINT "YOU'LL NEVER GET HERE"
  4830.                  SKIPIT: PRINT "ALL DONE!"
  4831.  
  4832.        After execution of this code, the screen will appear as follows:
  4833.  
  4834.                  ALL DONE!
  4835.  
  4836.        Note that the first print statement never executes because of the GOTO.
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.                                        Page - 76
  4851.  
  4852.  
  4853.  
  4854.  
  4855.                                   IF/THEN/ELSE/ENDIF
  4856.  
  4857.        Format:        IF condition THEN label1                  <--Format 1
  4858.                       IF condition THEN label1 ELSE label2      <--Format 2
  4859.  
  4860.                       IF condition THEN                         <--Format 3
  4861.                            <zero or more ASIC statements>
  4862.                       ENDIF
  4863.  
  4864.                       IF condition THEN                         <--Format 4
  4865.                            <zero or more ASIC statements>
  4866.                       ELSE
  4867.                            <zero or more ASIC statements>
  4868.                       ENDIF
  4869.  
  4870.        Description:
  4871.  
  4872.             This statement is used to conditionally transfer to a different
  4873.        location in the program.  The operand "condition" is one of the
  4874.        following:
  4875.  
  4876.                       number1 > number2
  4877.                       string1  > string2
  4878.                       number1 = number2
  4879.                       string1  = string2
  4880.                       number1 < number2
  4881.                       string1  < string2
  4882.  
  4883.  
  4884.        Format 1--If "condition" is true, control is transferred to label1.
  4885.        Otherwise the program continues at the next statement.
  4886.  
  4887.        Format 2--If "condition" is true, control is transferred to label1,
  4888.        otherwise the program branches to label2 and continues execution from
  4889.        there.
  4890.  
  4891.        Format 3--If "condition" is true, the program will continue execution at
  4892.        the next statement.  If the condition is false, the program will branch
  4893.        to the statement following the next ENDIF statement encountered.
  4894.  
  4895.        Format 4--If "condition" is true, program will continue execution at the
  4896.        next statement up to the next ELSE statement encountered, at which point
  4897.        it will branch to the statement following the next ENDIF statement
  4898.        encountered.  If "condition" is false, the program will branch to the
  4899.        next ELSE statement and resume execution at that statement.
  4900.  
  4901.        Example 1:
  4902.  
  4903.                  IF A > 0 THEN APLUS:
  4904.  
  4905.        In this example, if A is greater than zero, the program jumps to the
  4906.        label called "APLUS:".
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.                                        Page - 77
  4914.  
  4915.  
  4916.  
  4917.  
  4918.                             IF/THEN/ELSE/ENDIF (Continued)
  4919.  
  4920.        Example 2:
  4921.  
  4922.                  IF A$="YES" THEN TRUE: ELSE FALSE:
  4923.  
  4924.        In this example, if A$ contains the string "YES", the program jumps to
  4925.        the label called "TRUE:", otherwise the program transfers to label
  4926.        "FALSE:"
  4927.  
  4928.        Example 3:
  4929.  
  4930.                  OPEN "I",1,"TEST.DAT"
  4931.                  IF ERROR>0 THEN
  4932.                       PRINT "ERROR OPENING FILE";
  4933.                       PRINT ERROR
  4934.                       END
  4935.                  ENDIF
  4936.                  REM rest of program follows
  4937.                  .
  4938.                  .
  4939.  
  4940.  
  4941.        In this example, if there is an error opening file "TEST.DAT", the
  4942.        program will print an error message and terminate.  Otherwise control
  4943.        will fall through to the REM statement and the program will continue.
  4944.  
  4945.        Example 4:
  4946.  
  4947.                  PRINT "ENTER A NUMBER";
  4948.                  INPUT NUMBER
  4949.                  IF NUMBER > 100 THEN
  4950.                       PRINT "THAT'S A BIG NUMBER"
  4951.                  ELSE
  4952.                       PRINT "THAT'S A SMALL NUMBER"
  4953.                  ENDIF
  4954.  
  4955.        Comments:
  4956.  
  4957.             Formats 3 and 4 are BLOCK IF formats.  You can nest BLOCK IF
  4958.        statements up to 25 levels deep.  The example below is shown three
  4959.        levels deep.
  4960.  
  4961.             IF A=1 THEN                                  <-Level 1
  4962.                  IF B=2 THEN                             <-Level 2
  4963.                       IF C=3 THEN                        <-Level 3
  4964.                            PRINT "C=3, B=2, AND A=1"
  4965.                       ELSE
  4966.                            PRINT "C<>3, B=2, AND A=1"    <-ELSE  for Level 3
  4967.                       ENDIF                              <-ENDIF for Level 3
  4968.                  ENDIF                                   <-ENDIF for Level 2
  4969.             ENDIF                                        <-ENDIF for Level 1
  4970.  
  4971.             It's a good idea to indent your IFs, ELSEs and ENDIFs as shown
  4972.        above.  Otherwise matching IFs up with matching ENDIFs and ELSEs can
  4973.        become very confusing.
  4974.  
  4975.  
  4976.                                        Page - 78
  4977.  
  4978.  
  4979.  
  4980.  
  4981.                                         INKEY$
  4982.  
  4983.        Format:        string1 = INKEY$
  4984.  
  4985.        Description:
  4986.  
  4987.             Used to retrieve keystrokes from the keyboard buffer.  If a
  4988.        character is waiting in the buffer, string1 will be set to the value of
  4989.        that character, and that character will be removed from the keyboard
  4990.        buffer.  If the buffer is empty, string1 will be set to a value of ""
  4991.        (that is, a null string with a length of 0).  If an extended key is
  4992.        pressed (for example the function keys F1 through F10), the system
  4993.        variable EXTENDED will be set to 1, otherwise it will contain 0.
  4994.  
  4995.        Example:
  4996.  
  4997.                  LOOP: X$=INKEY$
  4998.                  IF X$="" THEN LOOP:
  4999.  
  5000.        The above code will cause the program to loop until a key is pressed.
  5001.  
  5002.        Comment:
  5003.  
  5004.             ASIC provides an extension here over BASICA/GWBASIC.  The EXTENDED
  5005.        system variable will allow you to detect special keys as mentioned
  5006.        above.  To do so requires an understanding of keyboard scan codes, which
  5007.        is beyond the scope of the ASIC Manual.  For more information I would
  5008.        suggest Peter Norton's Programmer Guide to the IBM PC (Microsoft Press).
  5009.  
  5010.  
  5011.  
  5012.                                           INP
  5013.  
  5014.        Format:        number1 = INP (number2)
  5015.  
  5016.        Description:
  5017.  
  5018.             This statement reads a byte from port number2 and stores the result
  5019.        in number1.
  5020.  
  5021.        Example:
  5022.  
  5023.             A=INP(513)
  5024.             A=ZBIT(4,A)
  5025.             IF A=1 THEN TRIGGERPRESSED:
  5026.  
  5027.        The above code will test the joystick port to see if the trigger is
  5028.        being pressed on joystick 1.  You need a game card and joystick for this
  5029.        to work.
  5030.  
  5031.        See also:
  5032.  
  5033.             OUT
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039.                                        Page - 79
  5040.  
  5041.  
  5042.  
  5043.  
  5044.                                          INPUT
  5045.  
  5046.        Format :       INPUT variable1     <--Format 1
  5047.                       INPUT variable1;    <--Format 2
  5048.  
  5049.  
  5050.        Description:
  5051.  
  5052.             This statement will retrieve a line of text from the input buffer
  5053.        and store it in variable1.  There are two statement formats.
  5054.  
  5055.             When using Format 1, ASIC will first issue the prompt "?".  It will
  5056.        then wait until the user enters a string or number and presses the
  5057.        <return> or <enter> key.  The type of data ASIC will expect is dependent
  5058.        on the type of variable1 (integer, decimal, or string).  If an integer
  5059.        or decimal is being entered, ASIC will edit the input for validity. If
  5060.        the edit fails ASIC will issue another "?" to the user, and will wait
  5061.        for the number to be retyped.  Only when a valid integer has been
  5062.        entered will variable1 be updated, and only then will control return to
  5063.        your ASIC program.  Following a successful INPUT, ASIC will generate a
  5064.        carriage return/line feed sequence and advance the cursor to the next
  5065.        line.
  5066.  
  5067.             When using Format 2, ASIC will NOT issue a prompt.  It will still
  5068.        edit the user input based on the type of variable.  However, if the
  5069.        input is invalid it does not reprompt the user to re-enter the data.
  5070.        Instead, it will set the system ERROR variable to "1" and return control
  5071.        to your ASIC program.  The value stored in variable1 will be undefined
  5072.        if the ERROR variable is set!  ASIC will issue a carriage return, but it
  5073.        will NOT issue a line feed.  Format 2 is useful when you want to use the
  5074.        INPUT statement with it's data edit capabilities in conjunction with a
  5075.        data entry form.  In this case, you don't want ASIC to write any prompts
  5076.        to the screen, and you don't want ASIC to scroll the screen.
  5077.  
  5078.        Example 1:
  5079.  
  5080.                  PRINT "Enter a String";
  5081.                  INPUT A$
  5082.  
  5083.        ASIC will issue the prompt:
  5084.  
  5085.                  Enter a String?
  5086.  
  5087.        It will then wait until you enter a string or press enter.  If you
  5088.        pressed enter with no characters A$ would contain "" (ie its length
  5089.        would equal 0), otherwise A$ would contain the string entered.
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.                                        Page - 80
  5103.  
  5104.  
  5105.  
  5106.  
  5107.                                    INPUT (Continued)
  5108.  
  5109.        Example 2:
  5110.  
  5111.                  INPUT I
  5112.  
  5113.        In this example ASIC will issue the prompt:
  5114.  
  5115.                  ?
  5116.  
  5117.        ASIC will then wait for you to enter a valid number.  If you enter an
  5118.        invalid number, say "x", ASIC will reissue the "?" prompt and wait for
  5119.        you to retype your input.  Once the input has been edited by ASIC, "I"
  5120.        would contain the number entered.
  5121.  
  5122.        Example 3:
  5123.  
  5124.             LOOP:
  5125.                  PRINT "YOUR CHOICE?";
  5126.                  INPUT A;
  5127.                  IF ERROR=1 THEN
  5128.                       PRINT "THE NUMBER YOU ENTERED WAS INVALID"
  5129.                  END IF
  5130.                  GOTO LOOP:
  5131.  
  5132.        This example uses Format 2.  Notice that since ASIC will not issue a
  5133.        prompt, we must include the "?" on the PRINT statement or it will not
  5134.        appear on the screen.  Also note that errors fall through.  If an error
  5135.        is detected the message "THE NUMBER YOU ENTERED WAS INVALID" will be
  5136.        displayed, and the program will branch to the label "LOOP:" to ask for
  5137.        the input again.
  5138.  
  5139.  
  5140.        See Also:
  5141.  
  5142.             INKEY$
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.  
  5163.  
  5164.  
  5165.                                        Page - 81
  5166.  
  5167.  
  5168.  
  5169.  
  5170.                                         INPUT#
  5171.  
  5172.        Format:        INPUT# number1, number1                 <-Format 1
  5173.                       INPUT# number1, string1                 <-Format 2
  5174.                       INPUT# number1, string1 CRLF            <-Format 3
  5175.                       INPUT# number1, string1 NONULL          <-Format 4
  5176.                       INPUT# number1, string1 BYTE            <-Format 5
  5177.  
  5178.  
  5179.        Description:
  5180.  
  5181.             This statement will read a variable from a file identified by file
  5182.        number number1.  It will be stored in number1/string1.  If an error
  5183.        occurs during a read, the system variable ERROR will be set to a non-
  5184.        zero value.  The possible errors are listed in the error messages
  5185.        section the of the ASIC Manual.  If you read a file past its end, the
  5186.        contents of variable1 are undefined.
  5187.  
  5188.             Five formats of this statement are provided to provide greater
  5189.        flexibility in reading files written by ASIC and non-ASIC programs.  The
  5190.        five formats are summarized below:
  5191.  
  5192.        Format 1 -- Read numeric data from a file previously written by ASIC.
  5193.  
  5194.        Format 2 -- Read string data from a file previously written by ASIC.
  5195.  
  5196.        Format 3 -- Read strings from a non-ASIC file.  Assumes the strings
  5197.        (CRLF)      will be terminated by a CR/LF (carriage return/linefeed).
  5198.                    Note that ASIC still considers a NULL character, if
  5199.                    encountered, as an end of string character.  Also ASIC
  5200.                    terminates the string if 80 characters are read before
  5201.                    encountering a CR/LF pair.
  5202.  
  5203.        Format 4 -- Read strings from a file until 80 characters or the end
  5204.        (NONULL)    of the file is reached.  Note that ASIC still considers a
  5205.                    NULL character, if encountered, as an end of string
  5206.                    character.
  5207.  
  5208.        Format 5 -- Reads a single byte from a file and stores it in string1.
  5209.        (BYTE)      If ASIC has read a NULL byte, the string will be set to
  5210.                    NULL and its length will be 0.
  5211.  
  5212.        Example 1:
  5213.  
  5214.             OPEN "I",1,"TEMP.DAT"
  5215.             INPUT#1, A$
  5216.             IF ERROR=99 THEN ENDOFFILE:
  5217.  
  5218.        In this example, a string will be read from file "TEMP.DAT", and it will
  5219.        be stored in A$.  The system ERROR variable is then checked to see if
  5220.        End of file was reached.  Note, other ERRORS could also be returned by
  5221.        INPUT#, besides error code 99.  Refer to the error messages section for
  5222.        more information.
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.                                        Page - 82
  5229.  
  5230.  
  5231.  
  5232.  
  5233.                                   INPUT#  (Continued)
  5234.        Example 2:
  5235.  
  5236.             OPEN "I",1,"TEMP.DAT"
  5237.             INPUT#1, A$ NONULL
  5238.             IF ERROR=99 THEN ENDOFFILE:
  5239.  
  5240.        In this example, ASIC will read 80 characters from the file "TEMP.DAT",
  5241.        or up until the next NULL character in the file, which ever comes first.
  5242.  
  5243.        Example 3:
  5244.  
  5245.             OPEN "I",1,"CONFIG.DAT"
  5246.             INPUT#1, A$ BYTE
  5247.             IF ERROR=99 THEN ENDOFFILE:
  5248.  
  5249.        In this example, ASIC will read a single character from the file
  5250.        "CONFIG.DAT", and place it in the variable A$.
  5251.  
  5252.        Example 4:
  5253.  
  5254.             OPEN "I",1,"TEST.DAT"
  5255.             INPUT#1, A
  5256.             IF ERROR=99 THEN ENDOFFILE:
  5257.  
  5258.        In this example, ASIC will read an integer value from the file
  5259.        "TEST.DAT", and place it in the integer variable "A".
  5260.  
  5261.        Example 5:
  5262.  
  5263.             OPEN "I",1,"ASCII.DAT"
  5264.             OPEN "O",2,"ASCII.NEW"
  5265.             CR$=CHR$(13)
  5266.             LF$=CHR$(10)
  5267.             CRLF$=CR$+LF$
  5268.        READMORE:
  5269.             INPUT #1, A$ CRLF
  5270.             IF ERROR=96 THEN WRITE:
  5271.             IF ERROR>0 THEN ENDOFFILE:
  5272.        WRITEWITHCRLF:
  5273.             PRINT #2,A$ NONULL
  5274.             PRINT #2,CRLF$ NONULL
  5275.             GOTO READMORE:
  5276.        WRITE:
  5277.             PRINT #2, A$ NONULL
  5278.             GOTO READMORE:
  5279.        ENDOFFILE:
  5280.             CLOSE 1
  5281.             CLOSE 2
  5282.  
  5283.        This example copies file ASCII.DAT to file ASCII.NEW.  Note:  Even
  5284.        though ASIC can only handle 80 character strings, this example shows
  5285.        that by checking the ERROR variable for a value of 96, it is possible to
  5286.        read the file in up-to-80-character chunks and reassemble the strings in
  5287.        their original forms in the new file.  Also note that ASIC will still
  5288.        treat any NULL characters in the file as an end of string character.
  5289.  
  5290.  
  5291.                                        Page - 83
  5292.  
  5293.  
  5294.  
  5295.  
  5296.                                   INPUT# (Continued)
  5297.  
  5298.        Comments:
  5299.  
  5300.             Note that number1 must be a constant in the range of 1-3.  It
  5301.        identifies a file by file number which must have previously been opened
  5302.        by an OPEN command for modes INPUT or RANDOM.
  5303.  
  5304.             ASIC assumes that integers will be stored in files in 2-byte binary
  5305.        format, which is the format ASIC writes integers.  Consequently, If a
  5306.        file contained a string "123", but you told ASIC to read integer "X",
  5307.        then ASIC would read two bytes from the file and interpret "12" as two
  5308.        binary bytes that it would then combine and store as "X".  "X" would
  5309.        contain the integer value 12849.  Thus to read an integer correctly, you
  5310.        will have had to previously written it with an ASIC program.
  5311.  
  5312.        See Also:
  5313.  
  5314.             OPEN, CLOSE, PRINT#, FILEPOS
  5315.  
  5316.  
  5317.  
  5318.                                          INSTR
  5319.  
  5320.        Format:        number1 = INSTR (string1,string2)
  5321.  
  5322.        Description:
  5323.  
  5324.             This statement is used to determine if a given substring exists
  5325.        within a string, and if so, the character position at which the
  5326.        substring first appears in the string.  String1 is the string to be
  5327.        searched.  String2 contains the substring to find within string1.  The
  5328.        character position of string2 within string1 is returned in number1.  If
  5329.        the string is not found then number1 is set to zero.
  5330.  
  5331.        Example 1:
  5332.  
  5333.             A=INSTR("THE QUICK BROWN FOX","QUICK")
  5334.  
  5335.        After execution of this statement, variable "A" will contain the value
  5336.        5, which is the offset of the string "QUICK" within the string "THE
  5337.        QUICK BROWN FOX".
  5338.  
  5339.             B=INSTR("FOX","HEN")
  5340.  
  5341.        After the execution of this statement, variable "B" will contain 0,
  5342.        since the string "HEN" is not found within the string "FOX".
  5343.  
  5344.        See also:
  5345.  
  5346.             LEFT$, RIGHT$, MID$, LEN
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.                                        Page - 84
  5355.  
  5356.  
  5357.  
  5358.  
  5359.                                          INT86
  5360.  
  5361.        Format:        INT86(number1,AX,BX,CX,DX,DI,SI,BP,DS,ES)
  5362.  
  5363.        Description:
  5364.  
  5365.             This statement is used to call a DOS, BIOS, or custom-written
  5366.        Interrupt.  Number1 must be a constant, and should identify the number
  5367.        of the interrupt to be called.  The fields following number1 represent
  5368.        the CPU registers.  For example, ASIC will move the value from the ASIC
  5369.        variable "AX" to the CPU register "AX" prior to performing the interrupt
  5370.        call.  After the call, ASIC will move the value from the CPU register
  5371.        "AX" to the ASIC variable "AX".  Your ASIC program can then use this
  5372.        "AX" variable just like any other integer variable in the rest of the
  5373.        program.  Each of the registers listed (AX,BX,CX,DX,DI,SI,BP,DS,ES) must
  5374.        be included on the INT86 statement in the same order as shown in the
  5375.        Format statement above.  The exception to this rule, is that you can
  5376.        substitute "NA" for any register you do not need for the call.  The BP
  5377.        register may be used to pass values to the INT86 call, however, unlike
  5378.        all of the other registers, ASIC does not return the value of the BP
  5379.        register following the INT86 call.
  5380.  
  5381.        Example 1:
  5382.  
  5383.                  INT86(5,NA,NA,NA,NA,NA,NA,NA,NA,NA)
  5384.  
  5385.        The above example shows the code to perform a screen print to the
  5386.        printer.  This example will call INT 5 (BIOS Print Screen Interrupt),
  5387.        pass no parameters to the call, and receive no return values from the
  5388.        call.
  5389.  
  5390.        Example 2:
  5391.  
  5392.                  AX=&hex3600
  5393.                  DX=0
  5394.                  INT86(&hex21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  5395.                  PRINT "Default Drive has:"
  5396.                  PRINT
  5397.                  PRINT "Sectors/Cluster";
  5398.                  PRINT AX
  5399.                  PRINT "Available Cluster Count";
  5400.                  PRINT BX
  5401.                  PRINT "Bytes/Sector";
  5402.                  PRINT CX
  5403.                  PRINT "Total Clusters";
  5404.                  PRINT DX
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.                                        Page - 85
  5418.  
  5419.  
  5420.  
  5421.  
  5422.                                    INT86 (Continued)
  5423.  
  5424.        This example show a more complex call to DOS to find out free disk space
  5425.        information for the current drive.  DOS Interrupt 21 (hex) function 36
  5426.        (hex) is used to retrieve this information.  The AX register is used to
  5427.        pass the function number.  The DX register is used to select the disk
  5428.        drive (0=the default disk drive).  Note that the BX and CX registers
  5429.        were included on the call.  No parameters are being passed to the call
  5430.        in these registers, however, we'll be receiving information back from
  5431.        DOS in them, so they need to be on the INT86 statement.  Since the
  5432.        SI,DI,BP,DS, and ES registers are not needed by the call, they have been
  5433.        substituted with "NA" which you can think of as meaning "Not Applicable"
  5434.        to this call.  After the call, the example program will display
  5435.        information about the default disk drive.
  5436.  
  5437.        Comments:
  5438.  
  5439.        This statement is intended for advanced programmers.  To use it
  5440.        properly, you must have some knowledge of assembler language, or (at
  5441.        least) the CPU registers in the IBM PC.  You also need a DOS or BIOS
  5442.        reference manual to identify which registers to pass to each interrupt,
  5443.        and to identify the values to place in those registers.
  5444.  
  5445.        One register was required for ASIC housekeeping after the INT86 call.
  5446.        This is why the BP register is unavailable to receive return values from
  5447.        calls.  The BP register was chosen, because none of the DOS or BIOS
  5448.        Interrupts use this register to return values.  If you write your own
  5449.        interrupts and want to call them from an ASIC program, remember that you
  5450.        can pass the BP register to the interrupt, but the ASIC "BP" variable
  5451.        will not be updated following the interrupt.
  5452.  
  5453.        If a register is not needed for the call, specify "NA" instead of the
  5454.        register name.  ASIC does not generate any code for "NA" registers, and
  5455.        this will reduce the size of your program.
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.                                        Page - 86
  5481.  
  5482.  
  5483.  
  5484.  
  5485.                                          KILL
  5486.  
  5487.        Format:        KILL string1
  5488.  
  5489.        Description:
  5490.  
  5491.             This statement is used to delete a file from disk.  It is similar
  5492.        to the DOS ERASE Statement.  Specify the file to delete in string1.  You
  5493.        can specify the full path to the file, or just the file name if it is in
  5494.        the current directory.  If an error occurs (eg, File not found), then
  5495.        ASIC will set the System ERROR variable.  A list of codes returned by
  5496.        KILL is listed in the ERROR Messages Chapter of the ASIC Manual.
  5497.  
  5498.        Example:
  5499.  
  5500.                  KILL "TEMP.DAT"
  5501.                  IF ERROR = 0 THEN NOERROR:
  5502.                  REM CHECK ERROR CODES HERE
  5503.  
  5504.        After this statement is executed, the file "TEMP.DAT" will have been
  5505.        erased from the current directory of the current drive, and will no
  5506.        longer be accessible from DOS or your programs.
  5507.  
  5508.  
  5509.  
  5510.  
  5511.                                         LCASE$
  5512.  
  5513.        Format:        string1=LCASE$(string2)
  5514.  
  5515.        Description:
  5516.  
  5517.             This statement will convert all of the letters in string2 from
  5518.        upper case to lower case, and store the result in string1.
  5519.  
  5520.        Example:
  5521.  
  5522.             A$=LCASE$("123 Main Street, USA")
  5523.  
  5524.        After the execution of this statement, the variable A$ will contain the
  5525.        string "123 main street, usa".
  5526.  
  5527.        See also:
  5528.  
  5529.             UCASE$
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.                                        Page - 87
  5544.  
  5545.  
  5546.  
  5547.  
  5548.                                          LEFT$
  5549.  
  5550.        Format:        string1=LEFT$(string2,number1)
  5551.  
  5552.        Description:
  5553.  
  5554.             This statement will copy number1 characters from the left of
  5555.        string2 to string1.
  5556.  
  5557.        Example:
  5558.  
  5559.             A$=LEFT$("RED RIDING HOOD",3)
  5560.  
  5561.        After the execution of the above statement, the variable A$ will contain
  5562.        the string "RED".
  5563.  
  5564.        See also:
  5565.  
  5566.             MID$, RIGHT$
  5567.  
  5568.  
  5569.  
  5570.                                           LEN
  5571.  
  5572.        Format:        number1 = LEN (string1)
  5573.  
  5574.        Description:
  5575.  
  5576.             This statement returns the length (number of characters) of a
  5577.        string, and stores the length in number1.
  5578.  
  5579.        Example:
  5580.  
  5581.                  A$="abc"
  5582.                  LENGTH1 = LEN(A$)
  5583.  
  5584.        After execution of these statements, LENGTH1 would contain 3.
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.                                        Page - 88
  5607.  
  5608.  
  5609.  
  5610.  
  5611.                                         LOCATE
  5612.  
  5613.        Format:        LOCATE row,column
  5614.  
  5615.        Description:
  5616.  
  5617.             This statement is used to position the cursor to a row and column.
  5618.        Row and Column should be integers.  Row has the range 0-24, Column has
  5619.        the range 0-79.  This function does not perform edits on the ranges of
  5620.        row and column.  Consequently using this function with values outside
  5621.        these ranges will have unpredictable results.
  5622.  
  5623.        Example:
  5624.  
  5625.                  LOCATE 10,20
  5626.                  PRINT "HELLO"
  5627.  
  5628.  
  5629.        After execution of these statements, the message "HELLO" will appear
  5630.        beginning at row 10, column 20.
  5631.  
  5632.  
  5633.  
  5634.  
  5635.  
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.                                        Page - 89
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.                                         LPRINT
  5678.  
  5679.        Format:        LPRINT printobject [;]        <--Format 1
  5680.  
  5681.  
  5682.        Description:
  5683.  
  5684.             This statement is used to send the contents of printobject to an
  5685.        attached printer.  "printobject" can be any valid ASIC datatype:
  5686.        integer, string, or decimal number.  Optionally, a ";" can be included
  5687.        with this statement to suppress a carriage return/line feed which ASIC
  5688.        normally also sends to the printer following each LPRINT.  This can be
  5689.        used to string several printobjects together on a single print line.
  5690.  
  5691.        Example:
  5692.  
  5693.                  A=12345
  5694.                  LPRINT "The value of A is: ";
  5695.                  LPRINT A
  5696.  
  5697.        After execution of these statements the printer would print:
  5698.  
  5699.                  The value of A is: 12345
  5700.  
  5701.        Comments:
  5702.  
  5703.             Note that if the printer is not "online" that DOS will issue a
  5704.        message to "Abort, Retry, or Ignore".  This could overwrite a portion of
  5705.        the program display, unless not planned for.
  5706.  
  5707.             Note also, that some printers do not begin printing until they
  5708.        receive a carriage return/line feed sequence.
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.                                        Page - 90
  5733.  
  5734.  
  5735.  
  5736.  
  5737.                                         LTRIM$
  5738.  
  5739.        Format:        string1=LTRIM$(string2)
  5740.  
  5741.        Description:
  5742.  
  5743.             This statement will remove all leading spaces from string2 and
  5744.        store the result in string1.
  5745.  
  5746.        Example:
  5747.  
  5748.             A$="   XYZ"
  5749.             A$=LTRIM$(A$)
  5750.  
  5751.        After execution of these statements, the variable A$ will contain the
  5752.        string "XYZ" with no leading spaces.
  5753.  
  5754.        See also:
  5755.  
  5756.             RTRIM$
  5757.  
  5758.  
  5759.  
  5760.                                          MID$
  5761.  
  5762.        Format:        string1 = MID$(string2,number1,number2)
  5763.  
  5764.        Description:
  5765.  
  5766.             This statement is used to extract a substring from string2
  5767.        beginning at position number1 within string2 and continuing for number2
  5768.        bytes.  This value is then stored in string1.
  5769.  
  5770.        Example:
  5771.  
  5772.                       A$="THE QUICK BROWN FOX"
  5773.                       B$=MID$(A$,1,4)
  5774.                       C$=MID$(A$,11,9)
  5775.                       D$=B$ + C$
  5776.  
  5777.        After execution of these statements, the contents of A$ will be
  5778.        unchanged.  The contents of B$ will be "THE ".  The contents of C$ will
  5779.        be "BROWN FOX", and the contents of D$ will be "THE BROWN FOX".
  5780.  
  5781.        See also:
  5782.  
  5783.             LEFT$, RIGHT$
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.                                        Page - 91
  5796.  
  5797.  
  5798.  
  5799.  
  5800.                                          MKDIR
  5801.  
  5802.        Format:        MKDIR string1
  5803.  
  5804.        Description:
  5805.  
  5806.             This statement is used to create a new DOS directory.  Specify the
  5807.        directory to create in string1.  If ASIC is unable to create the
  5808.        directory, it will set the System ERROR variable.  A list of ERROR codes
  5809.        may be found is the Error Messages Chapter of the ASIC Manual.
  5810.  
  5811.        Example:
  5812.  
  5813.                  MKDIR "WORK"
  5814.                  IF ERROR = 0 THEN NOERROR:
  5815.  
  5816.        This code would create a directory called "WORK" under the current
  5817.        directory of the current drive.
  5818.  
  5819.        Example 2:
  5820.  
  5821.                  MKDIR "C:\WORK"
  5822.  
  5823.        This code would create a directory called "WORK" under the root
  5824.        directory of drive "C".
  5825.  
  5826.        See also:
  5827.  
  5828.             CHDIR,RMDIR
  5829.  
  5830.  
  5831.  
  5832.                                           MOD
  5833.  
  5834.        Format:        integer1 = number2 MOD number3
  5835.  
  5836.        Description:
  5837.  
  5838.             This statement will perform modulo division of number2 by number3
  5839.        and store the remainder (instead of the quotient) in integer1.
  5840.  
  5841.        Example:
  5842.  
  5843.                  A = 8
  5844.                  B = 5
  5845.                  C = A MOD B
  5846.  
  5847.        After execution of these statements, variable "C" will contain the value
  5848.        "3" which is the remainder of the division of 8 by 5.
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.                                        Page - 92
  5859.  
  5860.  
  5861.  
  5862.  
  5863.                                          NAME
  5864.  
  5865.        Format:        NAME string1 AS string2
  5866.  
  5867.        Description:
  5868.  
  5869.             This statement will allow you to rename a file.  String1 should
  5870.        contain the current file name, and string2 should contain the new name
  5871.        for the file.  If ASIC is unable to rename the file, it will set the
  5872.        System ERROR variable.  A list of ERROR codes is contained in the Error
  5873.        Messages Chapter of the ASIC Manual.
  5874.  
  5875.        Example:
  5876.  
  5877.             NAME "olddata.txt" AS "newdata.txt"
  5878.             IF ERROR = 0 THEN SUCCESS:
  5879.  
  5880.        After execution of these statements, file "olddata.txt" will have been
  5881.        renamed to "newdata.txt"
  5882.  
  5883.        Comments:
  5884.  
  5885.             You cannot rename a file to a new disk drive.
  5886.  
  5887.  
  5888.  
  5889.                                          OPEN
  5890.  
  5891.        Format:        OPEN string1, number1, string2
  5892.  
  5893.        Description:
  5894.  
  5895.             This statement is used to open a file for input or output.  Up to
  5896.        three files may be open concurrently, these are known as file 1, 2, or
  5897.        3.  You must specify with number1 which file number you wish to open
  5898.        this file as.  Number1 may only be a constant.  The file mode is
  5899.        specified in string1.  The valid values are "I" for INPUT, "O" for
  5900.        OUTPUT, "A" for APPEND, and "R" for RANDOM INPUT/OUTPUT.  The file name
  5901.        is specified with string2.  Any errors returned from DOS on the OPEN
  5902.        call will be returned in the system variable "ERROR".
  5903.  
  5904.        Example:
  5905.  
  5906.                  OPEN "I",3,"INFILE"
  5907.                  IF ERROR > 0 THEN PROCESSERROR:
  5908.                  OPEN "O",1,"A:\NEWFILE.DAT"
  5909.                  IF ERROR > 0 THEN PROCESSERROR:
  5910.  
  5911.        In this example, two files are opened.  File "INFILE" from the current
  5912.        disk drive and directory will be opened as file number 3 for input.  The
  5913.        file "A:\NEWFILE.DAT" will be opened for output as file number 1.  Note
  5914.        that if "A:\NEWFILE.DAT" previously existed, it contents will be
  5915.        destroyed in preparation for writing.
  5916.  
  5917.        See also:
  5918.  
  5919.        CLOSE, FILEPOS, INPUT#, PRINT#
  5920.  
  5921.                                        Page - 93
  5922.  
  5923.  
  5924.  
  5925.  
  5926.                                         OPENCOM
  5927.  
  5928.        Format:        OPENCOM(number1,number2,number3,number4,number5)
  5929.  
  5930.        Description:
  5931.  
  5932.             This statement is used to initialize the serial port.  Number1 is
  5933.        used to specify the baud rate.  Number2 specifies parity.  Number3
  5934.        specifies stop bits.  Number4 specifies bytesize, and Number5 identifies
  5935.        which port to open (see the tables below).  OPENCOM does not check the
  5936.        validity of the values you give it.
  5937.  
  5938.                  (number1)                          (number2)
  5939.                  BAUD RATE                          PARITY
  5940.             ------+-----------                 ------+------------
  5941.             VALUE | DESCRIPTION                VALUE | DESCRIPTION
  5942.               0   | 110  baud                    0   | No Parity
  5943.               1   | 150  baud                    1   | Odd Parity
  5944.               2   | 300  baud                    3   | Even Parity
  5945.               3   | 600  baud
  5946.               4   | 1200 baud                      (number3)
  5947.               5   | 2400 baud                      STOP BITS
  5948.               6   | 4800 baud                  ------+------------
  5949.               7   | 9600 baud                  VALUE | DESCRIPTION
  5950.                                                  0   | One Stop Bit
  5951.                                                  1   | Two Stop Bits
  5952.  
  5953.                  (number4)                          (number5)
  5954.                  BYTE SIZE                          COM PORT
  5955.             ------+------------                ------+------------
  5956.             VALUE | DESCRIPTION                VALUE | DESCRIPTION
  5957.               2   | 7 Bits                       0   | Com1
  5958.               3   | 8 Bits                       1   | Com2
  5959.  
  5960.        Example:
  5961.  
  5962.                  OPENCOM(2,0,0,3,0)
  5963.  
  5964.        This statement would open COM1 at 300 baud, No parity, 1 Stop bit, 8 bit
  5965.        bytesize.
  5966.  
  5967.  
  5968.  
  5969.        See also:
  5970.  
  5971.             COMSTAT,RECEIVE,SEND
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.                                        Page - 94
  5985.  
  5986.  
  5987.  
  5988.  
  5989.                                           OUT
  5990.  
  5991.        Format:        OUT (number1,number2)
  5992.  
  5993.        Description:
  5994.  
  5995.             This statement writes a byte to a port.  Number1 should contain the
  5996.        port to write to.  Number2 should contain an integer value in the range
  5997.        of 0-255 to be written to the port.
  5998.  
  5999.        Example:
  6000.  
  6001.             OUT 512,0
  6002.  
  6003.        The above statement would send a byte with the binary value of "0" to
  6004.        port number 512.
  6005.  
  6006.  
  6007.        See also:
  6008.  
  6009.             INP
  6010.  
  6011.  
  6012.  
  6013.                                          PEEK
  6014.  
  6015.        Format:        number1 = PEEK (number2)
  6016.  
  6017.        Description:
  6018.  
  6019.             This statement is used to examine actual memory location values
  6020.        directly.  By default, the ASIC DS address is assumed.  However, this
  6021.        may be overridden with the use of the DEFSEG command.  The value of the
  6022.        byte at address number2 is stored in number1.
  6023.  
  6024.        Example:
  6025.  
  6026.             DEFSEG = &hexB800
  6027.             A = PEEK (0)
  6028.  
  6029.        The above statements will retrieve the first byte of video memory for a
  6030.        CGA/EGA/VGA card and store it in variable "A".
  6031.  
  6032.        Comments:
  6033.  
  6034.             Since the Intel 8088 architecture is segmented in 64k segments,
  6035.        number2 is limited to the range of 0-65535.
  6036.  
  6037.  
  6038.  
  6039.        See also:
  6040.  
  6041.             DEFSEG, POKE
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.                                        Page - 95
  6048.  
  6049.  
  6050.  
  6051.  
  6052.                                          POINT
  6053.  
  6054.        Format:        number1 = POINT (number2,number3)
  6055.  
  6056.        Description:
  6057.  
  6058.             This statement is used to determine the color of a given pixel in
  6059.        medium and high resolution graphics modes.  The row to test is specified
  6060.        with number2, the column with number3.  The color of the pixel is stored
  6061.        in number1.
  6062.  
  6063.        Example:
  6064.  
  6065.                  PCOLOR = POINT (10,20)
  6066.  
  6067.        After execution of this statement, PCOLOR will contain the color of the
  6068.        pixel in row 10 column 20.
  6069.  
  6070.        Comments:
  6071.  
  6072.             No range checking is performed on row and column.  If the specified
  6073.        row or column is outside the valid range for the given graphics mode,
  6074.        the results are unpredictable.
  6075.  
  6076.        See also:
  6077.  
  6078.             PSET, PRESET, SCREEN
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.  
  6085.  
  6086.  
  6087.  
  6088.  
  6089.  
  6090.  
  6091.  
  6092.  
  6093.  
  6094.  
  6095.  
  6096.  
  6097.  
  6098.  
  6099.  
  6100.  
  6101.  
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107.  
  6108.  
  6109.  
  6110.                                        Page - 96
  6111.  
  6112.  
  6113.  
  6114.  
  6115.                                          POKE
  6116.  
  6117.        Format:        POKE number1, number2
  6118.  
  6119.        Description:
  6120.  
  6121.             This instruction is used store the byte value number2 at the memory
  6122.        address specified by number1.  By default, ASIC uses its default data
  6123.        segment address, however, this may be overridden with the DEFSEG
  6124.        statement.
  6125.  
  6126.        Example:
  6127.  
  6128.             DEFSEG = &hexB800
  6129.             POKE 0,1
  6130.  
  6131.        The above statements will store a byte with the binary value of "1" in
  6132.        the first byte of video memory for a CGA/EGA/VGA card.
  6133.  
  6134.        Comments:
  6135.  
  6136.             This statement is NOT RECOMMENDED FOR BEGINNERS.  Directly
  6137.        overwriting memory locations can be disastrous, unless you know what is
  6138.        stored at that address.  This can cause program "hangs", system crashes,
  6139.        etc.
  6140.  
  6141.             Since the Intel 8088 architecture is segmented in 64k segments,
  6142.        number2 is limited to the range of 0-65535.
  6143.  
  6144.  
  6145.        See also:
  6146.  
  6147.             DEFSEG, PEEK
  6148.  
  6149.  
  6150.  
  6151.                                           POS
  6152.  
  6153.        Format:        number1 = POS (number2)
  6154.  
  6155.        Description:
  6156.  
  6157.             This statement finds the column number of the cursor and stores it
  6158.        in number1.  number2 is a dummy argument included only because a dummy
  6159.        argument is required in BASICA/GWBASIC.
  6160.  
  6161.        Example:
  6162.  
  6163.                  A = POS(0)
  6164.  
  6165.        After this statement executes, A will contain the column number of the
  6166.        cursor.
  6167.  
  6168.        See also:
  6169.  
  6170.             CSRLIN
  6171.  
  6172.  
  6173.                                        Page - 97
  6174.  
  6175.  
  6176.  
  6177.  
  6178.                                         PRESET
  6179.  
  6180.        Format:        PRESET (number1,number2)
  6181.  
  6182.        Description:
  6183.  
  6184.             This statement is used to set the color of a pixel to the
  6185.        background color. The row of the pixel is specified in number1, and the
  6186.        column is specified in number2.  This statement only works in graphics
  6187.        modes.
  6188.  
  6189.        Example:
  6190.  
  6191.                  PRESET (10,20)
  6192.  
  6193.        The pixel at row 10 column 20 would be set to the background color.
  6194.  
  6195.        See also:
  6196.  
  6197.             PSET, SCREEN, POINT
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.                                        Page - 98
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244.                                          PRINT
  6245.  
  6246.        Format:        PRINT [printobject1 [;]]           <--Format 1
  6247.  
  6248.        Description:
  6249.  
  6250.             This statement is used to print to the screen.  Printing begins at
  6251.        the current cursor location.  Printobject1 is defined as any valid ASIC
  6252.        data type:  integer constant, integer variable, decimal constant,
  6253.        decimal variable, string constant, string variable, and arrays.  The
  6254.        semicolon is optional and is used to tell ASIC if you want a carriage
  6255.        return/line feed issued.  A semicolon at the end of a PRINT statement
  6256.        will suppress the carriage return/line feed ASIC normally issues.  If no
  6257.        operands are supplied, ASIC will simply issue a carriage return and line
  6258.        feed.
  6259.  
  6260.        Example 1:
  6261.  
  6262.                  A=1000
  6263.                  PRINT "A=";
  6264.                  PRINT A
  6265.                  PRINT
  6266.                  PRINT "DONE!"
  6267.  
  6268.        After execution of these statements your screen would display:
  6269.  
  6270.                  A=  1000
  6271.  
  6272.                  DONE!
  6273.  
  6274.        See also:
  6275.  
  6276.             COLOR, SCREEN, LOCATE
  6277.  
  6278.  
  6279.  
  6280.  
  6281.  
  6282.  
  6283.  
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.  
  6290.  
  6291.  
  6292.  
  6293.  
  6294.  
  6295.  
  6296.  
  6297.  
  6298.  
  6299.                                        Page - 99
  6300.  
  6301.  
  6302.  
  6303.  
  6304.                                         PRINT#
  6305.  
  6306.        Format:        PRINT# constant1, printobject1 [NONULL]
  6307.  
  6308.        Description:
  6309.  
  6310.             This statement is used to write integers, decimals and strings to
  6311.        disk.  Constant1 identifies the file number that the file was opened as.
  6312.        This must be a constant with a value of 1, 2 or 3.  The file must have
  6313.        been previously opened with the OPEN command.  If printobject1 is a
  6314.        string, you can also add the optional argument "NONULL", which will
  6315.        cause ASIC to suppress the trailing NULL character it would normally
  6316.        write to disk.  DOS errors are returned in the system variable "ERROR".
  6317.        A list of these error codes may be found in the error messages section
  6318.        of the ASIC Manual.  Also, refer to the technical details section of the
  6319.        ASIC Manual for more information on the format in which ASIC writes the
  6320.        data to disk.
  6321.  
  6322.        Example:
  6323.  
  6324.                  PRINT# 1, "HELLO"
  6325.                  IF ERROR = 255 THEN DISKFULL:
  6326.                  PRINT# 1, "WORLD"
  6327.                  IF ERROR = 255 THEN DISKFULL:
  6328.  
  6329.        After successful execution of the print statements the file identified
  6330.        by file number 1 would contain "HELLO0WORLD0" . Note that the "0"
  6331.        following HELLO and WORLD in our example represents the ASCII null
  6332.        character.  Strings in ASIC are always internally terminated with ASCII
  6333.        null characters.  By default, these nulls are also written to disk.
  6334.  
  6335.                  PRINT# 2, "HELLO" NONULL
  6336.  
  6337.        In this example, the string "HELLO" would be written to file #2, and no
  6338.        trailing NULL will be written to disk.
  6339.  
  6340.                  PRINT #3, 1234
  6341.  
  6342.        In this example, the number "1234" would be written to file #3 as two
  6343.        bytes in Intel binary format (the file would contain the two hexadecimal
  6344.        bytes:  D2 04).
  6345.  
  6346.  
  6347.  
  6348.  
  6349.  
  6350.  
  6351.  
  6352.  
  6353.  
  6354.  
  6355.  
  6356.  
  6357.  
  6358.  
  6359.  
  6360.  
  6361.  
  6362.                                       Page - 100
  6363.  
  6364.  
  6365.  
  6366.  
  6367.                                   PRINT# (Continued)
  6368.  
  6369.        Comments:
  6370.  
  6371.          Note that while ASIC doesn't generate carriage returns and line feeds
  6372.        for you as it does with the PRINT command, you can write these
  6373.        characters to disk as follows:
  6374.  
  6375.                  A$=CHR$(13)
  6376.                  B$=CHR$(10)
  6377.                  A$ = A$ + B$
  6378.                  PRINT #1, A$
  6379.  
  6380.        You might be wondering about the purpose of the NONULL option.  ASIC
  6381.        normally writes trailing NULLs with strings.  This is desirable if you
  6382.        plan to read the file exclusively with other ASIC programs.
  6383.  
  6384.        However, sometimes you may want to write a string for use by another
  6385.        program.  In this case, the NULL character sometimes confuses the other
  6386.        program.  Specifying the NONULL option will cause ASIC to suppress the
  6387.        offending NULL character.
  6388.  
  6389.        What happens if you read a string that is terminated by a Carriage
  6390.        Return/Line Feed Sequence (such as GWBASIC/BASICA produces)?  In this
  6391.        instance, specify the CRLF option on the INPUT# statement.  Then ASIC
  6392.        will read the string until it finds a CR/LF or until it reads 80
  6393.        characters, whichever comes first.
  6394.  
  6395.        See also:
  6396.  
  6397.                  OPEN, CLOSE, INPUT#, FILEPOS
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.  
  6407.  
  6408.  
  6409.  
  6410.  
  6411.  
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.                                       Page - 101
  6426.  
  6427.  
  6428.  
  6429.  
  6430.                                          PSET
  6431.  
  6432.        Format:        PSET (number1,number2),number3
  6433.  
  6434.        Description:
  6435.  
  6436.             This statement is used to set a pixel to a specified color in
  6437.        graphics modes.  The row is specified in number1, the column in number2,
  6438.        and the color in number3.  Note that no range checking is performed on
  6439.        number1 or number2.  A row or column specified outside the range allowed
  6440.        by the graphics mode in use can result in unpredictable results.
  6441.  
  6442.        Example:
  6443.  
  6444.                  PSET (10,20),1
  6445.  
  6446.        In this example the pixel defined at row 10 and column 20 will be set to
  6447.        color 1.
  6448.  
  6449.        See also:
  6450.  
  6451.             PRESET, SCREEN, POINT
  6452.  
  6453.  
  6454.  
  6455.                                        RANDOMIZE
  6456.  
  6457.        Format:        RANDOMIZE
  6458.  
  6459.        Description:
  6460.  
  6461.                  This statement will cause the seed for the random number
  6462.        generator to be reseeded using the system timer.  This statement should
  6463.        always precede the first RND statement in your program, unless you want
  6464.        the same sequence of random numbers generated.
  6465.  
  6466.        Example:
  6467.  
  6468.             RANDOMIZE
  6469.  
  6470.        The above statement would insure that each time your program runs, any
  6471.        subsequent RND numbers generated would be different.
  6472.  
  6473.        See also:
  6474.  
  6475.             RND
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.                                       Page - 102
  6489.  
  6490.  
  6491.  
  6492.  
  6493.                                          READ
  6494.  
  6495.        Format:        READ variable1
  6496.  
  6497.        Description:
  6498.  
  6499.             This statement reads a constant from DATA statements into a
  6500.        variable.  Variable1 is a string, decimal or integer type variable.
  6501.  
  6502.        Example:
  6503.  
  6504.             DATA 7,"CARGO"
  6505.  
  6506.             READ A
  6507.             READ B$
  6508.  
  6509.        After execution of these statements, "A" will contain 7, and B$ will
  6510.        contain "CARGO".
  6511.  
  6512.        Comments:
  6513.  
  6514.             ASIC does not check to see that the data type on the READ statement
  6515.        matches the data type on the DATA statement.  It is up to the programmer
  6516.        to insure that the types match.  The above example is correct.  The DATA
  6517.        statement contains an integer, then a string.  This is the same sequence
  6518.        in which the DATA is READ (ie, integer, then string).  In the above
  6519.        example, if the read statements were reversed, the contents of A and B$
  6520.        are undefined.  Also note that ASIC does not check to see that you don't
  6521.        read past the end of the DATA you specified.  In the above example, if
  6522.        you had a third READ statement that contained "READ C$", then C$ would
  6523.        contain random garbage, since you read three values, but only provided
  6524.        data for two.
  6525.  
  6526.        See also:
  6527.  
  6528.             DATA,RESTORE
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.                                       Page - 103
  6552.  
  6553.  
  6554.  
  6555.  
  6556.                                         RECEIVE
  6557.  
  6558.        Format:        variable1 = RECEIVE(number2)
  6559.  
  6560.        Description:
  6561.  
  6562.             This statement will read a byte from the specified serial port.
  6563.        Number2 identifies which port to read (0=COM1, and 1=COM2).  The byte
  6564.        read is stored in variable1 (which may be an integer or string type
  6565.        variable).  Before executing this statement you should first check to
  6566.        see if there is data waiting to be read.  Executing this statement when
  6567.        data is not waiting can cause your PC to "hang" until data is received
  6568.        at the hardware serial port.  The example below illustrates how to
  6569.        determine if data is waiting to be received.
  6570.  
  6571.        Example:
  6572.  
  6573.             OPENCOM(2,0,0,3,0)
  6574.  
  6575.             PORTSTAT = COMSTAT(0)
  6576.             DATAREADY = ZBIT(8,PORTSTAT)
  6577.             IF DATAREADY = 0 THEN NODATAWAITING:
  6578.             A$=RECEIVE(0)
  6579.  
  6580.  
  6581.        These statements do the following.  The first retrieves the status of
  6582.        COM1 to the variable PORTSTAT.  The second checks to see if bit 8 is on,
  6583.        DATAREADY will contain 1 if so, otherwise it will contain 0.  Since Bit
  6584.        8 is used to determine if data is waiting to be received from the port,
  6585.        if DATAREADY NOT = 0 then the program will RECEIVE data from the port to
  6586.        variable "A$".
  6587.  
  6588.        Comments:
  6589.  
  6590.             Variable1 can be either a string or integer type variable.
  6591.        However, if variable1 is a string, bear in mind that you cannot directly
  6592.        receive a NULL (ASCII Code 0), since NULL is used to delimit the end of
  6593.        a string in ASIC.  However, if in the above example data was waiting at
  6594.        the port but A$ contained "" after the receive, you would know that the
  6595.        character received was a NULL.  This is not a problem if variable1 is an
  6596.        integer variable.
  6597.  
  6598.        See also:
  6599.  
  6600.             OPENCOM,SEND,COMSTAT
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.  
  6608.  
  6609.  
  6610.  
  6611.  
  6612.  
  6613.  
  6614.                                       Page - 104
  6615.  
  6616.  
  6617.  
  6618.  
  6619.                                           REM
  6620.  
  6621.        Format:        REM  free form comments
  6622.  
  6623.        Description:
  6624.  
  6625.             This statement is used to insert comments into your program.
  6626.        Everything following REM is treated by ASIC as a comment.
  6627.  
  6628.        Example:
  6629.  
  6630.             REM The compiler will ignore this line
  6631.  
  6632.  
  6633.  
  6634.                                         RESTORE
  6635.  
  6636.        Format:        RESTORE
  6637.  
  6638.        Description:
  6639.  
  6640.             This statement allows you to READ data from DATA statements after
  6641.        you have already READ it once.
  6642.  
  6643.        Example:
  6644.                  DATA 0
  6645.  
  6646.                  READ A
  6647.                  RESTORE
  6648.                  READ B
  6649.  
  6650.        In this example, "READ A" causes variable "A" to be set to 0.  Now, the
  6651.        DATA statement is "used up".  There is no more data left on it to be
  6652.        read.  The RESTORE resets the DATA so that the next statement "READ B"
  6653.        will result in "B" being set to 0.  If the RESTORE was not done, the
  6654.        contents of B would be undefined.
  6655.  
  6656.        See also:
  6657.  
  6658.             READ, DATA
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.                                       Page - 105
  6678.  
  6679.  
  6680.  
  6681.  
  6682.                                         RETURN
  6683.  
  6684.        Format:        RETURN
  6685.  
  6686.        Description:
  6687.  
  6688.             Used to return from a GOSUB call.
  6689.  
  6690.        Example:
  6691.  
  6692.             GOSUB PRINTIT:
  6693.             END
  6694.  
  6695.             PRINTIT: PRINT "IT"
  6696.             RETURN
  6697.  
  6698.        In the above example, the word "IT" will be printed on the screen.  The
  6699.        RETURN statement causes program execution to resume on the statement
  6700.        following the corresponding GOSUB statement.  In this example, control
  6701.        will be returned to the END statement.
  6702.  
  6703.        Comments:
  6704.  
  6705.             Executing a RETURN statement without having first executed a GOSUB
  6706.        statement could cause unpredictable results.
  6707.  
  6708.        See also:
  6709.  
  6710.             GOSUB
  6711.  
  6712.  
  6713.  
  6714.                                         RIGHT$
  6715.  
  6716.        Format:        string1 = RIGHT$(string2,number1)
  6717.  
  6718.        Description:
  6719.  
  6720.             This statement will copy the rightmost number1 characters from
  6721.        string2 to string1.
  6722.  
  6723.        Example:
  6724.  
  6725.             A$=RIGHT$("RED RIDING HOOD",4)
  6726.  
  6727.        After the execution of the above statement, the variable A$ will contain
  6728.        the string "HOOD".
  6729.  
  6730.        See also:
  6731.  
  6732.             MID$, LEFT$
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.  
  6739.  
  6740.                                       Page - 106
  6741.  
  6742.  
  6743.  
  6744.  
  6745.                                          RMDIR
  6746.  
  6747.        Format:        RMDIR string1
  6748.  
  6749.        Description:
  6750.  
  6751.             This statement will delete an empty directory from disk.  String1
  6752.        should contain the name of the directory to delete.  If ASIC is unable
  6753.        to delete the directory, it will set the System ERROR variable.  A list
  6754.        of ERROR codes is listed in the Error Messages Chapter of the ASIC
  6755.        Manual.
  6756.  
  6757.        Example:
  6758.  
  6759.                  RMDIR "C:\WORK\TEST"
  6760.                  IF ERROR = 0 THEN SUCCESS:
  6761.  
  6762.        After execution of this code, the directory TEST under directory WORK
  6763.        will be deleted (if it had no files or subdirectories in it, and if it
  6764.        is not the current directory for drive "C").
  6765.  
  6766.        See also:
  6767.  
  6768.             MKDIR,CHDIR
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.                                       Page - 107
  6804.  
  6805.  
  6806.  
  6807.  
  6808.                                           RND
  6809.  
  6810.        Format:        number1 = RND (number2)
  6811.  
  6812.        Description:
  6813.  
  6814.             This statement will return an integer number in the range of 0
  6815.        through 32767 for normal integers, and in the range of 0 to
  6816.        2,147,483,647 for long integers. This random number will be stored in
  6817.        number1.  Number2 is a dummy argument and can be any valid integer
  6818.        value.  If number1 is a decimal variable, the random number returned
  6819.        will be an integer in the range of 0 to 2,147,483,647.
  6820.  
  6821.        Example 1:
  6822.  
  6823.                  A& = RND(0)
  6824.  
  6825.        After execution of this statement "A" will contain a number between 0
  6826.        and 2,147,483,647 inclusive.
  6827.  
  6828.        Example 2:
  6829.  
  6830.                  RANDOMIZE
  6831.  
  6832.                  DIEROLL=RND(0)
  6833.                  DIEROLL=DIEROLL MOD 6
  6834.                  DIEROLL=DIEROLL+1
  6835.                  PRINT "YOU ROLLED A";DIEROLL
  6836.  
  6837.        The above example demonstrates how to generate a number in a given
  6838.        range.  In this case, the range will be 1-6, which would be suitable for
  6839.        simulating the roll of a die.  The above example will generate the
  6840.        simulated die roll, and print the result.
  6841.  
  6842.  
  6843.        Comments:
  6844.  
  6845.                In BASICA/GWBASIC, RND always returns a value between 1 and 0.
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.                                       Page - 108
  6867.  
  6868.  
  6869.  
  6870.  
  6871.                                         RTRIM$
  6872.  
  6873.        Format:        string1=RTRIM$(string2)
  6874.  
  6875.        Description:
  6876.  
  6877.             This statement will remove all trailing spaces from string2 and
  6878.        store the resulting string in string1.
  6879.  
  6880.        Example:
  6881.  
  6882.             A$=RTRIM$("XYZ   ")
  6883.  
  6884.        After the execution of this statement, the variable "A$" will contain
  6885.        "XYZ".
  6886.  
  6887.        See also:
  6888.  
  6889.             LTRIM$
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.  
  6929.                                       Page - 109
  6930.  
  6931.  
  6932.  
  6933.  
  6934.                                           RUN
  6935.  
  6936.        Format:        RUN string1
  6937.  
  6938.        Description:
  6939.  
  6940.             This function can be used to load and execute other programs
  6941.        compiled with ASIC or another compiler.  String1 represents the name of
  6942.        the program to execute.  If an error occurs when ASIC attempts to RUN
  6943.        the program, it will set the system ERROR variable to 255.  Otherwise,
  6944.        the ERROR variable will be set to the value of the return code of the
  6945.        called program (which is 0 unless the called program specifies
  6946.        otherwise).
  6947.  
  6948.        Example:
  6949.  
  6950.             RUN "OTHER.COM"
  6951.  
  6952.        Comments:
  6953.  
  6954.             String1 must contain the FULL pathname of the program
  6955.        (ie,"\directory\progname.COM") only if the program is NOT in the current
  6956.        directory.  You must include the file extension on the file name (for
  6957.        example, use "MYPROG.COM" instead of just "MYPROG", or use "MYPROG.EXE"
  6958.        instead of "MYPROG").
  6959.  
  6960.             At this time, RUN and CALL are functionally equivalent, with one
  6961.        exception.  RUN does not accept program arguments, but CALL does.
  6962.  
  6963.             It is recommended (but not required) that you compile your program
  6964.        using the EXE format (instead of the COM format) when your program uses
  6965.        this statement, since an EXE program will release more memory when
  6966.        calling the program.  This will allow you to call a slightly larger
  6967.        program than is possible with the COM format.
  6968.  
  6969.        CAUTION:
  6970.  
  6971.             You may use the debugger with programs which contain "CALL" or
  6972.        "RUN" statements.  However, the programs you call should not themselves
  6973.        contain debugging code.  For example, if A.ASI calls B.ASI, then make
  6974.        sure you compile B.ASI with the "Debugging Code" option OFF before you
  6975.        try to debug program A.ASI.  Failure to do so will cause the debugger to
  6976.        behave erratically.  This also applies to programs you write using other
  6977.        compilers, since they also use the same interrupt that ASIC uses (INT 3)
  6978.        for debugging purposes.
  6979.  
  6980.        See also:
  6981.  
  6982.             CALL
  6983.  
  6984.  
  6985.  
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.                                       Page - 110
  6993.  
  6994.  
  6995.  
  6996.  
  6997.                                         SCREEN
  6998.  
  6999.        Format:        SCREEN number1
  7000.  
  7001.        Description:
  7002.  
  7003.             This statement will transfer the computer between text mode and
  7004.        graphics modes.  Number1 must be an integer constant with a value of 0,
  7005.        1, 2, 7, 9, or 13.  These modes are described in the table below.  The
  7006.        "Mode" column identifies the value of number1 to specify on the SCREEN
  7007.        command to select that graphics mode.  The "Graphics Resolution" column
  7008.        has three numbers.  The first identifies the number of rows of pixels
  7009.        supported in this mode.  The second number identifies the number of
  7010.        columns.  The third number identifies the number of colors which may
  7011.        displayed on screen at one time.  The numbers in the "Text Resolution"
  7012.        column tell you how many rows, columns and colors you may display on the
  7013.        screen when displaying text.  The adapters column identifies the type of
  7014.        graphics adapter required to use this mode.
  7015.  
  7016.        Mode      Graphics Resolution      Text Resolution     Adapters
  7017.        -----     -------------------      ---------------     -------
  7018.          0       None                     25 x 80 x 16        Any Adapter
  7019.          1       200 x 320 x 4            25 x 40 x 4         CGA/EGA/VGA
  7020.          2       200 x 640 x 2            25 x 80 x 2         CGA/EGA/VGA
  7021.          7       200 x 320 x 16           25 x 40 x 16        EGA/VGA
  7022.          9       350 x 640 x 16           25 x 80 x 16        EGA/VGA
  7023.         13       200 x 320 x 256          25 x 40 x 16        VGA
  7024.  
  7025.  
  7026.  
  7027.        Example:
  7028.  
  7029.                  SCREEN 13
  7030.  
  7031.        After execution of this statement, the PC will be in Graphics Mode 13
  7032.        which will allow you to display 200 rows by 320 columns of pixels in 256
  7033.        different colors.  Up to 25 rows and 80 columns of text can be displayed
  7034.        in up to 256 colors.  And finally, mode 13 requires a VGA Graphics Card.
  7035.  
  7036.        Comments:
  7037.  
  7038.             Any program which uses the SCREEN command should issue a "SCREEN 0"
  7039.        command before terminating.  Otherwise, the screen will not be reset
  7040.        properly when you return to DOS.
  7041.  
  7042.        See also:
  7043.  
  7044.             PSET, PRESET, POINT, ZMODE
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.                                       Page - 111
  7056.  
  7057.  
  7058.  
  7059.  
  7060.                                          SEND
  7061.  
  7062.        Format:        SEND (data1,number2)
  7063.  
  7064.        Description:
  7065.  
  7066.             This statement is used to send one character to a serial port.  The
  7067.        port should initialized with OPENCOM prior to using this statement.
  7068.        Data1 may be any valid data type (integer or string, variable or
  7069.        constant) and it should contain the character to be sent to the port.
  7070.        Number2 identifies which COM port to send to (0=COM1, 1=COM2).
  7071.  
  7072.        Example:
  7073.  
  7074.                  OPENCOM(2,0,0,3,0)
  7075.                  SEND ("X",0)
  7076.  
  7077.        The above code will open COM1 at 300baud, 1 stop bit, 8bit character
  7078.        size, with no parity.  It will then send the character "X" to COM1.
  7079.  
  7080.        See also:
  7081.  
  7082.             RECEIVE,COMSTAT,OPENCOM
  7083.  
  7084.  
  7085.  
  7086.                                          SOUND
  7087.  
  7088.        Format:        SOUND number1,number2
  7089.  
  7090.        Description:
  7091.  
  7092.             This statement will generate a sound on your computer speaker with
  7093.        a frequency of number1, and a duration of number2.  Frequency should be
  7094.        in the range of 0 to 32767.  ASIC, however, only checks to see that it
  7095.        is non-negative.
  7096.  
  7097.        Example:
  7098.  
  7099.                  SOUND  400,20
  7100.  
  7101.        Execution of the above statement will produce a short beep.
  7102.  
  7103.        Comments:
  7104.  
  7105.             ASIC "frequencies" values go from high to low.  That is, a
  7106.        frequency of 0 is the highest, and 32767 is the lowest.
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.                                       Page - 112
  7119.  
  7120.  
  7121.  
  7122.  
  7123.                                         SPACE$
  7124.  
  7125.        Format:        string1=SPACE$(number1)
  7126.  
  7127.        Description:
  7128.  
  7129.             This statement will return a string containing number1 ASCII space
  7130.        characters.
  7131.  
  7132.        Example:
  7133.  
  7134.             A$=SPACE$(10)
  7135.             B$="<"+A$
  7136.             B$=B$+">"
  7137.  
  7138.        After execution of these statements, variable "B$" will contain the
  7139.        string "<          >".
  7140.  
  7141.        See also:
  7142.  
  7143.             STRING$
  7144.  
  7145.  
  7146.  
  7147.                                          STR$
  7148.  
  7149.        Format:        string1 = STR$ (number1)
  7150.  
  7151.        Description:
  7152.  
  7153.             This statement will convert number1 to a string format and store
  7154.        the string format in string1.
  7155.  
  7156.        Example:
  7157.  
  7158.                  A=1234
  7159.                  A$ = STR$(A)
  7160.  
  7161.        After execution of these statements, A$ would contain the string "1234".
  7162.  
  7163.        See also:
  7164.  
  7165.             VAL
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.                                       Page - 113
  7182.  
  7183.  
  7184.  
  7185.  
  7186.                                         STRING$
  7187.  
  7188.        Format:        string1=STRING$(number1,number2)  <--Format 1
  7189.  
  7190.                       string1=STRING$(number1,string2)   <--Format 2
  7191.  
  7192.        Description:
  7193.  
  7194.             This statement will return a string containing number1 characters
  7195.        of ASCII value number2 (Format1).  If format 2 is used, this statement
  7196.        will create a string containing number1 characters. Each of these
  7197.        characters will be the same as the first character of string2.
  7198.  
  7199.        Example 1:
  7200.  
  7201.             A$=STRING$(8,111)
  7202.  
  7203.        After execution of these statements, variable "A$" will contain the
  7204.        string "oooooooo".
  7205.  
  7206.        Example 2:
  7207.  
  7208.             A$=STRING$(5,"xyz")
  7209.  
  7210.        After execution of these statements, variable "A$" will contain the
  7211.        string "xxxxx".
  7212.  
  7213.        See also:
  7214.  
  7215.             SPACE$
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.  
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.                                       Page - 114
  7245.  
  7246.  
  7247.  
  7248.  
  7249.                                          TIME$
  7250.  
  7251.        Format:        string1 = TIME$
  7252.  
  7253.        Description:
  7254.  
  7255.             This statement will retrieve the current time from the PC's system
  7256.        clock.  The time will be retrieved and stored in String1, in the format:
  7257.        "HH.MM.SS".
  7258.  
  7259.        Example:
  7260.  
  7261.             CURTIME$=TIME$
  7262.             PRINT CURTIME$
  7263.  
  7264.        After execution of the above statements the current time (as per the
  7265.        PC's internal clock) will be displayed on the screen.
  7266.  
  7267.        Comments:
  7268.  
  7269.             Note:  if the time printed is wrong, you have probably not set the
  7270.        system clock.  Most older XTs and PCs do not have a battery to preserve
  7271.        the DATE and TIME in the system clock, so you have to set them each time
  7272.        you power up the PC.  Most ATs and newer PCs have a battery backup, so
  7273.        that the date is preserved for you.
  7274.  
  7275.             Unlike GWBASIC/BASICA, you cannot set the system time with TIME$,
  7276.        however, you can set the system time from DOS by typing TIME.
  7277.  
  7278.        See also:
  7279.  
  7280.             DATE$, TIMER
  7281.  
  7282.  
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.                                       Page - 115
  7308.  
  7309.  
  7310.  
  7311.  
  7312.                                          TIMER
  7313.  
  7314.        Format:        number1 = TIMER
  7315.  
  7316.        Description:
  7317.  
  7318.             This statement will retrieve a timer count from the PCs hardware
  7319.        circuitry.  The timer count will be placed in number1.  The timer count
  7320.        is in "clock ticks".  A "clock tick" occurs in the PC approximately 18.2
  7321.        times per second.  The PC is continually incrementing this clock
  7322.        counter.  This statement can be used to time the duration of events.
  7323.  
  7324.        Example:
  7325.  
  7326.  
  7327.             CLS
  7328.             PRINT "PRESS A KEY"
  7329.             STARTCNT&=TIMER
  7330.        LOOP:X$=INKEY$
  7331.             IF X$="" THEN LOOP:
  7332.             ENDCNT&=TIMER
  7333.             ELAPSED&=ENDCNT&-STARTCNT&
  7334.             ELAPSED&=ABS(ELAPSED&)
  7335.             ELAPSED&=ELAPSED&/18
  7336.             PRINT "IT TOOK YOU APPROXIMATELY";
  7337.             PRINT ELAPSED&
  7338.             PRINT " SECONDS TO PRESS A KEY"
  7339.  
  7340.  
  7341.        The above code fragment will time how long you wait to press a key in
  7342.        seconds.  You could modify it easily to display in clock ticks, which
  7343.        would provide much more accuracy, if you deleted the statement which
  7344.        divides the ELAPSED count by 18.
  7345.  
  7346.        Comments:
  7347.  
  7348.             Note that it is necessary to use the absolute value of ELAPSED&
  7349.        since the clock counts is stored as unsigned integers.  ASIC integers,
  7350.        on the other hand, are signed.  If number1 is a long integer variable,
  7351.        then TIMER retrieves the full PC timer value.  However, if a normal
  7352.        integer variable is specified as number1, then ASIC retrieves the least
  7353.        16 significant bits from the PC timer.
  7354.  
  7355.        See also:
  7356.  
  7357.             DATE$,TIME$
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.                                       Page - 116
  7371.  
  7372.  
  7373.  
  7374.  
  7375.                                         UCASE$
  7376.  
  7377.        Format:        string1=UCASE$(string2)
  7378.  
  7379.        Description:
  7380.  
  7381.             This statement will convert all lowercase letters in string2 to
  7382.        uppercase, and store the resulting string in string1.
  7383.  
  7384.        Example:
  7385.  
  7386.             A$=UCASE$("123 Main St, USA")
  7387.  
  7388.        After execution of this statement, the variable "A$" will contain the
  7389.        string "123 MAIN ST, USA".
  7390.  
  7391.        See also:
  7392.  
  7393.             LCASE$
  7394.  
  7395.  
  7396.  
  7397.                                           VAL
  7398.  
  7399.        Format:        number1 = VAL (string1)
  7400.  
  7401.        Description:
  7402.  
  7403.             This statement will attempt to convert string1 into an integer
  7404.        value, and it will store the result in number1.
  7405.  
  7406.        Example:
  7407.  
  7408.                  A$ = "12345"
  7409.                  A = VAL (A$)
  7410.  
  7411.        After execution of these statements, variable "A" would contain the
  7412.        value 12345.
  7413.  
  7414.  
  7415.        See also:
  7416.  
  7417.             STR$
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.                                       Page - 117
  7434.  
  7435.  
  7436.  
  7437.  
  7438.                                         VARPTR
  7439.  
  7440.        Format:        number1 = VARPTR (variable1)
  7441.  
  7442.        Description:
  7443.  
  7444.             This statement will return the address of a variable  variable1 and
  7445.        store it in number1.  This may be used to peek and poke values directly
  7446.        into a variable.
  7447.  
  7448.        Example:
  7449.  
  7450.                  A$ = "XYZ"
  7451.                  B = VARPTR(A$)
  7452.                  C = PEEK (B)
  7453.                  PRINT C
  7454.  
  7455.        After execution of these statements the screen would display the number
  7456.        88 which is the number for the ASCII character "X".
  7457.  
  7458.        See also:
  7459.  
  7460.             PEEK, POKE
  7461.  
  7462.  
  7463.  
  7464.                                       WHILE/WEND
  7465.  
  7466.        Format:        WHILE condition
  7467.                       WEND
  7468.  
  7469.        Description:
  7470.  
  7471.             This statement will execute those statements which are between the
  7472.        WHILE and the WEND statements as long as the "condition" is true.  The
  7473.        operand "condition" is one of the following:
  7474.  
  7475.                       number1 > number2
  7476.                       string1  > string2
  7477.                       number1 = number2
  7478.                       string1  = string2
  7479.                       number1 < number2
  7480.                       string1  < string2
  7481.  
  7482.        Example:
  7483.  
  7484.                  PRINT "PRESS A KEY TO CONTINUE"
  7485.                  A$=""
  7486.                  WHILE A$=""
  7487.                       A$=INKEY$
  7488.                  WEND
  7489.  
  7490.        In this example, the program will pause until the user presses a key.
  7491.        WHILE statements may be nested 25 levels deep.
  7492.  
  7493.  
  7494.  
  7495.  
  7496.                                       Page - 118
  7497.  
  7498.  
  7499.  
  7500.  
  7501.                                          WIDTH
  7502.  
  7503.        Format:        WIDTH number1
  7504.  
  7505.        Description:
  7506.  
  7507.             This statement will set the screen to 40 column text or 80 column
  7508.        text mode only.  The only two valid values for number1 are thus 40 and
  7509.        80.  In ASIC, WIDTH 80 is equivalent to executing SCREEN 0.  Also, WIDTH
  7510.        40 is equivalent to executing SCREEN 1.  If you use WIDTH 40, you should
  7511.        always reset the screen back to WIDTH 80 before terminating your program
  7512.        with END.  Otherwise, your PC will be left in 40 column mode.
  7513.  
  7514.        Example:
  7515.  
  7516.             WIDTH 40
  7517.  
  7518.        The above statement would put the PC in 40 column mode.
  7519.  
  7520.  
  7521.  
  7522.                                          ZBIT
  7523.  
  7524.        Format:        number1 = ZBIT(number2,number3)
  7525.  
  7526.        Description:
  7527.  
  7528.             This statement is used to determine if a single "bit" in an integer
  7529.        variable is set to "1".  Number2 represents the bit to be tested.  It
  7530.        should be in the range 0 to 15.  Number3 represents the integer variable
  7531.        or constant to be tested.  The result of the test is returned to
  7532.        number1.  If the bit was set, number1 will be set to "1", otherwise,
  7533.        number1 will be set to "0".
  7534.  
  7535.        Example:
  7536.  
  7537.                  GAMEPORT = INP(513)
  7538.                  TRIGGER = ZBIT(4,GAMEPORT)
  7539.                  IF TRIGGER = 1 THEN TRIGGERPRESSED:
  7540.  
  7541.        In this example, the joystick port is read, and its status is placed in
  7542.        the variable "GAMEPORT".  The bit which represents the trigger for
  7543.        joystick 1 is then tested using ZBIT.  If the trigger bit is set, then
  7544.        the program would transfer to the label "TRIGGERPRESSED:".  Note that
  7545.        the above code assumes that a game card is present in the computer.
  7546.  
  7547.        Comments:
  7548.  
  7549.             This statement is an extension over GWBASIC/BASICA, although it is
  7550.        possible to perform similar tests in GWBASIC/BASICA with the boolean AND
  7551.        statement.
  7552.  
  7553.  
  7554.  
  7555.  
  7556.  
  7557.  
  7558.  
  7559.                                       Page - 119
  7560.  
  7561.  
  7562.  
  7563.  
  7564.                                          ZMODE
  7565.  
  7566.        Format:        integer = ZMODE
  7567.  
  7568.        Description:
  7569.  
  7570.             This command returns a code which indicates whether a color or
  7571.        monochrome card is active in the system.  ZMODE returns a value of 1
  7572.        when a color card is detected, and a value of 0 for monochrome.
  7573.  
  7574.        Example:
  7575.  
  7576.                  A = ZMODE
  7577.                  IF A = 0 THEN
  7578.                       PRINT "This program requires a Color Card to Run"
  7579.                       END
  7580.                  ENDIF
  7581.  
  7582.        The above code fragment will check for a color card; if not found, the
  7583.        program will terminate with an appropriate message.  Otherwise, the
  7584.        program will continue.
  7585.  
  7586.        Comments:
  7587.  
  7588.             This statement is an extension over BASICA/GWBASIC.
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594.  
  7595.  
  7596.  
  7597.  
  7598.  
  7599.  
  7600.  
  7601.  
  7602.  
  7603.  
  7604.  
  7605.  
  7606.  
  7607.  
  7608.  
  7609.  
  7610.  
  7611.  
  7612.  
  7613.  
  7614.  
  7615.  
  7616.  
  7617.  
  7618.  
  7619.  
  7620.  
  7621.  
  7622.                                       Page - 120
  7623.  
  7624.  
  7625.  
  7626.  
  7627.  
  7628.  
  7629.  
  7630.                                         A S I C
  7631.  
  7632.                                        Chapter 8
  7633.  
  7634.                            Compatibility with GWBASIC/BASICA
  7635.  
  7636.  
  7637.        In general, although ASIC does not support all options on every BASIC
  7638.        statement, those it does support work like they do in BASICA/GWBASIC.
  7639.        The known exceptions are listed in this chapter.
  7640.  
  7641.  
  7642.        INKEY$
  7643.  
  7644.             This statement is compatible, however ASIC does provide an
  7645.        extension over GWBASIC/BASICA.  If an extended key is pressed (e.g. F1-
  7646.        F10), ASIC returns the scan code for the extended key, and sets a
  7647.        special system variable "EXTENDED" to a value of 1.  For non-extended
  7648.        keys, the "EXTENDED" variable will contain 0.
  7649.  
  7650.  
  7651.        FILE HANDLING
  7652.  
  7653.             ASIC provides no EOF statement or ON ERROR statements.  Instead,
  7654.        ASIC sets a special system variable when an error occurs during file
  7655.        I/O.  This special variable is called "ERROR" and it is set after every
  7656.        file I/O statement (OPEN/INPUT#/PRINT#/CLOSE, etc) to either 0 to
  7657.        indicate no errors, or a non-zero value.  If a non-zero value is
  7658.        present, an error has occurred.  The specific errors are identified in
  7659.        chapter 10.
  7660.  
  7661.  
  7662.        FILE FORMAT
  7663.  
  7664.             ASIC Files are written with 2/4 bytes per normal/long integer in
  7665.        binary format, instead of string format as in BASICA/GWBASIC.  Strings
  7666.        are written as a sequence of ASCII characters terminated by an ASCII
  7667.        null, or optionally with no NULL terminator.
  7668.  
  7669.  
  7670.        PUNCTUATION
  7671.  
  7672.             ASIC permits use of punctuation that it does not require to allow
  7673.        you to enter statements in their familiar GWBASIC/BASICA Formats.  For
  7674.        example:
  7675.  
  7676.                  A = ABS (B(1))
  7677.  
  7678.             This statement is valid in both ASIC and in GWBASIC/BASICA.
  7679.        However, ASIC ignores the parenthesis and comma.  Thus ASIC will
  7680.        actually accept the following formats as alternatives to the above:
  7681.  
  7682.             A = ABS B 1
  7683.             A = ABS B 1,,,,,,)))))
  7684.  
  7685.                                       Page - 121
  7686.  
  7687.  
  7688.  
  7689.  
  7690.        FOR/NEXT
  7691.  
  7692.             FOR/NEXT loops always fall through the body of the FOR at least one
  7693.        time in ASIC.  This does not happen in BASICA/GWBASIC.  For more
  7694.        information on this, refer to Chapter 7.
  7695.  
  7696.  
  7697.        RND
  7698.  
  7699.             RND (N) returns a value from 0-32767 for normal integers and     0-
  7700.        2,147,483,647 for long integers instead of 0 to 1 as in BASICA/GWBASIC.
  7701.  
  7702.  
  7703.        LOCATE/CSRLIN/POS
  7704.  
  7705.             Coordinates are specified in range 0-24 and 0-79 instead of 1-25
  7706.        and 1-80.
  7707.  
  7708.  
  7709.        PSET/PRESET/POINT
  7710.  
  7711.             Coordinates are specified in row/column order instead of column/row
  7712.        order.
  7713.  
  7714.  
  7715.        BLOAD/BSAVE
  7716.  
  7717.             File formats are not compatible with GWBASIC/BASICA.  BLOAD
  7718.        requires offset and the number of bytes to read.
  7719.  
  7720.        OPENCOM/COMSTAT/SEND/RECEIVE
  7721.  
  7722.             These statements provide serial port support in ASIC.  In
  7723.        GWBASIC/BASICA this is provided by OPEN/INPUT#/PRINT#.
  7724.  
  7725.        DATE$/TIME$
  7726.  
  7727.             ASIC allows you to retrieve the system date and time, but will not
  7728.        allow you to set new system date/time values.
  7729.  
  7730.        CALL/RUN
  7731.  
  7732.             These statements perform functions similar to their GWBASIC/BASICA
  7733.        counterparts, but function differently.  Refer to the keyword reference
  7734.        for the appropriate keyword for details on their operation.
  7735.  
  7736.  
  7737.  
  7738.  
  7739.  
  7740.  
  7741.  
  7742.  
  7743.  
  7744.  
  7745.  
  7746.  
  7747.  
  7748.                                       Page - 122
  7749.  
  7750.  
  7751.  
  7752.  
  7753.  
  7754.  
  7755.        EXTENSIONS OVER BASICA/GWBASIC
  7756.  
  7757.  
  7758.        CODE                COMMAND$
  7759.        INT86               FILEPOS
  7760.        FIND                LCASE$
  7761.        LTRIM$              MOD
  7762.        RTRIM               UCASE$
  7763.        ZBIT                ZMODE
  7764.        EXTENDED
  7765.  
  7766.             The statements above are extensions over BASICA/GWBASIC.
  7767.  
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.  
  7780.  
  7781.  
  7782.  
  7783.  
  7784.  
  7785.  
  7786.  
  7787.  
  7788.  
  7789.  
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.  
  7796.  
  7797.  
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.                                       Page - 123
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.                                         A S I C
  7820.  
  7821.                                        Chapter 9
  7822.  
  7823.                                 Technical Details/Tips
  7824.  
  7825.  
  7826.        This chapter contains technical information and tips regarding ASIC.
  7827.  
  7828.  
  7829.  
  7830.                                     COMPILER LIMITS
  7831.  
  7832.  
  7833.        Maximum Source Program Size:   Command Line Compiler - Unlimited
  7834.                                       Integrated Environment - Limited only by
  7835.                                       available memory
  7836.  
  7837.        Maximum Object Program Size:   64k bytes--.COM Format:
  7838.                                                     64k code/data/stack
  7839.                                      130k+ bytes--.EXE Format:
  7840.                                                     64k code
  7841.                                                     64k data
  7842.                                                     up to 64k stack
  7843.                                      130k+ bytes--.OBJ Format:
  7844.                                                     64k ASIC code
  7845.                                                     64k ASIC data
  7846.                                                     up to 64k stack
  7847.                                                     PLUS up to ~500k externally
  7848.                                                     assembled ".OBJ" files can
  7849.                                                     be linked into your ASIC
  7850.                                                     program and called using
  7851.                                                     the CALL SUB statement.
  7852.        Maximum Source Line Length     128 bytes - Command Line
  7853.                                       80 bytes - Integrated Environment
  7854.  
  7855.        Compiler Symbol Table Size:    Unlimited - can use all available memory
  7856.  
  7857.        Maximum Number of Arrays:      25
  7858.  
  7859.        FOR/NEXT Nesting Depth         25
  7860.  
  7861.        IF/THEN/ELSE Nesting Depth     25
  7862.  
  7863.        WHILE/WEND Nesting Depth       25
  7864.  
  7865.        Compiler Memory Requirements  305k - Command Line
  7866.                                      405k - Integrated Environment
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.                                       Page - 124
  7875.  
  7876.  
  7877.  
  7878.  
  7879.  
  7880.  
  7881.                                   COMPILER OPERATION
  7882.  
  7883.  
  7884.             ASIC is a single pass compiler written entirely in C (Borland C
  7885.        Version 3.1).  Each source statement is translated directly into machine
  7886.        code.  ASIC compiles 100% in memory for maximum speed.  The compiler
  7887.        does not require any disk work space.  ASIC generates a minimum of error
  7888.        checking code.  This is because the ASIC philosophy stresses execution
  7889.        speed.  This does place greater responsibility on the programmer to
  7890.        check for out of bounds conditions, etc...
  7891.  
  7892.  
  7893.                                   MEMORY OPTIMIZATION
  7894.  
  7895.  
  7896.             ASIC provides 32 bit long integers in addition to 16 bit normal
  7897.        integers.  This allows you to store much larger numbers, however,
  7898.        nothing in life is free.  Long integers will increase the size of the
  7899.        resulting ".COM" file by approximately 475 bytes.  If you are not using
  7900.        long integers, be sure to compile with the "Extended Math" Option turned
  7901.        OFF so that ASIC does not include these unneeded bytes in your COM or
  7902.        EXE file. Otherwise, ASIC will include the long integer support code in
  7903.        your file, even if you never create a single long integer!  Note: by
  7904.        default, this option is turned off in both the command line and
  7905.        integrated versions of the compiler.
  7906.  
  7907.             Likewise, the "Decimal Math" option will allow math with fractional
  7908.        results of very large numbers, but this option will increase your
  7909.        program size.  Use integers or long integers unless you need this
  7910.        fractional precision, and turn off the "Decimal Math" option.  Note:  by
  7911.        default, this option is turned off in both the command line and
  7912.        integrated versions of the compiler.
  7913.  
  7914.             Also remember that ASIC's debugging option increases your ".COM"
  7915.        file size.  So don't forget to recompile your program with the
  7916.        "Debugging" Option turned off (after you have finished debugging it, of
  7917.        course).
  7918.  
  7919.             COM disk files will usually be smaller than EXE files by several
  7920.        hundred bytes.  However, COM files require 64k of memory to execute.
  7921.        Additionally, COM files (because of a DOS requirement), will
  7922.        automatically allocate all available memory at load time.  EXE files
  7923.        require the actual size of the program plus 2000 bytes for the stack
  7924.        (4000 bytes for the stack when compiling with debugging mode).  Thus,
  7925.        your program may be loadable in as few as 3-4k bytes of memory.  Also
  7926.        note that an ASIC EXE does NOT allocate all available memory to your
  7927.        program.  ASIC only allocates the amount of memory your program actually
  7928.        needs.  The following chart summarizes when it is usually best to use
  7929.        each type of file:
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.  
  7936.  
  7937.                                       Page - 125
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943.  
  7944.                             MEMORY OPTIMIZATION (Continued)
  7945.  
  7946.  
  7947.             Use COM files when:
  7948.             -------------------
  7949.  
  7950.             o  You want to minimize the disk space a program occupies
  7951.             o  Your program is smaller than 64k in size
  7952.  
  7953.             Use EXE files when:
  7954.             -------------------
  7955.  
  7956.             o  Your program is larger than 64k in size
  7957.             o  You want to minimize your program's run-time memory requirements
  7958.             o  You are calling another program using the RUN or CALL Statements
  7959.  
  7960.             Use the OBJ option to create an EXE file when:
  7961.             ----------------------------------------------
  7962.  
  7963.             o To use the CALL SUB statement.
  7964.  
  7965.  
  7966.                                PERFORMANCE OPTIMIZATION
  7967.  
  7968.  
  7969.        This section contains tips for making your programs run as fast as
  7970.        possible.
  7971.  
  7972.        1)   VARIABLE TYPES - Don't use long integer variables or decimal
  7973.        variables to store numbers that can fit in a regular integer variable.
  7974.        Long integer variables are exponentially slower than regular integers,
  7975.        and decimal variables are exponentially slower than long integer
  7976.        variables.  If the number will exceed the range allowed by a regular
  7977.        integer, but is an integer in the range +/-2,147,483,647, then use a
  7978.        long integer.  If the number requires one or more decimal places of
  7979.        precision, or is an integer larger than +/-2,147,483,647, then use a
  7980.        decimal variable.  Always use integers on FOR/NEXT loops, when possible.
  7981.  
  7982.        2)   DECIMAL VARIABLES - When using decimal variables, be aware that the
  7983.        least efficient operation is screen I/O.  Don't PRINT a number unless
  7984.        you need to. (Note:  The decimal variable format used by ASIC was
  7985.        selected to optimize speed when adding, subtracting, multiplying,and
  7986.        dividing.  The trade off in using this format is that it takes longer to
  7987.        convert the internal format to printable form than it would have with a
  7988.        packed binary coded decimal (BCD) format.)
  7989.  
  7990.        3)   MATH FUNCTIONS - The math functions, in order of least efficient to
  7991.        most efficient, are:  Division, Multiplication, Subtraction and
  7992.        Addition.
  7993.  
  7994.        4)   DON'T MIX VARIABLE TYPES - When performing calculations using
  7995.        decimal variables, avoid mixing decimal variables with integer
  7996.        variables.  Although ASIC will automatically convert the integers to a
  7997.        decimal format internally, this conversion will slow down your
  7998.        calculations.
  7999.  
  8000.                                       Page - 126
  8001.  
  8002.  
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.                                     DEBUGGER LIMITS
  8009.  
  8010.  
  8011.        Maximum Concurrent Breakpoints     20
  8012.  
  8013.        Maximum Concurrent Watches         10
  8014.  
  8015.        Maximum Symbol Length              30 Characters
  8016.  
  8017.        Maximum Symbols                    Same as Compiler
  8018.  
  8019.        Maximum Source Statements          Unlimited
  8020.  
  8021.  
  8022.                                   DEBUGGER OPERATION
  8023.  
  8024.             When you select the "Debugging code" compiler option, the ASIC
  8025.        compiler inserts additional machine language instructions into your
  8026.        program.  It inserts a single statement at the beginning of your program
  8027.        (specifically, INT 3) which allows it to gain control.  When the ASIC
  8028.        editor is loaded, it saves the existing INT 3 vector, and installs the
  8029.        ASIC Debugger as INT 3.  In this way, when your program begins
  8030.        executing, the INT 3 statement that ASIC inserted in your program causes
  8031.        a transfer of control to the debugger.  Once the debugger gains control,
  8032.        it can set or remove additional breakpoints as needed in your program,
  8033.        plus provide access to the video memory and variable memory locations
  8034.        with the Swap, Watch, Unwatch, and Modify Commands.  When you exit the
  8035.        ASIC editor, ASIC deinstalls the debugger from INT 3, and restores the
  8036.        original interrupt 3 vector.
  8037.  
  8038.             The compiler also creates a file with a ".DBG" extension which
  8039.        contains the symbolic information needed by the debugger (ie, variable
  8040.        names and offsets, and source statement offsets).
  8041.  
  8042.  
  8043.                                    DEBUGGER OVERHEAD
  8044.  
  8045.             Running a program in debugging mode adds a small amount of overhead
  8046.        to your program (both compiled code size, and execution speed).
  8047.        Specifically, the size of the debugging code will be (approximately):
  8048.  
  8049.                  CodeSizeIncrease = 1 + LinesOfSourceCode
  8050.  
  8051.        Note that the actual increase will usually be less than the above, since
  8052.        DIM, DATA, REM, and blank source lines do not require debugging code.
  8053.        The reduction in execution speed is very slight in most cases (for you
  8054.        assembly language programmers out there, a single NOP instruction is
  8055.        executed for each source line).
  8056.  
  8057.             In EXE files, the stack size is increased by an additional 2k when
  8058.        debugging is enabled.
  8059.  
  8060.  
  8061.  
  8062.  
  8063.                                       Page - 127
  8064.  
  8065.  
  8066.  
  8067.  
  8068.  
  8069.  
  8070.  
  8071.                                     STORAGE FORMATS
  8072.  
  8073.  
  8074.             NORMAL INTEGERS are stored in ASIC as two bytes, with the low order
  8075.        byte appearing first (as per Intel conventions).
  8076.  
  8077.             LONG INTEGERS are stored in ASIC as four bytes, with the least
  8078.        significant word first, followed by the most significant word.  Within
  8079.        these two words, the least significant byte appears first followed by
  8080.        the most significant byte.
  8081.  
  8082.             STRING VARIABLES are stored as FIXED 80 character strings
  8083.        terminated by an ASCII null character for a total length of 81
  8084.        characters.
  8085.  
  8086.             STRING CONSTANTS are stored with 1 byte per character in the string
  8087.        followed by a terminating ASCII null character.
  8088.  
  8089.             DECIMAL VARIABLES AND CONSTANTS are stored in 8 bytes, from least
  8090.        significant byte to most significant byte.  They are stored as signed
  8091.        binary integers, with an implicit decimal point.  The integer values are
  8092.        adjusted after each multiplication or division to scale the result to
  8093.        the proper number of decimal places.
  8094.  
  8095.             ARRAYS - Each element in an array requires two bytes.  (Don't
  8096.        forget arrays have an element zero (ie  DIM A(2) is comprised of A(0),
  8097.        A(1), and A(2)).
  8098.  
  8099.        Examples:
  8100.  
  8101.                  Item      Data Type           Storage Requirements
  8102.                  A         Integer Variable              2 bytes
  8103.                  17        Integer Constant              2 bytes
  8104.                  A&        Long Integer Variable         4 bytes
  8105.                  55555&    Long Integer Constant         4 bytes
  8106.                  A$        String Variable               81 bytes
  8107.                  "ABC"     String Constant               4 bytes
  8108.                  "A"       String Constant               2 bytes
  8109.                  A@        Decimal Variable              8 bytes
  8110.                  1.23456   Decimal Constant              8 bytes
  8111.                  12345@    Decimal Constant              8 bytes
  8112.                  DIM A(10) Integer Array                 22 bytes
  8113.                  DIM A(1)  Integer Array                 4 bytes
  8114.                  DIM A&(10)  Long Integer Array          44 bytes
  8115.                  DIM A$(10)  String Array                891 bytes
  8116.                  DIM A@(10)  Decimal Array               88 bytes
  8117.  
  8118.        As you can see, string variables are expensive in terms of storage
  8119.        space.  Since string constants are stored at actual length +1, It is
  8120.        MUCH more efficient to store short strings as constants in ASIC in terms
  8121.        of storage space.  There is no performance advantage to constants over
  8122.        variables, however.
  8123.  
  8124.  
  8125.  
  8126.                                       Page - 128
  8127.  
  8128.  
  8129.  
  8130.  
  8131.                               STORAGE FORMATS (Continued)
  8132.  
  8133.        In disk files, strings, decimals, and integers are written out in the
  8134.        above formats.  Note that unlike GWBASIC/BASICA, integer and decimal
  8135.        values are NOT expanded into strings when written, and conversely, not
  8136.        converted from strings when read.  String variables and constants are
  8137.        written out as ASCII strings terminated by a null character (however,
  8138.        the null can be suppressed).  Thus, string variables when written to
  8139.        disk, take the same space byte for byte as string constants.
  8140.  
  8141.        The reason behind fixed length string variables was avoidance of string
  8142.        "garbage collection".  In addition to slight performance advantages,
  8143.        there is the added benefit of providing a string memory address which
  8144.        never changes.  Thus once VARPTR retrieves the address of a variable,
  8145.        you never have to worry about it changing.
  8146.  
  8147.  
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153.  
  8154.  
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.  
  8172.  
  8173.  
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179.  
  8180.  
  8181.  
  8182.  
  8183.  
  8184.  
  8185.  
  8186.  
  8187.  
  8188.  
  8189.                                       Page - 129
  8190.  
  8191.  
  8192.  
  8193.  
  8194.  
  8195.  
  8196.  
  8197.                                       MEMORY MAP
  8198.  
  8199.        COM File Memory Map
  8200.  
  8201.        The following describes the structure of the ".COM" file created by
  8202.        ASIC.  All addresses are in Hexadecimal.
  8203.  
  8204.  
  8205.  
  8206.             Description                   Address Range
  8207.        ------------------------------     -------------
  8208.        Program Segment Prefix (PSP)       0000 - 00FF
  8209.         (Created/Required by DOS)
  8210.  
  8211.        Transfer to Program Code           0100 - 0102
  8212.        String Conversion Buffer           0103 - 0109
  8213.        Input Buffer                       010A - 015B
  8214.        Screen Width                       015C
  8215.        Color/Attribute Byte               015D
  8216.        Screen Graphics Mode               015E
  8217.        Cursor Position                    015F - 0160
  8218.        File Control Table                 0161 - 0169
  8219.        ERROR System Variable              016A - 016B
  8220.        System Subroutine Vectors          016C - 017F
  8221.        EXTENDED System Variable           0180 - 0181
  8222.        RND Seed                           0182 - 0185
  8223.        Math Work Area                     0186 - 018D
  8224.        DEFSEG System Variable             018E - 018F
  8225.        Start DATA Block Pointer           0190 - 0191
  8226.        Current DATA Block Pointer         0192 - 0193
  8227.        Reserved for future use            0194 - 0195
  8228.        Optional Sys Subroutine Vectors    0196+
  8229.        and Work Areas (decimal math option)
  8230.        System Subroutines                 Address Varies
  8231.                  |
  8232.                  |
  8233.                  v
  8234.        Data Segment                       Address Varies
  8235.                  |
  8236.                  |
  8237.                  |
  8238.                  v
  8239.        Code Segment                       Address Varies
  8240.                  |
  8241.                  |
  8242.                  |
  8243.                  v
  8244.                  ^
  8245.                  |
  8246.                  |
  8247.        Program Stack  (builds downward)   FFFF
  8248.  
  8249.  
  8250.  
  8251.  
  8252.                                       Page - 130
  8253.  
  8254.  
  8255.  
  8256.  
  8257.  
  8258.                                 MEMORY MAP (Continued)
  8259.  
  8260.        EXE File Memory Map
  8261.  
  8262.        The following describes the structure of the ".EXE" file created by
  8263.        ASIC.  In the COM file format the code, data, and stack are all in the
  8264.        same memory segment.  In an ASIC EXE format file, the code, data, and
  8265.        stack each reside in their own segment.  Addresses are given as offsets
  8266.        from the CS (Code Segment), DS (Data Segment), or SS (Stack Segment)
  8267.        registers.
  8268.  
  8269.  
  8270.             Description                   Address Range
  8271.        ------------------------------     -------------
  8272.        Program Segment Prefix (PSP)       CS: minus 00FF
  8273.        (Created/Required by DOS, and
  8274.        immediately precedes the
  8275.        code segment)
  8276.                  |
  8277.                  |
  8278.                  v
  8279.        Code Segment (CS:)
  8280.             User Program                  0000 +
  8281.                  |
  8282.                  |
  8283.                  v
  8284.             System Subroutines            Address Varies
  8285.                  |
  8286.                  |
  8287.                  v
  8288.        Data Segment (DS:)
  8289.             Program Data Area #1          0000 - 0102
  8290.             String Conversion Buffer      0103 - 0109
  8291.             Input Buffer                  010A - 015B
  8292.             Screen Width                  015C
  8293.             Color/Attribute Byte          015D
  8294.             Screen Graphics Mode          015E
  8295.             Cursor Position               015F - 0160
  8296.             File Control Table            0161 - 0169
  8297.             ERROR System Variable         016A - 016B
  8298.             System Subroutine Vectors     016C - 017F
  8299.             EXTENDED System Variable      0180 - 0181
  8300.             RND Seed                      0182 - 0185
  8301.             Math Work Area                0186 - 018D
  8302.             DEFSEG System Variable        018E - 018F
  8303.             Start DATA Block Pointer      0190 - 0191
  8304.             Current DATA Block Pointer    0192 - 0193
  8305.             Reserved for future use       0194 - 0195
  8306.             Optional System Sub Vectors   0196+
  8307.             and Work Areas (decimal math option)
  8308.             Program Data Area #2          Address Varies
  8309.                  |
  8310.                  |
  8311.                  v
  8312.        Stack (SS:)  (builds downward)     0000 - 07D0 (0FA0--debug mode)
  8313.  
  8314.  
  8315.                                       Page - 131
  8316.  
  8317.  
  8318.  
  8319.  
  8320.                                 MEMORY MAP (Continued)
  8321.  
  8322.  
  8323.                  NOTE:  The format of an EXE file created using the
  8324.                  "B/OBJ" option is essentially the same as the one
  8325.                  produced by the "B/EXE" option, except that the
  8326.                  "B/OBJ" output file may contain additional code or
  8327.                  data segments linked in from other OBJ or LIB files.
  8328.  
  8329.  
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.  
  8344.  
  8345.  
  8346.  
  8347.  
  8348.  
  8349.  
  8350.  
  8351.  
  8352.  
  8353.  
  8354.  
  8355.  
  8356.  
  8357.  
  8358.  
  8359.  
  8360.  
  8361.  
  8362.  
  8363.  
  8364.  
  8365.  
  8366.  
  8367.  
  8368.  
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.                                       Page - 132
  8379.  
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.                                         A S I C
  8387.  
  8388.                                       Chapter 10
  8389.  
  8390.                               Mixed Language Programming
  8391.  
  8392.             ASIC programs can incorporate subroutines you write in assembly
  8393.        language.  This is a powerful feature, but it is a bit complicated until
  8394.        you have done it a few times.  This chapter describes how to use the
  8395.        CALL statement to call separately compiled assembly language programs.
  8396.  
  8397.                                        OVERVIEW
  8398.  
  8399.             Of course, the first thing you need is an assembler such as
  8400.        Borland's Turbo Assembler or Microsoft's Assembler.  You need to develop
  8401.        your assembly language subroutines and assemble them into OBJ format
  8402.        files.  Optionally, you can store these in a library file (.LIB) if you
  8403.        have Microsoft's LIB program or Borland's TLIB program.  Then, you
  8404.        develop the ASIC program which will call the subroutine, tell ASIC about
  8405.        the external object files and libraries, and compile your program.
  8406.        Thereafter, you may run and debug your program normally.
  8407.  
  8408.                            DEVELOPING ASSEMBLER SUBROUTINES
  8409.  
  8410.             The first step is to develop an assembler subroutine.  There are
  8411.        several things you need to be aware of, when developing an assembler
  8412.        program:
  8413.  
  8414.        1)   The entry point must be declared using the PUBLIC keyword.  If you
  8415.        do not do this, you will receive a linker error.
  8416.  
  8417.        2)   ASIC saves most critical registers prior to the CALL, however, in
  8418.        your assembler subroutine, you must take care to preserve the value of
  8419.        the SS and SP registers.  When you return to ASIC from your subroutine,
  8420.        you must insure that the SS and SP register values have not changed.
  8421.        This means that if you PUSH any values to the stack, you MUST POP them
  8422.        before the return instruction to ASIC.  Failure to do so will almost
  8423.        always crash your program.
  8424.  
  8425.        3)   ASIC calls external assembler subroutines using FAR calls
  8426.        (segment:offset), so you must declare the PROC as FAR, and must use the
  8427.        RETF (far return) instruction to return to ASIC.
  8428.  
  8429.        4)   ASIC passes parameters on the stack as far pointers (by reference).
  8430.        This means, that irregardless of whether the parameter being passed is a
  8431.        short integer, long integer, or string, ASIC will always place 4 bytes
  8432.        on the stack.  ASIC always pushes the segment portion (2 bytes) of the
  8433.        pointer to the stack first, followed by the offset (2 bytes).  Remember
  8434.        that these 4 bytes are not the value of the variable, but a pointer to
  8435.        the variable in memory.  If you look at the memory location pointed to
  8436.        by these 4 bytes, you will find the starting location of the variable.
  8437.        ASIC passes variables from the CALL SUB statement from left to right.
  8438.  
  8439.  
  8440.  
  8441.                                       Page - 133
  8442.  
  8443.  
  8444.  
  8445.  
  8446.        5.   When your subroutine receives control from ASIC, the stack will
  8447.        look like the following:
  8448.  
  8449.             etc
  8450.             SS:SP+10  (2 bytes) segment of next-to-last parameter
  8451.             SS:SP+8   (2 bytes} offset of next-to-last parameter
  8452.             SS:SP+6   (2 bytes) segment of last parameter
  8453.             SS:SP+4   (2 bytes) offset of last parameter
  8454.             SS:SP     (4 bytes) return address
  8455.  
  8456.        6) If your ASIC calling program passes constants to a subroutine, be
  8457.        aware that the subroutine can update the memory location used to store
  8458.        the constant values.  For example, if you modify the memory location
  8459.        used by ASIC to store the value of the constant "1" to "2", you will
  8460.        have inadvertently redefined the constant "1" to "2" throughout your
  8461.        ASIC program.  If you are not sure if a parameter will be updated by a
  8462.        subroutine, play it safe, use a variable for the parameter.
  8463.  
  8464.                               ASSEMBLING YOUR SUBROUTINE
  8465.  
  8466.             Before you subroutine can be used, it must be assembled.  Use your
  8467.        favorite assembler to do so.  If you like, you can store your object
  8468.        files in Microsoft LIB compatible format files for convenience.
  8469.  
  8470.                           DEVELOPING THE CALLING ASIC PROGRAM
  8471.  
  8472.             All that you have to do to call the subroutine, is insert a CALL
  8473.        SUB statement in your program.  The CALL SUB statement has the following
  8474.        format:
  8475.  
  8476.                  CALL SUB "subroutinename" [parm1...parmN]
  8477.  
  8478.             Where "subroutinename" is the name of the subroutine you wish to
  8479.        call (it must be in quotes).  No parameters are required, but you may
  8480.        provide one or more, if you like.  Any valid ASIC variable or constant
  8481.        type may be passed as a parameter.  "subroutinename" must match the name
  8482.        of the PUBLIC PROCedure you declared in your assembly language
  8483.        subroutine.
  8484.  
  8485.                             BUILDING THE EXECUTABLE PROGRAM
  8486.  
  8487.             Finally, you have to build the program.  You must do the following
  8488.        steps to create a valid EXE file:
  8489.  
  8490.             o  Load the edit buffer with the calling ASIC program
  8491.             o  Select the "Obj output file" option.
  8492.             o  Identify the names of any object modules to be linked with your
  8493.                 ASIC program, if any.
  8494.             o  Identify the names of any object libraries to be linked with
  8495.                 your ASIC program, if any.
  8496.             o  Tell ASIC where to find the MS DOS Linker
  8497.             o  Compile your program--ASIC will call the DOS linker
  8498.                 automatically.
  8499.  
  8500.             This can be made more clear through the use of an example.
  8501.        Included with your ASIC package are 2 files:
  8502.  
  8503.  
  8504.                                       Page - 134
  8505.  
  8506.  
  8507.  
  8508.  
  8509.             CALLSRCH.ASI
  8510.             SRCH.ASM
  8511.  
  8512.             The file CALLSRCH.ASI is an ASIC program which calls a subroutine
  8513.        called SRCH.  SRCH.ASM is the source to an assembly language program.
  8514.        Make sure these files are in your ASIC working directory for purposes of
  8515.        this example.  Also, copy the LINK.EXE file which comes with MS DOS to
  8516.        your ASIC directory or to the directory "C:\DOS".  Note:  if you don't
  8517.        want to make a copy of LINK.EXE, you don't have to, but you need to tell
  8518.        ASIC how to find LINK.EXE by using the LNK= compile option (see Chapter
  8519.        5 command line options, or the ADVANCED MENU OPTIONS section in chapter
  8520.        3, for information on setting the LINK path).
  8521.  
  8522.             The first step in producing the EXE file is to assemble the
  8523.        SRCH.ASM program.  If you have Borland's Turbo Assembler, type:
  8524.  
  8525.             TASM SRCH <return>
  8526.  
  8527.             Otherwise, if you have Microsoft's Macro Assembler, type:
  8528.  
  8529.             MASM SRCH <return>
  8530.  
  8531.             This should create a file called SRCH.OBJ in your working
  8532.        directory.  The second step is to build the ASIC program.  If you prefer
  8533.        the ASIC command line compiler, you can accomplish the build with a
  8534.        single command:
  8535.  
  8536.             ASICC CALLSRCH B/OBJ OBJ=SRCH
  8537.  
  8538.             That's all there is to it, if you are building from the command
  8539.        line.  You should be able to run the program now, try it--type:
  8540.  
  8541.             CALLSRCH <return>
  8542.  
  8543.             Read the comments in the programs for a description on what the
  8544.        program does.  You can also accomplish this easily from the integrated
  8545.        environment.
  8546.  
  8547.             First, load the program into ASIC:
  8548.  
  8549.             <Alt><f>
  8550.             <o>
  8551.             CALLSRCH <return>
  8552.  
  8553.             The above opens the "file" menu, selects the "open" option, and
  8554.        selects the file "CALLSRCH.ASI".  Next, set the compiler options:
  8555.  
  8556.             <Alt><c>
  8557.             <a>
  8558.             <o>
  8559.             <j>
  8560.             SRCH <return>
  8561.  
  8562.             This opens the  "compile" menu, selects the "advanced options"
  8563.        menu, sets the file output type to "obj" and set the "obJect names" to
  8564.        "SRCH".
  8565.  
  8566.  
  8567.                                       Page - 135
  8568.  
  8569.  
  8570.  
  8571.  
  8572.             <Alt><f>
  8573.             <s>
  8574.  
  8575.             This opens the "file" menu, and selects the "save" option.  This
  8576.        not only saves the CALLSRCH.ASI file to disk, it also saves all of the
  8577.        compile options you just set, to a file called CALLSRCH.PRJ.  So, the
  8578.        next time you enter ASIC, you won't have to re-set all those options for
  8579.        this program.
  8580.  
  8581.             Now compile the program:
  8582.  
  8583.             <F10>
  8584.  
  8585.             You should see the ASIC compiler screen compile the program, and
  8586.        you should then see a few messages as the Microsoft LINK program builds
  8587.        the EXE file.  In the future, from the integrated environment, you can
  8588.        rebuild the CALLSRCH program by loading it into the edit buffer and
  8589.        pressing <F10> to compile.  ASIC will remember all of the options you
  8590.        told it, so it will remember to link the "SRCH" module, automatically.
  8591.  
  8592.                                   OTHER LINK OPTIONS
  8593.  
  8594.             The above is a simple example; there are other compile examples in
  8595.        Chapter 5.  If you have one or more subroutine object modules stored in
  8596.        a library, you can use the "LIB=" option on the command line to specify
  8597.        the library names to ASIC.  You can also specify the library information
  8598.        inside the integrated environment (Open the "compile" menu, select the
  8599.        "Advanced options" option.  From the "Advanced options" menu that pops
  8600.        up, select the "liBrary names" option.
  8601.  
  8602.             When specifying object files, remember that the ".OBJ" file
  8603.        extension is optional, as is the ".LIB" extension on library files.  You
  8604.        don't have to give the full file spec (ie, disk drive and directory) if
  8605.        the file is in the ASIC directory.  See Chapter 3 and Chapter 5 for more
  8606.        information on setting these options from the integrated environment and
  8607.        command line compiler respectively.
  8608.  
  8609.                                        DEBUGGING
  8610.  
  8611.             You can use the debugger on ASIC programs which use the CALL SUB
  8612.        statement, however, you can't "trace into" the assembly language
  8613.        subroutine instructions.  When you press <F8> to trace one line, and you
  8614.        are positioned on a CALL SUB statement, the CALL SUB is executed, and
  8615.        ASIC advances to the next ASIC statement following the CALL SUB.  The
  8616.        called assembler subroutine should not contain INT 3 instructions.  If
  8617.        they do, the debugger will behave erratically.
  8618.  
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.                                       Page - 136
  8631.  
  8632.  
  8633.  
  8634.  
  8635.  
  8636.                                         A S I C
  8637.  
  8638.                                       Chapter 11
  8639.  
  8640.                                     Error Messages
  8641.  
  8642.  
  8643.        This chapter contains compiler messages, run-time error messages, and
  8644.        File I/O Error Codes.
  8645.  
  8646.  
  8647.  
  8648.                                     COMPILER ERRORS
  8649.  
  8650.  
  8651.  
  8652.             These messages indicate errors in your source program.  Those which
  8653.        begin with "** E" indicate "fatal" errors, which prevent ASIC from
  8654.        successfully compiling your program.  Warnings begin with "* W" and
  8655.        indicate possible errors and informative messages which will not prevent
  8656.        ASIC from generating an executable ".COM" or ".EXE" file.
  8657.  
  8658.  
  8659.                                      FATAL ERRORS
  8660.  
  8661.        ** E001 **  File Extensions must be '.ASI', '.PRJ' or omitted
  8662.  
  8663.             ASIC requires source programs to have the extension ".ASI".  Rename
  8664.        your source file with the DOS "RENAME" command to the name "file.ASI",
  8665.        where "file" is your source program name.  Then resubmit the compile.
  8666.        The ".ASI" extension is the only valid one for the ASIC Editor, but the
  8667.        command line compiler will also accept a ".PRJ" extension.
  8668.  
  8669.        ** E002 ** File Name specified is too long
  8670.  
  8671.             The source file may be identified by a file name up to 124
  8672.        characters long including disk drive specifiers and sub directory names.
  8673.        Move the source program to a directory which may be specified within
  8674.        this length.
  8675.  
  8676.  
  8677.        ** E003 ** Error Opening File:  xxxxxxxx.xxx
  8678.  
  8679.             The file indicated by "xxxxxxxx.xxx" could not be opened by ASIC.
  8680.        This error can be issued when ASIC attempts to read your source file, or
  8681.        when it writes any one of the possible output files (".COM", ".EXE",
  8682.        ".LST", or ".SYM").  If indicated file is your source program name,
  8683.        verify the spelling, and either make sure it is in the same directory as
  8684.        ASIC, or specify the full path name for the file.  If the indicated file
  8685.        is an output file, the error is usually a result of a write protect tab
  8686.        on the diskette or insufficient disk space.
  8687.  
  8688.  
  8689.  
  8690.  
  8691.  
  8692.  
  8693.                                       Page - 137
  8694.  
  8695.  
  8696.  
  8697.  
  8698.        ** E004 ** DIM Statements must precede all others except REMs
  8699.  
  8700.             In ASIC, DIM statements must appear before all other statement
  8701.        types, except REM statements (or blank lines).
  8702.  
  8703.  
  8704.        ** E005 ** Too many characters in source line
  8705.  
  8706.             Source program lines in ASIC are limited to 120 characters.  Change
  8707.        the indicated source line, so that it fits within this limit.
  8708.  
  8709.  
  8710.        ** E006 ** Unmatched Quote ('"') in source line
  8711.  
  8712.             A string constant was found with either no opening or closing quote
  8713.        mark.  Quotation marks must be matched in pairs within source lines.
  8714.  
  8715.  
  8716.        ** E007 ** Token in source line > 82 characters long
  8717.  
  8718.             Individual tokens in ASIC are limited to 82 characters in length,
  8719.        regardless of type.  A token is a group of letters and/or numbers
  8720.        delimited on either side by a space or math symbol.  Example, even
  8721.        though string constants are limited to 80 characters, ASIC considers the
  8722.        "token" to include the quotation marks.  In this case, however, ASIC
  8723.        detected a token longer than the longest possible token, the string
  8724.        constant.  Check for "tokens" or "words" more than 82 characters long in
  8725.        the indicated source line.
  8726.  
  8727.  
  8728.        ** E008 ** More than 30 tokens in source line
  8729.  
  8730.             Since all ASIC statements require less than 30 tokens, ASIC will
  8731.        flag any statement which contains more than this number.  A token is a
  8732.        group of letters and/or numbers delimited on either side by a space or
  8733.        math symbol.
  8734.  
  8735.  
  8736.        ** E009 ** Keyword Unknown:  xxxxxxxxx
  8737.  
  8738.             ASIC detected the symbol indicated by "xxxxxxxx" in your source
  8739.        line, but it was not a valid variable name, constant, label, or ASIC
  8740.        Function Name.
  8741.  
  8742.  
  8743.        ** E010 ** Symbol Table Space Exhausted
  8744.  
  8745.             The symbol table is used by ASIC to keep track of your variables,
  8746.        constants and labels.  It is also used to hold information used in
  8747.        FOR/NEXT processing, and internal system subroutine generation.  Reduce
  8748.        the number of LABELS, VARIABLE NAMES, or CONSTANTS in your program, and
  8749.        recompile.
  8750.  
  8751.  
  8752.  
  8753.  
  8754.  
  8755.  
  8756.                                       Page - 138
  8757.  
  8758.  
  8759.  
  8760.  
  8761.        ** E011 ** Symbol Incomplete Reference Space Exhausted
  8762.  
  8763.             This table is a sister table to the Symbol Table, it contains
  8764.        references to LABEL type symbols which have been defined in the symbol
  8765.        table.  Try to reduce the number of references made to LABEL symbols
  8766.        within the program and recompile.
  8767.  
  8768.  
  8769.        ** E012 ** No keywords in source line
  8770.  
  8771.             Every ASIC source program line must contain an ASIC keyword (eg.
  8772.        "PRINT", "=", "GOSUB", etc).
  8773.  
  8774.  
  8775.        ** E013 ** Syntax Error
  8776.  
  8777.             The "catch-all" error for ASIC.  This error is usually issued when
  8778.        ASIC has identified an error in the parameters for an ASIC keyword.  The
  8779.        best way to find this error is to refer to the entry in the Keyword
  8780.        Reference (chapter 7) for that particular keyword.
  8781.  
  8782.  
  8783.        ** E014 ** Undefined Symbol:  xxxxxx
  8784.  
  8785.             ASIC detected a LABEL "xxxxxx" which was referenced, but never
  8786.        defined in the program.  A label is considered to be defined when it is
  8787.        the first token on the source line.  A reference to a label occurs when
  8788.        a label name appears elsewhere in the source statement
  8789.  
  8790.             Example:           PRINTIT:   PRINT "hello"      <---Defined
  8791.                                GOTO PRINTIT:                 <--Referenced
  8792.  
  8793.  
  8794.        ** E015 ** Compiled Code Exceeds 64k-Can't fit in .COM file
  8795.  
  8796.             Your source program is too large to fit in the .COM file format.
  8797.        Recompile using the "Build EXE" option.  See Chapter 5 for more
  8798.        information.
  8799.  
  8800.        ** E016 ** Integer Constant Not in range +32767 to -32767
  8801.  
  8802.             The above range of numbers is the maximum which can be contained in
  8803.        integer format in ASIC.  Reduce the constant so that it falls within the
  8804.        specified range.
  8805.  
  8806.  
  8807.        ** E017 ** Duplicate Label:    xxxxxx
  8808.  
  8809.             The indicated label "xxxxxx" was defined more than once in the
  8810.        program.  Reduce the multiple definitions to a single definition and
  8811.        then recompile.
  8812.  
  8813.  
  8814.  
  8815.  
  8816.  
  8817.  
  8818.  
  8819.                                       Page - 139
  8820.  
  8821.  
  8822.  
  8823.  
  8824.        ** E018 ** Second FOR defined for variable with no intervening NEXT
  8825.  
  8826.             FOR/NEXT Statements cannot be nested with the same variable name.
  8827.  
  8828.                  VALID                              INVALID
  8829.  
  8830.                  FOR I=1 TO 10                      FOR I=1 TO 10
  8831.                       FOR J=1 TO 20                      FOR I=1 TO 20
  8832.                       NEXT J                             NEXT I
  8833.                  NEXT I                             NEXT I
  8834.  
  8835.  
  8836.        ** E019 ** For/Next Table Space Exhausted
  8837.  
  8838.             An unlimited of FOR/NEXT statements can exist, however, they can be
  8839.        "nested" to a maximum depth of 25.
  8840.  
  8841.  
  8842.        ** E020 ** NEXT without FOR
  8843.  
  8844.             A NEXT statement was found, however it was not preceded in the
  8845.        source program with a matching FOR statement.
  8846.  
  8847.  
  8848.        ** E021 ** FOR without NEXT at Source Line NNNNN
  8849.  
  8850.             The indicated source line NNNNN contains a FOR statement, for which
  8851.        no NEXT statement was ever found.
  8852.  
  8853.  
  8854.        ** E022 ** Invalid Option:  x
  8855.  
  8856.             An invalid compile option was specified.  Review Chapter 5 for a
  8857.        list of valid compile options.
  8858.  
  8859.  
  8860.        ** E023 ** More than 63000 bytes in Data Segment
  8861.  
  8862.             An ASIC program can be up to 64k bytes in size.  Of this total,
  8863.        63000 bytes can contain program variables and constants, leaving at
  8864.        least 1k for program code.  Reduce the number of variables and constants
  8865.        in your program.
  8866.  
  8867.  
  8868.        ** E024 ** Too many arrays defined
  8869.  
  8870.             A single ASIC source program can contain up to 25 arrays.
  8871.  
  8872.  
  8873.        ** E025 ** Re-DIMension of previously DIMensioned variable
  8874.  
  8875.             Only one DIM statement can be specified per array name.
  8876.  
  8877.  
  8878.  
  8879.  
  8880.  
  8881.  
  8882.                                       Page - 140
  8883.  
  8884.  
  8885.  
  8886.  
  8887.        ** E026 ** Invalid subscript on Array
  8888.  
  8889.             A subscript was found which is not valid.  Either ASIC expected
  8890.        more or less subscripts than were present, or ASIC detected a subscript
  8891.        which was itself an array.  Subscripts on arrays may only be non-array
  8892.        variables and/or integer constants.
  8893.  
  8894.  
  8895.        ** E030 ** Code Segment Memory Exhausted
  8896.  
  8897.             ASIC will attempt to allocate 64k of memory to use a work space to
  8898.        hold the code generated by your program statements.  This message
  8899.        indicates that the amount of memory it was able to allocate was not
  8900.        sufficient to hold the code generated by the program you are trying to
  8901.        compile.
  8902.  
  8903.  
  8904.        ** E031 ** Data Segment Memory Exhausted
  8905.  
  8906.             ASIC will attempt to allocate 64k of memory to use a work space to
  8907.        hold the data segment for your program.  This message indicates that the
  8908.        amount of memory it was able to allocate was not sufficient to hold the
  8909.        data generated by the program you are trying to compile.
  8910.  
  8911.  
  8912.        ** E032 ** Insufficient Memory to Run ASIC
  8913.  
  8914.             You don't have enough memory to run ASIC.  If you have any TSRs
  8915.        loaded, try removing them and re-compiling.
  8916.  
  8917.  
  8918.        ** E033 ** Edit Buffer Memory Allocation Failed
  8919.  
  8920.             ASIC attempted to allocate memory for the edit buffer in the
  8921.        integrated environment, but was unable to.  If you have any TSRs loaded,
  8922.        remove them from memory, and try again.
  8923.  
  8924.  
  8925.  
  8926.  
  8927.  
  8928.  
  8929.  
  8930.  
  8931.  
  8932.  
  8933.  
  8934.  
  8935.  
  8936.  
  8937.  
  8938.  
  8939.  
  8940.  
  8941.  
  8942.  
  8943.  
  8944.  
  8945.                                       Page - 141
  8946.  
  8947.  
  8948.  
  8949.  
  8950.        ** E034 ** DATA Statements Must Precede All Except DIMs or REMs
  8951.  
  8952.             If you wish to use the DATA statement in ASIC, you must place them
  8953.        all at the beginning of your program following any DIM and/or REM
  8954.        statements (or blank lines).
  8955.  
  8956.  
  8957.        ** E035 ** Requires 32 Bit Math--Recompile W/Math Option
  8958.  
  8959.             The compiler found a statement containing long (32bit) integer
  8960.        variables or constants.  You must compile with the Extended Math Option
  8961.        turned on to be able to use long integer math.  Turn on the "Extended
  8962.        Math" Option from the Compile Menu in the ASIC Integrated Environment,
  8963.        and recompile the program.  If you are compiling from the MS DOS command
  8964.        line, recompile using switch "E".
  8965.  
  8966.  
  8967.        ** E036 ** Error Allocating Debugger Screen Memory
  8968.  
  8969.             ASIC was unable to allocate memory to save the screen output from
  8970.        your programs when you run your program in debugging mode in the ASIC
  8971.        integrated environment.  You could try removing some TSRs from your
  8972.        AUTOEXEC.BAT file.  Then try running ASIC again.
  8973.  
  8974.  
  8975.        ** E037 ** IF Statements Nested Deeper Than 25 Levels
  8976.  
  8977.             An unlimited number of block IF statements may be used in your
  8978.        program, however, they may be nested to a maximum depth of 25 levels.
  8979.        See the IF statement documentation in Chapter 7 for more information.
  8980.  
  8981.  
  8982.        ** E038 ** ELSE Statement Without Preceding IF Statement.
  8983.  
  8984.             ASIC found an ELSE statement but did not find a preceding block IF
  8985.        statement.  See the IF Statement documentation in Chapter 7 for more
  8986.        information.
  8987.  
  8988.  
  8989.        ** E039 ** ENDIF Statement Without Preceding IF Statement.
  8990.  
  8991.             ASIC found an ENDIF statement with no preceding matching IF
  8992.        statement.  See the IF statement documentation in Chapter 7 for more
  8993.        information.
  8994.  
  8995.  
  8996.        ** E040 ** Block IF Statement Without Matching ENDIF Statement.
  8997.  
  8998.             When using the block IF format of the IF statement, you must always
  8999.        specify a matching ENDIF statement.  See the IF Statement documentation
  9000.        in Chapter 7 for more information.
  9001.  
  9002.  
  9003.  
  9004.  
  9005.  
  9006.  
  9007.  
  9008.                                       Page - 142
  9009.  
  9010.  
  9011.  
  9012.  
  9013.        ** E041 ** WHILE Statements Nested Deeper Than 25 Levels
  9014.  
  9015.             An unlimited number of WHILE statements may be used in your
  9016.        program, however, they may be nested to a maximum depth of 25 levels.
  9017.        See the WHILE statement in Chapter 7 for more information.
  9018.  
  9019.  
  9020.        ** E042 ** WEND Statement Without Preceding WHILE Statement
  9021.  
  9022.             ASIC found a WEND statement with no preceding matching WHILE
  9023.        statement.  See the WHILE statement documentation in Chapter 7 for more
  9024.        information.
  9025.  
  9026.  
  9027.        ** E043 ** WHILE Statement Without Matching WEND Statement
  9028.  
  9029.             Each WHILE statement must be followed by a matching WEND statement.
  9030.        See the WHILE statement documentation in Chapter 7 for more information.
  9031.  
  9032.        ** E044 ** This statement format is only valid when producing OBJ files.
  9033.  
  9034.             You used a format of a statement which does not make sense with the
  9035.        current compiler option.  For example, you specified "CALL SUB" when
  9036.        compiling with the B/EXE or B/COM option.  This is invalid, since CALL
  9037.        SUB will generate a reference for the linker to resolve the SUB
  9038.        procedure name.  ASIC will not resolve the SUB reference when using the
  9039.        B/COM or B/EXE option, since no OBJ file is produced with these options.
  9040.        Recompile with the B/OBJ option (select the OBJ option in the integrated
  9041.        environment).
  9042.  
  9043.        ** E047 ** Requires Decimal Math--Recompile w/DEC Option
  9044.  
  9045.             Your program contains a statement containing a decimal variable or
  9046.        constant (eg, A@ or 1.234).  To use decimal numbers, you must turn on
  9047.        the "Decimal Math" option from the "Compile" menu, or, if you are
  9048.        compiling from the command line, by specifying the command line option
  9049.        "DEC".  Turn on this option, and recompile your program.
  9050.  
  9051.        ** E048 ** 999999999999.99999 Is Max Constant Size
  9052.  
  9053.             You specified a decimal constant in your program which exceeds the
  9054.        maximum size that ASIC can handle.  Modify your program until the
  9055.        constant is within +/-999,999,999,999.99999 and recompile your program.
  9056.  
  9057.  
  9058.  
  9059.  
  9060.  
  9061.  
  9062.  
  9063.  
  9064.  
  9065.  
  9066.  
  9067.  
  9068.  
  9069.  
  9070.  
  9071.                                       Page - 143
  9072.  
  9073.  
  9074.  
  9075.  
  9076.                                   NON-FATAL WARNINGS
  9077.  
  9078.  
  9079.        * W002 * Printer Not Ready - 'P' Option Ignored
  9080.  
  9081.             You selected the "Printer" option, but ASIC was not able to access
  9082.        the printer.  Make sure the printer is online before compiling with the
  9083.        'P' option.
  9084.  
  9085.  
  9086.        * W004 * Edit Buffer Full--File Truncated
  9087.  
  9088.             While loading a file, the edit buffer filled before ASIC reached
  9089.        end-of-file.  The file is truncated in memory.  IF YOU SAVE THE FILE
  9090.        AFTER RECEIVING THIS MESSAGE, PART OF THE FILE WILL BE LOST ON DISK.  IT
  9091.        IS RECOMMENDED THAT YOU EITHER EXIT ASIC IMMEDIATELY, OR THAT YOU SAVE
  9092.        THE TRUNCATED FILE UNDER A NEW NAME SO THAT THE ORIGINAL FILE IS NOT
  9093.        DAMAGED.
  9094.  
  9095.  
  9096.        * W005 *  Edit Buffer Full
  9097.  
  9098.             ASIC issues this message when the edit buffer is full and you
  9099.        attempt to insert a line.  Delete some unnecessary source lines to
  9100.        create space in the edit buffer.
  9101.  
  9102.  
  9103.        * W006 * Source/Dest of Block Copy/Move May Not Overlap
  9104.  
  9105.             You attempted to move or copy a block of lines to a destination
  9106.        line which was within the source block of lines.  Execution of this
  9107.        block move/copy would result in an endless series of copies or moves.
  9108.        Move the cursor outside of the highlighted block of lines, and try
  9109.        again.
  9110.  
  9111.  
  9112.        * W007 * Source Program Modified.  Recompile? (Y/N)
  9113.  
  9114.             You selected the RUN or TRACE option of ASIC.  ASIC has noticed
  9115.        that you have modified the source.  You should answer "Y" here to cause
  9116.        ASIC to recompile your program before running it.  If you instead answer
  9117.        "N", ASIC will execute the existing copy of the compiled program, which
  9118.        will not contain your latest changes.
  9119.  
  9120.  
  9121.        * W009 * File has been modified.  Save File Now? (Y/N)
  9122.  
  9123.             You have told ASIC to exit back to DOS, but the edit buffer has
  9124.        been modified.  You should answer "Y" so that ASIC will save your
  9125.        changes back to disk.  If you answer "N" here, any changes you have made
  9126.        to your program since the last SAVE command will be lost.
  9127.  
  9128.  
  9129.  
  9130.  
  9131.  
  9132.  
  9133.  
  9134.                                       Page - 144
  9135.  
  9136.  
  9137.  
  9138.  
  9139.        * W010 * Too Much Debugging Info-Truncating
  9140.  
  9141.             ASIC could not handle all of the debugging information it found.
  9142.        This error should not occur.
  9143.  
  9144.  
  9145.        * W011 * Variable Not Found
  9146.  
  9147.             During the processing of a Watch, Unwatch, or Modify Command, you
  9148.        specified a variable name which ASIC could not find in the debugging
  9149.        information.  Checking your spelling for possible errors.  Also, verify
  9150.        that you have compiled your program with the Debugging compiler option
  9151.        turned ON.
  9152.  
  9153.  
  9154.        * W012 * Maximum Number of Variables Are Being Watched
  9155.  
  9156.             You are already "watching" the maximum number of variables that
  9157.        this version of ASIC supports.  "Unwatch" one of the variables in the
  9158.        watch window.  This will allow you to "Watch" a new one.
  9159.  
  9160.  
  9161.        * W013 * There Are No Variables Being Watched
  9162.  
  9163.             You selected the "Unwatch" command.  However, there are no
  9164.        variables in the watch window to "Unwatch".  Before this command may be
  9165.        used, you must first have added a variable to the Watch window using the
  9166.        "Watch variable" command.
  9167.  
  9168.  
  9169.        * W014 * Unable to Load/Run Program
  9170.  
  9171.             When ASIC attempted to load and run either the compiler or your
  9172.        program it detected an error.  This is due to one of two reasons.
  9173.        First, ASIC could not find the program on disk.  If compiling, make sure
  9174.        that the ASICC.EXE file is in the same directory as the ASIC.EXE file,
  9175.        and make that directory current.  The second reason that you might get
  9176.        this error is that there may be insufficient memory available on your
  9177.        PC.  In this case, you either need to free up more memory (by removing
  9178.        TSRs etc), or you could execute your program or the compiler from the
  9179.        DOS command line.  For more information on compiling from the command
  9180.        line, see Chapter 5--Stand-alone Compiler Options.
  9181.  
  9182.  
  9183.        * W015 * Can't Set Breakpoint--No Code Generated For That Source
  9184.                 Line
  9185.  
  9186.             You attempted to set a breakpoint and either 1) You haven't
  9187.        compiled with the Debugging Compiler Option turned on, or 2)  You have
  9188.        tried to set a breakpoint on a line which did not generate any object
  9189.        code.  Thus, breakpoints cannot be set on REM or DATA statements, for
  9190.        example.  If you are sure that you have compiled with the above option
  9191.        turned on, then try setting the breakpoint on another nearby statement.
  9192.  
  9193.  
  9194.  
  9195.  
  9196.  
  9197.                                       Page - 145
  9198.  
  9199.  
  9200.  
  9201.  
  9202.        * W018 * Your Program Must Be Running To Use This Function
  9203.  
  9204.             You selected a function which is only operable when you are running
  9205.        a program (which was compiled with the debugging compiler option turned
  9206.        on).  After your program terminates, this function is not available.
  9207.  
  9208.  
  9209.        * W019 * Function Unavailable Until You Terminate Your Program
  9210.  
  9211.             You selected a function while your program was running in debugging
  9212.        mode.  Before you can execute this function you must either Abort your
  9213.        program, or allow it to Run until normal termination.  Both the Run and
  9214.        the Abort Options are available on the "Run" Menu.
  9215.  
  9216.  
  9217.        * W020 * Invalid Debug (.DBG) File Format
  9218.  
  9219.             ASIC attempted to access the symbolic debugging information file
  9220.        created by the compiler for your program.  It was able to locate the
  9221.        file, but detected an error in the format while reading it.  Make sure
  9222.        that the version number of both the ASIC Integrated Editor and the ASIC
  9223.        Compiler are the same.  The version number is displayed on the top line
  9224.        of the editor screen, following the word "ASIC".  It is also displayed
  9225.        on the compiler status screen while a compile is executing.
  9226.  
  9227.  
  9228.        * W021 * Maximum Number of Breakpoints Already Set
  9229.  
  9230.             You have attempted to set another breakpoint, but the maximum
  9231.        number that this version of ASIC can support are already in use.  Remove
  9232.        one of the existing breakpoints you have set.  This will free one up for
  9233.        your use elsewhere.
  9234.  
  9235.  
  9236.        * W022 * Can't Open ASIC.IDX File
  9237.  
  9238.             You requested online help for an ASIC keyword.  This function
  9239.        requires a file called "ASIC.IDX" provided with your ASIC package, and
  9240.        ASIC could not find this file in the current disk directory.  Copy this
  9241.        file from your ASIC package to the directory in which you are running
  9242.        ASIC and try again.
  9243.  
  9244.  
  9245.        * W023 * Can't Open ASIC.DOC File
  9246.  
  9247.             You requested online help for an ASIC keyword or menu option.  This
  9248.        function requires a file called "ASIC.DOC" provided with your ASIC
  9249.        package, and ASIC could not find this file in the current disk
  9250.        directory.  Copy this file from your ASIC package to the directory in
  9251.        which you are running ASIC and try again.
  9252.  
  9253.  
  9254.  
  9255.  
  9256.  
  9257.  
  9258.  
  9259.  
  9260.                                       Page - 146
  9261.  
  9262.  
  9263.  
  9264.  
  9265.        * W024 * Can't Open ASICM.IDX File
  9266.  
  9267.             You requested online help for an ASIC menu option.  This function
  9268.        requires a file called "ASICM.IDX" which was provided with your ASIC
  9269.        package, and ASIC could not find this file in the current disk
  9270.        directory.  Copy this file from your ASIC package to the directory in
  9271.        which you are running ASIC and try again.
  9272.  
  9273.  
  9274.        * W025 * No Help Available For Selected Item
  9275.  
  9276.             There is no online help available for the item you selected.  The
  9277.        information should be available in the ASIC Manual.
  9278.  
  9279.  
  9280.        * W026 * Unable To Write ASIC.CFG File
  9281.  
  9282.             You told ASIC to save your current Integrated Environment Options.
  9283.        ASIC attempted to do so, but was not able to.  Your options were not
  9284.        saved to disk.  This is usually caused by one of two things: 1)  The
  9285.        disk is full, or 2)  The disk is write-protected.  If the disk is full,
  9286.        delete some unneeded files and try again.  If the disk is write-
  9287.        protected, remove the write-protect tab from the disk and try again.
  9288.  
  9289.  
  9290.        * W027 * Debugger Can't Fully Save User Screen--Insufficient Memory
  9291.  
  9292.             ASIC was not able to allocate enough memory to save the screen
  9293.        output from your program while it was running in debugging mode in the
  9294.        integrated environment.  As a result, the screen displays may become
  9295.        garbled.  You should normally only see this message when your program is
  9296.        using a high resolution EGA/VGA graphic mode on machines with very low
  9297.        memory, or you have many TSRs installed.  Either purchase more memory,
  9298.        go to a lesser graphics mode, remove some TSRs from the AUTOEXEC.BAT
  9299.        file, or run your program outside of the integrated environment.
  9300.  
  9301.        * W028 * Not Enough Memory To Build Full File List
  9302.  
  9303.             After you selected the Open or Save options from the File menu,
  9304.        ASIC attempted to build a list of existing file names in memory, but was
  9305.        unable to due to lack of memory.  Exit from the editor and try to free
  9306.        up more memory by removing TSR's, etc.
  9307.  
  9308.        * W029 * Out of Memory -- Allocating Debug Symbols
  9309.  
  9310.             The editor was trying to read the debugging information for your
  9311.        program, but was unable to allocate enough memory to store the
  9312.        information.  If you proceed, the Watch, Unwatch, Modify Variable,
  9313.        Trace, and Breakpoint commands may perform erratically.  Exit the editor
  9314.        and try to free up more memory by removing TSR's, etc.
  9315.  
  9316.        * W030 * Stack Size Must Be 16-32767
  9317.  
  9318.             You selected the Stack Option off of the Advanced Options Menu, and
  9319.        entered a stack size that is too small or too large.  Your entry was
  9320.        ignored--the stack size was not updated.
  9321.  
  9322.  
  9323.                                       Page - 147
  9324.  
  9325.  
  9326.  
  9327.  
  9328.  
  9329.        * W031 * Unable To Save Program Options
  9330.  
  9331.             ASIC attempted to save program compile options to disk, but was not
  9332.        able to.  This is usually caused by a disk that is full or has the write
  9333.        protect tab set.
  9334.  
  9335.        * W032 * Unable to run COMMAND.COM
  9336.  
  9337.             ASIC was unable to locate the COMMAND.COM file.  Because of this,
  9338.        it was unable to complete your request.
  9339.  
  9340.  
  9341.  
  9342.  
  9343.  
  9344.  
  9345.  
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.  
  9352.  
  9353.  
  9354.  
  9355.  
  9356.  
  9357.  
  9358.  
  9359.  
  9360.  
  9361.  
  9362.  
  9363.  
  9364.  
  9365.  
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377.  
  9378.  
  9379.  
  9380.  
  9381.  
  9382.  
  9383.  
  9384.  
  9385.  
  9386.                                       Page - 148
  9387.  
  9388.  
  9389.  
  9390.  
  9391.                                     RUN TIME ERRORS
  9392.  
  9393.  
  9394.        Divide Overflow
  9395.  
  9396.  
  9397.             This message indicates that your program attempted to divide by
  9398.        zero.
  9399.  
  9400.  
  9401.  
  9402.  
  9403.  
  9404.  
  9405.  
  9406.  
  9407.  
  9408.  
  9409.  
  9410.  
  9411.  
  9412.  
  9413.  
  9414.  
  9415.  
  9416.  
  9417.  
  9418.  
  9419.  
  9420.  
  9421.  
  9422.  
  9423.  
  9424.  
  9425.  
  9426.  
  9427.  
  9428.  
  9429.  
  9430.  
  9431.  
  9432.  
  9433.  
  9434.  
  9435.  
  9436.  
  9437.  
  9438.  
  9439.  
  9440.  
  9441.  
  9442.  
  9443.  
  9444.  
  9445.  
  9446.  
  9447.  
  9448.  
  9449.                                       Page - 149
  9450.  
  9451.  
  9452.  
  9453.  
  9454.  
  9455.  
  9456.  
  9457.                                SYSTEM ERROR CODE VALUES
  9458.  
  9459.  
  9460.        After most commands which access the disk, ASIC sets a special "ERROR"
  9461.        variable to indicate success or failure of that command.  After you
  9462.        execute one of these commands, you can reference this variable as a
  9463.        regular variable in your program, to determine the outcome of the
  9464.        command(eg. "IF ERROR = 000 THEN OKAY:").
  9465.  
  9466.  
  9467.        ERROR Codes Set by BLOAD
  9468.  
  9469.        000       No Error
  9470.        002       File Not Found
  9471.        003       Path Not Found or File Doesn't Exist
  9472.        004       File Not Found
  9473.        005       File Access Denied
  9474.        006-255   Read Past End of File
  9475.  
  9476.        ERROR Codes Set by BSAVE
  9477.  
  9478.        000       No Error
  9479.        002       File Not Found
  9480.        004       File Not Found
  9481.        005       File Access Denied
  9482.        006-255   Disk Full
  9483.  
  9484.        ERROR Codes Set by CALL
  9485.  
  9486.        000-254   Return Code from Program (Zero If Not Set by User Program)
  9487.        255       Error Loading/Running Program
  9488.  
  9489.        ERROR Codes Set by CHDIR
  9490.  
  9491.        000       No Error
  9492.        003       Path Not Found
  9493.  
  9494.        ERROR Codes Set by CLOSE
  9495.  
  9496.        000       No Error
  9497.        006       Invalid Handle
  9498.        095       Cannot Close File -- File is not Open
  9499.  
  9500.        ERROR Codes Set by FILEPOS
  9501.  
  9502.        000       No Error
  9503.        001       Invalid Function Number
  9504.        006       Invalid Handle
  9505.        098       File mode not Random or Append
  9506.  
  9507.  
  9508.  
  9509.  
  9510.  
  9511.  
  9512.                                       Page - 150
  9513.  
  9514.  
  9515.  
  9516.  
  9517.                          SYSTEM ERROR CODE VALUES (Continued)
  9518.  
  9519.  
  9520.        ERROR Codes Set by FIND
  9521.  
  9522.        000       No Error
  9523.        002       File Not Found
  9524.        018       No More Files Match Search Criteria
  9525.  
  9526.        ERROR Codes Set by GETDIR
  9527.  
  9528.        000       No Error
  9529.        015       Invalid Disk Drive Specification
  9530.  
  9531.        ERROR Codes Set by INPUT (when using ";" option)
  9532.  
  9533.        000       No Error
  9534.        001       Invalid Input
  9535.  
  9536.        ERROR Codes Set by INPUT#
  9537.  
  9538.        000       No Error
  9539.        005       Read Access Denied
  9540.        006       Invalid File Handle
  9541.        096       Input String Truncated at 80 characters
  9542.                  (this error code is not set when you specify NONULL)
  9543.        098       File Not Open for Input or Random Modes
  9544.        099       End of File
  9545.  
  9546.        ERROR Codes Set by KILL
  9547.  
  9548.        000       No Error
  9549.        002       File Not Found
  9550.        005       Access Denied
  9551.  
  9552.        ERROR Codes Set by MKDIR
  9553.  
  9554.        000       No Error
  9555.        003       Path Not Found
  9556.        005       Access Denied
  9557.  
  9558.        ERROR Codes Set by NAME
  9559.  
  9560.        000       No Error
  9561.        002       File Not Found
  9562.        003       Path Not Found or File Doesn't Exist
  9563.        005       Access Denied
  9564.        017       Not Same Disk Drive
  9565.  
  9566.        ERROR Codes Set by OPEN --- Mode Input
  9567.  
  9568.        000       No Error
  9569.        002       File Not Found
  9570.        004       File Not Found
  9571.        005       File Access Denied
  9572.        254       File Number Already in Use
  9573.  
  9574.  
  9575.                                       Page - 151
  9576.  
  9577.  
  9578.  
  9579.  
  9580.                          SYSTEM ERROR CODE VALUES (Continued)
  9581.  
  9582.  
  9583.        ERROR Codes Set by OPEN --- Mode Output, Append, or Random
  9584.  
  9585.        000       No Error
  9586.        001       Invalid Append Function
  9587.        003       Path Not Found
  9588.        004       No File Handle Available
  9589.        005       File Access Denied
  9590.        006       Invalid Append Handle
  9591.        254       File Number Already in Use
  9592.  
  9593.        ERROR Codes Set by PRINT#
  9594.  
  9595.        000       No Error
  9596.        005       File Access Denied
  9597.        006       Invalid File Handle
  9598.        097       File Not Open for Output, Append, or Random Modes
  9599.        255       Disk Full
  9600.  
  9601.        ERROR Codes Set by RMDIR
  9602.  
  9603.        000       No Error
  9604.        003       Path Not Found
  9605.        005       Access Denied
  9606.        006       Can't Delete Current Directory
  9607.        016       Can't Delete Current Directory
  9608.  
  9609.        ERROR Codes Set by RUN
  9610.  
  9611.        000-254   Return Code from Program (Zero If Not Set by User Program)
  9612.        255       Error Loading/Running Program
  9613.  
  9614.        ERROR Codes Set by DECIMAL Math Routines
  9615.  
  9616.        000       No Error
  9617.        001       Division By Zero
  9618.  
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.  
  9630.  
  9631.  
  9632.  
  9633.  
  9634.  
  9635.  
  9636.  
  9637.  
  9638.                                       Page - 152