Vilnius BASIC

Last updated
Vilnius Basic
Paradigm imperative, algorithmic
First appeared1986;38 years ago (1986)
Dialects
BASIC-86, BASIC-88
Influenced by
MSX BASIC
Influenced
None
Vilnius BASIC on BK-0010-01 Basic-Vilnus.png
Vilnius BASIC on BK-0010-01

Vilnius BASIC, sometimes known as BK BASIC, is a dialect of the BASIC programming language running on the Elektronika BK-0010-01/BK-0011M and UKNC computers. It was developed at Vilnius University, located in Lithuania which was a republic of the Soviet Union at the time.

Contents

In contrast to most microcomputer dialects of BASIC of the era, which were interpreters, Vilnius BASIC was a compile and go language that compiled the source when the user entered the RUN command. It was otherwise similar to GW-BASIC and MSX BASIC in style and most features, although it lacked some of the multimedia commands found in MSX. One oddity was that it did not allow more than one statement on a single line, a feature normally implemented using the colon. It also lacked the ability to open more than one data file at a time.

Only the UKNC version had a full-screen editor, versions of the 0010 series machines used a line editor. Machine-dependent features, like graphics operators, parameters, and PEEK/POKE addresses were also different among the machines.

Description

Program editing

In contrast to most BASIC dialects of the era, Vilnius BASIC was a compile and go system, not an interpreter. When the user types RUN, the compiler reads the code and produces a threaded code executable that it then ran. Nevertheless, this detail was largely invisible to the user, as the system still allowed statements to be typed in without a line number for direct (immediate) mode, or with a number for indirect mode in which case the new line was added to the program or replaced the same-numbered line if it already existed.

By the late 1970s, most microcomputer dialects offered a full-screen editor, in which the user can use the cursor keys to move around the program and type changes into any visible line of code. The Electronica systems were emulating an PDP-11, machines that had been built in the era before cursor-addressable computer terminals were widely available and thus retain the older line editor style. In these systems, a prompt is displayed that allows the user to type in one line of code, or recall a previously typed line and then edit it in-place.

Commands and statements

The list of keywords supported in Vilnius can be separated into two groups, those that can only be used in direct mode, and those that can be direct or indirect.

The former, known as commands, included the common CONT, LIST, NEW, RUN. CLOAD and CSAVE load and save programs to cassette tape. AUTO turned on automatic line number entry, RENUM renumbered the lines in the current program, and DELETE deleted ranges of lines using the same "to" format as LIST, for instance, DELETE -200 would delete everything from the start of the program up to an including line 200.

Vilnius' primitives were similar to other BASICs of the era, and supported most of the elementary statements like DATA, DEF FN, DIM, END, FOR..TO..STEP..NEXT, GOSUB, GOTO, IF..THEN with an optional ELSE, INPUT, (optional) LET, LIST, PRINT, ON...GOTO and ON...GOSUB, READ, REM, RESTORE, RETURN, STOP. In contrast to most dialects, Vilnius did not allow more than one statement per line.

Numeric variables, operators and functions

As with most dialects, variable names had to start with a letter and could be followed by more letters or digits. Variable names could be any length, but only the first two characters were stored or matched, meaning that typing PRT001=1 followed PR=5 would result in a single variable in memory known as PR with the value 5.

Vilnius BASIC had four basic data types, strings, single and double-precision floating point numbers, and integers. Unless otherwise denoted, variables were assumed to be double-precision, stored in eight bytes and providing about 17 digits of precision. For comparison, most MS dialects used a 5-byte format for floating point. If ! was suffixed to the variable name, the value was stored in single-precision using four bytes with about 7 digits of precision. % specified an integer, using a single 16-bit word to store values between -32768 and +32767. If a value with more precision was assigned to a variable with less, any excess was simply discarded; A%=1.5 will result in A% having the value 1.

Numeric constants in the source code could also be specified as a particular type using the same indicators; 50% would store the constant as an integer, 0.05! or 5E-02 stores a single-precision value 0.05, and 0.05 or 5D-02 stores the same value in the default double-precision format. Vilnius also had the additional ability to allow numeric constants to be typed in as strings of binary, octal or hexadecimal characters, by prefixing the string with & and a single letter indicating the type, B, O, H. For instance, A=&H9A8B would convert the hexadecimal string H9A8B to the equivalent decimal value 39563 and store that in A.

Operators for numerical values included +, -, *, /, ^ adding \ for integer division and MOD for the remainder. Thus 5\2 returns 2, while 5 MOD 2 returns 1. Numeric functions include the standard ABS, ATN, COS, EXP, INT, LOG, RND, SGN, SIN, SQR, TAN. It also included the FIX operator, which is similar to INT but always truncates toward zero so that FIX(-1.5) returns -1 instead of -2 like INT.

In addition to PEEK and POKE, which returned 16-bit values, the system also offered OUT and INP, which were similar but applied a bit mask to the values to allow individual bits to be set or cleared. [1] CLS cleared the screen. System functions include FRE which returned the amount of free memory, and TAB which moved to the given column. AT (x,y) worked in a similar fashion to TAB, but moved the cursor to the given X,Y location.

Strings

Suffixing a variable with $ indicated it was a string. String functions include the common ASC, CHR$, LEN, STR$, VAL. The STRING$ function makes copies of a given pattern string so that A$=STRING$(17, "X") will produce a string of 17 X's. [2] Only one manipulation function is included, MID$, which works as in MS, but can also be used to replace characters in an existing string, MID$(A$,1,1)="Y" will replace the first letter of A$ with Y. INKEY$ returns the current key pressed on the keyboard, if any. [3] + was used for string concatenation, as in most dialects.

The HEX$, OCT$ and BIN$ functions returned a string encoding the value passed in. For instance PRINT HEX$(255) produces FF, while PRINT BIN$(255) produces 0000000011111111.

Graphics additions

The Electronica systems included computer graphics support, and Vilnius BASIC included a number of statements to work with graphics. One interesting feature of this system was that X,Y coordinates were written in parens. The system remembered the last specified point, and new locations could be indicated with the @, for instance, if the last draw command was at (100,100), one could turn the pixel at (105,105) to color 3 with PSET @(5,5),3. There were five color values, 0 through 3.

In addition to PSET, one could draw lines from-to using a pair of coordinates separated by a minus sign, similar to the LIST command, for instance LINE (100,100)-(120,120),3. In its simplest form, CIRCLE took an X,Y pair for the center, a radius, and a color, CIRCLE (120,120),30,1. It could also plot arcs from given start and end angles in radians, CIRCLE (120,120),30,1,0,1.5, and could "compress" the vertical axis to produce an ellipse, CIRCLE (100,100),20,1,,,0.4. PAINT (100,100),3,1 performed a flood fill starting at (100,100), filling with color 3 and moving outward until it saw color 1.

Finally, there was the multi-purpose DRAW command. This took a string which encoded a series of drawing steps that could produce a complex shape in a single line of code. The four cardinal directions were indicated with U, D, L and R (up, down, left, right). The 45-degree angles were, moving clockwise, E (up-right), F, G and H (up-left). For instance, DRAW "R20D20L20U20" would produce a square with sides 20 pixels long starting at the last drawn position. In addition to directions, the M command could be used to specify explicit coordinates, like "M100,120", which did not require the parens. C changes the color, B moves without drawing a line, and N resets the coordinates to what they were before the DRAW command.

There is a single graphics function, POINT(x,y), which returns the number of the color of that location on the screen.

Example program

1 CLS  2 FOR X%=30% TO 1% STEP -2%  3 ? AT(X%,1%);"*"  4 ? AT(X%,20%);"*"  5 NEXT X% 

This program clears the screen, creates a loop based on integer values, and then uses the AT command to move the cursor alternately between Y values 1 and 20, printing (using the short form for PRINT, ?) an asterix at both locations. The result is a series of 30 asterixes in two horizontal lines.

See also

Related Research Articles

Applesoft BASIC is a dialect of Microsoft BASIC, developed by Marc McDonald and Ric Weiland, supplied with the Apple II series of computers. It supersedes Integer BASIC and is the BASIC in ROM in all Apple II series computers after the original Apple II model. It is also referred to as FP BASIC because of the Apple DOS command FP used to invoke it, instead of INT for Integer BASIC.

BASIC09 is a structured BASIC programming language dialect developed by Microware on behalf of Motorola for the then-new Motorola 6809 CPU and released in February 1980. It is primarily used with the OS-9 operating system, released in 1979. Microware also released a version for OS-9/68k on the 68000 as Microware BASIC.

HyperTalk is a discontinued high-level, procedural programming language created in 1987 by Dan Winkler and used in conjunction with Apple Computer's HyperCard hypermedia program by Bill Atkinson. Because the main target audience of HyperTalk was beginning programmers, HyperTalk programmers were usually called "authors" and the process of writing programs was known as "scripting". HyperTalk scripts resembled written English and used a logical structure similar to that of the Pascal programming language.

GRASS is a programming language created to script 2D vector graphics animations. GRASS was similar to BASIC in syntax, but added numerous instructions for specifying 2D object animation, including scaling, translation and rotation over time. These functions were directly supported by the Vector General 3D graphics terminal GRASS was written for. It quickly became a hit with the artistic community who were experimenting with the new medium of computer graphics, and is most famous for its use by Larry Cuba to create the original "attacking the Death Star will not be easy" animation in Star Wars (1977).

Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer.

In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be a match." The patterns generally have the form of either sequences or tree structures. Uses of pattern matching include outputting the locations of a pattern within a token sequence, to output some component of the matched pattern, and to substitute the matching pattern with some other token sequence.

Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on cassette for the Apple I in 1976, then included in ROM on the Apple II from its release in 1977, it was the first version of BASIC used by many early home computer owners.

Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET (1977) to the Commodore 128 (1985).

BASIC-PLUS is an extended dialect of the BASIC programming language that was developed by Digital Equipment Corporation (DEC) for use on its RSTS/E time-sharing operating system for the PDP-11 series of 16-bit minicomputers in the early 1970s through the 1980s.

HP Time-Shared BASIC is a BASIC programming language interpreter for Hewlett-Packard's HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as the platform that released the first public versions of the game Star Trek.

Color BASIC is the implementation of Microsoft BASIC that is included in the ROM of the Tandy/Radio Shack TRS-80 Color Computers manufactured between 1980 and 1991. BASIC is a high level language with simple syntax that makes it easy to write simple programs. Color BASIC is interpreted, that is, decoded as it is run.

In computer programming, an enumerated type is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language. An enumerated type can be seen as a degenerate tagged union of unit type. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated type has values that are different from each other, and that can be compared and assigned, but are not specified by the programmer as having any particular concrete representation in the computer's memory; compilers and interpreters can represent them arbitrarily.

Systems Programming Language, often shortened to SPL but sometimes known as SPL/3000, was a procedurally-oriented programming language written by Hewlett-Packard for the HP 3000 minicomputer line and first introduced in 1972. SPL was used to write the HP 3000's primary operating system, Multi-Programming Executive (MPE). Similar languages on other platforms were generically referred to as system programming languages, confusing matters.

SCELBAL, short for SCientific ELementary BAsic Language, is a version of the BASIC programming language released in 1976 for the SCELBI and other early Intel 8008 and 8080-based microcomputers like the Mark-8. Later add-ons to the language included an extended math package and string handling. The original version required 8 kB of RAM, while the additions demanded at least 12 kB.

SUPER BASIC, sometimes SBASIC for short, is an advanced dialect of the BASIC programming language offered on Tymshare's SDS 940 systems starting in 1968 and available well into the 1970s.

Data General Extended BASIC, also widely known as Nova Extended BASIC, was a BASIC programming language interpreter for the Data General Nova series minicomputers. It was based on the seminal Dartmouth BASIC, including the Fifth Edition's string variables and powerful MAT commands for matrix manipulation. In contrast to the compile-and-go Dartmouth BASIC, Extended BASIC was an interpreter.

SDS BASIC, also known as CP-V BASIC, Batch BASIC or Sigma BASIC depending on the version, is a BASIC programming language compiler for Scientific Data Systems's (SDS) Sigma series mainframe computers, originally released in 1967. Xerox purchased SDS in 1969 and began rebranding it as Xerox Data Systems, and finally just Xerox, at which time the language became known as Xerox BASIC.

<span class="mw-page-title-main">BASIC interpreter</span> Interpreter that enables users to enter and run programs in the BASIC language

A BASIC interpreter is an interpreter that enables users to enter and run programs in the BASIC language and was, for the first part of the microcomputer era, the default application that computers would launch. Users were expected to use the BASIC interpreter to type in programs or to load programs from storage.

Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s. When these machines were updated to the VP series in 1976, BASIC-2 was introduced and remained the pattern for future machines in the 2200 series. A planned BASIC-3 was never released.

Acorn System BASIC and Atom BASIC are two closely related dialects of the BASIC programming language developed by Acorn Computers for their early microcomputers like the Acorn System 3 and Acorn Atom. Developed in-house, they have a number of significant idiosyncrasies compared to most BASIC dialects of the home computer era.

References

Citations

  1. Manual, p. 46.
  2. Manual, p. 44.
  3. Manual, p. 45.

Bibliography