ASIC is a compiler and integrated development environment for a subset of the BASIC programming language. It was released for MS-DOS and compatible systems as shareware. Written by Dave Visti of 80/20 Software, it was one of the few BASIC compilers legally available for download from BBSes. ASIC allows compiling to an EXE or COM file. A COM file for the Hello world program is 360 bytes. and floating-point arithmetic. These shortcomings resulted in the tongue-in-cheek motto, "ASIC: It's almost BASIC!"
Features
ASIC is strongly impoverished in comparison with its contemporary BASICs. The features of ASIC are selected to make a program be easily and directly compiled into machine language. Thus, many language constructs of ASIC are equivalent to constructs of assembly language.
Program elements
Neither identifiers nor keywords are case-sensitive.
Any <code>DIM</code> statements, if specified, must precede all other statements except <code>REM</code> statements or blank lines.
All <code>DATA</code> statements must be placed at the beginning of the program, before all other statement types, except <code>DIM</code>, <code>REM</code> statements, or blank lines.
Expressions
ASIC does not have the exponentiation operator <code>^</code>.
ASIC does not have boolean operators (<code>AND</code>, <code>OR</code>, <code>NOT</code> etc.).
Arrays
The size of array specified in the <code>DIM</code> statement must be a literal constant. A single <code>DIM</code> allows declaring only one array.
Input and output
<code>PRINT</code>'s arguments must be a literal or variable. <code>PRINT</code> does not allow combined expressions as its arguments, nor strings concatenated with <code>;</code> or <code>+</code>.
If a <code>PRINT</code> command ends with <code>;</code> or <code>,</code>, then the next <code>PRINT</code> command will resume in the position where this one left off, just as though its argument were appended to the argument of the current <code>PRINT</code> command.
The <code>PRINT</code> statement prints integer values six characters wide. They are aligned to the right (no trailing spaces).
; <code>LOCATE row, column </code> : Moves the text cursor to the position (<code>column</code>, <code>row</code>), where 0 ≤ <code>column</code> and 0 ≤ <code>row</code>. The position (0, 0) is the upper left corner.
Graphics
; <code>PSET (row,column),color</code> : Turns on the pixel of the color <code>color</code> at position (<code>column</code>, <code>row</code>), where 0 ≤<code>column</code> and 0 ≤ <code>row</code>. The position (0, 0) is the upper left corner.
Control Structures
A boolean condition may be only a comparison of numbers or strings, but not a comparison of combined expressions. A literal cannot be the left operand of comparison (e.g. can be <code>X = 2</code>, not <code>2 = X</code>).
Decisions
After <code>THEN</code>, there may be a sequence of statements delimited by <code>ELSE</code> or <code>ENDIF</code>. An example:
<syntaxhighlight lang="basic">
IF X < 0 THEN
PRINT "Negative"
ELSE
PRINT "Non-negative"
ENDIF
</syntaxhighlight>
Contrary to other BASICs, statements cannot be put between <code>THEN</code> and the end of the line.
An if-statement can realize the conditional jump. In this case, after <code>THEN</code> there may be a label.
Looping
In <code>FOR</code>, after <code>TO</code> there may be only a number - literal or variable - but not a combined expression. The <code>STEP</code> clause does not exist in ASIC.
Branching
In a <code>GOTO</code> statement, the label must be followed by a colon.
Subroutines
In a <code>GOSUB</code> statement, the label must be followed by a colon.
BAS2ASI
This utility, serving to convert GW-BASIC programs to ASIC syntax, in the version 5.0 does not support some GW-BASIC features. Examples:
<code>STEP</code> in the for loop is not converted. The program
<syntaxhighlight lang="basic">
10 FOR i=10 TO 1 STEP -1
20 PRINT i
30 NEXT i
</syntaxhighlight>
is converted into
<syntaxhighlight lang="QBasic">
REM 10 FOR i=10 TO 1 STEP -1
FOR I@ = 10 TO 1
ASIC0@ = -1 -1
I@ = I@ + ASIC0@
REM 20 PRINT i
PRINT I@
REM 30 NEXT i REM 30 NEXT i 3: Syntax error
</syntaxhighlight>
The exponentiation operator <code>^</code> is not converted. The program
<syntaxhighlight lang="basic">
10 a=2
20 b=a^10
30 PRINT b
</syntaxhighlight>
is converted into
<syntaxhighlight lang="QBasic">
REM 10 a=2
L10:
A@ = 2
REM 20 b=a^10
2: Syntax error
REM 30 PRINT b REM 30 PRINT b 3: Syntax error
</syntaxhighlight>
References
External links
<!--*Simtelnet archive for ASIC 5.0 [ftp://ftp.simtel.net/pub/simtelnet/msdos/basic/asic500.zip] Dead link -->
- ASIC 5.00 + Libraries + Linker
- Category:ASIC Tasks implemented in ASIC on rosettacode.org
