Английская Википедия:Data General Extended BASIC

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description Шаблон:See also Шаблон:Infobox software

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 Шаблон:Code commands for matrix manipulation. In contrast to the compile-and-go Dartmouth BASIC, Extended BASIC was an interpreter.

To this, Extended BASIC added substring manipulation using array slicing, which was common on BASICs of the era, found on HP Time-Shared BASIC, Sinclair BASIC, Atari BASIC and others. This contrasts with the Microsoft BASIC style which uses string functions like Шаблон:Code, and thus makes porting string code somewhat difficult.

Data General later purchased rights to a much-expanded BASIC which was released as Data General Business Basic. This added powerful database functionality and largely replaced Extended BASIC on DG platforms.

Description

Mathematics

The internal floating point number format normally used two 16-bit words for a total of 32-bits, stored least significant bit first. Bit 0 was the sign, 1 through 7 was the exponent stored in excess-64 format, and 8 through 31 the mantissa stored as hexadecimal digits.Шаблон:Sfn Numbers could alternately use a double-precision format that extended the mantissa only, adding another 32-bits. That meant the double-precision format did not extend the range of numbers that could be stored, only the accuracy of those numbers.Шаблон:Sfn Possible numbers ranged from 5.4Шаблон:X10^ to −7.2Шаблон:X10^. Numbers with less than six digits were displayed as decimals, while those with more were displayed in exponent format.Шаблон:Sfn

Variable names could consist of a single letter, or a letter and a single digit. Two-letter names were not allowed. Arrays could be Шаблон:Codemed in 1 (array) or 2 (matrix) dimensions, and the lower bound was always 1.Шаблон:Sfn As was common at the time, variables with no Шаблон:Code defaulted to a 1-D array of 10 elements. Confusingly, if a variable was Шаблон:Codeed, it was not the same as a variable with the same name that had not been Шаблон:Codeed; Шаблон:Code and Шаблон:Code might be the same or different variables depending on how they were created.Шаблон:Sfn

Mathematics operators were the standard set, with the addition of a unary plus.Шаблон:Sfn Relational operators for comparisons were also the standard set, there was no Шаблон:Code for not-equals as found in some contemporary BASICs.Шаблон:Sfn

Matrix math

Extended BASIC added the suite of matrix math operations from Dartmouth BASIC's Fifth Edition. These were, in essence, macros that performed operations that would otherwise be accomplished with Шаблон:Code loops.Шаблон:Sfn

The system included a number of pre-rolled matrixes, like Шаблон:Code for a zero-matrix, Шаблон:Code for a matrix of all 1's, and Шаблон:Code for the identity matrix. Most mathematical operations were supported, for instance, Шаблон:Code multiplies every element in A by 2. Шаблон:Code takes the determinant, and Шаблон:Code inverts it.Шаблон:Sfn

Strings

String literals (constants) were entered between double-quotes. Characters within strings could be escaped by placing their ASCII value between angle-brackets, for instance, Шаблон:Code String variables, like their numeric counterparts, consisted of only a single letter, or one letter and one digit.Шаблон:Sfn

As is the case for all variables in Extended BASIC, string variables were normally allocated ten spaces, but could be extended up to a maximum of 32 k with an explicit Шаблон:Code. Because the array syntax was used to declare the length of the string, string arrays were not possible. Assigning a string to a variable that was too small too hold it resulted in any excess being truncated.Шаблон:Sfn

String manipulation was carried out using array slicing syntax. Шаблон:Code referred to the substring from position 10 to the end of the string, while Шаблон:Code referred to characters 10 through 20. Concatenation used the comma, so Шаблон:Code added Шаблон:Mono to the end of Шаблон:Mono.Шаблон:Sfn This was an uncommon syntax, even when it was being introduced, most BASICs using slicing used that for concatenation as well, for instance, Шаблон:Code would append Шаблон:Mono at the end of Шаблон:Mono, while those using string functions, like Microsoft BASIC, already widely used the plus sign for this operation.

This syntax change was because Extended BASIC allowed math operators to be applied to strings, up to the first non-numeric character. For instance, Шаблон:Code would put 3579 into A, without the need to explicitly convert them to numerics, normally handled with the Шаблон:Code function in most dialects. Non-numerics were simply ignored, Шаблон:Code put 1234 into A.Шаблон:Sfn

Extended BASIC lacked the Шаблон:Code command from Dartmouth that converted an entire string to or from ASCII values in an array, for instance, Шаблон:Code which results in B being assigned 10 numbers, each one an ASCII value.

Statements

Extended BASIC is otherwise similar to Dartmouth and Microsoft BASIC in the variety of commands it supports and their syntax. Exceptions include Шаблон:Code instead of Шаблон:Code, Шаблон:Code instead of Шаблон:Code (which was not common anyway). Two additions were Шаблон:Code which allowed errors to be trapped, a feature that became common on other BASICs, and Шаблон:Code which allowed the break key (escape in this case) to be trapped as well.Шаблон:Sfn Шаблон:Code was similar to Шаблон:Code, but allowed a single line to be re-run after a break, instead of continuing the entire program.Шаблон:Sfn Шаблон:Code set the time limit for Шаблон:Code statements to respond, which was a "timed input" otherwise identical to Шаблон:Code.Шаблон:Sfn

Extended BASIC added a variety of immediate mode editing statements that are not really part of the language per se. These included Шаблон:Code to remove a range of lines from a program, Шаблон:Code to read the contents of a text file into the program, and Шаблон:Code.Шаблон:Sfn Шаблон:Code was similar to Шаблон:Code, but read the lines from the card reader.

It also added a number of statements for dealing with the underlying file system, including Шаблон:Code which lists files in the user's directory and Шаблон:Code which does the same with wildcards, Шаблон:Code which printed the name of that directory, Шаблон:Code and Шаблон:Code for the program code, Шаблон:Code and Шаблон:Code, and Шаблон:Code, which printed the free space. Шаблон:Code was like Шаблон:Code, but sent the file to the card punch. Шаблон:Code printed the attributes of a given file.Шаблон:Sfn

Other operating system-related statements included Шаблон:Code to print a list of logged-in users, Шаблон:Code to bother them, Шаблон:Code to set the right margin (page width), and Шаблон:Code to print the memory used by the program, the opposite of what would be returned in MS BASIC with Шаблон:Code.Шаблон:Sfn

Functions

Functions closely matched Dartmouth and Microsoft BASIC, with a few additions. Шаблон:Code returned a numeric value encoding the positions of the front-panel switches.Шаблон:Sfn Шаблон:Code returned whether or not file Шаблон:Mono had reached the end-of-file. Шаблон:Code returned the position of Шаблон:Mono within Шаблон:Mono, anywhere after the optional position Шаблон:Mono, similar to the MS-standard Шаблон:Code.Шаблон:Sfn Note that this overrides the Шаблон:Code found in MS, which returns the current column position of the cursor.

References

Citations

Шаблон:Reflist

Bibliography

Шаблон:BASIC