|
![](/i/fill.gif) |
On 25/04/2012 10:18 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] dev null> wrote:
>> In a similar was, AMOS BASIC has local variables, named functions and
>> procedures, separate compilation, and a whole chock-load of features. In
>> fact, so many features that it hardly counts as "BASIC" any more; it's
>> more like a brand new language with a superficial resemblance to BASIC...
>
> If I recall correctly, the original BASIC, and the vast majority of
> clones for a pretty long time, didn't even have
C64 BASIC is the very first programming language I ever learned, when I
was still only 9 years old. (I soon learned many other dialects.)
The language is interpreted, not compiled. "Files" are stored on tape,
so random access is impossible, and splitting a program across several
files would be a pointless endeavour.
There is no text editor. Instead you edit the program using line
numbers. Type in a command and it executes immediately. (So the BASIC
interpreter is also the "operating system" as such.) Type in a line
number followed by a command, and that line is added to the program.
Lines are kept in sorted order, so you can insert between lines
(provided their numbers are not consecutive). For this reason, lines are
invariably numbered in 10s. Enter a line number that already exists, and
the existing line is replaced. Enter a line number with nothing
following it, and the line is deleted. The LIST command shows you the
program listing as it currently exists.
There are three types of variable. Normal variables hold signed
integers. (I have no idea what their range is.) Variable names ending
with "#" hold floating-point values. (Remember, no FPU, so SLOOOW. Also,
64KB of RAM, so these eat memory like candy.) Variable names ending with
"$" hold variable-length text strings. Typically a string cannot be more
than 255 characters. Typically a variable name cannot be more than 30
characters - which is fine. The entire screen is only 40 characters
wide. (A few BASIC implementations allow up to 30 characters, BUT IGNORE
ANYTHING BEYOND 8!)
All variables are global variables.
There are no subroutines. There is only GOTO and GOSUB/RETURN. This is
an UNSTRUCTURED programming language, after all.
You can have multi-dimensional arrays. They all start at index 1. There
are no user-defined data types.
Your flow control constructs are IF/THEN/ELSE, WHILE/LOOP, REPEAT/UNTIL,
and FOR/NEXT. Some dialects allow compound statements on a single line
using ":" as separator. Others demand that you use THEN GOTO if you want
multiple statements.
Almost every dialect had a strange DATA construct. A DATA statement is
followed by a comma-separated list of decimal numbers. The READ
statement fetches the next code into the specified variable. The RESTORE
command resets to the first DATA statement. If you want to write machine
code, you invariably have to write a BASIC program such as
10 FOR X = 1 TO 13
20 READ D
30 POKE (23874+X), D
40 NEXT X
50 DATA 45,84,27,45,95,13,75,65,42,84,13,10,59
This uses the POKE command to copy the stuff in the DATA statements into
a given location in RAM. (Notice how the DATA statements accept only
decimal. In general, BASIC understands nothing else.) This is arguably
the only reason that I know that the op-code for the 6510 "RTS" (return
from subroutine) command is 96 decimal.
To my mind, any language more sophisticated than this is no longer
"BASIC". It is now "a language based on BASIC".
Post a reply to this message
|
![](/i/fill.gif) |