home *** CD-ROM | disk | FTP | other *** search
/ PC & Mediji 1997 February / PCM_9702.iso / bralci / mitja / asic / asic.doc < prev    next >
Text File  |  1996-07-20  |  335KB  |  9,746 lines

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