home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / BASIC / ASIC20.ZIP / ASIC.DOC next >
Encoding:
Text File  |  1990-10-13  |  186.4 KB  |  7,036 lines

  1. mCB
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.        +--------------------------------------------------------------------+
  9.        |                                                                    |
  10.        |                            A S I C   2.0                           |
  11.        |                                                                    |
  12.        |                         "Its Almost Basic"                         |
  13.        |                                                                    |
  14.        |                                                                    |
  15.        |                          Copyright 1990                            |
  16.        |                                by                                  |
  17.        |                           David A. Visti                           |
  18.        |                                                                    |
  19.        |                         All Rights Reserved                        |
  20.        +--------------------------------------------------------------------+
  21.        |  ASIC 2.0 is provided as shareware.  Under the shareware concept,  |
  22.        |  you can test a program before you buy it. If you find it suitable |
  23.        |  for your needs and make use of this program, you are expected to  |
  24.        |  send a $10 registration fee.                                      |
  25.        |                                                                    |
  26.        |  Feel free to distribute this software to others.  However, you    |
  27.        |  may not charge for the distribution of this software to others    |
  28.        |  nor may you alter the software or this documentation.             |
  29.        |                                                                    |
  30.        |  Registered users of any version of ASIC will receive a diskette   |
  31.        |  containing the current version of ASIC, plus may purchase future  |
  32.        |  updates at half of the normal registration price.  A printed 2.0  |
  33.        |  manual is available to registered users for an additional $10.00. |
  34.        +--------------------------------------------------------------------+
  35.        |                                                                    |
  36.        |     Please send registration fees and suggestions to:              |
  37.        |                                                                    |
  38.        |                        David Visti                                 |
  39.        |                        P.O. Box 2952                               |
  40.        |                        Raleigh, NC  27602-2952                     |
  41.        |                                                                    |
  42.        |     Please mention the version of ASIC in any correspondence       |
  43.        |                     (This is ASIC Version 2.0)                     |
  44.        +--------------------------------------------------------------------+
  45.        |    I can also be reached for questions/comments on GEnie and       |
  46.        |    Compuserve via EMAIL:                                           |
  47.        |                                                                    |
  48.        |         Compuserve      73065,1302                                 |
  49.        |         GEnie           D.VISTI                                    |
  50.        |                                                                    |
  51.        +--------------------------------------------------------------------+
  52.        |                                                                    |
  53.        |  DISCLAIMER:  This software is provided "as is" without warranty   |
  54.        |  of any kind.  In no event shall I be held liable for any damages  |
  55.        |  whatsoever arising from the use of or inability to use this       |
  56.        |  product.                                                          |
  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.  
  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  3
  74.             2.    Tutorial                                      Page  5
  75.             3.    Integrated Editor/Compiler Environment        Page 10
  76.             4     Using the Debugger                            Page 20
  77.             5.    Stand-alone Compiler Options                  Page 28
  78.             6.    Language Elements                             Page 31
  79.             7.    Keyword Reference                             Page 35
  80.                       ABS                      Page 35
  81.                       ASC                      Page 35
  82.                       BLOAD                    Page 36
  83.                       BSAVE                    Page 37
  84.                       CALL                     Page 38
  85.                       CHDIR                    Page 40
  86.                       CHR$                     Page 41
  87.                       CLOSE                    Page 42
  88.                       CLS                      Page 42
  89.                       CODE                     Page 43
  90.                       COLOR                    Page 44
  91.                       COMMAND$                 Page 45
  92.                       COMSTAT                  Page 46
  93.                       CSRLIN                   Page 47
  94.                       DATA                     Page 48
  95.                       DATE$                    Page 49
  96.                       DEFSEG                   Page 49
  97.                       DIM                      Page 50
  98.                       END                      Page 50
  99.                       FOR/NEXT                 Page 51
  100.                       GOSUB                    Page 53
  101.                       GOTO                     Page 53
  102.                       IF/THEN/ELSE             Page 54
  103.                       INKEY$                   Page 55
  104.                       INP                      Page 56
  105.                       INPUT                    Page 57
  106.                       INPUT#                   Page 58
  107.                       KILL                     Page 59
  108.                       LEN                      Page 59
  109.                       LOCATE                   Page 60
  110.                       LPRINT                   Page 61
  111.                       MID$                     Page 62
  112.                       MKDIR                    Page 63
  113.                       NAME                     Page 64
  114.                       OPEN                     Page 65
  115.                       OPENCOM                  Page 66
  116.                       OUT                      Page 67
  117.                       PEEK                     Page 67
  118.                       POINT                    Page 68
  119.  
  120.  
  121.  
  122.  
  123.  
  124.                                       Page - 1
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                            Table of Contents (Continued)
  132.  
  133.          Chapter  Title
  134.  
  135.             7.    Keyword Reference (Continued)
  136.  
  137.                       POKE                     Page 69
  138.                       POS                      Page 69
  139.                       PRESET                   Page 70
  140.                       PRINT                    Page 71
  141.                       PRINT#                   Page 72
  142.                       PSET                     Page 74
  143.                       RANDOMIZE                Page 74
  144.                       READ                     Page 75
  145.                       RECEIVE                  Page 76
  146.                       REM                      Page 77
  147.                       RESTORE                  Page 77
  148.                       RETURN                   Page 78
  149.                       RMDIR                    Page 78
  150.                       RND                      Page 79
  151.                       RUN                      Page 80
  152.                       SCREEN                   Page 81
  153.                       SEND                     Page 82
  154.                       SOUND                    Page 83
  155.                       STR$                     Page 83
  156.                       TIME$                    Page 84
  157.                       TIMER                    Page 85
  158.                       VAL                      Page 86
  159.                       VARPTR                   Page 86
  160.                       WIDTH                    Page 87
  161.                       ZBIT                     Page 87
  162.                       ZMODE                    Page 88
  163.             8.    Compatibility with BASICA/GWBASIC             Page 89
  164.             9.    Technical Details/Tips                        Page 92
  165.             10.   Error Messages                                Page 96
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.                                       Page - 2
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.                                       A S I C
  199.  
  200.                                      Chapter 1
  201.  
  202.                                   Getting Started
  203.  
  204.  
  205.  
  206.                                     INTRODUCTION
  207.  
  208.             Welcome to ASIC!
  209.  
  210.             ASIC is a "BASIC" programming language compiler for IBM PC's and
  211.        compatibles.  It includes an integrated full screen editor, from which
  212.        you can edit, compile, and debug your programs.  Or at your option,
  213.        you can use your own text editor, and compile your programs from the
  214.        MS DOS command line.
  215.  
  216.             ASIC is a subset of BASICA and GWBASIC which supports over 60
  217.        BASIC statements, integer and string variables, and integer arrays.
  218.        It will compile your programs at high speed, and the code it generates
  219.        is fast and compact.  The syntax of each ASIC statement is generally a
  220.        valid subset of the syntax used by BASICA and GWBASIC (exceptions are
  221.        noted in Chapter 8.)
  222.  
  223.  
  224.             All you need to get started is:
  225.  
  226.                  1)  ASIC
  227.                  2)  IBM PC or 100% Compatible
  228.                  3)  300-400k Available Memory*
  229.                  4)  Two floppy disk drives
  230.                           <or>
  231.                      One hard disk drive and one floppy disk drive
  232.  
  233.             The first step is to install ASIC as described below.  Then,
  234.        proceed to Chapter 2 for a brief ASIC tutorial.  Following that you
  235.        can read the remainder of the documentation straight through, or refer
  236.        to it as you need it.  Have Fun!
  237.  
  238.  
  239.             *  The ASIC Compiler will run in 300k of memory. The ASIC Editor
  240.                will run in less than 200k of memory, however, to compile and
  241.                debug within the editor, 400k of available memory is required.
  242.                If ASIC does not find sufficient memory to call the compiler
  243.                from within the editor, it will ignore the compile
  244.                request and return to the editor.
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.                                       Page - 3
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                                     INSTALLATION
  263.  
  264.  
  265.          To install ASIC execute the following commands as appropriate for
  266.        your machine.  The procedure to do so is provided below for both
  267.        floppy systems and hard disk based systems.  Also refer to the README
  268.        file on your ASIC Diskette for additional information.
  269.  
  270.  
  271.        TWO-FLOPPY DISK SYSTEM INSTALLATION
  272.  
  273.        1)  Make sure that the following files are all on the same diskette
  274.        (the diskette that contains these files will be referred to in this
  275.        manual as the "Compiler" diskette):
  276.  
  277.                  ASIC.EXE
  278.                  ASICC.EXE
  279.  
  280.        2)  Format one or more blank diskettes to hold your programs (these
  281.        diskettes will be referred to in this manual as your "Program"
  282.        diskettes):
  283.  
  284.                  Note:  Whenever you see the symbol     <enter>    in this
  285.                         document, this refers to the <enter> or <return> key
  286.                         on your keyboard.
  287.  
  288.  
  289.        HARD DISK SYSTEM INSTALLATION
  290.  
  291.        1)  Type:   C: <enter>
  292.        2)  Type:   MD C:\ASIC <enter>
  293.        3)  The next step is to copy the ASIC software to the ASIC directory.
  294.  
  295.            If your ASIC software is on a floppy, insert the floppy in Drive
  296.            A: then type the command:
  297.  
  298.                   COPY A:*.* C:\ASIC <enter>
  299.  
  300.            If your ASIC software is already on a hard disk directory, copy
  301.            it to the ASIC directory with the command:
  302.  
  303.                   COPY C:\directoryname\*.* C:\ASIC <enter>
  304.  
  305.             Note that ASIC will run from any subdirectory, however, the
  306.             tutorial assumes ASIC is under C:\ASIC
  307.  
  308.                  Note:  Whenever you see the symbol     <enter>    in this
  309.                         document, this refers to the <enter> or <return> key
  310.                         on your keyboard.
  311.  
  312.  
  313.  
  314.  
  315.  
  316.                                       Page - 4
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.                                       A S I C
  327.  
  328.                                      Chapter 2
  329.  
  330.                                       Tutorial
  331.  
  332.  
  333.        ASIC programs look very much like regular "BASIC" programs which you
  334.        are probably already familiar with.  The one very noticeable
  335.        difference is that ASIC programs have no line numbers.  Let's take a
  336.        look at a very simple program written both in GWBASIC/BASICA and in
  337.        ASIC:
  338.  
  339.             GWBASIC/BASICA                          ASIC
  340.             --------------------------+----------------------------------
  341.                                       |
  342.             10  I=I+1                 |   ADDONE: I=I+1
  343.             20  PRINT I               |           PRINT I
  344.             30  IF I<100 THEN 10      |           IF I<100 THEN ADDONE:
  345.             --------------------------+----------------------------------
  346.  
  347.             Both of these programs do the same thing.  They display the
  348.        numbers from 1 to 100.  However, notice that ASIC allows you to use
  349.        descriptive labels (ADDONE) instead of a line number (10).  These
  350.        labels can be up to 80 characters long!  Also note that the ASIC
  351.        "PRINT" and "IF" statements were indented only for increased program
  352.        readability.  The ASIC program could just as well have been written
  353.        as:
  354.  
  355.                                         ASIC
  356.                            ------------------------------
  357.                            ADDONE:I=I+1
  358.                            PRINT I
  359.                            IF I<100 THEN ADDONE:
  360.                            ------------------------------
  361.  
  362.             We could have made our variable names longer.  Instead of "I" we
  363.        could have chosen "SECONDS" or "VELOCITY", or some other name up to 80
  364.        characters in total.  In ASIC, variable names, labels, and string
  365.        constants can all be up to 80 characters in length.
  366.  
  367.             Well, now that we've seen a basic ASIC program, let's try to
  368.        enter and run a slightly larger program.  The program we will be
  369.        working with will print the message "HELLO yourname" in 256 color
  370.        combinations.  If you have a monochrome display card, don't worry, the
  371.        program will work, but instead of seeing different colors you'll see
  372.        characters with different attributes, such as blinking, underlined,
  373.        etc.
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.                                       Page - 5
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.             Let's get started.  If you haven't done so already, install ASIC
  388.        as described in Chapter 1.  Now then, writing an ASIC program involves
  389.        these three steps.
  390.  
  391.             1.  Write your program.
  392.             2.  Compile your program.
  393.             3.  Run/Test your Program.
  394.  
  395.             These three steps can all be performed from within the ASIC
  396.        Integrated Environment.  Before we proceed with our "Hello yourname"
  397.        Program, let's go over some conventions.
  398.  
  399.  
  400.             In the following section:
  401.  
  402.             FLOPPY TYPE-->       Means that only 2-floppy disk system users
  403.                                  should type this line.
  404.  
  405.             HARD TYPE-->         Means that only hard disk system users
  406.                                  should type this line.
  407.  
  408.             TYPE-->              Means that both floppy and hard disk users
  409.                                  should type this line.
  410.  
  411.             X>                   This is a representation of the prompt from
  412.                                  PC-DOS or MS-DOS.  Floppy Disk Users will
  413.                                  actually see "A>" for a prompt.  Hard Disk
  414.                                  Users will see "C>" for a prompt.
  415.  
  416.             <enter>              Means that you should press the <enter>
  417.                                  or <return> key on your keyboard.
  418.  
  419.             <?>                  Text enclosed between the "<" and the ">"
  420.                                  symbols indicate a key to type.  Don't type
  421.                                  the "<" or ">" symbols.  For example, if the
  422.                                  tutorial lists "<F1>", your should press the
  423.                                  "F1" key on your keyboard.
  424.  
  425.        NOTE:  Floppy Disk users need to insert their ASIC Compiler diskette
  426.        in Drive A: at this point, and a Program diskette in Drive B:  (See
  427.        the Installation section for more information)
  428.  
  429.  
  430.        Let's begin:
  431.  
  432.  
  433.                  FLOPPY TYPE-->      A: <enter>
  434.                  HARD TYPE-->        CD C:\ASIC <enter>
  435.  
  436.        The computer should respond:
  437.  
  438.                                      X>
  439.  
  440.        Now enter the command to invoke ASIC
  441.  
  442.  
  443.  
  444.                                       Page - 6
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.                  TYPE-->      ASIC <enter>
  453.  
  454.        You are now in ASIC.  The top line is the Menu Bar.  The bottom line
  455.        is the Status Line.  Chapter 3 describes these features in more
  456.        detail.  For now, we'll just describe a couple of features on these
  457.        lines.
  458.  
  459.        The status line indicates that the current mode is "INSERT".  This
  460.        means that any characters you type on a line will be inserted between
  461.        the existing characters.  If you press the <INS> key on the keypad,
  462.        ASIC will toggle to it's other mode, OVERSTRIKE.  In this mode, when
  463.        you type a character, it overlays the character that was there before.
  464.        Each time you press the <INS> key, ASIC will toggle between the INSERT
  465.        and OVERSTRIKE modes.
  466.  
  467.        You can open the menus listed on the "Menu Bar" by holding down the
  468.        ALT key while typing the Capitalized letter of the menu you wish to
  469.        open.  For example, to open the File menu, press <ALT><F>.  The "File"
  470.        menu will pop open.  You can select a menu option from that menu by
  471.        typing the capitalized letter of the option, or by using the arrow
  472.        keys on your keypad to highlight the option you want and then pressing
  473.        <enter>.  Let's leave this menu for now.  To do so, press the <ESC>
  474.        key.  The <ESC> key will always let you escape from any menu in ASIC,
  475.        without taking any action.
  476.  
  477.        If you need help, press the <F1> key for a quick summary of some of
  478.        ASIC's features.  Chapter 3 gives a full description of the ASIC
  479.        Editor Commands which are available.
  480.  
  481.        Entering a program in ASIC is simplicity itself.  We'll simply type in
  482.        each line, pressing <enter> at the end of each line.  If you make a
  483.        typing mistake, just use the arrow keys to move to the error, and type
  484.        in the correction.  Use the <DEL> or <Backspace> keys to delete any
  485.        unwanted characters from the screen.
  486.  
  487.        Make sure the status line says "Mode: Insert".  This is the default
  488.        mode in ASIC.  If it doesn't, press the <INS> key until it does.  Now
  489.        let's enter our program (the program below intentionally contains an
  490.        invalid ASIC statement.  We'll correct the line later in the tutorial,
  491.        for now, type in the program exactly as it's listed below):
  492.  
  493.                  TYPE-->        CLS  <enter>
  494.                  TYPE-->        PRINT "Please enter your name"; <enter>
  495.                  TYPE-->        INPUT YOURNAME$  <enter>
  496.                  TYPE-->        FOR I=1 TO 16  <enter>
  497.                  TYPE-->            FOR J=1 TO 16  <enter>
  498.                  TYPE-->                COLOR I,J <enter>
  499.                  TYPE-->                PRINT "HELLO "; <enter>
  500.                  TYPE-->                PRINT YOURNAME$; <enter>
  501.                  TYPE-->            NEXT J <enter>
  502.                  TYPE-->        NEXT I <enter>
  503.                  TYPE-->        CLS <enter>
  504.                  TYPE-->        THE END <enter>
  505.  
  506.  
  507.  
  508.                                       Page - 7
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.                  
  517.  
  518.        There, that was easy.  Now, let's compile our program.  To do it,
  519.        we'll open the "Compile" menu, and select the "Compile program"
  520.        option:
  521.  
  522.                  TYPE-->       <ALT><C>
  523.  
  524.        The "Compile" menu will pop open.  The first option, "Compile program"
  525.        can be selected by typing the option letter which is capitalized "C",
  526.        or by moving the highlight bar to this option and pressing the <enter>
  527.        key.  Since the highlight bar is already on this option, let's just
  528.        press <enter>:
  529.  
  530.                  TYPE-->       <enter>
  531.  
  532.        Since we didn't specify a file name when we invoked ASIC, ASIC will
  533.        now ask for a file name (so it can save your program before calling
  534.        the compiler):
  535.  
  536.                  FLOPPY TYPE-->      B:TUTOR.ASI  <enter>
  537.                  HARD TYPE-->        TUTOR.ASI <enter>
  538.  
  539.        Note that ASIC requires that your programs be stored in files ending
  540.        with the extension ".ASI".  Had we entered "TUTOR" for our program
  541.        name, ASIC would have appended the letters ".ASI" for us.  If we tried
  542.        to provide a different extension, such as "TUTOR.SRC", ASIC would
  543.        display an error message.  Also, whenever you are presented a dialog
  544.        box where you are asked to enter text (such as file name, or Y/N
  545.        responses to questions), you must press the <enter> key before ASIC
  546.        will accept the input.
  547.  
  548.        Once you select the "Compile program" option, you'll see the ASIC
  549.        compiler screen appear.  It will display a count of the lines
  550.        compiled, and when it is done, it will return to the ASIC editor.
  551.  
  552.        If it detected any errors, it will display the first error message at
  553.        the bottom of the editor screen.  It will also highlight the line in
  554.        your program which is in error.  In this case the line "THE END" was
  555.        flagged with the error message "Syntax Error".  Of course, that line
  556.        should have been entered simply as "END".
  557.  
  558.        That should be easy enough to fix.  Let's exit the error menu by
  559.        pressing the <ESC> key:
  560.  
  561.             TYPE-->      <ESC>
  562.  
  563.        The error menu has disappeared, and our cursor is now on the erroneous
  564.        line.  To fix the line:
  565.  
  566.             TYPE-->      <DEL><DEL><DEL><DEL>
  567.  
  568.  
  569.  
  570.  
  571.  
  572.                                       Page - 8
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.        That should do it.  The last line of our program should now read
  581.        "END".  Let's recompile the program:
  582.  
  583.             TYPE-->      <ALT><C>
  584.             TYPE-->      <enter>
  585.  
  586.        This time you should see the message "No Compiler Errors". If you
  587.        didn't, check your spelling and recompile the program until you
  588.        receive this message.  Press <ESC> to remove the "No Compiler Errors"
  589.        Window.
  590.  
  591.        Now let's run the program.  To do so, we'll open the "Run" menu, and
  592.        select the "Run your program" option.
  593.  
  594.             TYPE-->      <ALT><R>
  595.             TYPE-->      <r>
  596.  
  597.        This time, we just entered the capitalized letter from the menu option
  598.        "Run your program".  Your computer screen should now prompt you to
  599.        "Please enter your name?".  Go ahead and enter your name now:
  600.  
  601.             TYPE-->      yourname  <enter>
  602.  
  603.        You should see "HELLO yourname" printed in various color combinations,
  604.        and then the ASIC editor screen will reappear.  Well, that's all there
  605.        is to writing, compiling, and running an ASIC program.  Now, to exit
  606.        ASIC, open the "File" menu and select the "eXit" option.
  607.  
  608.             TYPE-->      <ALT><F>
  609.             TYPE-->      <X>
  610.  
  611.        You should see your MS DOS prompt once again.  By the way, now that
  612.        you've successfully compiled the program, you can execute it directly
  613.        from MS DOS.  Let's try it:
  614.  
  615.             HARD TYPE-->     TUTOR <enter>
  616.             FLOPPY TYPE-->   B:TUTOR <enter>
  617.  
  618.        Well, that's a brief introduction to ASIC!  Next, you might want to
  619.        read Chapter 3, "Integrated Editor/Compiler Environment" to learn
  620.        about the many other features available in the ASIC editor.  Following
  621.        this you should read Chapter 4 which explains how to use the new ASIC
  622.        Debugger.  Chapter 4 includes another short tutorial in which you
  623.        debug a program.
  624.  
  625.             The remaining chapters provide reference material which you can
  626.        either read, or just refer to as needed.  Chapter 5 explains how to
  627.        compile programs directly from the command line of DOS.  Chapters 6-8
  628.        describe the BASIC statements which are supported by ASIC.  Chapter 10
  629.        provides more descriptive information for ASIC error messages.
  630.  
  631.        Hope you enjoy programming in ASIC!
  632.  
  633.  
  634.  
  635.  
  636.                                       Page - 9
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.                                       A S I C
  647.  
  648.                                      Chapter 3
  649.  
  650.                              Integrated Editor/Compiler
  651.                                     Environment
  652.  
  653.  
  654.                                     INTRODUCTION
  655.  
  656.             The ASIC integrated environment lets you edit, save, compile, and
  657.        debug your ASIC programs without ever leaving ASIC!  This chapter will
  658.        explain the usage of the integrated environment.
  659.  
  660.  
  661.                                 ASIC SCREEN CONTENTS
  662.  
  663.             ASIC divides the screen into three parts.  The top line is called
  664.        the "Menu Bar".  All of the menu's available to you are listed on this
  665.        line.  The bottom Line is called the "Status Line".  It continuously
  666.        displays some important program information.  The middle 23 lines are
  667.        the "Edit Window".  This is the section of the screen where you can
  668.        make changes or additions to your program.
  669.  
  670.                                 MENU BAR PROCESSING
  671.  
  672.        Currently, there are four menus available.  The "File" menu allows you
  673.        to load/save your existing program files to/from disk.  It is also
  674.        used to exit ASIC.  The "Edit" menu contains various editing commands
  675.        which are available.  The "Compile" menu is used to compile your
  676.        program, set compiler options, and to view compiler errors.  The "Run"
  677.        menu allows you to run your programs, and test them using the new ASIC
  678.        debugger.
  679.  
  680.             To open a menu, hold down the <ALT> key and type the first letter
  681.        of the menu.  The menu will pop down and display the options available
  682.        on that menu.  If you want to close the menu without taking any
  683.        action, press the <ESC> key.  If you wish to open a different menu
  684.        without first closing the current menu, press the left or right arrow
  685.        keys.  Otherwise, to select an option, type the capitalized letter of
  686.        the menu option.  For example, on the "File" menu, to select the
  687.        "eXit" option, type an "X" or an "x".  Another way to select an option
  688.        is to move the "Highlighted Bar" down to the option you wish to
  689.        select, and press the <enter> key.
  690.  
  691.             Some functions may be accessed outside of the menus with function
  692.        keys.  These are listed on the menus (eg. "search Again <F3>" on the
  693.        Edit Menu), however, these function keys do not operate when a menu is
  694.        open.  (A list of these Function keys is presented later in this
  695.        chapter in the Keyboard Usage Section).
  696.  
  697.  
  698.  
  699.  
  700.                                      Page - 10
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.             Now let's describe the options available on each menu.
  709.  
  710.  
  711.                                      FILE MENU
  712.  
  713.        "Open" Option
  714.  
  715.             This option allows you to open an existing ASIC file and load it
  716.        into the ASIC edit buffer where you can modify it.  If you select this
  717.        option another window will open to ask you the file name.  If you
  718.        don't wish to open a file, you can press <ESC> to close the menu
  719.        without taking any action.  Otherwise, enter an ASIC file name, and
  720.        press the <enter> key.
  721.  
  722.        "Save" Option
  723.  
  724.             This option allows you to write the changes you've made to your
  725.        program back to the file.  Changes you enter in the ASIC editor are
  726.        made to memory only.  You must select this option before your changes
  727.        will become permanent.  Note:  Your file is saved to disk
  728.        automatically whenever you compile it, or run it, if the file modified
  729.        indicator is set.
  730.  
  731.        "save As" Option
  732.  
  733.             This option will allow you to write the changes you've made to
  734.        the program in the edit buffer to a new file.  You will be prompted to
  735.        provide ASIC with a new file name.
  736.  
  737.        "eXit" Option
  738.  
  739.             This option will allow you to exit from ASIC back to MS DOS.
  740.        ASIC will ask you if you wish to save your file before you exit.
  741.  
  742.  
  743.                                      EDIT MENU
  744.  
  745.        "Begin block" Option
  746.  
  747.             This option will allow you to mark the beginning of a block of
  748.        text for use with the block delete, copy, and move commands described
  749.        below.  To mark a block of text, move the cursor to the first line of
  750.        the block, and then select this option.  The beginning line of the
  751.        block will be highlighted on the screen.  Next, move the cursor to the
  752.        ending line of the block, and select the "End block" option from this
  753.        menu.  All of the lines in the block will be highlighted.  This block
  754.        of lines can now be "moved", "copied", or "deleted" using the block
  755.        commands described below.
  756.  
  757.        "End block" Option
  758.  
  759.             This option will allow you to mark the end of a block of text.
  760.        Refer to the "Begin block" Option above for more information.
  761.  
  762.  
  763.  
  764.                                      Page - 11
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.        "Search" Option
  773.  
  774.             This option allows you to locate a string of characters in the
  775.        edit buffer.  When you select this option, ASIC will ask you for a
  776.        search string which can be up to 30 characters in length.  ASIC will
  777.        then search forward from the current line until it finds the string or
  778.        reaches the end of the edit buffer.  If it finds the string, the
  779.        cursor will be placed on the line containing the string.
  780.  
  781.        "Replace" Option
  782.  
  783.             This option will allow you to replace one or more occurrences of
  784.        a string of characters with another set of characters.  When you
  785.        select this option, ASIC will ask you for a search string which can be
  786.        up to 30 characters in length.  ASIC will then ask you for the string
  787.        of characters which is to replace the search string.  Finally, ASIC
  788.        will ask you to specify how many occurrences of this search string are
  789.        to be replaced (from 1-9999).  ASIC will search forward from the
  790.        current line, and briefly display each line as it modifies it.  If it
  791.        reaches the end of the edit buffer before it has replaced the number
  792.        of occurrences you've specified, ASIC will display an "End of Buffer"
  793.        message, and stop.
  794.  
  795.        "Delete block" Option
  796.  
  797.             This option will delete a block of lines.  Refer to the "Begin
  798.        block" option above for information on marking a block of lines.  If
  799.        you haven't marked a block of lines, selecting this option will have
  800.        no effect.
  801.  
  802.        "Move block" Option
  803.  
  804.             This option will move a block of lines to a new location in the
  805.        edit buffer.  Refer to the "Begin block" option above for information
  806.        on marking a block of lines.  If you don't mark a block of lines,
  807.        selecting this option will have no effect.  Once you have marked a
  808.        block of lines, move the cursor to the location in the edit buffer
  809.        where you want the lines moved. Selecting the "Move block" option will
  810.        result in the block of lines being deleted from their current
  811.        location, and moved to the buffer at the line following the cursor.
  812.        ASIC will not overlay lines, it will insert enough blank space to hold
  813.        the relocated text.
  814.  
  815.        "Copy block" Option
  816.  
  817.             This option is the same as the "Move block" option, with one
  818.        exception.  After moving the block, ASIC does NOT delete the original
  819.        block of lines.  Use this option to clone a block of text.
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.                                      Page - 12
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.        "search Again <F3>" Option
  837.  
  838.             This option will allow you to search for the next occurence of
  839.        the last string you searched for with the "Search" Option, without
  840.        retyping the previous search string.  This option may also be selected
  841.        outside of the Edit Menu by pressing function key <F3>.
  842.  
  843.  
  844.                                     COMPILE MENU
  845.  
  846.        "Compile program <F10>" Option
  847.  
  848.             Use this option to have ASIC compile the program which is
  849.        currently loaded in the edit buffer.  If the compile is successful,
  850.        ASIC will display the message "No Compiler Errors".  Otherwise, it
  851.        will display the first error message (see "View compile errors" option
  852.        below).  ASIC will automatically save your program before calling the
  853.        compiler.  This option may also be selected outside of the menu by
  854.        pressing function key <F10>.
  855.  
  856.        "Full program listing" Option
  857.  
  858.             This menu option, and the next two options are used to toggle
  859.        various compiler options on or off.  When the option is on, you will
  860.        see a "check mark" symbol next to the option.  This compiler option
  861.        will cause ASIC to display each source line as it compiles it.  This
  862.        option will slow down the compile, but since ASIC also writes these
  863.        lines to a listing file, this option can be used to create a compile
  864.        listing.  The compile listing will be contained in a file called
  865.        "progname.LST", where "progname" is the name of your program.
  866.  
  867.        "Printer output" Option
  868.  
  869.             This menu option will toggle the "Printer output" compiler option
  870.        on or off.  When the option is on, you will see a "check mark" symbol
  871.        next to the option name.  This compiler option will cause compiler
  872.        messages to be printed on your printer.
  873.  
  874.        "Symbol table" Option
  875.  
  876.             This menu option will toggle the "Symbol table" compiler option
  877.        on or off.  When the option is on, you will see a "check mark" symbol
  878.        next to the option name.  This compiler option will cause ASIC to
  879.        create a symbol table file called "progname.SYM", where "progname" is
  880.        the name of your program.  The symbol table is a list of all
  881.        variables, labels, and internally created compiler addresses.
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.                                      Page - 13
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.        "Debugging code" Option
  901.  
  902.             This menu option will toggle the "Debugging code" compiler option
  903.        on or off.  When the option is on, you will see a "check mark" symbol
  904.        next to the option name.  This compiler option will cause ASIC to
  905.        generate code required by the ASIC debugger to allow you to set
  906.        breakpoints, single step through your program, and view/modify program
  907.        variables.  This option is "on" by default in the integrated
  908.        environment.  You should leave this option on while you are debugging
  909.        your program.  When you have everything working properly, you should
  910.        turn it "off" and recompile your program.  This will reduce the size
  911.        of your program slightly, and will make it run faster (of course, you
  912.        can't use the debugger with it, since there is no debugging
  913.        information available to ASIC any more.  If you need to debug your
  914.        program again, just recompile with the this option turned "on" again).
  915.  
  916.        "View compile errors" Option
  917.  
  918.             When you wish to examine the errors from a previous compile of
  919.        your program, select this option.  If no errors exist, ASIC will so
  920.        inform you.  Otherwise, ASIC will display the first error message at
  921.        the bottom of the screen, and it will highlight the line of your
  922.        program which corresponds to that error.  If you wish to correct the
  923.        program line, press the <ESC> key.  The cursor will be positioned at
  924.        the beginning of that program line.  You may also view subsequent
  925.        compiler errors by pressing the <F10> key instead of the <ESC> key.
  926.  
  927.  
  928.                                       RUN MENU
  929.  
  930.  
  931.             The "Using the ASIC Debugger" Chapter has additional information
  932.        on the debugger and it's options.  You may wish to refer to it, should
  933.        you need more information than is provided below.
  934.  
  935.  
  936.        "Run your program <F5>" Option
  937.  
  938.             After you have successfully compiled your program, you can select
  939.        this option to cause ASIC to load and execute your program.  After
  940.        your program ENDs, ASIC will return you to the editor.  ASIC will save
  941.        the edit buffer before loading and executing your program.  If you are
  942.        running a program containing debugging code, this option will cause
  943.        ASIC to run your program up to the first breakpoint it encounters, or
  944.        through the end of your program if you haven't set any breakpoints.
  945.        If you are already "paused" at a breakpoint, selecting this option
  946.        will cause your program to resume execution at the statement following
  947.        the breakpoint, and run up to the next breakpoint or to the end of
  948.        your program, if no further breakpoints are encountered.  This option
  949.        may also be selected outside of the "Run menu" by pressing function
  950.        key <F5>.
  951.  
  952.  
  953.  
  954.  
  955.  
  956.                                      Page - 14
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.        "Breakpoint toggle <F9>" Option
  965.  
  966.             If you have compiled your program with the "Debugging code"
  967.        option turned on, you may use this option to set breakpoints.  You can
  968.        have up to 20 breakpoints active at a time.  When you run your program
  969.        with breakpoints set, ASIC will pause your program when it tries to
  970.        execute a line on which you have set a breakpoint.  At this time, you
  971.        can view or modify variables, or view the screen output produced by
  972.        your program.  You can then resume program execution by selecting the
  973.        "Run your program" option from the run menu.  If you select this
  974.        option and the current statement in the edit buffer already has a
  975.        breakpoint set, then the breakpoint for that source statement will be
  976.        removed (toggled off).  Lines at which you have set a breakpoint will
  977.        be displayed in reverse video.  Also, when you run your program and
  978.        ASIC stops at a breakpoint, ASIC will display the next line to execute
  979.        in reverse video on the second line of the screen with a red
  980.        background (underlined if you have a monochrome system).  This option
  981.        may also be selected outside of the "Run" Menu by pressing function
  982.        key <F9>.
  983.  
  984.        "Trace <F8>" Option
  985.  
  986.             If you have compiled your program with the "Debugging code"
  987.        option turned on, you may use this option to execute your program one
  988.        statement at a time.  After you select this option, ASIC will execute
  989.        the next program statement in your program, and pause, displaying the
  990.        next line which will be executed in reverse video with a red
  991.        background (underlined if you have a monochrome system).  At this
  992.        time, you can view or modify variables, or view the screen output
  993.        produced by your program.  You can then resume program execution by
  994.        selecting the "Run your program" option from the run menu, or by
  995.        selecting the "Trace" option again.  This option may also be selected
  996.        outside of the "Run" Menu by pressing function key <F8>.
  997.  
  998.        "Modify variable" Option
  999.  
  1000.             If you have compiled your program with the "Debugging code"
  1001.        option turned on, you may use this option to modify the contents of
  1002.        variables in your program while your program is paused at a breakpoint
  1003.        or following a "Trace" command.  When you select this option, ASIC
  1004.        will ask you for the variable name.  After you enter the variable
  1005.        name, ASIC will ask you for the new value to be stored in the
  1006.        variable.  If the variable is an array, ASIC will ask you which
  1007.        element of the array to modify.
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.                                      Page - 15
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.        "Watch variable <F6>" Option
  1029.  
  1030.             If you have compiled your program with the "Debugging code"
  1031.        option turned on, you may use this option to view the contents of
  1032.        variables in your program, while your program is paused at a
  1033.        breakpoint or following a "Trace" command.  After you enter the
  1034.        variable name, ASIC will open a "Watch" window at the bottom of the
  1035.        screen showing you the variable name and the current value.  As you
  1036.        continue execution of your program and reach a new breakpoint, the
  1037.        values of variables will be updated to reflect their new values.  In
  1038.        this way you can watch the changing values of variables in your
  1039.        program without inserting "PRINT variablename" statements in your
  1040.        program.  Up to 10 variables may be watched at a time.  If you enter a
  1041.        variable name which is an array, ASIC will ask you which element of
  1042.        the array you wish to watch.  This option may also be selected outside
  1043.        of the "Run" Menu by pressing function key <F6>.
  1044.  
  1045.        "Unwatch variable <F7>" Option
  1046.  
  1047.             If you have compiled your program with the "Debugging code"
  1048.        option turned on, you may use this option to remove variables from the
  1049.        "Watch" window (see previous option).  When you select this option,
  1050.        you will be asked for a variable name to remove from the window.  If
  1051.        the variable is an array, you will also be asked which element of the
  1052.        array.  ASIC will then remove the variable from the watch window, and
  1053.        resize the window accordingly.  Since only 10 variables may be watched
  1054.        concurrently, you may need to remove variables which are no longer
  1055.        needed from the "Watch" Window using this command.  This option may
  1056.        also be selected outside of the "Run" Menu by pressing function key
  1057.        <F7>.
  1058.  
  1059.        "Abort execution" Option
  1060.  
  1061.             If you are running your program, and it is paused at a
  1062.        breakpoint, you may select this option to abort the execution of your
  1063.        program.  Your program will be terminated immediately.
  1064.  
  1065.        "Clear all break/watch" Option
  1066.  
  1067.             If you have set breakpoints or watch variables (using the above)
  1068.        options, you may use this option to remove all of them at once,
  1069.        instead of removing them one at a time using the "Toggle breakpoint"
  1070.        or "Unwatch variable" options.
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.                                      Page - 16
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.        "Program arguments" Option
  1093.  
  1094.             This option allows you to pass command line arguments to your
  1095.        programs, which may be retrieved by your program using the COMMAND$
  1096.        statement.  If you are testing outside the integrated environment, you
  1097.        would normally specify the command line arguments by typing
  1098.        "progname arguments".  However, in the integrated environment, since
  1099.        ASIC is executing your program for you, this option is a means to pass
  1100.        the "arguments" to your program as if they had been typed on the
  1101.        command line following your program name.
  1102.  
  1103.        "Swap to user screen <F4>" Option
  1104.  
  1105.             Whenever ASIC pauses your program at a breakpoint, it saves the
  1106.        screen created by your program in a memory buffer.  You may select
  1107.        this option to view your program screen output.  When you are done
  1108.        viewing your program's output, press a key to return to viewing the
  1109.        ASIC editor.  This function may also be selected outside the "Run"
  1110.        Menu by pressing the <F4> function key.
  1111.  
  1112.  
  1113.                                     STATUS LINE
  1114.  
  1115.             The bottom line of the ASIC screen is called the "Status Line".
  1116.        As it's name implies, it is used to display various types of status
  1117.        information.  At the left of the status line "FILE: xxxxxxxx.xxx" will
  1118.        display the name of the file which is currently loaded in the edit
  1119.        buffer.  If you haven't opened a file yet, the file name will be
  1120.        blank.
  1121.  
  1122.  
  1123.             After the file name is the "File Modified Indicator".  If you
  1124.        have entered any changes in the edit buffer, and have not saved them
  1125.        to disk, an "*" will appear to indicate this.  If the edit buffer has
  1126.        not been modified since the last save to disk, no "*" will be present.
  1127.  
  1128.             The next piece of information is "Mode:".  Mode will always
  1129.        display one of two values:  "Insert" or "Ovrstr".  In "Insert" mode,
  1130.        any characters you type in the edit buffer will be inserted at the
  1131.        cursor position, and the characters to the right of the cursor will be
  1132.        shifted to the right by one.  In "Ovrstr" mode, any characters you
  1133.        type in the edit buffer will overlay (and thus destroy) the character
  1134.        at the cursor position.  You can change back and forth between these
  1135.        two modes by pressing the <INS> key on your keypad.
  1136.  
  1137.             To the right of "Mode:" ASIC displays the number of bytes which
  1138.        it allocated to the edit buffer.  Divide this number by 81 to get a
  1139.        rough idea of how many lines will fit in the edit buffer.
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.                                      Page - 17
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.             The "Line: nnnn" status indicator, will identify which line of
  1157.        the file is being displayed.  For example, if the display reads "Line:
  1158.        100", the line containing the cursor is the 100th line in the file.
  1159.        When ASIC is reading or writing your program to/from disk, it will
  1160.        display a running total of the number of records read/written in this
  1161.        field.
  1162.  
  1163.             The "Row:" and "Col:" numbers identify the relative position of
  1164.        the cursor within the "Edit Window".
  1165.  
  1166.  
  1167.                                     EDIT WINDOW
  1168.  
  1169.             The edit window is the area of the screen where your program is
  1170.        displayed.  It displays up to 23 lines of your program at a time.  You
  1171.        can use the keys described below to manipulate the text in this
  1172.        window.
  1173.  
  1174.  
  1175.                                    KEYBOARD USAGE
  1176.  
  1177.             Most keys on the keyboard behave in ASIC just as you'd expect.
  1178.        The key usages which might not be obvious are described here.
  1179.  
  1180.        <ESC>          Exit from any menu without taking any action.
  1181.  
  1182.        <TAB>          Move the cursor to the next "tab stop".  Tab stops in
  1183.                       ASIC are fixed at every fourth column (4,8,12,etc).
  1184.  
  1185.        <HOME>         Move the cursor to the beginning of the current line.
  1186.  
  1187.        <END>          Move the cursor to the last non-blank character on the
  1188.                       current line.
  1189.  
  1190.        <DEL>          Delete the character at the cursor position.
  1191.  
  1192.        <INS>          Toggle between Insert and Overstrike Modes.
  1193.  
  1194.        <PGUP>         Display the previous "page" of the edit buffer.
  1195.  
  1196.        <PGDN>         Display the next "page" of the edit buffer.
  1197.  
  1198.        <Ctl-PGUP>     Display the first "page" of the edit buffer.
  1199.  
  1200.        <Ctl-PGDN>     Display the last "page" in the edit buffer.
  1201.  
  1202.        <Backspace>    Delete the character at the cursor position, and
  1203.                       move the cursor one column to the left.
  1204.  
  1205.        <Up Arrow>     Moves cursor up one line.
  1206.  
  1207.        <Down Arrow>   Moves cursor down one line.
  1208.  
  1209.  
  1210.  
  1211.  
  1212.                                      Page - 18
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.        <Left Arrow>   Moves cursor left one column.
  1221.  
  1222.        <Right Arrow>  Moves cursor right one column.
  1223.  
  1224.        <Alt-D>        Delete the line containing the cursor.
  1225.  
  1226.        <Alt-A>        Add a line following the line containing the cursor.
  1227.  
  1228.        <F1>           Displays a help screen.
  1229.  
  1230.        <F3>           Repeats the last "Search" command.  See Edit Menu
  1231.                       Section of this chapter for more information.
  1232.  
  1233.        <F4>           Swaps the display to the output from your program
  1234.                       temporarily.  See Run Menu Section of this chapter for
  1235.                       more information.
  1236.  
  1237.        <F5>           Runs your program.  See Run Menu Section of this
  1238.                       chapter for more information.
  1239.  
  1240.        <F6>           Add a variable to the "Watch" Window.  See Run Menu
  1241.                       Section of this chapter for more information.
  1242.  
  1243.        <F7>           Remove a variable from the "Watch" Window.  See Run
  1244.                       Menu Section of this chapter for more information.
  1245.  
  1246.        <F8>           Execute a single statement of your program.  See Run
  1247.                       Menu Section of this chapter for more information.
  1248.  
  1249.        <F9>           Toggle breakpoint on/off at the current edit buffer
  1250.                       line.  See Run Menu Section of this chapter for more
  1251.                       information.
  1252.  
  1253.        <F10>          Compile your program.  See Compile Menu Section of
  1254.                       this chapter for more information.
  1255.  
  1256.        <enter>        In Insert mode, pressing <enter> is identical to
  1257.                       pressing <Alt-A>.  In OvrStr mode, pressing <enter>
  1258.                       is identical to pressing the <Down Arrow> key.
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.                                      Page - 19
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.                                       A S I C
  1287.  
  1288.                                      Chapter 4
  1289.  
  1290.                                  Using the Debugger
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.                                     INTRODUCTION
  1299.  
  1300.             The source level debugger in ASIC's integrated programming
  1301.        environment helps you debug your programs by allowing you to "peek"
  1302.        inside them as they're running.  You can single step through your
  1303.        programs, or select places in the program where you wish execution to
  1304.        pause by setting breakpoints.  Then, while the program is paused, you
  1305.        can view or modify any of your program's variables, and also examine
  1306.        the screen output created by your program.
  1307.  
  1308.             All of the debugger's commands can be selected from the run menu,
  1309.        and they are described in the "RUN MENU" Section of Chapter 3,
  1310.        "Integrated Editor/Compiler Environment".  Many of the debugger
  1311.        commands may be selected outside the "Run" menu, by pressing a
  1312.        function key (eg, <F5>,<F6>,etc).  A complete list of the function
  1313.        keys available is contained in Chapter 3, in the "KEYBOARD USAGE"
  1314.        Section.
  1315.  
  1316.             This chapter explains how to use the debugger with a short
  1317.        tutorial which guides you through a sample debugging session.  The
  1318.        tutorial is followed by a reference section which you should read
  1319.        after completing the tutorial.
  1320.  
  1321.                                  DEBUGGER TUTORIAL
  1322.  
  1323.             The debugger tutorial follows the same format as the general
  1324.        tutorial in chapter 2.  You should complete (or at least review) the
  1325.        general tutorial before taking the debugger tutorial.
  1326.  
  1327.             This tutorial will use a program file provided with your ASIC
  1328.        compiler package called "DBGTUTOR.ASI".  If you are running from a
  1329.        hard disk, make sure it is in the ASIC directory.  If you are running
  1330.        from a two-floppy system, make sure it is on the diskette in drive b:,
  1331.        with the compiler in drive a:.
  1332.  
  1333.        NOTE:  Floppy disk users should verify that the ASIC compiler diskette
  1334.        is in drive A: and the "DBGTUTOR.ASI" disk is in drive b: before
  1335.        proceeding.
  1336.  
  1337.  
  1338.  
  1339.  
  1340.                                      Page - 20
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.        Let's get started:
  1348.  
  1349.             FLOPPY TYPE-->      A: <enter>
  1350.                                 ASIC B:DBGTUTOR <enter>
  1351.  
  1352.             HARD TYPE-->        C: <enter>
  1353.                                 CD C:\ASIC <enter>
  1354.                                 ASIC DBGTUTOR <enter>
  1355.  
  1356.        You should be in ASIC now, and you should see a source program.  The
  1357.        first few lines should contain:
  1358.  
  1359.                            dim scores(10)
  1360.                            data 55,33,877,99,44,101,21,88,105,1
  1361.                            rem DBGTUTOR.ASI
  1362.                                 .
  1363.                                 . (etc)
  1364.                                 .
  1365.  
  1366.        This sample program will sort an array of 10 scores into ascending
  1367.        sequence.  It uses a simple "bubble" sort algorithm.  The "bubble"
  1368.        sort algorithm simply steps through each element of the array and
  1369.        compares it to its next higher neighbor.  If it's neighbor's value is
  1370.        less than its own, the two values are swapped.  It is necessary to
  1371.        execute this process N-1 times where N= number of items to sort.
  1372.        Here's why.  Let's say the lowest value to be sorted was "1" and it is
  1373.        in array element "10" (assume 10 numbers will be sorted).  The first
  1374.        swapping pass will result in the "1" being swapped from element 10 to
  1375.        element 9 of the array.  An additional 8 passes through the array are
  1376.        necessary to move the "1" to array element number 1.  This algorithm
  1377.        gets it's name, because the process of moving the elements has been
  1378.        compared to that of bubbles slowly rising to the surface.
  1379.  
  1380.        This program has a list of ten scores to be sorted.  Line 5 of the
  1381.        program will read the ten scores to an array called "Scores", and also
  1382.        print the original values (before the sort) to the screen.  Then two
  1383.        loops will execute at statements 8 and 9 in the program to perform the
  1384.        bubble sort as described above.  Finally, after the sort is complete,
  1385.        the sorted values will be displayed.
  1386.  
  1387.        First, let's compile the program.  When we plan to use the debugger,
  1388.        we must set the "Debugging code" option on.  This is done on the
  1389.        Compile Menu.  However, the default in the integrated environment is
  1390.        "Debugging code" on.  Let's take a look to be sure:
  1391.  
  1392.  
  1393.             TYPE-->        <Alt><c>
  1394.  
  1395.        The compile menu should pop open, and you should see a check mark next
  1396.        to the "Debugging code" option.  If you don't, press the letter "D",
  1397.        and a check mark should appear.  Once you've verified that the option
  1398.        is on, we can compile the program.  Notice that there is an <F10> next
  1399.        to the option.  Instead of opening this menu and selecting the
  1400.  
  1401.  
  1402.  
  1403.  
  1404.                                      Page - 21
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.        "Compile" option, we could have pressed <F10>.  Let's try it.  First,
  1412.        let's close the menu (Function keys don't work inside a menu):
  1413.  
  1414.             TYPE-->        <ESC>
  1415.  
  1416.        The menu should have closed.  Now let's compile using the function
  1417.        key:
  1418.  
  1419.             TYPE-->        <F10>
  1420.  
  1421.        You should see the compiler screen pop up, and compile the program.
  1422.        No errors should be detected.  Now we're ready to test the program.
  1423.        First, let's set a breakpoint so we can easily view the screen output,
  1424.        Use the down arrow key to position the cursor on line 20 (the line
  1425.        number is displayed on the ASIC status line).  Line 20 should contain
  1426.        an "END" statement.  Let's open the run menu and set a breakpoint:
  1427.  
  1428.  
  1429.             TYPE-->        <Alt><r>
  1430.                            <b>
  1431.  
  1432.        The "END" statement should now be displayed in reverse video.  That
  1433.        tells us that a breakpoint has been set there.  Did you notice that
  1434.        the breakpoint option on the menu also had a function key listed.  We
  1435.        could set a breakpoint without opening a menu, by pressing <F9>
  1436.        instead.  Now that we've set a breakpoint, let's run the program and
  1437.        see how it works:
  1438.  
  1439.             TYPE-->        <Alt><r>
  1440.                            <r>
  1441.  
  1442.        Note that we could have pressed the short cut key of <F5> to run the
  1443.        program instead of selecting the option from the menu.  At this point
  1444.        our program is running, but is paused at the breakpoint we set on line
  1445.        20.  When you reach a breakpoint, ASIC will position the breakpointed
  1446.        line on the second line of the edit window, highlighted in red (or
  1447.        underlined, if you have a monochrome system). ASIC has interrupted the
  1448.        program before it executed the line with the breakpoint, in this case
  1449.        "END".  Let's take a look at the screen output of the program to see
  1450.        if it worked:
  1451.  
  1452.             TYPE-->        <Alt><r>
  1453.                            <s>
  1454.  
  1455.        Note we could also select the "Swap" function by pressing <F4> without
  1456.        opening a menu.  You should now see the output from the program on the
  1457.        screen.  It should look something like:
  1458.  
  1459.        Original Scores:
  1460.            55    33   877    99    44   101    21    88   105     1
  1461.        Sorting...
  1462.        Here are the sorted scores:
  1463.            33    55    99    44   101    21    88   105     1   877
  1464.  
  1465.  
  1466.  
  1467.  
  1468.                                      Page - 22
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.        Well, that doesn't look quite right.  Maybe we can use the debugger to
  1477.        figure out what went wrong.  First, let's allow the program to run to
  1478.        completion (remember, we're paused at a breakpoint on the "END"
  1479.        statement).  Swap back to the ASIC screen from the user screen by
  1480.        pressing any key:
  1481.  
  1482.             TYPE-->        <enter>
  1483.  
  1484.        You should see the editor screen again.  Now let's tell ASIC to resume
  1485.        program execution:
  1486.  
  1487.             TYPE-->        <Alt><r>
  1488.                            <r>
  1489.  
  1490.        ASIC has executed the END statement, and our program has terminated.
  1491.        You should see the message "Program Terminated Normally (0)".  (The
  1492.        "0" is the return code set by the program.  You can set return codes
  1493.        in your programs using the new END statement.  Refer to Chapter 7 for
  1494.        details.).  Now we'll set another breakpoint in the program.  Move the
  1495.        cursor to line 7 (the status line should now say LINE: 7) using the
  1496.        arrow keys.  The cursor should now be positioned on the statement
  1497.        which says:  PRINT "Sorting...".  Set a breakpoint here:
  1498.  
  1499.             TYPE-->        <F9>
  1500.  
  1501.        The source statement should now appear in reverse video.  We used the
  1502.        shortcut key <F9> to set the breakpoint this time, but you could have
  1503.        opened the Run Menu, and selected the Breakpoint option and done the
  1504.        same thing.  Let's remove the breakpoint:
  1505.  
  1506.             TYPE-->        <F9>
  1507.  
  1508.        Line 7 should no longer be highlighted.  The same command is used to
  1509.        turn breakpoints on or off for a source line.  ASIC just checks to see
  1510.        if a breakpoint is already set at that source line when you select the
  1511.        breakpoint command.  If one is set, it "toggles" it off (ie removes
  1512.        it), otherwise, it "toggles" it on (ie sets a breakpoint).  This
  1513.        exercise was just to show you how to remove a breakpoint, let's go
  1514.        ahead and set it again:
  1515.  
  1516.             TYPE-->        <F9>
  1517.  
  1518.        Line 7 should be highlighted again (the breakpoint is set).
  1519.        If might be nice to see what's in some of our program's variables, so
  1520.        let's "watch" some variables.  Open the Run Menu, select the Watch
  1521.        command, and tell ASIC you want to watch variable "I".
  1522.  
  1523.             TYPE-->        <Alt><r>
  1524.                            <w>
  1525.                            i<enter>
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.                                      Page - 23
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.        ASIC should have opened a "Watch" window at the bottom of the screen.
  1540.        You should see the variable name "I" at the left, followed by a ":".
  1541.        Following the ":" is the current value of that variable.  The number
  1542.        there now doesn't really mean anything, since our program is not
  1543.        running.  But once the we start the program, this number should
  1544.        represent the actual value of the variable "I".
  1545.  
  1546.        Let's watch a few more variables: j, j1, and scores(1).  This time,
  1547.        we'll use the shortcut key for the watch command:
  1548.  
  1549.             TYPE-->        <F6>
  1550.                            j<enter>
  1551.  
  1552.        Variable "J" should now be in the watch window.
  1553.  
  1554.             TYPE-->        <F6>
  1555.                            j1<enter>
  1556.  
  1557.        Variable "J1" should now be in the watch window.  When we watch
  1558.        "scores", we'll also have to tell ASIC which element we want to watch
  1559.        by entering a subscript, since "scores" is an array.  First ASIC will
  1560.        prompt you for the variable name.  Type it, without the subscript.
  1561.        ASIC will prompt you for the numeric subscript.
  1562.  
  1563.  
  1564.             TYPE-->        <F6>
  1565.                            scores<enter>
  1566.                            <1><enter>
  1567.  
  1568.        Scores(1) should now be in the watch window.  Now we're ready to run
  1569.        the program again:
  1570.  
  1571.             TYPE-->        <F5>
  1572.  
  1573.        Again we selected the short cut key, you could have selected the "Run
  1574.        your program" option from the "Run" Menu.  The second line of the edit
  1575.        screen should show the PRINT "Sorting..." statement (highlighted in
  1576.        red, or underlined if you have a monochrome monitor).  The variables
  1577.        in the watch window should have the following values:
  1578.  
  1579.             I:    11
  1580.             J:     0
  1581.             J1:     0
  1582.             SCORES(1):    55
  1583.  
  1584.        Let's execute the next statement by using the Trace command:
  1585.  
  1586.             TYPE-->        <Alt><r>
  1587.                            <t>
  1588.  
  1589.        ASIC has executed the PRINT "Sorting..." statement and has paused
  1590.        execution on the "FOR I" statement on line 8 of the program.  Since
  1591.        the PRINT statement did not modify any variables, the numbers in the
  1592.  
  1593.  
  1594.  
  1595.  
  1596.                                      Page - 24
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.        watch window should remain unchanged.  Let's Trace one more statement,
  1604.        this time, we'll use the short cut key:
  1605.  
  1606.             TYPE-->        <F8>
  1607.  
  1608.        ASIC has executed the "FOR I" statement on line 8, and is now paused
  1609.        on statement "FOR J" on line 9 of the program.  Something looks wrong
  1610.        though.  Even though we executed the first "FOR I" statement, the
  1611.        variable "I" still contains "11".  It should contain "1".  If you look
  1612.        at line 8, you'll see that the FOR statement was mistyped, it reads:
  1613.        "FOR I = I to 9", instead of "FOR I=1 to 9".  Since the program also
  1614.        used variable "I" to READ the data into the array, "I" still contains
  1615.        the value "11".  Since "11" is greater than the "TO" value of the
  1616.        "FOR" loop, the FOR loop on line 8 is executed only 1 time instead of
  1617.        9 times.  That's why the data is not being fully sorted.  With the
  1618.        ASIC debugger, we can continue testing without recompiling, by
  1619.        modifying the value of "I" to "1", so we can see if the rest of our
  1620.        logic is correct.  If changing "I" to "1" works, then we can go back
  1621.        and modify the "FOR" statement and recompile the program to correct
  1622.        the program permanently.  Modify the value of "I" to "1":
  1623.  
  1624.             TYPE-->        <Alt><r>
  1625.                            <m>
  1626.                            i<enter>
  1627.                            <1><enter>
  1628.  
  1629.        The watch window should now show the value of "I" as 1.  We can resume
  1630.        program execution at this point by selecting the "Run your program"
  1631.        option.  We'll use the short cut key again:
  1632.  
  1633.             TYPE-->        <F5>
  1634.  
  1635.        ASIC should pause the program at the next breakpoint, which is on line
  1636.        20.  This statement contains the "END" command.  Now let's see if the
  1637.        program worked, by swapping to the user screen:
  1638.  
  1639.             TYPE-->        <F4>
  1640.  
  1641.        Again, we used the short cut key.  You should see the following on
  1642.        your screen:
  1643.  
  1644.        Original Scores:
  1645.            55    33   877    99    44   101    21    88   105     1
  1646.        Sorting...
  1647.        Here are the sorted scores:
  1648.             1    21    33    44    55    88    99   101   105   877
  1649.  
  1650.        It looks like the program worked.  Let's return to the editor screen.
  1651.  
  1652.             TYPE-->        <enter>
  1653.  
  1654.        Now we could press <F5> to resume execution and in this case
  1655.        terminate, since the END statement is the next one to execute.  But
  1656.        let's look at another way to terminate a program.  While at a
  1657.  
  1658.  
  1659.  
  1660.                                      Page - 25
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.        breakpoint, you can select the "Abort your program" option, which
  1668.        instructs ASIC to terminate your program immediately, without
  1669.        executing any more of your program.  Let's try it:
  1670.  
  1671.             TYPE-->        <Alt><r>
  1672.                            <a>
  1673.  
  1674.        ASIC should display the message "Program Terminated Normally (0)".  At
  1675.        this point, we'll just exit from ASIC, but normally, you would fix the
  1676.        FOR statement using the editor, save the file, recompile the program,
  1677.        and retest it to make sure the "bug" is really fixed.
  1678.  
  1679.             TYPE-->        <Alt><f>
  1680.                            <x>
  1681.  
  1682.        You should be back at the DOS prompt now.  That concludes the brief
  1683.        introduction to the ASIC debugger.  The rest of this chapter provides
  1684.        some additional reference material for the debugger.  Chapter 3
  1685.        provides additional information about each of the debugging commands.
  1686.  
  1687.                                    DEBUGGER TIPS
  1688.  
  1689.  
  1690.        1)  WHEN YOU ARE DONE DEBUGGING YOUR PROGRAM, YOU SHOULD RECOMPILE
  1691.            WITH THE "DEBUGGING CODE" OPTION TURNED OFF. Although your program
  1692.            can run from the DOS command line with debugging code present, it
  1693.            will increase the program size and execution times.  Recompiling
  1694.            with the "Debugging code" option off will insure your programs
  1695.            will be smaller and faster.
  1696.  
  1697.        2)  Remember that the default option on the command line compiler is
  1698.            "Debugging code" off.  The default option in the integrated
  1699.            environment is "Debugging code" on.
  1700.  
  1701.        3)  Breakpoints/Watches are automatically cleared when you
  1702.            OPEN or COMPILE a file.
  1703.  
  1704.        4)  If you change source lines in a program while a program
  1705.            is running, without recompiling, source statements will
  1706.            not match executable code.  Abort the running program
  1707.            and recompile after making code changes.
  1708.  
  1709.        5)  Breakpoints are set in the edit buffer relative to the
  1710.            beginning of the buffer.  If you insert/delete lines in
  1711.            the buffer, the breakpoints will still be set at the
  1712.            same relative line number from the beginning of the
  1713.            buffer.
  1714.  
  1715.        6)  ASIC takes over the INT 3 Interrupt vector for debugging
  1716.            purposes. It re-installs the default vector when you
  1717.            exit ASIC.
  1718.  
  1719.        7)  You must compile with the "Debugging code" option to use
  1720.            source level debugging.
  1721.  
  1722.  
  1723.  
  1724.                                      Page - 26
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.        8)  If you wish to run a program from the beginning again
  1733.            while its already running,  select the "Abort your
  1734.            program" option from the Run menu.  Then, select the
  1735.            "Run your program" option.
  1736.  
  1737.        9)  If you select the Abort option from the Run menu, your
  1738.            program's files will NOT be closed gracefully.  That
  1739.            is, data in the buffers will not be flushed to disk.
  1740.  
  1741.        10) You may still run a program in the integrated environment that
  1742.            has been compiled without the Debugging code option.  You just
  1743.            won't be able to use the debugging commands (eg,
  1744.            Breakpoints/Watches).
  1745.  
  1746.        11) Toggling a breakpoint on/off will clear any block of
  1747.            text you had previously marked for editing (eg, MOVE,
  1748.            COPY).
  1749.  
  1750.        12) When modifying array variables, make sure that the
  1751.            subscript you specify is valid.  For example, if you
  1752.            "DIM A(10)", make sure the subscript you specify is in
  1753.            the range of 0 to 10.  ASIC does not check the range of
  1754.            a subscript.  If you specify a subscript that exceeds
  1755.            the valid range for that variable, your program may
  1756.            crash.
  1757.  
  1758.        13) You can pass arguments to programs using the "Arguments"
  1759.            option on the Run Menu.  You may retrieve these options
  1760.            in your program with the COMMAND$ statement.  Using the
  1761.            "Arguments" option is equivalent to specifying arguments
  1762.            following the program name, when you run your program
  1763.            from the DOS command line.
  1764.  
  1765.        14) The compiler allows variable names up to 80 characters in
  1766.            length.  The debugger only uses the first 30 characters of a
  1767.            variable name.  When the debugger finds two variables whose names
  1768.            are not unique within 30 characters, it will always select the
  1769.            first one it finds (this applies to the Watch/Unwatch/Modify
  1770.            Variables commands).
  1771.  
  1772.        15) ASIC will allow you to set a breakpoint on a "FOR" statement.
  1773.            However, you should be aware that the source statement containing
  1774.            the "FOR" is executed only once (to initialize the loop).  When
  1775.            the "NEXT" statement executes, control transfers back to the line
  1776.            following the "FOR", instead of the "FOR".  For example, in the
  1777.            following code fragment:
  1778.  
  1779.             FOR I = 1 TO 3           <---Executes 1 time to initialize loop
  1780.                  PRINT I             <---Executes 3 times
  1781.                  A=A+1               <---Executes 3 times
  1782.             NEXT I                   <---Executes 3 times, loops back to
  1783.                                          "PRINT I", not to "FOR I= 1 TO 3"
  1784.  
  1785.  
  1786.  
  1787.  
  1788.                                      Page - 27
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.                                       A S I C
  1799.  
  1800.                                      Chapter 5
  1801.  
  1802.                                   Compiler Options
  1803.  
  1804.  
  1805.                                 COMMAND LINE SYNTAX
  1806.  
  1807.  
  1808.        Invoke the command line version of the compiler as follows:
  1809.  
  1810.  
  1811.             ASICC filename option1 option2 option3 option4 option5 option6
  1812.  
  1813.  
  1814.             Where:         filename  is the name of the source program to be
  1815.                                      compiled.  This file must have the file
  1816.                                      extension ".ASI", although the extension
  1817.                                      may be omitted from the command line.
  1818.  
  1819.                            optionN   specifies any options desired.  No
  1820.                                      options are required, but as many as
  1821.                                      six may be specified.
  1822.  
  1823.  
  1824.                                   COMPILER OPTIONS
  1825.  
  1826.  
  1827.  
  1828.        A total of six compiler switches are currently available for ASIC.
  1829.        Each is described in detail below:
  1830.  
  1831.  
  1832.        Switch         Description
  1833.  
  1834.          C            CONTINUE--ASIC will not pause after messages are
  1835.                                 issued, but will continue compiling.
  1836.  
  1837.                       Default:  ASIC will pause after each error message.
  1838.                                 Compilation will resume after you press
  1839.                                 a key.
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                      Page - 28
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.        Switch         Description
  1861.  
  1862.          L            LIST ALL--ASIC will list each source line as it
  1863.                                 compiles it.
  1864.  
  1865.                       Default:  ASIC will list only source lines with
  1866.                                 compile errors.
  1867.  
  1868.                       Comment:  Use of this switch will slow compile
  1869.                                 speeds slightly due to the additional
  1870.                                 screen I/O.
  1871.                                 
  1872.  
  1873.          P            PRINTLIST--ASIC will echo all messages which
  1874.                                 appear on the screen to the printer.
  1875.                                 Output to the printer will be paged
  1876.                                 with header lines identifying the
  1877.                                 program name, and the date/time
  1878.                                 compiled.
  1879.  
  1880.                       Default:  ASIC will not send any messages to
  1881.                                 the printer.
  1882.  
  1883.                       Comments: Even though output to the printer is
  1884.                                 buffered, this option will slow compile
  1885.                                 speeds considerably.  The compiler typically
  1886.                                 compiles only as fast as your printer
  1887.                                 can print the messages.  An alternative
  1888.                                 to this switch is the DISKLIST option
  1889.                                 described below.
  1890.  
  1891.  
  1892.          D            DISKLIST--ASIC will echo all screen messages to a disk
  1893.                                 file named "progname.LST".  The format is
  1894.                                 the same produced by PRINTLIST.  This allows
  1895.                                 you to compile at higher speed, and print
  1896.                                 the source listing later from the disk file
  1897.                                 via the DOS print spooler.
  1898.  
  1899.                       Default:  ASIC does not produce a ".LST" file.
  1900.  
  1901.  
  1902.          S            SYMTAB----ASIC will produce a formatted Symbol Table
  1903.                                 in a file named "progname.SYM".  The symbol
  1904.                                 table contains a list of all variables,
  1905.                                 labels, and internally created compiler
  1906.                                 addresses.
  1907.  
  1908.                       Default:  ASIC does not produce a ".SYM" file.
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.                                      Page - 29
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.          X            DEBUG-----ASIC will generate debugging code in the
  1926.                                 ".COM" file and a ".DBG" file for use by the
  1927.                                 integrated environment debugger.
  1928.  
  1929.                       Default:  ASIC does not generate debugging information.
  1930.                                 
  1931.                       Comment:  If you are running from the integrated
  1932.                                 environment, ASIC sets this option on by
  1933.                                 default.  You may turn it off in the Compile
  1934.                                 menu, should you so desire.
  1935.  
  1936.  
  1937.                                   COMPILE EXAMPLES
  1938.  
  1939.  
  1940.        Example 1:  Compile "MYFILE.ASI" with default compiler options:
  1941.  
  1942.  
  1943.                       ASICC MYFILE
  1944.  
  1945.  
  1946.        Example 2:  Compile "MYPROG.ASI", Listing all source lines, writing
  1947.                    a compile listing to a disk file for printing later.  The
  1948.                    listing file will be called "MYPROG.LST":
  1949.  
  1950.                       ASICC MYPROG L D
  1951.  
  1952.  
  1953.        Example 3:  Compile "FILEX.ASI", don't pause for any errors, and
  1954.                    print the errors on the printer:
  1955.  
  1956.                       ASICC FILEX C P
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.                                      Page - 30
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.                                       A S I C
  1991.  
  1992.                                      Chapter 6
  1993.  
  1994.                                  Language Elements
  1995.  
  1996.  
  1997.  
  1998.                                    CHARACTER SET
  1999.  
  2000.  
  2001.        Symbol         Description
  2002.  
  2003.          *            Multiplication
  2004.                       Example: A=B*C  (multiply B by C, store result in A)
  2005.  
  2006.          /            Division
  2007.                       Example: A=B/C  (divide B by C, store result in A)
  2008.  
  2009.          +            Addition
  2010.                       Example: A=B+C  (add C to B, store result in A)
  2011.  
  2012.          +            String Concatenation
  2013.                       Example: A$="AB"+"C"   (A$ will contain "ABC")
  2014.  
  2015.          =            Assignment
  2016.                       Example: A=1    (A will be assigned the value 1)
  2017.  
  2018.          =            Equality testing
  2019.                       Example: IF A=1 THEN QUIT:  (If the value stored in
  2020.                            (A equals 1 goto label QUIT)
  2021.  
  2022.          -            Subtraction
  2023.                       Example: A=B-C   (Subtract C from B, store result in A)
  2024.  
  2025.          "            String Delimiter
  2026.                       Example: A$="the string is inside quote marks"
  2027.  
  2028.          ()           Parenthesis -- Ignored by ASIC
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.                                      Page - 31
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.        Symbol         Description
  2053.  
  2054.          ;            Suppress Carriage Return/Line Feed with PRINT/LPRINT
  2055.  
  2056.          #            Used to identify file usage with PRINT#/INPUT#
  2057.  
  2058.          ,            Comma,  Ignored by ASIC
  2059.  
  2060.          $            Distinguishes a String Variable from an Integer.
  2061.                       Example:    ABC$   <---- string variable
  2062.                       Example:    ABC    <---- integer variable
  2063.  
  2064.          :            Distinguishes a Label from a variable name.
  2065.                       Example:    START:    <---Label name
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.                                      Page - 32
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.                           CONSTANTS, VARIABLES, AND LABELS
  2118.  
  2119.  
  2120.        ASIC supports the following data types:  Integer Constants, Integer
  2121.        Variables, single dimension Integer Arrays, String Constants, and
  2122.        String Variables.  The following describes the restrictions for each
  2123.        data type.
  2124.  
  2125.  
  2126.        INTEGER CONSTANTS   Range  +32767 to -32767
  2127.  
  2128.                            Example:       -26
  2129.  
  2130.        INTEGER VARIABLE    Described by a variable name beginning with a
  2131.                            letter, followed by up to 79 additional letters
  2132.                            or numbers.  It may contain a number in the range
  2133.                            +32767 to -32767.
  2134.  
  2135.                            Example:       VELOCITY1
  2136.  
  2137.        INTEGER ARRAY       Described by a variable name beginning with a
  2138.                            letter, followed by up to 79 additional letters
  2139.                            or numbers.  This name is followed by an
  2140.                            integer variable or constant for the dimension
  2141.                            of the array.  Arrays must be dimensioned at the
  2142.                            beginning of the program.  See the DIM statement.
  2143.                            
  2144.                            Example:       GROWTH (YEAR)
  2145.  
  2146.        STRING CONSTANT     A group of 0-80 characters enclosed by quotation
  2147.                            marks.
  2148.  
  2149.                            Example:       "This is a String Constant"
  2150.  
  2151.        STRING VARIABLE     Described by a variable name which begins with a
  2152.                            letter, followed by up to 78 additional
  2153.                            letters or numbers, terminated with a "$".
  2154.                            Can contain 0-80 characters.
  2155.  
  2156.                            Example:       ADDRESS$
  2157.  
  2158.        LABEL               A Label is a location in your program you wish
  2159.                            to transfer to.  It must begin with a letter,
  2160.                            and it may contain up to 78 additional letters
  2161.                            or numbers.  It must be terminated with a ":".
  2162.                  
  2163.                            Example:       START:
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.                                      Page - 33
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.                               VARIABLES VS. CONSTANTS
  2182.  
  2183.  
  2184.        In general, ASIC will allow the use of either variables, arrays, or
  2185.        constants as operands to any program statement.  For example:
  2186.  
  2187.  
  2188.                       PRINT CASH
  2189.                       PRINT 20
  2190.                       PRINT A(10)
  2191.  
  2192.        All three of the above examples are valid.  The only case where a
  2193.        constant cannot be used, is where the value is being modified.  For
  2194.        example:
  2195.  
  2196.                  A = A + B           <----VALID
  2197.                  17 = A + C          <----INVALID
  2198.  
  2199.        Of course you must specify the correct data type for the ASIC keyword.
  2200.        For example:
  2201.  
  2202.                  A = ABS("HELLO")    <----INVALID
  2203.  
  2204.  
  2205.        This statement is invalid because you cannot take the absolute value
  2206.        of a string!
  2207.  
  2208.        There are a few ASIC statements which will accept only integer
  2209.        constants for some operands (DIM, OPEN, PRINT#, INPUT#).  Refer to the
  2210.        individual statement for more information.
  2211.  
  2212.        Finally, there is a restriction on the use of subscripts for Arrays.
  2213.        A subscript for an array cannot be another array.  For example:
  2214.  
  2215.  
  2216.                  A(I(1))             <----INVALID
  2217.                  A(I)                <----VALID
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.                                      Page - 34
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.                                       A S I C
  2247.  
  2248.                                      Chapter 7
  2249.  
  2250.                                  Keyword Reference
  2251.  
  2252.  
  2253.  
  2254.                                         ABS
  2255.  
  2256.        Format:        integer1 = ABS (integer2)
  2257.  
  2258.        Description:
  2259.  
  2260.             This function returns the absolute value of integer2 which is
  2261.        then stored in integer1.
  2262.  
  2263.        Example:
  2264.  
  2265.                  A = ABS (-7)
  2266.  
  2267.        After execution of this statement, "A" will contain 7.
  2268.  
  2269.  
  2270.  
  2271.                                         ASC
  2272.  
  2273.        Format:        integer1 = ASC (string1)
  2274.  
  2275.        Description:
  2276.  
  2277.             This function returns the ASCII value of the first character of
  2278.        string1, storing the result in integer1.
  2279.  
  2280.        Example:
  2281.  
  2282.                  A = ASC("123")
  2283.  
  2284.        After execution of this statement "A" would contain 49, which the is
  2285.        ASCII value of "1".
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.                                      Page - 35
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.                                        BLOAD
  2310.  
  2311.        Format:        BLOAD string1, integer1, integer2
  2312.  
  2313.        Description:
  2314.  
  2315.             This function loads data previously saved by BSAVE from a file to
  2316.        memory.  String1 should be the name of the file previously created by
  2317.        BSAVE.  Integer1 should be the memory offset to load the data to.
  2318.        Integer2 should be the number of bytes to read from the file.  If
  2319.        DEFSEG has been set, it will be used as the data segment, otherwise,
  2320.        the default ASIC data segment will be used.
  2321.  
  2322.        Example:
  2323.  
  2324.                  DEFSEG -18432
  2325.                  BLOAD "SAVED.DAT" 0 100
  2326.  
  2327.        After execution of these statements 100 bytes will be read from the
  2328.        file "SAVED.DAT" and stored in memory start at 0 bytes from the start
  2329.        of the override data segment (which in this case happens to point to
  2330.        the beginning of video memory for a CGA card).  Assuming a CGA card
  2331.        was present, the first 50 characters on the screen would contain data
  2332.        read from the file (don't forget that each screen character is
  2333.        represented by two bytes data and attribute, that's why only 50
  2334.        characters will be displayed, assuming you are not in graphics mode).
  2335.  
  2336.        Comments:
  2337.  
  2338.             THIS FUNCTION IS RECOMMENDED ONLY FOR ADVANCED PROGRAMMERS.  THIS
  2339.        STATEMENT WILL ALLOW YOU TO OVERLAY ANY AREA OF MEMORY, AND IT IS VERY
  2340.        EASY TO ACCIDENTALLY OVERLAY YOUR PROGRAM OR THE MEMORY USED BY DOS.
  2341.  
  2342.             If ASIC detects an error executing this command, it will set the
  2343.        system ERROR variable.  These error codes are listed in the Error
  2344.        Messages Chapter.
  2345.  
  2346.             This statement is slightly different from GWBASIC/BASICA in that
  2347.        you must specify how many bytes to read from the file.  Also, the
  2348.        memory offset is not stored in the file by BSAVE, so you must specify
  2349.        the offset as integer1 in ASIC.  Offset is optional in GWBASIC/BASICA.
  2350.  
  2351.        See also:
  2352.  
  2353.             DEFSEG,BSAVE
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.                                      Page - 36
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.                                        BSAVE
  2375.  
  2376.        Format:        BSAVE string1, integer1, integer2
  2377.  
  2378.        Description:   
  2379.             
  2380.             This statement writes the block of memory beginning at offset
  2381.        integer1 from the start of the data segment for a length of integer2
  2382.        bytes to the file specified by string1.  This data may be later loaded
  2383.        by BLOAD.  If DEFSEG has been set, it will be used as the data
  2384.        segment, otherwise, the default ASIC data segment will be used.
  2385.  
  2386.        Example:
  2387.  
  2388.                  DEFSEG -18432
  2389.                  BSAVE "SAVED.DAT" 0 4000
  2390.  
  2391.        After execution of these statements 4000 bytes at offset 0 bytes from
  2392.        the start of the override data segment (which in this case happens to
  2393.        point to the beginning of video memory for a CGA card) will be written
  2394.        to the file "SAVED.DAT".  Assuming a CGA card was present, the current
  2395.        screen would be saved to disk, assuming you are not in graphics mode.
  2396.  
  2397.        Comments:
  2398.  
  2399.             If ASIC detects an error executing this command, it will set the
  2400.        system ERROR variable.  These error codes are listed in the Error
  2401.        Messages Chapter.
  2402.  
  2403.        See also:
  2404.  
  2405.             DEFSEG,BLOAD
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.                                      Page - 37
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.                                         CALL
  2439.  
  2440.        Format:        CALL (string1,string2)
  2441.  
  2442.        Description:
  2443.  
  2444.             This function can be used to load and execute other programs
  2445.        compiled with ASIC or another compiler.  String1 represents the name
  2446.        of the program to execute.  String2 contains any arguments to be
  2447.        passed to the program (it may be NULL, ie "").  If an error occurs
  2448.        when ASIC attempts to call the program, it will set the system ERROR
  2449.        variable to 255.  Otherwise, the ERROR variable will be set to the
  2450.        value of the return code of the called program (which is 0 unless the
  2451.        called program specifies otherwise).
  2452.  
  2453.        Example:
  2454.                  CALL ("MYPROG.COM","")
  2455.                  REM other code follows
  2456.  
  2457.        This statement would cause ASIC to load and execute the program
  2458.        "MYPROG.COM".  No arguments will be passed to the program.  When
  2459.        MYPROG terminates, the calling program will regain control on the line
  2460.        following the call, in this case the "REM" statement.
  2461.  
  2462.        Example 2:
  2463.  
  2464.                  CALL ("COMMAND.COM"," /C WP.BAT")
  2465.  
  2466.        In this example, a ".BAT" type file is executed called "WP.BAT".  To
  2467.        run ".BAT" files, it is necessary to load a copy of COMMAND.COM as
  2468.        shown above (COMMAND.COM contains the DOS code required to load and
  2469.        execute ".BAT" files).  Using this format, you can also run some
  2470.        "built in" DOS commands such as DIR or SORT.  Using CALL with this
  2471.        format, is similar to using the GWBASIC/BASICA SHELL command.
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.                                      Page - 38
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.                                   CALL (Continued)
  2500.  
  2501.  
  2502.  
  2503.        Comments:
  2504.  
  2505.             String1 must contain the FULL pathname of the program
  2506.        (ie,"\directory\progname.COM") only if the program is NOT in the
  2507.        current directory.  You must include the file extension on the file
  2508.        name (for example, use "MYPROG.COM" instead of just "MYPROG", or use
  2509.        "MYPROG.EXE" instead of "MYPROG").
  2510.  
  2511.  
  2512.             If you wish to pass arguments to the program build it as follows:
  2513.  
  2514.                  YOURPARM$ = "arguments"
  2515.                  N = LEN(YOURPARM$)
  2516.                  A$ = CHR$(N)
  2517.                  A$ = A$ + YOURPARM$
  2518.                  B$ = CHR$(13)
  2519.                  A$ = A$ + B$
  2520.                  CALL "progname" a$
  2521.  
  2522.             The above creates an argument list according to the strict DOS
  2523.        calling rules, but so far, I have found that you can just create the
  2524.        arguments in a string, and precede them with a leading space.  You
  2525.        might want to try this short cut first, and only resort to the full
  2526.        formal approach if you have problems with it:
  2527.  
  2528.                  CALL "progname" " arguments"
  2529.  
  2530.        CAUTION:
  2531.  
  2532.             You may use the debugger with programs which contain "CALL" or
  2533.        "RUN" statements.  However, the programs you call should not
  2534.        themselves contain debugging code.  For example, if A.ASI calls B.ASI,
  2535.        then make sure you compile B.ASI with the "Debugging Code" option OFF
  2536.        before you try to debug program A.ASI.  Failure to do so will cause
  2537.        the debugger to behave erratically.  This also applies to programs you
  2538.        write using other compilers, since they also use the same interrupt
  2539.        that ASIC uses (INT 3) for debugging purposes.
  2540.  
  2541.        See also:
  2542.  
  2543.             RUN,COMMAND$
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.                                      Page - 39
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.                                        CHDIR
  2567.  
  2568.        Format:        CHDIR string1
  2569.  
  2570.        Description:
  2571.  
  2572.             This statement will change the current directory to that
  2573.        specified in string1.  If an error occurs when ASIC executes this
  2574.        command, it will set the System ERROR variable.  A list of possible
  2575.        error codes is listed in the Error Messages Chapter of this manual.
  2576.  
  2577.        Example:
  2578.  
  2579.             CHDIR "\DOS"
  2580.             IF ERROR = 0 THEN NOERROR:
  2581.  
  2582.        If Drive "C" was the current drive, then this statement would change
  2583.        the current directory to "C:\DOS".
  2584.  
  2585.             CHDIR "C:\DOS"
  2586.  
  2587.        This statement would change the current directory on drive C to
  2588.        "C:\DOS" whether or not drive C is the current drive. It would NOT
  2589.        change the default drive to "C".  Note that DOS retains a current
  2590.        directory for each disk drive on your computer.
  2591.  
  2592.        See also:
  2593.  
  2594.             MKDIR, RMDIR
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.                                      Page - 40
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.                                         CHR$
  2631.  
  2632.        Format:        string1 = CHR$(integer1)
  2633.  
  2634.        Description:
  2635.  
  2636.             This function converts an integer in the range of 0-255 to an
  2637.        ASCII character, and stores in string1.
  2638.  
  2639.        Example:
  2640.  
  2641.                  A$ = CHR$(49)
  2642.  
  2643.        After execution of this statement, "A$" will contain "1", since "1" is
  2644.        represented by ASCII 49.
  2645.  
  2646.        Comments:
  2647.  
  2648.                  If integer1 is outside the range 0-255, then the least
  2649.        significant byte of integer 1 is converted to string1.
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.                                      Page - 41
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.                                        CLOSE
  2695.  
  2696.        Format:        CLOSE integer1
  2697.  
  2698.        Description:
  2699.  
  2700.             This function closes the file number identified by integer1.  If
  2701.        an error is returned by DOS, the system variable "ERROR" will be > 0.
  2702.  
  2703.        Example:
  2704.  
  2705.                  CLOSE 1
  2706.                  IF ERROR > 0 THEN CHECKERROR:
  2707.  
  2708.        After successful execution of the CLOSE statement, the file previously
  2709.        opened as file 1 will be closed.  If an error is returned by DOS, the
  2710.        ERROR variable will be set by ASIC to a non-zero value.
  2711.  
  2712.        Comments:
  2713.  
  2714.             IF YOU FAIL TO CLOSE AN OPEN FILE (WHICH WAS OPENED FOR WRITING),
  2715.        YOU MAY LOSE DATA, SINCE FILE I/O IS BUFFERED, AND THE LAST BUFFER MAY
  2716.        NOT HAVE BEEN FLUSHED.
  2717.  
  2718.             Also, integer1 may only be a constant with the value of 1-3.
  2719.  
  2720.        See Also:
  2721.  
  2722.             OPEN,PRINT#,INPUT#
  2723.  
  2724.  
  2725.  
  2726.                                         CLS
  2727.  
  2728.        Format:        CLS
  2729.  
  2730.        Description:
  2731.  
  2732.             This function clears the screen.
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.                                      Page - 42
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.                                         CODE
  2759.  
  2760.        Format:        CODE (integer1)
  2761.  
  2762.        Description:
  2763.  
  2764.             This function may be used to insert machine language code
  2765.        directly into your program.  Integer1 should be in the range of 0-255.
  2766.  
  2767.        Example:
  2768.                  CODE 205
  2769.                  CODE 5
  2770.  
  2771.        These statements represent the machine code generated from the
  2772.        assembly language statement "INT 5".  INT 5 is the BIOS routine which
  2773.        will print the screen to the printer.  After execution of these
  2774.        statements in your program, the current screen contents would be
  2775.        printed on your printer.
  2776.  
  2777.        Comments:
  2778.  
  2779.             THIS STATEMENT IS INTENDED FOR ADVANCED PROGRAMMERS.  THIS
  2780.        STATEMENT IS VERY POWERFUL, AND IF YOU DON'T UNDERSTAND MACHINE
  2781.        LANGUAGE YOU COULD EASILY CRASH YOUR PROGRAM.
  2782.  
  2783.             When you use this statement, be sure to save the contents of the
  2784.        following 8088 registers if you plan to modify them, and restore them
  2785.        before returning to ASIC.  Otherwise the results may be unpredictable.
  2786.        Registers:  DS/CS/ES/SS.  Also, make sure you clean up the stack
  2787.        before you return (ie, if you push a value to the stack, make sure you
  2788.        pop it before you return to ASIC)  Failure to do so, will almost
  2789.        certainly cause your program to crash.
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.                                      Page - 43
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.                                        COLOR
  2823.  
  2824.        Format:        COLOR integer1,integer2
  2825.  
  2826.        Description:
  2827.  
  2828.             This function is used to set the foreground and background screen
  2829.        colors.  The foreground color is specified in integer1, the background
  2830.        color in integer2.
  2831.  
  2832.                       Valid Colors:       Foreground       Background
  2833.                                           ----------       ----------
  2834.                       Black                    0              0
  2835.                       Blue                     1              1
  2836.                       Green                    2              2
  2837.                       Cyan                     3              3
  2838.                       Red                      4              4
  2839.                       Magenta                  5              5
  2840.                       Brown                    6              6
  2841.                       White                    7              7
  2842.                       Dark Gray                8              
  2843.                       Light Blue               9    
  2844.                       Light Green              10
  2845.                       Light Cyan               11
  2846.                       Light Red                12
  2847.                       Light Magenta            13
  2848.                       Yellow                   14
  2849.                       Bright White             15
  2850.  
  2851.                  Note:   Colors 8-15 when specified for background color
  2852.                            result in blinking text.
  2853.  
  2854.        Example:
  2855.  
  2856.                  COLOR 4,8
  2857.  
  2858.        After execution of this statement, future characters written to the
  2859.        screen will be Blinking Red on a Black Background.
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.                                      Page - 44
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.                                       COMMAND$
  2887.  
  2888.        Format:        string1 = COMMAND$
  2889.  
  2890.        Description:
  2891.  
  2892.             This statements retrieves any command line arguments that were
  2893.        entered and stores them in string1.
  2894.  
  2895.        Example:
  2896.                  If your program was invoked with:       MYPROG XXX
  2897.  
  2898.                  And if your program MYPROG.ASI contained the following:
  2899.  
  2900.                       A$=COMMAND$
  2901.                       PRINT A$
  2902.  
  2903.  
  2904.        After execution of these statements, the screen would display " XXX".
  2905.  
  2906.        Comments:
  2907.  
  2908.             In the integrated environment, you can specify command line
  2909.        arguments on the "Run" Menu.
  2910.  
  2911.             This statement is an extension over BASICA/GWBASIC.
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.                                      Page - 45
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.                                       COMSTAT
  2951.  
  2952.        Format:        integer1 = COMSTAT (integer2)
  2953.  
  2954.        Description:
  2955.  
  2956.             This statement returns the status of a com port.  Integer2 should
  2957.        contain "0" for COM1, or "1" for COM2.  The status of that COM port is
  2958.        returned in integer1.  Each bit in integer1 represents a different
  2959.        piece of information.  These are described in the table below.  Note
  2960.        that you may test if a bit is on/off using the ZBIT command.
  2961.  
  2962.        Example:
  2963.  
  2964.             PORTSTAT = COMSTAT (0)
  2965.             DATAREADY = ZBIT(8,PORTSTAT)
  2966.             IF DATAREADY = 1 THEN GORECEIVE:
  2967.  
  2968.        These statements do the following.  The first retrieves the status of
  2969.        COM1 to the variable PORTSTAT.  The second checks to see if bit 8 is
  2970.        on, DATAREADY will contain 1 if so, otherwise it will contain 0.
  2971.        Since Bit 8 is used to determine if data is waiting to be received
  2972.        from the port, if DATAREADY = 1 then the program will transfer to the
  2973.        label GORECEIVE: which would contain code to RECEIVE data from the
  2974.        port.
  2975.  
  2976.        Comments:
  2977.  
  2978.             Status Codes Returned by COMSTAT (Meaning when set to 1)
  2979.  
  2980.             Bit 0     Delta clear-to-send
  2981.                 1     Delta data-set-ready
  2982.                 2     Trailing-edge ring detector
  2983.                 3     Delta receive line signal detect
  2984.                 4     Clear-to-send
  2985.                 5     Data-set-ready
  2986.                 6     Ring Indicator
  2987.                 7     Received line signal detect
  2988.                 8     Data Ready
  2989.                 9     Overrun error
  2990.                10     Parity error
  2991.                11     Framing error
  2992.                12     Break-detect error
  2993.                13     Transfer holding register empty
  2994.                14     Transfer shift-register empty
  2995.                15     Time-out error
  2996.  
  2997.  
  2998.        See also:
  2999.  
  3000.             OPENCOM,SEND,RECEIVE
  3001.  
  3002.  
  3003.  
  3004.                                      Page - 46
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.                                        CSRLIN
  3015.  
  3016.        Format:        integer1 = CSRLIN
  3017.  
  3018.        Description:
  3019.  
  3020.             This function returns row of the cursor.
  3021.  
  3022.        Example:
  3023.  
  3024.                       LOCATE 10,20
  3025.                       A = CSRLIN
  3026.  
  3027.        The locate command will have positioned the cursor in row 10, column
  3028.        20.  After execution of the CSRLIN statement, "A" will contain the
  3029.        value of 10.
  3030.  
  3031.        See also:
  3032.  
  3033.             POS
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.                                      Page - 47
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.                                         DATA
  3079.  
  3080.        Format:        DATA constant1[,constant2,...,constantn]
  3081.  
  3082.        Description:
  3083.  
  3084.             This statement is used store integer and string constants in
  3085.        memory for later retrieval by READ statements.  At least one integer
  3086.        or string constant must be specified, although multiples of each type
  3087.        are permitted.
  3088.  
  3089.        Example:
  3090.  
  3091.             DATA 1,"APPLE",2,"ORANGES"
  3092.  
  3093.  
  3094.             READ A
  3095.             READ A$
  3096.             READ B
  3097.             READ B$
  3098.  
  3099.        The above statements are equivalent of entering the following code:
  3100.  
  3101.             A=1
  3102.             A$="APPLE"
  3103.             B=2
  3104.             B$="ORANGES"
  3105.  
  3106.        Comments:
  3107.  
  3108.             All DATA Statements must be placed at the beginning of the
  3109.        program, before all other statement types, except DIM statements.  DIM
  3110.        statements, if specified, must precede all other statements including
  3111.        DATA statements.  As long as you follow these rules, you may specify
  3112.        an unlimited number of DATA statements.
  3113.  
  3114.             GWBASIC/BASICA does not require quotes around string constants in
  3115.        some instances.  ASIC always requires quotes around string constants.
  3116.  
  3117.        See also:
  3118.  
  3119.             READ,RESTORE
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.                                      Page - 48
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.                                        DATE$
  3143.  
  3144.        Format:        string1 = DATE$
  3145.  
  3146.        Description:
  3147.  
  3148.             This function returns the value of the system date in the format
  3149.        of "MM-DD-YYYY".
  3150.  
  3151.        Example:
  3152.  
  3153.             A$=DATE$
  3154.             PRINT A$
  3155.  
  3156.        After executing these statements, the date stored in the PC's System
  3157.        Clock will be displayed on the screen.
  3158.  
  3159.  
  3160.        Comments:
  3161.  
  3162.  
  3163.             Note:  if the date printed is wrong, you have probably not set
  3164.        the system clock.  Most older XT's and PC's do not have a battery to
  3165.        preserve the DATE and TIME in the system clock, so you have to set
  3166.        them each time you power up the PC.  Most AT's and newer PC's have a
  3167.        battery backup, so that the date is preserved for you.
  3168.  
  3169.             Unlike GWBASIC/BASICA, you cannot set the system date with DATE$,
  3170.        however, you can set the system date from DOS by typing DATE.
  3171.  
  3172.        See also:
  3173.  
  3174.             TIME$, TIMER
  3175.  
  3176.  
  3177.  
  3178.                                        DEFSEG
  3179.  
  3180.        Format:        DEFSEG = integer1
  3181.  
  3182.             This function is used the alter the default data segment used
  3183.        when peeking and poking data with PEEK and POKE statements.  DEFSEG,
  3184.        PEEK, and especially POKE are not recommended for beginners.  If
  3185.        integer1 =-1, then the data segment address is set back to the ASIC
  3186.        default data segment address.
  3187.  
  3188.        See also:
  3189.  
  3190.             PEEK, POKE, BLOAD, BSAVE
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.                                      Page - 49
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.                                         DIM
  3207.  
  3208.        Format:        DIM variable(integer1)
  3209.  
  3210.  
  3211.        Description:
  3212.                  
  3213.             This statement will create one dimensional arrays.  An integer
  3214.        variable name must be specified in variable.  Integer 1 contains the
  3215.        number of elements in the array.
  3216.  
  3217.        Example:
  3218.  
  3219.                  DIM A(10)
  3220.  
  3221.        In this example an array of 10 integer variables is defined.
  3222.  
  3223.        Comments:
  3224.  
  3225.             On the DIM statement, integer1 may only be a constant.  Also, DIM
  3226.        statements must appear before all other statement types in the
  3227.        program.
  3228.  
  3229.  
  3230.  
  3231.                                         END
  3232.  
  3233.        Format:        END [(integer1)]
  3234.  
  3235.        Description:
  3236.             
  3237.             This statement causes your program to terminate and return to
  3238.        DOS, optionally setting a return code.  Integer1 may be optionally
  3239.        specified to set the return code.  If omitted, ASIC uses a return code
  3240.        of zero by default.
  3241.  
  3242.        Example:
  3243.  
  3244.                  END
  3245.  
  3246.        In this example, the program will terminate and return to DOS with a
  3247.        return code of zero.
  3248.  
  3249.                  END (20)
  3250.  
  3251.        In this example, the program will terminate and return to DOS with a
  3252.        return code of "20".
  3253.  
  3254.        Comments:
  3255.  
  3256.             The optional return code is an extension over GWBASIC/BASICA.
  3257.  
  3258.  
  3259.  
  3260.                                      Page - 50
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.                                       FOR/NEXT
  3271.  
  3272.        Format:        FOR integer1 = integer2 to integer3
  3273.                       NEXT integer1
  3274.  
  3275.        Description:
  3276.  
  3277.             These two statements are used to create a loop, so that you can
  3278.        execute a portion of your program a certain number of times.  All of
  3279.        the code between the FOR and the NEXT statement will be executed a
  3280.        certain number of times, but at least once.  The actual number of
  3281.        times the loop executes is dependent on integer1/integer2/integer3.
  3282.        When the FOR statement is encountered in your program, integer1 is
  3283.        assigned the value of integer2.  Then the statements up to the
  3284.        matching NEXT statement is executed one time.  Then, 1 is added to
  3285.        integer1, and integer1 is compared to integer3.  If integer1 is
  3286.        greater than integer3 then the control passes to the statement
  3287.        following NEXT.  Otherwise, the program loops back up to the statement
  3288.        following the FOR statement.
  3289.  
  3290.        Example:
  3291.  
  3292.                  FOR I = 1 TO 2
  3293.                       FOR J = 3 TO 5
  3294.                            PRINT I;
  3295.                            PRINT J
  3296.                       NEXT J
  3297.                  NEXT I
  3298.                  PRINT "AFTER THE LOOP";
  3299.                  PRINT I;
  3300.                  PRINT J;
  3301.        Execution of this section of code would result in the following
  3302.        printout:
  3303.  
  3304.                  1    3
  3305.                  1    4
  3306.                  1    5
  3307.                  2    3
  3308.                  2    4
  3309.                  2    5
  3310.                  AFTER THE LOOP    3    6
  3311.  
  3312.        Comments:
  3313.             
  3314.             Unlike BASICA/GWBASIC, ASIC FOR/NEXT loops execute at least 1
  3315.        time.  For example, the value "HELLO" will be printed in the following
  3316.        example.  It wouldn't have been in BASICA/GWBASIC.
  3317.  
  3318.                  FOR I = 1 TO 0
  3319.                       PRINT "HELLO"
  3320.                  NEXT I
  3321.  
  3322.  
  3323.  
  3324.                                      Page - 51
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.                                 FOR/NEXT (Continued)
  3335.  
  3336.             Unlike GWBASIC/BASICA, arrays may be used for integer1 and
  3337.        integer2.  However, if integer3 is an array, element zero will be
  3338.        used, regardless of the subscript you specify.
  3339.  
  3340.             ASIC will allow you to modify the value of integer3, while
  3341.        GWBASIC/BASICA ignores changes.
  3342.  
  3343.                  J=1
  3344.                  FOR I=1 TO J
  3345.                       J=2
  3346.                  NEXT I
  3347.  
  3348.             The above loop will execute one time in GWBASIC/BASICA, but it
  3349.        will execute two times in ASIC.
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  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.                                      Page - 52
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.                                        GOSUB
  3399.  
  3400.        Format:        GOSUB label1
  3401.  
  3402.        Description:
  3403.  
  3404.             This statement "calls" a subroutine called "label1".  This
  3405.        subroutine must contain a "RETURN".  After the subroutine is executed,
  3406.        control is returned to the next statement following the GOSUB.
  3407.  
  3408.        Example:
  3409.  
  3410.                  GOSUB PRINTIT:
  3411.                  PRINT "All Done!"
  3412.                  END
  3413.                  PRINTIT:  PRINT "It"
  3414.                  RETURN
  3415.  
  3416.        After execution of this code the screen would contain:
  3417.  
  3418.                  It
  3419.                  All Done!
  3420.  
  3421.  
  3422.  
  3423.                                         GOTO
  3424.  
  3425.        Format:        GOTO label1
  3426.  
  3427.        Description:
  3428.  
  3429.             This statement transfer program execution to the statement
  3430.        identified by label1.
  3431.  
  3432.        Example:
  3433.  
  3434.                  GOTO SKIPIT:
  3435.                  PRINT "YOU'LL NEVER GET HERE"
  3436.                  SKIPIT: PRINT "ALL DONE!"
  3437.  
  3438.        After execution of this code, the screen will appear as follows:
  3439.  
  3440.                  ALL DONE!
  3441.  
  3442.        Note that the first print statement never executes because of the
  3443.        GOTO.
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.                                      Page - 53
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.                                     IF/THEN/ELSE
  3463.  
  3464.        Format:        IF condition THEN label1                  <--Format 1
  3465.                       IF condition THEN label1 ELSE label2      <--Format 2
  3466.  
  3467.        Description:
  3468.  
  3469.             This statement is used to conditionally transfer to a different
  3470.        location in the program. If "condition" is true, control is
  3471.        transferred to label1.  If "condition" is false, if label2 is
  3472.        specified, control transfers to label2, otherwise a false condition
  3473.        will cause the program to continue executing the statement following
  3474.        the IF statement.  The operand "condition" is one of the following:
  3475.  
  3476.                       integer1 > integer2
  3477.                       string1  > string2
  3478.                       integer1 = integer2
  3479.                       string1  = string2
  3480.                       integer1 < integer2
  3481.                       string1  < string2
  3482.  
  3483.        Example:
  3484.  
  3485.                  IF A > 0 THEN APLUS:
  3486.  
  3487.        In this example, if A is greater than zero, the program jumps to the
  3488.        label called "APLUS:".
  3489.  
  3490.        Example:
  3491.  
  3492.                  IF A$="YES" THEN TRUE: ELSE FALSE:
  3493.  
  3494.        In this example, if A$ contains the string "YES", the program jumps to
  3495.        the label called "TRUE:", otherwise the program transfers to label
  3496.        "FALSE:"
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.                                      Page - 54
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.                                        INKEY$
  3527.  
  3528.        Format:        string1 = INKEY$
  3529.  
  3530.        Description:
  3531.  
  3532.             Used to retrieve keystrokes from the keyboard buffer.  If a
  3533.        character is waiting in the buffer, string1 will be set to the value
  3534.        of that character, and that character will be removed from the
  3535.        keyboard buffer.  If the buffer is empty, string1 will be set to a
  3536.        value of "" (that is, a null string with a length of 0).  If an
  3537.        extended key is pressed (for example the function keys F1 through
  3538.        F10), the system variable EXTENDED will be set to 1 otherwise it will
  3539.        contain 0.
  3540.  
  3541.        Example:
  3542.  
  3543.                  LOOP: X$=INKEY$
  3544.                  IF X$="" THEN LOOP:
  3545.  
  3546.        The above code will cause the program to loop until a key is pressed.
  3547.  
  3548.        Comment:
  3549.  
  3550.             ASIC provides an extension here over BASICA/GWBASIC.  the
  3551.        EXTENDED system variable will allow you to detect special keys as
  3552.        mentioned above.  To do so requires an understanding of keyboard scan
  3553.        codes, which is beyond the scope of this manual.  For more information
  3554.        I would suggest Peter Norton's Programmer's Guide to the IBM PC
  3555.        (Microsoft Press).
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.                                      Page - 55
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.                                         INP
  3591.  
  3592.        Format:        integer1 = INP (integer2)
  3593.  
  3594.        Description:
  3595.  
  3596.             This statement reads a byte from port integer2 and stores the
  3597.        result in integer1.
  3598.  
  3599.        Example:
  3600.  
  3601.             A=INP(513)
  3602.             A=ZBIT(4,A)
  3603.             IF A=1 THEN TRIGGERPRESSED:
  3604.  
  3605.        The above code will test the joystick port to see if the trigger is
  3606.        being pressed on joystick 1.  You need a game card and joystick for
  3607.        this to work.
  3608.  
  3609.        See also:
  3610.  
  3611.             OUT
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.                                      Page - 56
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.                                        INPUT
  3655.  
  3656.  
  3657.        Format:        INPUT variable1
  3658.  
  3659.        Description:
  3660.  
  3661.             This statement will retrieve a line of text terminated from the
  3662.        input buffer and stores it in variable1.  ASIC will first issue the
  3663.        prompt "?".  It will then wait until the user enters a string or
  3664.        integer and presses the <return> or <enter> key.  The type of data
  3665.        ASIC will expect is dependent on the type of variable1 (integer or
  3666.        string).  If an integer is being entered, ASIC will edit the input for
  3667.        validity as an integer, and if the edit fails will issue another "?"
  3668.        to the user, and will wait for the number to be retyped.  Only when a
  3669.        valid integer has been entered will variable1 be updated, and only
  3670.        then will control return to your ASIC program.
  3671.  
  3672.        Example:
  3673.  
  3674.                  PRINT "Enter a String";
  3675.                  INPUT A$
  3676.  
  3677.        ASIC will issue the prompt:
  3678.  
  3679.                  Enter a String?
  3680.  
  3681.        It will then wait until you enter a string or press enter.  If you
  3682.        pressed enter with no characters A$ would contain "" (ie its length
  3683.        would equal 0), otherwise A$ would contain the string entered.
  3684.  
  3685.        Example:
  3686.  
  3687.                  INPUT I
  3688.  
  3689.        In this example ASIC will issue the prompt:
  3690.  
  3691.                  ?
  3692.  
  3693.        ASIC will then wait for you to enter a valid number.  If you enter an
  3694.        invalid number, say "x", ASIC will reissue the "?" prompt and wait for
  3695.        you to retype your input.  Once the input has been edited by ASIC, "I"
  3696.        would contain the number entered.
  3697.  
  3698.        See Also:
  3699.  
  3700.             INKEY$
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.                                      Page - 57
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.                                        INPUT#
  3719.  
  3720.        Format:        INPUT# integer1, variable1 [NONULL]
  3721.  
  3722.        Description:
  3723.  
  3724.             This statement will read a variable from a file identified by
  3725.        file number integer1.  It will be stored in variable1.  When reading
  3726.        ASCII strings from a file not created by ASIC, specify the NONULL
  3727.        option.  This tells ASIC to not expect NULLs at then end of strings.
  3728.        (however, if ASIC finds a NULL, it will still consider this the end of
  3729.        that string).  If an error occurs during a read, the system variable
  3730.        ERROR will be set to a non-zero value.  The possible errors are listed
  3731.        in the error messages section of this manual.  If you read a file past
  3732.        it's end, the contents of variable1 are undefined.
  3733.  
  3734.        Example:
  3735.  
  3736.             INPUT#1, A$
  3737.             IF ERROR=99 THEN ENDOFFILE:
  3738.  
  3739.        In this example, a string will be read from file #1, and it will be
  3740.        stored in A$.  The system ERROR variable is then checked to see if End
  3741.        of file was reached.  Note, other ERRORS could also be returned by
  3742.        INPUT#, besides error code 99.  Refer to the error messages section
  3743.        for more information.
  3744.  
  3745.        Comments:
  3746.  
  3747.             Note that integer1 must be a constant in the range of 1-3.  It
  3748.        identifies a file by file number which must have previously been
  3749.        opened by an OPEN command.
  3750.  
  3751.             ASIC assumes that integers will be stored in files in 2-byte
  3752.        binary format, which is the format ASIC writes integers.
  3753.        Consequently, If a file contained a string "123", but you told ASIC to
  3754.        read integer "X", then ASIC would read two bytes from the file and
  3755.        interpret "12" as two binary bytes that it would then combine and
  3756.        store as "X".  "X" would contain the integer value 12849.  Thus to
  3757.        read an integer correctly, you will have had to previously written it
  3758.        with an ASIC program.
  3759.  
  3760.        See Also:
  3761.  
  3762.             OPEN, CLOSE, PRINT#
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.                                      Page - 58
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.                                         KILL
  3783.  
  3784.        Format:        KILL string1
  3785.  
  3786.        Description:
  3787.  
  3788.             This statement is used to delete a file from disk.  It is similar
  3789.        to the DOS ERASE Statement.  Specify the file to delete in string1.
  3790.        You can specify the full path to the file, or just the file name if it
  3791.        is in the current directory.  If an error occurs (eg, File not found),
  3792.        then ASIC will set the System ERROR variable.  A list of codes
  3793.        returned by KILL is listed in the ERROR Messages Chapter of this
  3794.        manual.
  3795.  
  3796.        Example:
  3797.  
  3798.                  KILL "TEMP.DAT"
  3799.                  IF ERROR = 0 THEN NOERROR:
  3800.                  REM CHECK ERROR CODES HERE
  3801.  
  3802.        After this statement is executed, the file "TEMP.DAT" will have been
  3803.        erased from the current directory of the current drive, and will no
  3804.        longer be accessible from DOS or your programs.
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.                                         LEN
  3811.  
  3812.        Format:        integer1 = LEN (string1)
  3813.  
  3814.        Description:
  3815.  
  3816.             This statement returns the length (number of characters) of a
  3817.        string, and stores the length in integer1.
  3818.  
  3819.        Example:
  3820.  
  3821.                  A$="abc"
  3822.                  LENGTH1 = LEN(A$)
  3823.  
  3824.        After execution of these statements, LENGTH1 would contain 3.
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.                                      Page - 59
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.                                        LOCATE
  3847.  
  3848.        Format:        LOCATE row,column
  3849.  
  3850.        Description:
  3851.  
  3852.             This statement is used to position the cursor to a row and
  3853.        column.  Row and Column should be integers.  Row has the range 0-24,
  3854.        Column has the range 0-79.  This function does not perform edits on
  3855.        the ranges of row and column.  Consequently using this function with
  3856.        values outside these ranges will have unpredictable results.
  3857.  
  3858.        Example:
  3859.  
  3860.                  LOCATE 10,20
  3861.                  PRINT "HELLO"
  3862.  
  3863.        After execution of these statements, the message "HELLO" will appear
  3864.        beginning at row 10, column 20.
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.                                      Page - 60
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.                                        LPRINT
  3911.  
  3912.        Format:        LPRINT printobject [;]
  3913.  
  3914.        Description:
  3915.  
  3916.             This statement is used to send the contents of printobject to an
  3917.        attached printer.  "printobject" can be any valid ASIC datatype:
  3918.        integer constant, integer number, string constant, string variable,
  3919.        and also array elements.  Optionally, a ";" can be included with this
  3920.        statement to suppress a carriage return/line feed which ASIC normally
  3921.        also sends to the printer following each LPRINT.  This can be used to
  3922.        string several printobjects together on a single print line.
  3923.  
  3924.        Example:
  3925.  
  3926.                  A=12345
  3927.                  LPRINT "The value of A is: ";
  3928.                  LPRINT A
  3929.  
  3930.        After execution of these statements the printer would print:
  3931.  
  3932.                  The value of A is: 12345
  3933.  
  3934.        Comments:
  3935.  
  3936.                  Note that if the printer is not "online" that DOS will issue
  3937.        a message to "Abort, Retry, or Ignore".  This could overwrite a
  3938.        portion of the program display, unless not planned for.
  3939.  
  3940.                  Note also, that some printers do not begin printing until
  3941.        they receive a carriage return/line feed sequence.
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.                                      Page - 61
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.                                         MID$
  3975.  
  3976.        Format:        string1 = MID$(string2,integer1,integer2)
  3977.  
  3978.        Description:
  3979.  
  3980.             This statement is used to extract a substring from string2
  3981.        beginning at position integer1 within string2 and continuing for
  3982.        integer2 bytes.  This value is then stored in string1.
  3983.  
  3984.        Example:
  3985.  
  3986.                       A$="THE QUICK BROWN FOX"
  3987.                       B$=MID$(A$,1,4)
  3988.                       C$=MID$(A$,11,9)
  3989.                       D$=B$ + C$
  3990.  
  3991.        After execution of these statements, the contents of A$ will be
  3992.        unchanged.  The contents of B$ will be "THE ".  The contents of C$
  3993.        will be "BROWN FOX", and the contents of D$ will be "THE BROWN FOX".
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.                                      Page - 62
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.                                        MKDIR
  4039.  
  4040.        Format:        MKDIR string1
  4041.  
  4042.        Description:
  4043.  
  4044.             This statement is used to create a new DOS directory.  Specify
  4045.        the directory to create in string1.  If ASIC is unable to create the
  4046.        directory, it will set the System ERROR variable.  A list of ERROR
  4047.        codes may be found is the Error Messages Chapter of this manual.
  4048.  
  4049.        Example:
  4050.  
  4051.                  MKDIR "WORK"
  4052.                  IF ERROR = 0 THEN NOERROR:
  4053.  
  4054.        This code would create a directory called "WORK" under the current
  4055.        directory of the current drive.
  4056.  
  4057.        Example 2:
  4058.  
  4059.                  MKDIR "C:\WORK"
  4060.  
  4061.        This code would create a directory called "WORK" under the root
  4062.        directory of drive "C".
  4063.  
  4064.        See also:
  4065.  
  4066.             CHDIR,RMDIR
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.                                      Page - 63
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.                                         NAME
  4103.  
  4104.        Format:        NAME string1 AS string2
  4105.  
  4106.        Description:
  4107.  
  4108.             This statement will allow you to rename a file.  String1 should
  4109.        contain the current file name, and string2 should contain the new name
  4110.        for the file.  If ASIC is unable to rename the file, it will set the
  4111.        System ERROR variable.  A list of ERROR codes is contained in the
  4112.        Error Messages Chapter of this Manual.
  4113.  
  4114.        Example:
  4115.  
  4116.             NAME "olddata.txt" AS "newdata.txt"
  4117.             IF ERROR = 0 THEN SUCCESS:
  4118.  
  4119.        After execution of these statements, file "olddata.txt" will have been
  4120.        renamed to "newdata.txt"
  4121.  
  4122.        Comments:
  4123.  
  4124.             You cannot rename a file to a new disk drive.
  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.                                      Page - 64
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.                                         OPEN
  4167.  
  4168.        Format:        OPEN string1, integer1, string2
  4169.  
  4170.        Description:
  4171.  
  4172.             This statement is used to open a file for input or output.  Up to
  4173.        three files may be open concurrently, these are known as file 1, 2, or
  4174.        3.  You must specify with integer1 which file number you wish to open
  4175.        this file as.  Integer1 may only be a constant.  The file mode is
  4176.        specified in string1.  The valid values are "I" for INPUT and "O" for
  4177.        OUTPUT.  The file name is specified with string2.  Any errors returned
  4178.        from DOS on the OPEN call will be returned in the system variable
  4179.        "ERROR".
  4180.  
  4181.        Example:
  4182.  
  4183.                  A$="INFILE"
  4184.                  OPEN "I",3,A$
  4185.                  IF ERROR > 0 THEN PROCESSERROR:
  4186.                  OPEN "O",1,"A:\NEWFILE.DAT"
  4187.                  IF ERROR > 0 THEN PROCESSERROR:
  4188.  
  4189.        In this example, two files are opened.  File "INFILE" from the current
  4190.        disk drive and directory will be opened as file number 3 for input.
  4191.        The file "A:\NEWFILE.DAT" will be opened for output as file number 1.
  4192.        Note that if "A:\NEWFILE.DAT" previously existed, it contents will be
  4193.        destroyed in preparation for writing.
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.                                      Page - 65
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.                                       OPENCOM
  4231.  
  4232.        Format:        OPENCOM(integer1,integer2,integer3,integer4,integer5)
  4233.  
  4234.        Description:
  4235.  
  4236.             This statement is used to initialize the serial port.  Integer1
  4237.        is used to specify the baud rate.  Integer2 specifies parity.
  4238.        Integer3 specifies stop bits.  Integer4 specifies bytesize, and
  4239.        Integer5 identifies which port to open (see the tables below).
  4240.        OPENCOM does not check the validity of the values you give it.
  4241.  
  4242.        Example:
  4243.  
  4244.                  OPENCOM(2,0,0,3,0)
  4245.  
  4246.        This statement would open COM1 at 300 baud, No parity, 1 Stop bit, 8
  4247.        bit bytesize.
  4248.  
  4249.        Comments:
  4250.  
  4251.             The following tables provide appropriate values for each
  4252.        parameter required by OPENCOM.
  4253.  
  4254.                  (integer1)                        (integer2)
  4255.                  BAUD RATE                          PARITY
  4256.             ------+-----------                 ------+------------
  4257.             VALUE | DESCRIPTION                VALUE | DESCRIPTION
  4258.               0   | 110  baud                    0   | No Parity
  4259.               1   | 150  baud                    1   | Odd Parity
  4260.               2   | 300  baud                    3   | Even Parity
  4261.               3   | 600  baud
  4262.               4   | 1200 baud                      (integer3)
  4263.               5   | 2400 baud                      STOP BITS
  4264.               6   | 4800 baud                  ------+------------
  4265.               7   | 9600 baud                  VALUE | DESCRIPTION
  4266.                                                  0   | One Stop Bit
  4267.                                                  1   | Two Stop Bits
  4268.  
  4269.                  (integer4)                        (integer5)
  4270.                  BYTE SIZE                          COM PORT
  4271.             ------+------------                ------+------------
  4272.             VALUE | DESCRIPTION                VALUE | DESCRIPTION
  4273.               2   | 7 Bits                       0   | Com1
  4274.               3   | 8 Bits                       1   | Com2
  4275.  
  4276.  
  4277.        See also:
  4278.  
  4279.             COMSTAT,RECEIVE,SEND
  4280.  
  4281.  
  4282.  
  4283.  
  4284.                                      Page - 66
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.                                         OUT
  4295.  
  4296.        Format:        OUT (integer1,integer2)
  4297.  
  4298.        Description:
  4299.  
  4300.             This statement writes a byte to a port.  Integer1 should contain
  4301.        the port to write to.  Integer2 should contain an integer value in the
  4302.        range of 0-255 to be written to the port.
  4303.  
  4304.        See also:
  4305.  
  4306.             INP
  4307.  
  4308.  
  4309.  
  4310.                                         PEEK
  4311.  
  4312.        Format:        integer1 = PEEK (integer2)
  4313.  
  4314.        Description:
  4315.  
  4316.             This statement is used to examine actual memory location values
  4317.        directly.  By default, the ASIC DS address is assumed.  However, this
  4318.        may be overridden with the use of the DEFSEG command.  The value of
  4319.        the byte at address integer2 is stored in integer1.
  4320.  
  4321.        See also:
  4322.  
  4323.             DEFSEG, POKE
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.                                      Page - 67
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.                                        POINT
  4359.  
  4360.        Format:        integer1 = POINT (integer2,integer3)
  4361.  
  4362.        Description:
  4363.  
  4364.             This statement is used to determine the color of a given pixel in
  4365.        medium and high resolution graphics modes.  The row to test is
  4366.        specified with integer2, the column with integer3.  The color of the
  4367.        pixel is stored in integer1.
  4368.  
  4369.        Example:
  4370.  
  4371.                  PCOLOR = POINT (10,20)
  4372.  
  4373.        After execution of this statement, PCOLOR will contain the color of
  4374.        the pixel in row 10 column 20.
  4375.  
  4376.        Comments:
  4377.  
  4378.             No range checking is performed on row and column.  If the
  4379.        specified row or column is outside the valid range for the given
  4380.        graphics mode, the results are unpredictable.
  4381.  
  4382.        See also:
  4383.  
  4384.             PSET, PRESET, SCREEN
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.                                      Page - 68
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.                                         POKE
  4423.  
  4424.        Format:        POKE integer1, integer2
  4425.  
  4426.        Description:
  4427.  
  4428.             This instruction is used store the byte value integer2 at the
  4429.        memory address specified by integer1.  By default, ASIC uses it's
  4430.        default data segment address, however, this may be overridden with the
  4431.        DEFSEG statement.
  4432.  
  4433.        Comments:
  4434.  
  4435.             This statement is NOT RECOMMENDED FOR BEGINNERS.  Directly
  4436.        overwriting memory locations can be disastrous, unless you know what
  4437.        is stored at that address.  This can cause program "hangs", system
  4438.        crashes, etc.
  4439.  
  4440.        See also:
  4441.  
  4442.             DEFSEG, PEEK
  4443.  
  4444.  
  4445.  
  4446.                                         POS
  4447.  
  4448.        Format:        integer1 = POS (integer2)
  4449.  
  4450.        Description:
  4451.  
  4452.             This statement finds the column number of the cursor and stores
  4453.        it in integer1.  integer2 is a dummy argument included only because a
  4454.        dummy argument is required in BASICA/GWBASIC.
  4455.  
  4456.        Example:
  4457.  
  4458.                  A = POS(0)
  4459.  
  4460.        After this statement executes, A will contain the column number of the
  4461.        cursor.
  4462.  
  4463.        See also:
  4464.  
  4465.             CSRLIN
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.                                      Page - 69
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.                                        PRESET
  4487.  
  4488.        Format:        PRESET (integer1,integer2)
  4489.  
  4490.        Description:
  4491.  
  4492.             This statement is used to set the color of a pixel to the
  4493.        background color. The row of the pixel is specified in integer1, and
  4494.        the column is specified in integer2.  This statement only works in
  4495.        medium and high resolution graphics modes.
  4496.  
  4497.        Example:
  4498.  
  4499.                  PRESET (10,20)
  4500.  
  4501.        The pixel at row 10 column 20 would be set to the background color.
  4502.  
  4503.        See also:
  4504.  
  4505.             PSET, SCREEN, POINT
  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.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.                                      Page - 70
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.                                        PRINT
  4551.  
  4552.        Format:        PRINT printobject1 [;]
  4553.  
  4554.        Description:
  4555.  
  4556.             This statement is used to print to the screen.  Printing begins
  4557.        at the current cursor location.  Printobject1 is defined as any valid
  4558.        ASIC data type:  integer constant, integer variable, string constant,
  4559.        string variable, and arrays.  The semicolon is optional and is used to
  4560.        tell ASIC if you want a carriage return/line feed issued.  A semicolon
  4561.        at the end of a PRINT statement will suppress the carriage return/line
  4562.        feed ASIC normally issues.
  4563.  
  4564.        Example:
  4565.  
  4566.                  A=1000
  4567.                  PRINT "A=";
  4568.                  PRINT A
  4569.                  PRINT "DONE!"
  4570.  
  4571.        After execution of these statements your screen would display:
  4572.  
  4573.                  A=  1000
  4574.                  DONE!
  4575.  
  4576.  
  4577.        See also:
  4578.  
  4579.             COLOR, SCREEN, LOCATE
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.                                      Page - 71
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.                                        PRINT#
  4615.  
  4616.        Format:        PRINT# constant1, printobject1 [NONULL]
  4617.  
  4618.        Description:
  4619.  
  4620.             This statement is used to write integers and strings to disk.
  4621.        Constant1 identifies the file number that the file was opened as.
  4622.        This must be a constant with a value of 1, 2 or 3.  The file must have
  4623.        been previously opened with the OPEN command.  If printobject1 is a
  4624.        string, you can also add the optional argument "NONULL", which will
  4625.        cause ASIC to suppress the trailing NULL character it would normally
  4626.        write to disk.  DOS errors are returned in the system variable
  4627.        "ERROR".  A list of these error codes may be found in the error
  4628.        messages section of this manual.  Also, refer to the technical details
  4629.        section of this manual for more information on the format in which
  4630.        ASIC writes the data to disk.
  4631.  
  4632.        Example:
  4633.  
  4634.                  PRINT# 1, "HELLO"
  4635.                  IF ERROR = 255 THEN DISKFULL:
  4636.                  PRINT# 1, "WORLD"
  4637.                  IF ERROR = 255 THEN DISKFULL:
  4638.  
  4639.        After successful execution of the print statements the file identified
  4640.        by file number 1 would contain "HELLO0WORLD0" . Note that the "0"
  4641.        following HELLO and WORLD in our example represents the ASCII null
  4642.        character.  Strings in ASIC are always internally terminated with
  4643.        ASCII null characters.  By default, these nulls are also written to
  4644.        disk.
  4645.  
  4646.                  PRINT# 2, "HELLO" NONULL
  4647.  
  4648.        In this example, the string "HELLO" would be written to file #2, and
  4649.        no trailing NULL will be written to disk.
  4650.  
  4651.                  PRINT #3, 1234
  4652.  
  4653.        In this example, the number "1234" would be written to file #3 as two
  4654.        bytes in Intel binary format (the file would contain the two
  4655.        hexadecimal bytes:  D2 04).
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.                                      Page - 72
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.                                  PRINT# (Continued)
  4678.  
  4679.        Comments:
  4680.  
  4681.          Note that while ASIC doesn't generate carriage returns and line
  4682.        feeds for you as it does with the PRINT command, you can write these
  4683.        characters to disk as follows:
  4684.  
  4685.                  A$=CHR$(13)
  4686.                  B$=CHR$(11)
  4687.                  A$ = A$ + B$
  4688.                  PRINT #1, A$
  4689.  
  4690.        You might be wondering what the purpose of the new NONULL option is.
  4691.        ASIC 1.0 always wrote trailing NULL's with strings.  This was
  4692.        necessary, since when ASIC read a string from a file, it assumed that
  4693.        it would be terminated by a NULL.  In general, if you are writing a
  4694.        file to be read by an ASIC program, you should not specify the NONULL
  4695.        option.  In this way, ASIC will be able to correctly read the string.
  4696.  
  4697.        However, sometimes you may want to write a string for use by another
  4698.        program.  In this case, the NULL character sometimes confuses the
  4699.        other program.  Specifying the NONULL option will cause ASIC to
  4700.        suppress the offending NULL character.
  4701.  
  4702.        What happens if you read a string that is terminated by a Carriage
  4703.        Return/Line Feed Sequence (such as GWBASIC/BASICA produces)?  In this
  4704.        instance, specify the NONULL option on the INPUT# statement.  Then
  4705.        ASIC will read the string until it finds a NULL or until it reads 80
  4706.        characters, whichever comes first.  You can find the true end of the
  4707.        string after you INPUT# it, by using the MID$ command to find the
  4708.        Carriage Return character (ASCII value 13).
  4709.  
  4710.  
  4711.        See also:
  4712.  
  4713.                  OPEN, CLOSE, INPUT#
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.                                      Page - 73
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.                                         PSET
  4743.  
  4744.        Format:        PSET (integer1,integer2),integer3
  4745.  
  4746.        Description:
  4747.  
  4748.             This statement is used to set a pixel to a specified color in
  4749.        medium and high resolution graphics modes.  The row is specified in
  4750.        integer1, the column in integer2, and the color in integer3.  Note
  4751.        that no range checking is performed on integer1 or integer2.  A row or
  4752.        column specified outside the range allowed by the graphics mode in use
  4753.        can result in unpredictable results.
  4754.  
  4755.        Example:
  4756.  
  4757.                  PSET (10,20),1
  4758.  
  4759.        In this example the pixel defined at row 10 and column 20 will be set
  4760.        to color 1.
  4761.  
  4762.        See also:
  4763.  
  4764.             PRESET, SCREEN, POINT
  4765.  
  4766.  
  4767.  
  4768.                                      RANDOMIZE
  4769.  
  4770.        Format:        RANDOMIZE
  4771.  
  4772.        Description:
  4773.  
  4774.                  This statement will cause the seed for the random number
  4775.        generator to be reseeded using the system timer.  This statement
  4776.        should always precede the first RND statement in your program, unless
  4777.        you want the same sequence of random numbers generated.
  4778.  
  4779.        See also:
  4780.  
  4781.             RND
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.                                      Page - 74
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.                                         READ
  4807.  
  4808.        Format:        READ variable1
  4809.  
  4810.        Description:
  4811.  
  4812.             This statement reads a constant from DATA statements into a
  4813.        variable.  Variable1 is either a string or integer type variable.
  4814.  
  4815.        Example:
  4816.  
  4817.             DATA 7,"CARGO"
  4818.  
  4819.             READ A
  4820.             READ B$
  4821.  
  4822.        After execution of these statements, "A" will contain 7, and B$ will
  4823.        contain "CARGO".
  4824.  
  4825.        Comments:
  4826.  
  4827.             ASIC does not check to see that the data type on the READ
  4828.        statement matches the data type on the DATA statement.  It is up to
  4829.        the programmer to insure that the types match.  The above example is
  4830.        correct.  The DATA statement contains an integer, then a string.  This
  4831.        is the same sequence in which the DATA is READ (ie, integer, then
  4832.        string).  In the above example, if the read statements were reversed,
  4833.        the contents of A and B$ are undefined.  Also note that ASIC does not
  4834.        check to see that you don't read past the end of the DATA you
  4835.        specified.  In the above example, if you had a third READ statement
  4836.        that contained "READ C$", then C$ would contain random garbage, since
  4837.        you read three values, but only provided data for two.
  4838.  
  4839.        See also:
  4840.  
  4841.             DATA,RESTORE
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.                                      Page - 75
  4861.  
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.                                       RECEIVE
  4871.  
  4872.        Format:        variable1 = RECEIVE(integer2)
  4873.  
  4874.        Description:
  4875.  
  4876.             This statement will read a byte from the specified serial port.
  4877.        Integer2 identifies which port to read (0=COM1, and 1=COM2).  The byte
  4878.        read is stored in variable1 (which may be an integer or string type
  4879.        variable).  Before executing this statement you should first check to
  4880.        see if there is data waiting to be read.  Executing this statement
  4881.        when data is not waiting can cause your PC to "hang" until data is
  4882.        received at the hardware serial port.  The example below illustrates
  4883.        how to determine if data is waiting to be received.
  4884.  
  4885.        Example:
  4886.  
  4887.             OPENCOM(2,0,0,3,0)
  4888.             
  4889.             PORTSTAT = COMSTAT(0)
  4890.             DATAREADY = ZBIT(8,PORTSTAT)
  4891.             IF DATAREADY = 0 THEN NODATAWAITING:
  4892.             A$=RECEIVE(0)
  4893.  
  4894.  
  4895.        These statements do the following.  The first retrieves the status of
  4896.        COM1 to the variable PORTSTAT.  The second checks to see if bit 8 is
  4897.        on, DATAREADY will contain 1 if so, otherwise it will contain 0.
  4898.        Since Bit 8 is used to determine if data is waiting to be received
  4899.        from the port, if DATAREADY NOT = 0 then the program will RECEIVE data
  4900.        from the port to variable "A$".
  4901.  
  4902.        Comments:
  4903.  
  4904.             Variable1 can be either a string or integer type variable.
  4905.        However, if variable1 is a string, bear in mind that you cannot
  4906.        directly receive a NULL (ASCII Code 0), since NULL is used to delimit
  4907.        the end of a string in ASIC.  However, if in the above example data
  4908.        was waiting at the port but A$ contained "" after the receive, you
  4909.        would know that the character received was a NULL.  This is not a
  4910.        problem if variable1 is an integer variable.
  4911.  
  4912.        See also:
  4913.  
  4914.             OPENCOM,SEND,COMSTAT
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.                                      Page - 76
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.                                         REM
  4935.  
  4936.        Format:        REM  free form comments
  4937.  
  4938.        Description:
  4939.  
  4940.             This statement is used to insert comments into your program.
  4941.        Everything following REM is treated by ASIC as a comment.
  4942.  
  4943.  
  4944.  
  4945.                                       RESTORE
  4946.  
  4947.        Format:        RESTORE
  4948.  
  4949.        Description:
  4950.  
  4951.             This statement allows you to READ data from DATA statements after
  4952.        you have already READ it once.
  4953.  
  4954.        Example:
  4955.                  DATA 0
  4956.  
  4957.                  READ A
  4958.                  RESTORE
  4959.                  READ B
  4960.  
  4961.        In this example, "READ A" causes variable "A" to be set to 0.  Now,
  4962.        the DATA statement is "used up".  There is no more data left on it to
  4963.        be read.  The RESTORE resets the DATA so that the next statement "READ
  4964.        B" will result in "B" being set to 0.  If the RESTORE was not done,
  4965.        the contents of B would be undefined.
  4966.  
  4967.        See also:
  4968.  
  4969.             READ, DATA
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.                                      Page - 77
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.                                        RETURN
  4999.  
  5000.        Format:        RETURN
  5001.  
  5002.        Description:
  5003.  
  5004.             Used to return from a GOSUB call.
  5005.  
  5006.        Comments:
  5007.  
  5008.             Executing a RETURN statement without having first executed a
  5009.        GOSUB statement could cause unpredictable results.
  5010.  
  5011.        See also:
  5012.  
  5013.             GOSUB
  5014.  
  5015.  
  5016.  
  5017.                                        RMDIR
  5018.  
  5019.        Format:        RMDIR string1
  5020.  
  5021.        Description:
  5022.  
  5023.             This statement will delete an empty directory from disk.  String1
  5024.        should contain the name of the directory to delete.  If ASIC is unable
  5025.        to delete the directory, it will set the System ERROR variable.  A
  5026.        list of ERROR codes is listed in the Error Messages Chapter.
  5027.  
  5028.        Example:
  5029.  
  5030.                  RMDIR "C:\WORK\TEST"
  5031.                  IF ERROR = 0 THEN SUCCESS:
  5032.  
  5033.        After execution of this code, the directory TEST under directory WORK
  5034.        will be deleted (if it had no files or subdirectories in it, and if it
  5035.        is not the current directory for drive "C").
  5036.  
  5037.        See also:
  5038.  
  5039.             MKDIR,CHDIR
  5040.  
  5041.  
  5042.  
  5043.  
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.                                      Page - 78
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.                                         RND
  5063.  
  5064.        Format:        integer1 = RND (integer2)
  5065.  
  5066.        Description:
  5067.  
  5068.             This statement will return an integer number in the range of 0
  5069.        through 32767 and store it in integer1.  Integer2 is a dummy argument
  5070.        and can be any valid integer value.
  5071.  
  5072.        Example:
  5073.  
  5074.                  A = RND(0)
  5075.  
  5076.        After execution of this statement "A" will contain a number between 0
  5077.        and 32767 inclusive.
  5078.  
  5079.        Comments:
  5080.  
  5081.             In BASICA/GWBASIC, RND always returns a value between 1 and 0,
  5082.        however, since ASIC only operates with integer values, having the
  5083.        random number function only return two values seemed ridiculous.
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.  
  5105.  
  5106.  
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116.                                      Page - 79
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.                                         RUN
  5126.  
  5127.        Format:        RUN string1
  5128.  
  5129.        Description:
  5130.  
  5131.             This function can be used to load and execute other programs
  5132.        compiled with ASIC or another compiler.  String1 represents the name
  5133.        of the program to execute.  If an error occurs when ASIC attempts to
  5134.        RUN the program, it will set the system ERROR variable to 255.
  5135.        Otherwise, the ERROR variable will be set to the value of the return
  5136.        code of the called program (which is 0 unless the called program
  5137.        specifies otherwise).
  5138.  
  5139.        Example:
  5140.  
  5141.             RUN "OTHER.COM"
  5142.  
  5143.        Comments:
  5144.  
  5145.             String1 must contain the FULL pathname of the program
  5146.        (ie,"\directory\progname.COM") only if the program is NOT in the
  5147.        current directory.  You must include the file extension on the file
  5148.        name (for example, use "MYPROG.COM" instead of just "MYPROG", or use
  5149.        "MYPROG.EXE" instead of "MYPROG").
  5150.  
  5151.             At this time, RUN and CALL are functionally equivalent, with one
  5152.        exception.  RUN does not accept program arguments, but CALL does.
  5153.  
  5154.        CAUTION:
  5155.  
  5156.             You may use the debugger with programs which contain "CALL" or
  5157.        "RUN" statements.  However, the programs you call should not
  5158.        themselves contain debugging code.  For example, if A.ASI calls B.ASI,
  5159.        then make sure you compile B.ASI with the "Debugging Code" option OFF
  5160.        before you try to debug program A.ASI.  Failure to do so will cause
  5161.        the debugger to behave erratically.  This also applies to programs you
  5162.        write using other compilers, since they also use the same interrupt
  5163.        that ASIC uses (INT 3) for debugging purposes.
  5164.  
  5165.        See also:
  5166.  
  5167.             CALL
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.  
  5174.  
  5175.  
  5176.  
  5177.  
  5178.  
  5179.  
  5180.                                      Page - 80
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.                                        SCREEN
  5191.  
  5192.        Format:        SCREEN integer1
  5193.  
  5194.        Description:
  5195.  
  5196.             This statement will transfer the computer from text mode to
  5197.        medium and high resolution graphics modes.  integer1 must be an
  5198.        integer constant with a value of 0,1 or 2.  Screen mode 0 is 25 lines
  5199.        by 80 columns text with 16 colors.  Screen mode 1 is medium resolution
  5200.        graphics mode with 25 lines by 40 columns text, or 200 rows by 320
  5201.        columns of pixels with four colors.  Screen mode 2 is high resolution
  5202.        graphics mode with 25 lines by 80 columns of text, or 200 rows by 640
  5203.        columns of pixels with two colors (black and white).
  5204.  
  5205.        Example:
  5206.  
  5207.                  SCREEN 1
  5208.  
  5209.        After execution of this statement, the screen will be in medium
  5210.        resolution graphics mode.
  5211.  
  5212.  
  5213.        Comments:
  5214.  
  5215.             Any program which uses the two graphics modes (1 and 2) should
  5216.        issue a "SCREEN 0" command before terminating.  Otherwise, the screen
  5217.        will be left in 25x40 character graphics mode which is very irritating
  5218.        under DOS.
  5219.  
  5220.        See also:
  5221.  
  5222.             PSET, PRESET, POINT
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.                                      Page - 81
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.                                         SEND
  5255.  
  5256.        Format:        SEND (data1,integer2)
  5257.  
  5258.        Description:
  5259.  
  5260.             This statement is used to send one character to a serial port.
  5261.        The port should initialized with OPENCOM prior to using this
  5262.        statement.  Data1 may be any valid data type (integer or string,
  5263.        variable or constant) and it should contain the character to be sent
  5264.        to the port.  Integer2 identifies which COM port to send to (0=COM1,
  5265.        1=COM2).
  5266.  
  5267.        Example:
  5268.  
  5269.                  OPENCOM(2,0,0,3,0)
  5270.                  SEND ("X",0)
  5271.  
  5272.        The above code will open COM1 at 300baud, 1 stop bit, 8bit character
  5273.        size, with no parity.  It will then send the character "X" to COM1.
  5274.  
  5275.        See also:
  5276.  
  5277.             RECEIVE,COMSTAT,OPENCOM
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.                                      Page - 82
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.                                        SOUND
  5319.  
  5320.        Format:        SOUND integer1,integer2
  5321.  
  5322.        Description:
  5323.  
  5324.             This statement will generate a sound on your computer speaker
  5325.        with a frequency of integer1, and a duration of integer2.  Frequency
  5326.        should be in the range of 0 to 32767.  ASIC, however, only checks to
  5327.        see that it is non-negative.
  5328.  
  5329.        Example:
  5330.  
  5331.                  SOUND  400,20
  5332.  
  5333.        Execution of the above statement will produce a short beep.
  5334.  
  5335.        Comments:
  5336.  
  5337.             ASIC "frequencies" values go from high to low.  That is, a
  5338.        frequency of 0 is the highest, and 32767 is the lowest.
  5339.  
  5340.  
  5341.  
  5342.                                         STR$
  5343.  
  5344.        Format:        string1 = STR$ (integer1)
  5345.  
  5346.        Description:
  5347.  
  5348.             This statement will convert integer1 to a string format and store
  5349.        the string format in string1.
  5350.  
  5351.        Example:
  5352.  
  5353.                  A=1234
  5354.                  A$ = STR$(A)
  5355.  
  5356.        After execution of these statements, A$ would contain the string
  5357.        "1234".
  5358.  
  5359.        See also:
  5360.  
  5361.             VAL
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.  
  5371.  
  5372.                                      Page - 83
  5373.  
  5374.  
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381.  
  5382.                                        TIME$
  5383.  
  5384.        Format:        string1 = TIME$
  5385.  
  5386.        Description:
  5387.  
  5388.             This statement will retrieve the current time from the PC's
  5389.        system clock.  The time will be retrieved and stored in String1, in
  5390.        the format:  "HH.MM.SS".
  5391.  
  5392.        Example:
  5393.  
  5394.             CURTIME$=TIME$
  5395.             PRINT CURTIME$
  5396.  
  5397.        After execution of the above statements the current time (as per the
  5398.        PC's internal clock) will be displayed on the screen.
  5399.  
  5400.        Comments:
  5401.  
  5402.             Note:  if the time printed is wrong, you have probably not set
  5403.        the system clock.  Most older XT's and PC's do not have a battery to
  5404.        preserve the DATE and TIME in the system clock, so you have to set
  5405.        them each time you power up the PC.  Most AT's and newer PC's have a
  5406.        battery backup, so that the date is preserved for you.
  5407.  
  5408.             Unlike GWBASIC/BASICA, you cannot set the system time with TIME$,
  5409.        however, you can set the system time from DOS by typing TIME.
  5410.  
  5411.        See also:
  5412.  
  5413.             DATE$, TIMER
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.  
  5434.  
  5435.  
  5436.                                      Page - 84
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.                                        TIMER
  5447.  
  5448.        Format:        integer1 = TIMER
  5449.  
  5450.        Description:
  5451.  
  5452.             This statement will retrieve a timer count from the PC's hardware
  5453.        circuitry.  The timer count will be placed in integer1.  The timer
  5454.        count is in "clock ticks".  A "clock tick" occurs in the PC
  5455.        approximately 18.2 times per second.  The PC is continually
  5456.        incrementing this clock counter.  This statement can be used to time
  5457.        the duration of events up to a few minutes long.
  5458.  
  5459.        Example:
  5460.  
  5461.             CLS
  5462.             PRINT "PRESS A KEY"
  5463.             STARTCNT=TIMER
  5464.        LOOP:X$=INKEY$
  5465.             IF X$="" THEN LOOP:
  5466.             ENDCNT=TIMER
  5467.             ELAPSED=ENDCNT-STARTCNT
  5468.             ELAPSED=ABS(ELAPSED)
  5469.             ELAPSED=ELAPSED/18
  5470.             PRINT "IT TOOK YOU APPROXIMATELY";
  5471.             PRINT ELAPSED
  5472.             PRINT " SECONDS TO PRESS A KEY"
  5473.             
  5474.  
  5475.        The above code fragment will time how long you wait to press a key in
  5476.        seconds.  You could modify it easily to display in clock ticks, which
  5477.        would provide much more accuracy, if you deleted the statement which
  5478.        divides the ELAPSED count by 18.
  5479.  
  5480.        Comments:
  5481.  
  5482.             Note that it is necessary to use the absolute value of ELAPSED
  5483.        since the clock counts in the following sequence 0-32767, -32768 to
  5484.        -1, and then back to 0.  This is because internally the PC is treating
  5485.        the clock count as an unsigned 16 bit field, but ASIC integers are 2's
  5486.        complement signed 16 bit integers.
  5487.  
  5488.        See also:
  5489.  
  5490.             DATE$,TIME$
  5491.  
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.                                      Page - 85
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.                                         VAL
  5511.  
  5512.        Format:        integer1 = VAL (string1)
  5513.  
  5514.        Description:
  5515.  
  5516.             This statement will attempt to convert string1 into an integer
  5517.        value, and it will store the result in integer1.
  5518.  
  5519.        Example:
  5520.  
  5521.                  A$ = "12345"
  5522.                  A = VAL (A$)
  5523.  
  5524.        After execution of these statements, variable "A" would contain the
  5525.        value 12345.
  5526.  
  5527.  
  5528.        See also:
  5529.  
  5530.             STR$
  5531.  
  5532.  
  5533.  
  5534.                                        VARPTR
  5535.  
  5536.        Format:        integer1 = VARPTR (variable1)
  5537.  
  5538.        Description:
  5539.  
  5540.             This statement will return the address of a variable  variable1
  5541.        and store it in integer1.  This may be used to peek and poke values
  5542.        directly into a variable.
  5543.  
  5544.        Example:
  5545.  
  5546.                  A$ = "XYZ"
  5547.                  B = VARPTR(A$)
  5548.                  C = PEEK (B)
  5549.                  PRINT C
  5550.  
  5551.        After execution of these statements the screen would display the
  5552.        number 88 which is the number for the ASCII character "X".
  5553.  
  5554.        See also:
  5555.  
  5556.             PEEK, POKE
  5557.  
  5558.  
  5559.  
  5560.  
  5561.  
  5562.  
  5563.  
  5564.                                      Page - 86
  5565.  
  5566.  
  5567.  
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.                                        WIDTH
  5575.  
  5576.        Format:        WIDTH integer1
  5577.  
  5578.        Description:
  5579.  
  5580.             This statement will set the screen to 40 column text or 80 column
  5581.        text mode only.  The only two valid values for integer1 are thus 40
  5582.        and 80.  In ASIC, WIDTH 80 is equivalent to executing SCREEN 0.  Also,
  5583.        WIDTH 40 is equivalent to executing SCREEN 1.  If you use WIDTH 40,
  5584.        you should always reset the screen back to WIDTH 80 before terminating
  5585.        your program with END.  Otherwise, your PC will be left in 40 column
  5586.        mode.
  5587.  
  5588.  
  5589.  
  5590.                                         ZBIT
  5591.  
  5592.        Format:        integer1 = ZBIT(integer2,integer3)
  5593.  
  5594.        Description:
  5595.  
  5596.             This statement is used to determine if a single "bit" in an
  5597.        integer variable is set to "1".  Integer2 represents the bit to be
  5598.        tested.  It should be in the range 0 to 15.  Integer3 represents the
  5599.        integer variable or constant to be tested.  The result of the test is
  5600.        returned to integer1.  If the bit was set, integer1 will be set to
  5601.        "1", otherwise, integer1 will be set to "0".
  5602.  
  5603.        Example:
  5604.  
  5605.                  GAMEPORT = INP(513)
  5606.                  TRIGGER = ZBIT(4,GAMEPORT)
  5607.                  IF TRIGGER = 1 THEN TRIGGERPRESSED:
  5608.  
  5609.        In this example, the joystick port is read, and it's status is placed
  5610.        in the variable "GAMEPORT".  The bit which represents the trigger for
  5611.        joystick 1 is then tested using ZBIT.  If the trigger bit is set, then
  5612.        the program would transfer to the label "TRIGGERPRESSED:".  Note that
  5613.        the above code assumes that a game card is present in the computer.
  5614.  
  5615.        Comments:
  5616.  
  5617.             This statement is an extension over GWBASIC/BASICA, although it
  5618.        is possible to perform similar tests in GWBASIC/BASICA with the
  5619.        boolean AND statement.
  5620.  
  5621.  
  5622.  
  5623.  
  5624.  
  5625.  
  5626.  
  5627.  
  5628.                                      Page - 87
  5629.  
  5630.  
  5631.  
  5632.  
  5633.  
  5634.  
  5635.  
  5636.  
  5637.  
  5638.                                        ZMODE
  5639.  
  5640.        Format:        integer = ZMODE
  5641.  
  5642.        Description:
  5643.  
  5644.             This command returns a code which indicates whether a color or
  5645.        monochrome card is active in the system.  ZMODE returns a value of 1
  5646.        when a color card is detected, and a value of 0 for monochrome.
  5647.  
  5648.        Example:
  5649.  
  5650.                  A = ZMODE
  5651.                  IF A = 1 THEN CONTINUE:
  5652.                  PRINT "This program requires a Color Card to Run"
  5653.                  END
  5654.                  CONTINUE: REM rest of code follows here
  5655.  
  5656.        The above code fragment will check for a color card, if not found the
  5657.        program will terminate with an appropriate message.  Otherwise the
  5658.        program will continue.
  5659.  
  5660.        Comments:
  5661.  
  5662.             This statement is an extension over BASICA/GWBASIC.
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.  
  5687.  
  5688.  
  5689.  
  5690.  
  5691.  
  5692.                                      Page - 88
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.                                       A S I C
  5703.  
  5704.                                      Chapter 8
  5705.  
  5706.                          Compatibility with GWBASIC/BASICA
  5707.  
  5708.  
  5709.        In general, although ASIC does not support all options on every BASIC
  5710.        statement, those it does support work like they do in BASICA/GWBASIC.
  5711.        The known exceptions are listed in this chapter.
  5712.  
  5713.  
  5714.  
  5715.        INKEY$
  5716.  
  5717.             This statement is compatible, however ASIC does provide an
  5718.        extension over GWBASIC/BASICA.  If an extended key is pressed (e.g.
  5719.        F1-F10), ASIC returns the scan code for the extended key, and sets a
  5720.        special system variable "EXTENDED" to a value of 1.  For non-extended
  5721.        keys, the "EXTENDED" variable will contain 0.
  5722.  
  5723.  
  5724.        FILE HANDLING
  5725.  
  5726.             ASIC provides no EOF statement or ON ERROR statements.  Instead,
  5727.        ASIC sets a special system variable when an error occurs during file
  5728.        I/O.  This special variable is called "ERROR" and it is set after
  5729.        every file I/O statement (OPEN/INPUT#/PRINT#/CLOSE, etc) to either 0
  5730.        to indicate no errors, or a non-zero value.  If a non-zero value is
  5731.        present, an error has occurred.  The specific errors are identified in
  5732.        chapter 10.
  5733.  
  5734.  
  5735.        FILE FORMAT
  5736.  
  5737.             ASIC Files are written with 2 bytes per integer in binary format,
  5738.        instead of string format as in BASICA/GWBASIC.  Strings are written as
  5739.        a sequence of ASCII characters terminated by an ASCII null, or
  5740.        optionally with no NULL terminator.
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.                                      Page - 89
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.        PUNCTUATION
  5766.  
  5767.             ASIC permits use of punctuation that it does not require to allow
  5768.        you to enter statements in their familiar GWBASIC/BASICA Formats.  For
  5769.        example:
  5770.  
  5771.                  A = ABS (B(1))
  5772.  
  5773.             This statement is valid in both ASIC and in GWBASIC/BASICA.
  5774.        However, ASIC ignores the parenthesis and comma.  Thus ASIC will
  5775.        actually accept the following formats as alternatives to the above:
  5776.  
  5777.             A = ABS B 1
  5778.             A = ABS B 1,,,,,,)))))
  5779.  
  5780.  
  5781.        FOR/NEXT
  5782.  
  5783.             FOR/NEXT loops always fall through the body of the FOR at least
  5784.        one time in ASIC.  This does not happen in BASICA/GWBASIC.  For more
  5785.        information on this, refer to Chapter 7.
  5786.  
  5787.  
  5788.        RND
  5789.  
  5790.             RND (N) returns a value from 0-32767 inclusive instead of 0 to 1
  5791.        as in BASICA/GWBASIC.
  5792.  
  5793.  
  5794.        LOCATE/CSRLIN/POS
  5795.  
  5796.             Coordinates are specified in range 0-24 and 0-79 instead of 1-25
  5797.        and 1-80.
  5798.  
  5799.  
  5800.        PSET/PRESET/POINT
  5801.  
  5802.             Coordinates are specified in row/column order instead of
  5803.        column/row order.
  5804.  
  5805.  
  5806.        ZMODE
  5807.  
  5808.             ZMODE is an extension over BASICA/GWBASIC.  It returns a code
  5809.        which the program can check to determine if the PC contains a color or
  5810.        monochrome display adapter card.
  5811.  
  5812.  
  5813.        COMMAND$
  5814.  
  5815.             COMMAND$ is an extension over BASICA/GWBASIC.  It returns the
  5816.        command line arguments.
  5817.  
  5818.  
  5819.  
  5820.                                      Page - 90
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.        BLOAD/BSAVE
  5829.  
  5830.             File formats are not compatible with GWBASIC/BASICA.  BLOAD
  5831.        requires offset and the number of bytes to read.
  5832.  
  5833.        OPENCOM/COMSTAT/SEND/RECEIVE
  5834.  
  5835.             These statements provide serial port support in ASIC.  In
  5836.        GWBASIC/BASICA this is provided by OPEN/INPUT#/PRINT#.
  5837.  
  5838.        DATE$/TIME$
  5839.  
  5840.             ASIC allows you to retrieve the system date and time, but will
  5841.        not allow you to set new system date/time values.
  5842.  
  5843.        CALL/RUN
  5844.  
  5845.             These statements perform functions similar to their
  5846.        GWBASIC/BASICA counterparts, but function differently.  Refer to the
  5847.        keyword reference for the appropriate keyword for details on their
  5848.        operation.
  5849.  
  5850.        TIMER
  5851.  
  5852.             Since ASIC only supports integer variables, only the lowest 16
  5853.        bits of the system clock timer is returned.  This is in clock ticks.
  5854.        There are approximately 18.2 clock ticks per second.
  5855.  
  5856.        ZBIT
  5857.  
  5858.             This is an extension over BASICA/GWBASIC.  It has similarities to
  5859.        the logical AND in GWBASIC/BASICA.
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.  
  5884.                                      Page - 91
  5885.  
  5886.  
  5887.  
  5888.  
  5889.  
  5890.  
  5891.  
  5892.  
  5893.  
  5894.                                       A S I C
  5895.  
  5896.                                      Chapter 9
  5897.  
  5898.                                Technical Details/Tips
  5899.  
  5900.  
  5901.        This chapter contains technical information and tips regarding ASIC.
  5902.  
  5903.  
  5904.  
  5905.                                   COMPILER LIMITS
  5906.  
  5907.  
  5908.        Maximum Source Program Size:   Unlimited - Command Line
  5909.                                       809 Lines - Integrated Environment
  5910.  
  5911.        Maximum Object Program Size:   64k bytes  (.COM Format restriction)
  5912.  
  5913.        Maximum Source Line Length     128 bytes - Command Line
  5914.                                       80 bytes - Integrated Environment
  5915.  
  5916.        Compiler Symbol Table Size:    750+ Symbols
  5917.  
  5918.        Maximum Number of Arrays:      25
  5919.  
  5920.        FOR/NEXT Nesting Depth         25
  5921.  
  5922.        Compiler Memory Requirements   300k - Command Line
  5923.                                       400k - Integrated Environment
  5924.  
  5925.  
  5926.                                  COMPILER OPERATION
  5927.  
  5928.  
  5929.             ASIC is a single pass compiler written entirely in C (Borland
  5930.        Turbo C Version 2.0).  Each source statement is translated directly
  5931.        into machine code.  ASIC compiles 100% in memory for maximum speed.
  5932.        The compiler does not require any disk work space.  ASIC generates a
  5933.        minimum of error checking code.  This is because the ASIC philosophy
  5934.        stresses execution speed.  This does place greater responsibility on
  5935.        the programmer to check for out of bounds conditions, etc..
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.  
  5947.  
  5948.                                      Page - 92
  5949.  
  5950.  
  5951.  
  5952.  
  5953.  
  5954.  
  5955.  
  5956.  
  5957.                                   DEBUGGER LIMITS
  5958.  
  5959.  
  5960.        Maximum Concurrent Breakpoints 20
  5961.  
  5962.        Maximum Concurrent Watches     10
  5963.  
  5964.        Maximum Symbol Length          30 Characters
  5965.  
  5966.        Maximum Symbols                Same as Compiler
  5967.  
  5968.        Maximum Source Statements      809 Lines
  5969.  
  5970.  
  5971.                                  DEBUGGER OPERATION
  5972.  
  5973.             When you select the "Debugging code" compiler option, the ASIC
  5974.        compiler inserts additional machine language instructions into your
  5975.        program.  It inserts a single statement at the beginning of your
  5976.        program (specifically, INT 3) which allows it to gain control.  When
  5977.        the ASIC editor is loaded, it saves the existing INT 3 vector, and
  5978.        installs the ASIC Debugger as INT 3.  In this way, when your program
  5979.        begins executing, the INT 3 statement that ASIC inserted in your
  5980.        program causes a transfer of control to the debugger.  Once the
  5981.        debugger gains control, it can set or remove additional breakpoints as
  5982.        needed in your program, plus provide access to the video memory and
  5983.        variable memory locations with the Swap, Watch, Unwatch, and Modify
  5984.        Commands.  When you exit the ASIC editor, ASIC deinstalls the debugger
  5985.        from INT 3, and restores the original interrupt 3 vector.
  5986.  
  5987.             The compiler also creates a file with a ".DBG" extension which
  5988.        contains the symbolic information needed by the debugger (ie, variable
  5989.        names and offsets, and source statement offsets).
  5990.  
  5991.  
  5992.                                  DEBUGGER OVERHEAD
  5993.  
  5994.             Running a program in debugging mode adds a small amount of
  5995.        overhead to your program (both compiled code size, and execution
  5996.        speed).  Specifically, the size of the debugging code will be
  5997.        (approximately):
  5998.  
  5999.                  CodeSizeIncrease = 1 + LinesOfSourceCode
  6000.  
  6001.        Note that the actual increase will usually be less than the above,
  6002.        since DIM, DATA, REM, and blank source lines do not require debugging
  6003.        code.  The reduction in execution speed is very slight in most cases
  6004.        (for you assembly language programmers out there, a single NOP
  6005.        instruction is executed for each source line).
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.                                      Page - 93
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.                                   STORAGE FORMATS
  6023.  
  6024.  
  6025.        Integers are stored in ASIC as two bytes, with the low order byte
  6026.        appearing first (as per Intel conventions).  String variables are
  6027.        stored as FIXED 80 character strings terminated by an ASCII null
  6028.        character for a total length of 81 characters.  String constants are
  6029.        stored with 1 byte per character in the string followed by a
  6030.        terminating ASCII null character.  Each element in an array requires
  6031.        two bytes.  (Don't forget arrays have an element zero (ie  DIM A(2) is
  6032.        comprised of A(0), A(1), and A(2)).
  6033.  
  6034.        Examples:
  6035.  
  6036.                  Item        Data Type              Storage Requirements
  6037.                    A         Integer Variable            2 bytes
  6038.                    17        Integer Constant            2 bytes
  6039.                   A$         String Variable             81 bytes
  6040.                   "ABC"      String Constant             4 bytes
  6041.                   "A"        String Constant             2 bytes
  6042.                  DIM A(10)   Integer Array               22 bytes
  6043.                  DIM A(1)    Integer Array               4 bytes
  6044.  
  6045.        As you can see, string variables are expensive in terms of storage
  6046.        space.  Since string constants are stored at actual length +1, It is
  6047.        MUCH more efficient to store short strings as constants in ASIC in
  6048.        terms of storage space.  There is no performance advantage to
  6049.        constants over variables, however.
  6050.  
  6051.        In disk files, strings and integers are written out in the above
  6052.        formats.  Note that unlike GWBASIC/BASICA, integers are NOT expanded
  6053.        into strings when written, and conversely, not converted from strings
  6054.        to integers when read.  String variables and constants are written out
  6055.        as ASCII strings terminated by a null character (however, the null can
  6056.        be suppressed).  Thus, string variables when written to disk, take the
  6057.        same space byte for byte as string constants.
  6058.  
  6059.        The reason behind fixed length string variables was avoidance of
  6060.        string "garbage collection".  In addition to slight performance
  6061.        advantages, there is the added benefit of providing a string memory
  6062.        address which never changes.  Thus once VARPTR retrieves the address
  6063.        of a variable, you never have to worry about it changing.
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.                                      Page - 94
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.  
  6085.  
  6086.                                      MEMORY MAP
  6087.  
  6088.        The following describes the structure of the ".COM" file created by
  6089.        ASIC.  All addresses are in Hexadecimal.
  6090.  
  6091.  
  6092.  
  6093.             Description                   Address Range
  6094.        ------------------------------     -------------
  6095.        Program Segment Prefix (PSP)       0000 - 00FF
  6096.         (Created/Required by DOS)
  6097.  
  6098.        Transfer to Program Code           0100 - 0102
  6099.        String Conversion Buffer           0103 - 0109
  6100.        Input Buffer                       010A - 015B
  6101.        Screen Width                       015C
  6102.        Color/Attribute Byte               015D
  6103.        Screen Graphics Mode               015E
  6104.        Cursor Position                    015F - 0160
  6105.        File Control Table                 0161 - 0169
  6106.        ERROR System Variable              016A - 016B
  6107.        System Subroutine Vectors          016C - 017F
  6108.        EXTENDED System Variable           0180 - 0181
  6109.        RND Seed                           0182 - 0185
  6110.        Math Work Area                     0186 - 018D
  6111.        DEFSEG System Variable             018E - 018F
  6112.        Start DATA Block Pointer           0190 - 0191
  6113.        Current DATA Block Pointer         0192 - 0193
  6114.        Reserved for future use            0194 - 0195
  6115.        System Subroutines                 0196+
  6116.                  |
  6117.                  |
  6118.                  v
  6119.        Data Segment                       Address Varies
  6120.                  |
  6121.                  |
  6122.                  |
  6123.                  v
  6124.        Code Segment                       Address Varies
  6125.                  |
  6126.                  |
  6127.                  |
  6128.                  v
  6129.                  ^
  6130.                  |
  6131.                  |
  6132.        Program Stack  (builds downward)   FFFF
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.                                      Page - 95
  6141.  
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.                                       A S I C
  6151.  
  6152.                                      Chapter 10
  6153.  
  6154.                                    Error Messages
  6155.  
  6156.  
  6157.        This chapter contains compiler messages, run-time error messages, and
  6158.        File I/O Error Codes.
  6159.  
  6160.  
  6161.  
  6162.                                   COMPILER ERRORS
  6163.  
  6164.  
  6165.  
  6166.             These messages indicate errors in your source program.  Those
  6167.        which begin with "** E" indicate "fatal" errors, which prevent ASIC
  6168.        from successfully compiling your program.  Warnings begin with "* W"
  6169.        and indicate possible errors and informative messages which will not
  6170.        prevent ASIC from generating an executable ".COM" file.
  6171.  
  6172.  
  6173.  
  6174.        ** E001 **  File Extensions must be either ".ASI" or omitted
  6175.  
  6176.             ASIC requires source programs to have the extension ".ASI".
  6177.        Rename your source file with the DOS "RENAME" command to the name
  6178.        "file.ASI", where "file" is your source program name.  Then resubmit
  6179.        the compile.
  6180.  
  6181.  
  6182.  
  6183.        ** E002 ** File Name specified is too long
  6184.  
  6185.             The source file may be identified by a file name up to 124
  6186.        characters long including disk drive specifiers and sub directory
  6187.        names.  Move the source program to a directory which may be specified
  6188.        within this length.
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.                                      Page - 96
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.        ** E003 ** Error Opening File:  xxxxxxxx.xxx
  6215.  
  6216.             The file indicated by "xxxxxxxx.xxx" could not be opened by ASIC.
  6217.        This error can be issued when ASIC attempts to read your source file,
  6218.        or when it writes any one of the possible output files (".COM",
  6219.        ".LST", or ".SYM").  If indicated file is your source program name,
  6220.        verify the spelling, and either make sure it is in the same directory
  6221.        as ASIC, or specify the full path name for the file.  If the indicated
  6222.        file is an output file, the error is usually a result of a write
  6223.        protect tab on the diskette or insufficient disk space.
  6224.  
  6225.  
  6226.  
  6227.        ** E004 ** DIM Statements must precede all others
  6228.  
  6229.             In ASIC, DIM statements must appear before all other statement
  6230.        types, including REMarks.  Move all of your DIM statements to the very
  6231.        beginning of your source file.
  6232.  
  6233.  
  6234.  
  6235.        ** E005 ** Too many characters in source line
  6236.  
  6237.             Source program lines in ASIC are limited to 120 characters.
  6238.        Change the indicated source line, so that it fits within this limit.
  6239.  
  6240.  
  6241.  
  6242.        ** E006 ** Unmatched Quote ('"') in source line
  6243.  
  6244.             A string constant was found with either no opening or closing
  6245.        quote mark.  Quotation marks must be matched in pairs within source
  6246.        lines.
  6247.  
  6248.  
  6249.  
  6250.        ** E007 ** Token in source line > 82 characters long
  6251.  
  6252.             Individual tokens in ASIC are limited to 82 characters in length,
  6253.        regardless of type.  A token is a group of letters and/or numbers
  6254.        delimited on either side by a space or math symbol.  Example, even
  6255.        though string constants are limited to 80 characters, ASIC considers
  6256.        the "token" to include the quotation marks.  In this case, however,
  6257.        ASIC detected a token longer than the longest possible token, the
  6258.        string constant.  Check for "tokens" or "words" more than 82
  6259.        characters long in the indicated source line.
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.                                      Page - 97
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.        ** E008 ** More than 30 tokens in source line
  6279.  
  6280.             Since all ASIC statements require less than 30 tokens, ASIC will
  6281.        flag any statement which contains more than this number.  A token is a
  6282.        group of letters and/or numbers delimited on either side by a space or
  6283.        math symbol.
  6284.  
  6285.  
  6286.  
  6287.        ** E009 ** Keyword Unknown:  xxxxxxxxx
  6288.  
  6289.             ASIC detected the symbol indicated by "xxxxxxxx" in your source
  6290.        line, but it was not a valid variable name, constant, label, or ASIC
  6291.        Function Name.
  6292.  
  6293.  
  6294.  
  6295.        ** E010 ** Symbol Table Space Exhausted
  6296.  
  6297.             The symbol table is used by ASIC to keep track of your variables,
  6298.        constants and labels.  It is also used to hold information used in
  6299.        FOR/NEXT processing, and internal system subroutine generation.
  6300.        Reduce the number of LABELS, VARIABLE NAMES, or CONSTANTS in your
  6301.        program, and recompile.
  6302.  
  6303.  
  6304.  
  6305.        ** E011 ** Symbol Incomplete Reference Space Exhausted
  6306.  
  6307.             This table is a sister table to the Symbol Table, it contains
  6308.        references to LABEL type symbols which have been defined in the symbol
  6309.        table.  Try to reduce the number of references made to LABEL symbols
  6310.        within the program and recompile.
  6311.  
  6312.  
  6313.  
  6314.        ** E012 ** No keywords in source line
  6315.  
  6316.             Every ASIC source program line must contain an ASIC keyword (eg.
  6317.        "PRINT", "=", "GOSUB", etc).
  6318.  
  6319.  
  6320.  
  6321.        ** E013 ** Syntax Error
  6322.  
  6323.             The "catch-all" error for ASIC.  This error is usually issued
  6324.        when ASIC has identified an error in the parameters for an ASIC
  6325.        keyword.  The best way to find this error is to refer to the entry in
  6326.        the Keyword Reference (chapter 7) for that particular keyword.
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.                                      Page - 98
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.        ** E014 ** Undefined Symbol:  xxxxxx
  6343.  
  6344.             ASIC detected a LABEL "xxxxxx" which was referenced, but never
  6345.        defined in the program.  A label is considered to be defined when it
  6346.        is the first token on the source line.  A reference to a label occurs
  6347.        when a label name appears elsewhere in the source statement
  6348.  
  6349.             Example:           PRINTIT:   PRINT "hello"      <---Defined
  6350.                                GOTO PRINTIT:                 <--Referenced
  6351.  
  6352.  
  6353.  
  6354.        ** E015 ** Compiled Code Exceeds 64k-Can't fit in .COM file
  6355.  
  6356.             Your source program is too large to fit in the .COM file format.
  6357.        Eliminate extraneous variables and program statements.  Note:  REM
  6358.        statements do NOT generate any output code, so elimination of REM
  6359.        statements will not alleviate this problem.
  6360.  
  6361.  
  6362.  
  6363.        ** E016 ** Integer Constant Not in range +32767 to -32767
  6364.  
  6365.             The above range of numbers is the maximum which can be contained
  6366.        in integer format in ASIC.  Reduce the constant so that it falls
  6367.        within the specified range.
  6368.  
  6369.  
  6370.  
  6371.        ** E017 ** Duplicate Label:    xxxxxx
  6372.  
  6373.             The indicated label "xxxxxx" was defined more than once in the
  6374.        program.  Reduce the multiple definitions to a single definition and
  6375.        then recompile.
  6376.  
  6377.  
  6378.  
  6379.        ** E018 ** Second FOR defined for variable with no intervening NEXT
  6380.  
  6381.             FOR/NEXT Statements cannot be nested with the same variable name.
  6382.  
  6383.                  VALID                              INVALID
  6384.  
  6385.                  FOR I=1 TO 10                      FOR I=1 TO 10
  6386.                       FOR J=1 TO 20                      FOR I=1 TO 20
  6387.                       NEXT J                             NEXT I
  6388.                  NEXT I                             NEXT I
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.                                      Page - 99
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.        ** E019 ** For/Next Table Space Exhausted
  6407.  
  6408.             An unlimited of FOR/NEXT statements can exist, however, they can
  6409.        be "nested" to a maximum depth of 25.
  6410.  
  6411.  
  6412.  
  6413.        ** E020 ** NEXT without FOR
  6414.  
  6415.             A NEXT statement was found, however it was not preceded in the
  6416.        source program with a matching FOR statement.
  6417.  
  6418.  
  6419.  
  6420.        ** E021 ** FOR without NEXT at Source Line NNNNN
  6421.  
  6422.             The indicated source line NNNNN contains a FOR statement, for
  6423.        which no NEXT statement was ever found.
  6424.  
  6425.  
  6426.  
  6427.        ** E022 ** Invalid Option:  x
  6428.  
  6429.             An invalid compile option was specified.  Review Chapter 5 for a
  6430.        list of valid compile options.
  6431.  
  6432.  
  6433.  
  6434.        ** E023 ** More than 63000 bytes in Data Segment
  6435.  
  6436.  
  6437.             An ASIC program can be up to 64k bytes in size.  Of this total,
  6438.        63000 bytes can contain program variables and constants, leaving at
  6439.        least 1k for program code.  Reduce the number of variables and
  6440.        constants in your program.
  6441.  
  6442.  
  6443.  
  6444.        ** E024 ** Too many arrays defined
  6445.  
  6446.             A single ASIC source program can contain up to 25 arrays.
  6447.  
  6448.  
  6449.  
  6450.        ** E025 ** Re-DIMension of previously DIMensioned variable
  6451.  
  6452.             Only one DIM statement can be specified per array name.
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.                                      Page - 100
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.        ** E026 ** Invalid subscript on Array
  6471.  
  6472.             A subscript was found which is not valid.  Either ASIC expected
  6473.        more or less subscripts than were present, or ASIC detected a
  6474.        subscript which was itself an array.  Subscripts on arrays may only be
  6475.        non-array variables and/or integer constants.
  6476.  
  6477.  
  6478.  
  6479.        ** E027 ** String Arrays Are Not Supported
  6480.  
  6481.             A DIM statement specified a string variable type.  Only integer
  6482.        arrays are supported.
  6483.  
  6484.  
  6485.  
  6486.        ** E028 ** Comfile Buffer - Memory Allocation Failed
  6487.  
  6488.             ASIC attempted to allocate memory for an internal buffer .  This
  6489.        memory allocation failed.  More memory is required.  If you have any
  6490.        TSR's loaded in memory, remove them and try again.
  6491.  
  6492.  
  6493.  
  6494.        ** E029 ** Codeseg Buffer - Memory Allocation Failed.
  6495.  
  6496.             ASIC attempted to allocate memory for an internal buffer.  This
  6497.        memory allocation failed.  More memory is required.  If you have any
  6498.        TSR's are loaded in memory, remove them and try again.
  6499.  
  6500.  
  6501.  
  6502.        ** E030 ** Code Segment Memory Exhausted
  6503.  
  6504.             ASIC will attempt to allocate 64k of memory to use a work space
  6505.        to hold the code generated by your program statements.  This message
  6506.        indicates that the amount of memory it was able to allocate was not
  6507.        sufficient to hold the code generated by the program you are trying to
  6508.        compile.
  6509.  
  6510.  
  6511.        ** E031 ** Data Segment Memory Exhausted
  6512.  
  6513.             ASIC will attempt to allocate 64k of memory to use a work space
  6514.        to hold the data segment for your program.  This message indicates
  6515.        that the amount of memory it was able to allocate was not sufficient
  6516.        to hold the data generated by the program you are trying to compile.
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.                                      Page - 101
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.        ** E032 ** Insufficient Memory to Run ASIC
  6535.  
  6536.             You don't have enough memory to run ASIC.  If you have any TSR's
  6537.        loaded, try removing them and re-compiling.
  6538.  
  6539.  
  6540.  
  6541.        ** E033 ** Edit Buffer Memory Allocation Failed
  6542.  
  6543.             ASIC attempted to allocate memory for the edit buffer in the
  6544.        integrated environment, but was unable to.  If you have any TSR's
  6545.        loaded, remove them from memory, and try again.
  6546.  
  6547.  
  6548.  
  6549.        ** E034 ** DATA Statements Must Precede All Except DIM's
  6550.  
  6551.             If you wish to use the DATA statement in ASIC, you must place
  6552.        them all at the beginning of your program following any DIM
  6553.        statements.  If you are not using any DIM statements, then the DATA
  6554.        statements should be the at the very beginning of the program.
  6555.  
  6556.  
  6557.  
  6558.        * W001 * Last Statement Not END -- END supplied
  6559.  
  6560.             Warning only.  Asic expects the last statement of a program to be
  6561.        an END statement.  If it does not find one, it generates one for you.
  6562.  
  6563.  
  6564.  
  6565.        * W002 * Printer Not Ready - 'P' Option Ignored
  6566.  
  6567.             You selected the "Printer" option, but ASIC was not able to
  6568.        access the printer.  Make sure the printer is online before compiling
  6569.        with the 'P' option.
  6570.  
  6571.  
  6572.  
  6573.        * W004 * Edit Buffer Full--File Truncated
  6574.  
  6575.             While loading a file, the edit buffer filled before ASIC reached
  6576.        end-of-file.  The file is truncated in memory.  IF YOU SAVE THE FILE
  6577.        AFTER RECEIVING THIS MESSAGE, PART OF THE FILE WILL BE LOST ON DISK.
  6578.        IT IS RECOMMENDED THAT YOU EITHER EXIT ASIC IMMEDIATELY, OR THAT YOU
  6579.        SAVE THE TRUNCATED FILE UNDER A NEW NAME SO THAT THE ORIGINAL FILE IS
  6580.        NOT DAMAGED.
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.                                      Page - 102
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.        * W005 *  Edit Buffer Full
  6599.  
  6600.             ASIC issues this message when the edit buffer is full and you
  6601.        attempt to insert a line.  Delete some unnecessary source lines to
  6602.        create space in the edit buffer.
  6603.  
  6604.  
  6605.  
  6606.        * W006 * Source/Dest of Block Copy/Move May Not Overlap
  6607.  
  6608.             You attempted to move or copy a block of lines to a destination
  6609.        line which was within the source block of lines.  Execution of this
  6610.        block move/copy would result in an endless series of copies or moves.
  6611.        Move the cursor outside of the highlighted block of lines, and try
  6612.        again.
  6613.  
  6614.  
  6615.  
  6616.        * W007 * Source Program Modified.  Recompile? (Y/N)
  6617.  
  6618.             You selected the RUN or TRACE option of ASIC.  ASIC has noticed
  6619.        that you have modified the source.  You should answer "Y" here to
  6620.        cause ASIC to recompile your program before running it.  If you
  6621.        instead answer "N", ASIC will execute the existing copy of the
  6622.        compiled program, which will not contain your latest changes.
  6623.  
  6624.  
  6625.  
  6626.        * W009 * File has been modified.  Save File Now? (Y/N)
  6627.  
  6628.             You have told ASIC to exit back to DOS, but the edit buffer has
  6629.        been modified.  You should answer "Y" so that ASIC will save your
  6630.        changes back to disk.  If you answer "N" here, any changes you have
  6631.        made to your program since the last SAVE command will be lost.
  6632.  
  6633.  
  6634.  
  6635.        * W010 * Too Much Debugging Info-Truncating
  6636.  
  6637.             ASIC could not handle all of the debugging information it found.
  6638.        This error should not occur.
  6639.  
  6640.  
  6641.  
  6642.  
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649.  
  6650.  
  6651.  
  6652.                                      Page - 103
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.        * W011 * Variable Not Found
  6661.  
  6662.             During the processing of a Watch, Unwatch, or Modify Command, you
  6663.        specified a variable name which ASIC could not find in the debugging
  6664.        information.  Checking your spelling for possible errors.  Also,
  6665.        verify that you have compiled your program with the Debugging compiler
  6666.        option turned ON.
  6667.  
  6668.  
  6669.  
  6670.        * W012 * Maximum Number of Variables Are Being Watched
  6671.  
  6672.             You are already "watching" the maximum number of variables that
  6673.        this version of ASIC supports.  "Unwatch" one of the variables in the
  6674.        watch window.  This will allow you to "Watch" a new one.
  6675.  
  6676.  
  6677.  
  6678.        * W013 * There Are No Variables Being Watched
  6679.  
  6680.             You selected the "Unwatch" command.  However, there are no
  6681.        variables in the watch window to "Unwatch".  Before this command may
  6682.        be used, you must first have added a variable to the Watch window
  6683.        using the "Watch variable" command.
  6684.  
  6685.  
  6686.  
  6687.        * W014 * Unable to Load/Run Program
  6688.  
  6689.             When ASIC attempted to load and run either the compiler or your
  6690.        program it detected an error.  This is due to one of two reasons.
  6691.        First, ASIC could not find the program on disk.  If compiling, make
  6692.        sure that the ASICC.EXE file is in the same directory as the ASIC.EXE
  6693.        file, and make that directory current.  The second reason that you
  6694.        might get this error is that there may be insufficient memory
  6695.        available on your PC.  In this case, you either need to free up more
  6696.        memory (by removing TSR's, etc), or you could execute your program or
  6697.        the compiler from the DOS command line.  For more information on
  6698.        compiling from the command line, see Chapter 5--Stand-alone Compiler
  6699.        Options.
  6700.  
  6701.  
  6702.  
  6703.        * W015 * Can't Set Breakpoint There--No Code Generated For That Source
  6704.                 Line
  6705.  
  6706.             You attempted to set a breakpoint and either 1) You haven't
  6707.        compiled with the Debugging Compiler Option turned on, or 2)  You have
  6708.        tried to set a breakpoint on a line which did not generate any object
  6709.        code.  Thus, breakpoints cannot be set on REM or DATA statements, for
  6710.        example.  If you are sure that you have compiled with the above option
  6711.        turned on, then try setting the breakpoint on another nearby
  6712.        statement.
  6713.  
  6714.  
  6715.  
  6716.                                      Page - 104
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.        * W018 * Your Program Must Be Running To Use This Function
  6727.  
  6728.             You selected a function which is only operable when you are
  6729.        running a program (which was compiled with the debugging compiler
  6730.        option turned on).  After your program terminates, this function is
  6731.        not available.
  6732.  
  6733.  
  6734.  
  6735.        * W019 * Function Unavailable Until You Terminate Your Program
  6736.  
  6737.             You selected a function while your program was running in
  6738.        debugging mode.  Before you can execute this function you must either
  6739.        Abort your program, or allow it to Run until normal termination.  Both
  6740.        the Run and the Abort Options are available on the "Run" Menu.
  6741.  
  6742.  
  6743.  
  6744.        * W020 * Invalid Debug (.DBG) File Format
  6745.  
  6746.             ASIC attempted to access the symbolic debugging information file
  6747.        created by the compiler for your program.  It was able to locate the
  6748.        file, but detected an error in the format while reading it.  Make sure
  6749.        that the version number of both the ASIC Integrated Editor and the
  6750.        ASIC Compiler are the same.  The version number is displayed on the
  6751.        top line of the editor screen, following the word "ASIC".  It is also
  6752.        displayed on the compiler status screen while a compile is executing.
  6753.  
  6754.  
  6755.  
  6756.        * W021 * Maximum Number of Breakpoints Already Set
  6757.  
  6758.             You have attempted to set another breakpoint, but the maximum
  6759.        number that this version of ASIC can support are already in use.
  6760.        Remove one of the existing breakpoints you have set.  This will free
  6761.        one up for your use elsewhere.
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.                                      Page - 105
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.                                   RUN TIME ERRORS
  6788.  
  6789.  
  6790.  
  6791.        Divide Overflow
  6792.  
  6793.  
  6794.             This message indicates that your program attempted to divide by
  6795.        zero.
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.  
  6810.  
  6811.  
  6812.  
  6813.  
  6814.  
  6815.  
  6816.  
  6817.  
  6818.  
  6819.  
  6820.  
  6821.  
  6822.  
  6823.  
  6824.  
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.                                      Page - 106
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.                               SYSTEM ERROR CODE VALUES
  6852.  
  6853.  
  6854.        After most commands which access the disk, ASIC sets a special "ERROR"
  6855.        variable to indicate success or failure of that command.  After you
  6856.        execute one of these commands, you can reference this variable as a
  6857.        regular variable in your program, to determine the outcome of the
  6858.        command(eg. "IF ERROR = 000 THEN OKAY:").
  6859.  
  6860.  
  6861.        ERROR Codes Set by BLOAD
  6862.  
  6863.        000       No Error
  6864.        002       File Not Found
  6865.        003       Path Not Found or File Doesn't Exist
  6866.        004       File Not Found
  6867.        005       File Access Denied
  6868.        006-255   Read Past End of File
  6869.  
  6870.        ERROR Codes Set by BSAVE
  6871.  
  6872.        000       No Error
  6873.        002       File Not Found
  6874.        004       File Not Found
  6875.        005       File Access Denied
  6876.        006-255   Disk Full
  6877.  
  6878.        ERROR Codes Set by CALL
  6879.  
  6880.        000-254   Return Code from Program (Zero If Not Set by User Program)
  6881.        255       Error Loading/Running Program
  6882.  
  6883.        ERROR Codes Set by CHDIR
  6884.  
  6885.        000       No Error
  6886.        003       Path Not Found
  6887.  
  6888.        ERROR Codes Set by CLOSE
  6889.  
  6890.        000       No Error
  6891.        006       Invalid Handle
  6892.        095       Cannot Close File -- File is not Open
  6893.  
  6894.        ERROR Codes Set by INPUT#
  6895.  
  6896.        000       No Error
  6897.        005       Read Access Denied
  6898.        006       Invalid File Handle
  6899.        096       Input String Truncated at 80 characters
  6900.                  (this error code is not set when you specify NONULL)
  6901.        098       File Not Open for Input
  6902.        099       End of File
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.                                      Page - 107
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.                         SYSTEM ERROR CODE VALUES (Continued)
  6916.  
  6917.  
  6918.        ERROR Codes Set by KILL
  6919.  
  6920.        000       No Error
  6921.        002       File Not Found
  6922.        005       Access Denied
  6923.  
  6924.        ERROR Codes Set by MKDIR
  6925.  
  6926.        000       No Error
  6927.        003       Path Not Found
  6928.        005       Access Denied
  6929.  
  6930.        ERROR Codes Set by NAME
  6931.  
  6932.        000       No Error
  6933.        002       File Not Found
  6934.        003       Path Not Found or File Doesn't Exist
  6935.        005       Access Denied
  6936.        017       Not Same Disk Drive
  6937.  
  6938.        ERROR Codes Set by OPEN --- Mode Input
  6939.  
  6940.        000       No Error
  6941.        002       File Not Found
  6942.        004       File Not Found
  6943.        005       File Access Denied
  6944.        254       File Number Already in Use
  6945.  
  6946.        ERROR Codes Set by OPEN --- Mode Output
  6947.  
  6948.        000       No Error
  6949.        003       Path Not Found
  6950.        004       No File Handle Available
  6951.        005       File Access Denied
  6952.        254       File Number Already in Use
  6953.  
  6954.        ERROR Codes Set by PRINT#
  6955.  
  6956.        000       No Error
  6957.        005       File Access Denied
  6958.        006       Invalid File Handle
  6959.        097       File Not Open for Output
  6960.        255       Disk Full
  6961.  
  6962.        ERROR Codes Set by RMDIR
  6963.  
  6964.        000       No Error
  6965.        003       Path Not Found
  6966.        005       Access Denied
  6967.        006       Can't Delete Current Directory
  6968.        016       Can't Delete Current Directory
  6969.  
  6970.  
  6971.  
  6972.                                      Page - 108
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.                         SYSTEM ERROR CODE VALUES (Continued)
  6980.  
  6981.  
  6982.        ERROR Codes Set by RUN
  6983.  
  6984.        000-254   Return Code from Program (Zero If Not Set by User Program)
  6985.        255       Error Loading/Running Program
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.  
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.  
  7034.  
  7035.  
  7036.                                      Page - 109