ASIC programs look very much like regular "BASIC" programs which you are probably already familiar with. The one very noticeable difference is that ASIC programs have no line numbers. Let's take a look at a very simple program written both in GWBASIC/BASICA and in ASIC:

10  I=I+1
30  IF I<100 THEN 10

Both of these programs do the same thing. They display the numbers from 1 to 100. However, notice that ASIC allows you to use descriptive labels (ADDONE) instead of a line number (10). These labels can be up to 80 characters long! Also note that the ASIC "PRINT" and "IF" statements were indented only for increased program readability. The ASIC program could just as well have been written as:


We could have made our variable names longer. Instead of "I" we could have chosen "SECONDS" or "VELOCITY", or some other name up to 80 characters in total. In ASIC, variable names, labels, and string constants can all be up to 80 characters in length.

Well, now that we've seen a basic ASIC program, let's try to enter and run a slightly larger program. The program we will be working with will print the message "HELLO yourname" in 256 color combinations. If you have a monochrome display card, don't worry, the program will work, but instead of seeing different colors you'll see characters with different attributes, such as blinking, underlined, etc.

Let's get started. If you haven't done so already, install ASIC as described in Chapter 1. Now then, writing an ASIC program involves these three steps.
  1. Write your program.
  2. Compile your program.
  3. Run/Test your Program.
These three steps can all be performed from within the ASIC Integrated Environment. Before we proceed with our "Hello yourname" Program, let's go over some conventions.

In the following section:

FLOPPY TYPE-->      Means that only 2-floppy disk system users
                    should type this line.

HARD TYPE-->        Means that only hard disk system users
                    should type this line.

TYPE-->             Means that both floppy and hard disk users
                    should type this line.

X>                  This is a representation of the prompt from
                    PC-DOS or MS-DOS.  Floppy Disk Users will
                    actually see "A>" for a prompt.  Hard Disk
                    Users will see "C>" for a prompt.

<enter>             Means that you should press the <enter>
                    or <enter> key on your keyboard.

<?>                 Text enclosed between the "<" and the ">"
                    symbols indicate a key to type.  Don't type
                    the "<" or ">" symbols.  For example, if the
                    tutorial lists "<F1>", your should press the
                    "F1" key on your keyboard.

NOTE: Floppy Disk users need to insert their ASIC Compiler diskette in Drive A: at this point, and a blank diskette in Drive B: (See the Installation section for more information)

The tutorial uses the keyboard for all commands, but includes a few notes on mouse usage. For more information on using the mouse with ASIC see the "MOUSE USAGE" section in Chapter 3.

Let's begin:

FLOPPY TYPE-->      A: <enter>
HARD TYPE-->        CD C:\ASIC <enter>

The computer should respond:


Now enter the command to invoke ASIC:

TYPE-->             ASIC <enter>

You are now in ASIC. The top line is the Menu Bar. The bottom line is the Status Line. Chapter 3 describes this in more detail. For now, we'll just describe a couple of features on these lines.

The status line indicates that the current mode is "INSERT". This means that any characters you type on a line will be inserted between the existing characters. If you press the <INS> key on the keypad, ASIC will toggle to its other mode, OVERSTRIKE. In this mode, when you type a character, it overlays the character that was there before. Each time you press the <INS> key, ASIC will toggle between the INSERT and OVERSTRIKE modes.

You can open the menus listed on the "Menu Bar" by holding down the ALT key while typing the Red Capitalized letter of the menu you wish to open. For example, to open the File menu, press <ALT><F>. Try it now:

TYPE-->    <Alt><F>

The "File" menu will pop open. You can select a menu option from that menu by typing the capitalized letter of the option, or by using the arrow keys on your keypad to highlight the option you want and then pressing <enter>.

MOUSE USERS: If you have a mouse, you can open a menu by clicking the left mouse button on the menu name.
For example, to open the "File" menu, position the mouse pointer anywhere on the word "File", and click the left button.

If you are not sure what the menu option will do, you can press <F1> and ASIC will display some help information for the highlighted menu option. When you opened the File menu, the first option on that menu, "Open" was highlighted. Let's get some help on "Open":

TYPE-->    <F1>

ASIC will display some help information on "Open". Let's close the help window now:

TYPE-->    <ESC>

The help window will close. The <ESC> key will always let you escape from any menu or help screen in ASIC, without taking any action.

MOUSE USERS: To close a menu you can click the right mouse button. In fact, you can always use the right mouse button to cancel an option, instead of pressing the <ESC> key, if you prefer.

Let's also close the file menu for now:

TYPE-->    <ESC>

The "File" menu should have closed. By the way, in addition to the menu help, ASIC provides additional online help. If you need general ASIC help, press the <F1> key for a quick summary of some of ASIC's features:

TYPE-->    <F1>

ASIC will display some general help. From this screen, we can also retrieve additional information about BASIC statements such as PRINT or GOSUB. Let's bring up an index of these statements.

TYPE-->    <F1>

ASIC has opened a help index screen. From this screen we can use the arrow keys to highlight any ASIC keyword and obtain more information for that keyword by then pressing enter. We won't do that now, but don't forget that this screen is available. Chapter 3 of the ASIC Reference Manual describes all of the online "HELP" features available in ASIC and provides a full description of the ASIC Editor Commands which are available. Exit the help menu:

TYPE-->    <ESC>

Entering a program in ASIC is simplicity itself. We'll simply type in each line, pressing <enter> at the end of each line. If you make a typing mistake, just use the arrow keys to move to the error, and type in the correction. Use the <DEL> or <Backspace> keys to delete any unwanted characters from the screen.

Make sure the status line says "Mode: Insert". This is the default mode in ASIC. If it doesn't, press the <INS> key until it does. Now let's enter our program (the program below intentionally contains an invalid ASIC statement. We'll correct the line later in the tutorial, for now, type in the program exactly as it's listed below):

TYPE-->        CLS  <enter>
TYPE-->        PRINT "Please enter your name"; <enter>
TYPE-->        INPUT YOURNAME$  <enter>
TYPE-->        FOR I=1 TO 16  <enter>
TYPE-->            FOR J=1 TO 16  <enter>
TYPE-->                COLOR I,J <enter>
TYPE-->                PRINT "HELLO "; <enter>
TYPE-->                PRINT YOURNAME$; <enter>
TYPE-->            NEXT J <enter>
TYPE-->        NEXT I <enter>
TYPE-->        CLS <enter>
TYPE-->        THE END <enter>

There, that was easy. Now, let's compile our program. To do it, we'll open the "Compile" menu, and select the "Compile program" option:

TYPE-->       <ALT><C>

The "Compile" menu will pop open. The first option, "Compile program" can be selected by typing the option letter which is capitalized "C", or by moving the highlight bar to this option and pressing the <enter> key. Since the highlight bar is already on this option, let's just press <enter>:

MOUSE USERS: To select an option with the mouse, position the mouse pointer on the option name and click the left mouse button.

TYPE-->       <enter>

Since we didn't specify a file name when we invoked ASIC, ASIC will now ask for a file name (so it can save your program before calling the compiler):

FLOPPY TYPE-->      B:TUTOR.ASI  <enter>
HARD TYPE-->        TUTOR.ASI <enter>

Note that ASIC requires that your programs be stored in files ending with the extension ".ASI". Had we entered "TUTOR" for our program name, ASIC would have appended the letters ".ASI" for us. If we tried to provide a different extension, such as "TUTOR.SRC", ASIC would display an error message.

Once you select the "Compile program" option, you'll see the ASIC compiler screen appear. It will display a count of the lines compiled, and when it is done, it will return to the ASIC editor.

If ASIC detected any errors, it will display the first error message at the bottom of the editor screen. It will also highlight the line in your program which is in error. In this case the line "THE END" was flagged with the error message "Syntax Error". Of course, that line should have been entered simply as "END".

That should be easy enough to fix. Let's exit the error menu by pressing the <ESC> key:

TYPE-->      <ESC>

The error menu has disappeared, and our cursor is now on the erroneous line. To fix the line:

TYPE-->      <DEL><DEL><DEL><DEL>

That should do it. The last line of our program should now read "END".
Before we continue, let's assume we knew the name of the END command, but could not remember the proper syntax for it. ASIC provides an online lookup for each ASIC statement. With the cursor positioned somewhere on the word "END":

     TYPE-->      <Ctl><F1>

ASIC should have opened a help window describing the "END" statement. To return to your program press the <ESC> key.

     TYPE-->      <ESC>

The help window should have disappeared and you should see your program displayed again. Let's recompile the program:

     TYPE-->      <ALT><C>
     TYPE-->      <enter>

This time you should see the message "No Compiler Errors". If you didn't, check your spelling and recompile the program until you receive this message. Press <ESC> to remove the "No Compiler Errors" Window.

Now let's run the program. To do so, we'll open the "Run" menu, and select the "Run your program" option.

     TYPE-->      <ALT><R>
     TYPE-->      <r>

This time, we just entered the capitalized letter from the menu option "Run your program". Your computer screen should now prompt you to "Please enter your name?". Go ahead and enter your name now:

     TYPE-->      yourname  <enter>

You should see "HELLO yourname" printed in various color combinations, and then the ASIC editor screen will reappear. Well, that's all there is to writing, compiling, and running an ASIC program. Now, to exit ASIC, open the "File" menu and select the "eXit" option.

     TYPE-->      <ALT><F>
     TYPE-->      <X>

You should see your MS DOS prompt once again. By the way, now that you've successfully compiled the program, you can execute it directly from MS DOS.
Let's try it:

     HARD TYPE-->     TUTOR <enter>
     FLOPPY TYPE-->   B:TUTOR <enter>

Well, that's a brief introduction to ASIC! Next, you might want to read Chapter 3, "Integrated Editor/Compiler Environment" to learn about the many other features available in the ASIC editor. Following this you should read Chapter 4 which explains how to use the ASIC Debugger. Chapter 4 includes another short tutorial in which you debug a program. Chapter 11 provides information on converting your existing GWBASIC programs to ASIC format.

The remaining chapters provide reference material which you can either read, or just refer to as needed. Chapter 5 explains how to compile programs directly from the command line of DOS. Chapters 6-8 describe the BASIC statements which are supported by ASIC. Chapter 9 provides some technical information about ASIC. Chapter 10 explains how to call ASIC or assembly language object modules from an ASIC program. Chapter 12 provides more descriptive information for ASIC error messages.

Hope you enjoy programming in ASIC!