ASIC programming language: Difference between revisions
imported>Frap MOS:HEAD |
grammar |
||
| Line 30: | Line 30: | ||
| AsOf = | | AsOf = | ||
}} | }} | ||
'''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 [[Bulletin board system|BBS]]es. ASIC allows compiling to an [[EXE]] or [[COM file]]. A COM file for [[Hello world program]] is 360 bytes.<ref name=computereview126 /> | '''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 [[Bulletin board system|BBS]]es. ASIC allows compiling to an [[EXE]] or [[COM file]]. A COM file for the [[Hello world program]] is 360 bytes.<ref name=computereview126 /> | ||
ASIC has little or no support for [[logical operator]]s, [[control structure]]s,<ref>In ASIC 3.01 (1991), the manual lists [[For loop|FOR...NEXT]], [[Do while loop|WHILE...WEND]] and [[Conditional (computer programming)|IF...ENDIF]], but no [[switch statement]]s, and no functions or procedures with [[Parameter (computer programming)|parameters]] or [[local variable]]s, only [[GOSUB]] for [[subroutines]]. The example programs use [[Goto]] instead of WHILE.</ref> and [[floating-point arithmetic]]. These shortcomings resulted in the tongue-in-cheek motto, "ASIC: It's almost BASIC!"<ref>[http://www.palmtoppaper.com/ptphtml/19/pt190029.htm ASIC is the work of David Visti and his compiler takes code that is "almost BASIC" and compiles it down to a very small executable.] {{webarchive |url=https://web.archive.org/web/20151104080812/http://www.palmtoppaper.com/ptphtml/19/pt190029.htm |date=November 4, 2015 }}, Programmer's Corner: TIPI: A Small Programming Language for Small Comp, By Kent Peterson</ref><ref name=computereview126>[http://www.atarimagazines.com/compute/issue126/86_Area_code_magic_with.php ASIC], Area code magic with AC Hunter (computer program) (On Disk) (evaluation), by George Campbell, COMPUTE! ISSUE 126 / FEBRUARY 1991 / PAGE 86</ref> | ASIC has little or no support for [[logical operator]]s, [[control structure]]s,<ref>In ASIC 3.01 (1991), the manual lists [[For loop|FOR...NEXT]], [[Do while loop|WHILE...WEND]] and [[Conditional (computer programming)|IF...ENDIF]], but no [[switch statement]]s, and no functions or procedures with [[Parameter (computer programming)|parameters]] or [[local variable]]s, only [[GOSUB]] for [[subroutines]]. The example programs use [[Goto]] instead of WHILE.</ref> and [[floating-point arithmetic]]. These shortcomings resulted in the tongue-in-cheek motto, "ASIC: It's almost BASIC!"<ref>[http://www.palmtoppaper.com/ptphtml/19/pt190029.htm ASIC is the work of David Visti and his compiler takes code that is "almost BASIC" and compiles it down to a very small executable.] {{webarchive |url=https://web.archive.org/web/20151104080812/http://www.palmtoppaper.com/ptphtml/19/pt190029.htm |date=November 4, 2015 }}, Programmer's Corner: TIPI: A Small Programming Language for Small Comp, By Kent Peterson</ref><ref name=computereview126>[http://www.atarimagazines.com/compute/issue126/86_Area_code_magic_with.php ASIC], Area code magic with AC Hunter (computer program) (On Disk) (evaluation), by George Campbell, COMPUTE! ISSUE 126 / FEBRUARY 1991 / PAGE 86</ref> | ||
| Line 38: | Line 38: | ||
=== Program elements === | === Program elements === | ||
Neither | 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. | 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 | 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 ==== | ==== Expressions ==== | ||
| Line 50: | Line 50: | ||
=== Arrays === | === Arrays === | ||
The size of [[Array (data structure)|array]] specified in the <code>DIM</code> statement must be a literal constant. A single <code>DIM</code> allows | The size of [[Array (data structure)|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 === | === Input and output === | ||
<code>PRINT</code>'s arguments must be a literal or variable. <code>PRINT</code> does not allow | <code>PRINT</code>'s arguments must be a literal or variable. <code>PRINT</code> does not allow combined expressions as its arguments, nor [[String (computer science)|strings]] [[concatenation|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. | 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. | ||
Latest revision as of 12:40, 15 August 2025
Script error: No such module "Distinguish". Script error: No such module "Infobox".Template:Template other Script error: No such module "Check for unknown parameters".Script error: No such module "Check for conflicting parameters". 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.[1]
ASIC has little or no support for logical operators, control structures,[2] and floating-point arithmetic. These shortcomings resulted in the tongue-in-cheek motto, "ASIC: It's almost BASIC!"[3][1]
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 DIM statements, if specified, must precede all other statements except REM statements or blank lines.
All DATA statements must be placed at the beginning of the program, before all other statement types, except DIM, REM statements, or blank lines.
Expressions
ASIC does not have the exponentiation operator ^.
ASIC does not have boolean operators (AND, OR, NOT etc.).
Arrays
The size of array specified in the DIM statement must be a literal constant. A single DIM allows declaring only one array.
Input and output
PRINT's arguments must be a literal or variable. PRINT does not allow combined expressions as its arguments, nor strings concatenated with ; or +.
If a PRINT command ends with ; or ,, then the next PRINT command will resume in the position where this one left off, just as though its argument were appended to the argument of the current PRINT command.
The PRINT statement prints integer values six characters wide. They are aligned to the right (no trailing spaces).
LOCATE row, column- Moves the text cursor to the position (
column,row), where 0 ≤columnand 0 ≤row. The position (0, 0) is the upper left corner.
Graphics
PSET (row,column),color- Turns on the pixel of the color
colorat position (column,row), where 0 ≤columnand 0 ≤row. 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 X = 2, not 2 = X).
Decisions
After THEN, there may be a sequence of statements delimited by ELSE or ENDIF. An example:
IF X < 0 THEN
PRINT "Negative"
ELSE
PRINT "Non-negative"
ENDIF
Contrary to other BASICs, statements cannot be put between THEN and the end of the line.
An if-statement can realize the conditional jump. In this case, after THEN there may be a label.
Looping
In FOR, after TO there may be only a number - literal or variable - but not a combined expression. The STEP clause does not exist in ASIC.
Branching
In a GOTO statement, the label must be followed by a colon.
Subroutines
In a GOSUB 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:
STEP in the for loop is not converted. The program
10 FOR i=10 TO 1 STEP -1
20 PRINT i
30 NEXT i
is converted into
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
The exponentiation operator ^ is not converted. The program
10 a=2
20 b=a^10
30 PRINT b
is converted into
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
References
<templatestyles src="Reflist/styles.css" />
- ↑ a b ASIC, Area code magic with AC Hunter (computer program) (On Disk) (evaluation), by George Campbell, COMPUTE! ISSUE 126 / FEBRUARY 1991 / PAGE 86
- ↑ In ASIC 3.01 (1991), the manual lists FOR...NEXT, WHILE...WEND and IF...ENDIF, but no switch statements, and no functions or procedures with parameters or local variables, only GOSUB for subroutines. The example programs use Goto instead of WHILE.
- ↑ ASIC is the work of David Visti and his compiler takes code that is "almost BASIC" and compiles it down to a very small executable. Template:Webarchive, Programmer's Corner: TIPI: A Small Programming Language for Small Comp, By Kent Peterson
Script error: No such module "Check for unknown parameters".
External links
- ASIC 5.00 + Libraries + Linker
- Category:ASIC Tasks implemented in ASIC on rosettacode.org
Script error: No such module "Navbox".