Английская Википедия:Benton Harbor BASIC

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

Шаблон:Short description

Шаблон:Infobox programming language

Benton Harbor BASIC and Extended Benton Harbor BASIC were two versions of the BASIC programming language written by Heathkit for their H8 microcomputers. The BASICs were patterned on Dartmouth BASIC, and thus differ in some respects from the many Microsoft BASIC clones of the late-1970s era. The two differ from each other in that the former was able to run in machines with only 8 kB of main memory and only supported string constants, while Extended required 12 kB and added string variables and additional features. It is named after the town where Heathkit was located.Шаблон:Sfn

History

Heathkit had been watching the emerging microcomputer field since 1974, but at the time, they could not figure out what any of the traditional Heath customers would use one for. Attitudes changed when MITS introduced the Altair 8800 kit in January 1975 and it was a runaway bestseller. Heathkit began a program to develop their own kit that would be much superior to the Altair,Шаблон:Sfn which was known to have poor reliability due to a number of design decisions.Шаблон:Efn The concept of building a computer remained a heated issue in the company, but started moving forward after one engineer stated "All right, we'll build a computer. But we're not going to get involved in software!"Шаблон:Sfn

The idea of not getting involved in software quickly revealed itself as a bad one. Although the new design was largely a cleaned up Altair, or S-100 bus design as they were known by this time, it differed enough that software for the Altair would not run without conversion. This would leave the prospective owner will little or nothing to do with their computer.Шаблон:Sfn The decision was made to sell the systems with at least some fundamental programs, but no one in the company had any software experience.Шаблон:Sfn

The company contacted Wintek of Lafayette, Indiana to write a suite of programs for the system. Wintek sent one of their programmers, Gordon Letwin, to the Heath headquarters in Benton Harbor, Michigan to meet with them. The project lead at Heath, Louis Frenzel, recounted that Letwin once arrived for a business meeting with long hair, high-top sneakers and a velvet coat. In spite of his surprise at Letwin's appearance, Frenzel quickly realized Letwin knew what he was doing and decided to hire him directly.Шаблон:Sfn

Letwin's first project was HDOS, an operating system for the platform. With this completed, he began work on BASIC. The first versions were extremely simple, supporting only the most basic functionality, limited to 6 digits of precision, lacking string manipulation,Шаблон:Sfn and only allowing a single statement per line.Шаблон:Sfn This version shipped with all H8 systems. For $10, the user could also purchase Extended BASIC, which started at Version 10, which added string variables and various additional functions.Шаблон:Sfn

The system was not particularly well reviewed. One review called it "medium quality" and expressed concern about how slow it was, some 10 times slower than North Star BASIC.Шаблон:Sfn Additionally, in spite of Heath's claims that Extended offered improved performance, benchmarking by one user demonstrated that most operations were either identical in speed or slightly slower, with the exception of some math functions like square root.Шаблон:Sfn

Description

Program editing

Like most BASICs of the era, the system could be used in either interactive or program mode, or as it was known at the time, immediate mode and deferred mode. Heath refers to these as command mode and program mode. Statements entered without a line number, in command mode, were run immediately. Those with a number at the front were put into the appropriate place in the program storage, possibly replacing an existing line with the same number. In contrast to later home computer versions, the H8 did not assume any sort of cursor addressable display, so editing the code had to be done by re-entering the entire line at the Шаблон:Code prompt.Шаблон:Sfn Line numbers could be between 1 and 65,535,Шаблон:Sfn and any single line could be up to 80 characters in the base version, and 100 in Extended.Шаблон:Sfn

One advanced feature of the system was that it offered an autocomplete system. As the initial command is being typed in, as soon as it can be uniquely identified, the system will insert the entire word immediately.Шаблон:Sfn Although some other dialects like Sinclair BASIC offered similar features, they did so using special keystrokes or characters that performed the replacement.

Statements and commands

Statements were split into groups: those that could only be used in command mode, and thus known as commands, and those that could be used in command or program mode. Among those that could only be used in command mode were: Шаблон:Code, Шаблон:Code if it was paused, and Шаблон:Code rather than the more common Шаблон:Code to erase a program— (SCRATCH was used in a number of contemporary BASICs). Programs were saved using Шаблон:Code instead of Шаблон:Code, but loaded using Шаблон:Code. Files had long filenames and could be Шаблон:Code after DUMPing.Шаблон:Sfn

Statements that could be used in command or program mode represented the majority of the language. Among these were the common Шаблон:Code and the equivalent Шаблон:Code seen on a few other systems, Шаблон:Code, Шаблон:Code for 1 or 2 dimensions, Шаблон:Code, Шаблон:Code with the ability to use variables as well as line number constants, the optional Шаблон:Code, Шаблон:Code which could only list a single line or the entire program, Шаблон:Code and Шаблон:Code computed branches, Шаблон:Code and Шаблон:Code, Шаблон:Code, Шаблон:Code and Шаблон:Code. A number of statements seen in most dialects of the era were missing, including Шаблон:Code, Шаблон:Code, Шаблон:Code and Шаблон:Code. Шаблон:Code was supported with a single optional prompt, and if the prompt was there, the question mark that would normally appear was suppressed. This could also be triggered by entering no prompt string and just the semicolon separator.Шаблон:Sfn An addition was the Шаблон:Code command, seen in a few dialects, that stopped execution until a key was pressed.Шаблон:Sfn

Math operators were standard; Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code and Шаблон:Code. Logical operators were likewise standard; Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code and Шаблон:Code.Шаблон:Sfn Boolean operators included Шаблон:Code, Шаблон:Code and Шаблон:Code.Шаблон:Sfn

Functions were largely standard as well, including Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code which was a truncate, not a floor as is the case in most versions, Шаблон:Code, Шаблон:Code which returned the cursor position, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code that output a number of space characters and Шаблон:Code to move to a particular column, Шаблон:Code to print the amount of free memory and Шаблон:Code to call assembler language routines.Шаблон:Sfn Random numbers were based on a series; Шаблон:Code would return the last number without advancing the series, Шаблон:Code reseeded, and any positive value in the parameter returned the next value in the series.Шаблон:Sfn

There were also a number of additional special purpose functions and commands, including Шаблон:Code which returns the value of the key being held down on the front panel's keypad, and Шаблон:Code which converted the key value from PAD into a digit that could then be POKEd to the 7-segment display.Шаблон:SfnШаблон:Sfn Like Altair BASIC, Benton Harbor also included the Шаблон:Code statement to write a value to a port number, as the Intel 8080 used numbered I/O ports.Шаблон:Sfn

Variables could have a single character or a single character and one digit - two letter names were not allowed.Шаблон:Sfn

Extended BASIC

Extended BASIC's primarily notable addition was string variables and a number of functions to operate on strings. String variables were indicated with the $ sign, as in most dialects, and could hold up to 256 characters.Шаблон:Sfn String functions included the standard Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code and Шаблон:Code.Шаблон:Sfn Concatenation was performed with Шаблон:Code.Шаблон:Sfn Extended also supported Шаблон:Code which read the entire line as a single string instead of interpreting spaces as separators between values.Шаблон:Sfn

Another change was that the Шаблон:Code function supplanted with the command Шаблон:Code, which printed out a detailed table showing the memory use. Шаблон:Code was modified to take an optional value that would exit the pause state after that amount of time. The internal clock was updated every other millisecond, so this value was in units of 2 ms. The new Шаблон:Code statement allowed the output of PRINT to be directed to a different device, which made outputting text much easier than using OUT and looping over the string.Шаблон:Sfn

Extended also added a number of features intended to make programming easier. Notable was the addition of a second comma-separated input to allow listing a range of lines, like Шаблон:Code, also seen on some other dialects like Atari BASIC. Others included Шаблон:Code, which in most dialects would be called Шаблон:Code, which turned on automatic line numbering. For instance, Шаблон:Code would result in a "100" being printed automatically after the line was entered, and then every line entered would increment the number by 10; 100, 110, 120 etc. This was turned off by pressing Шаблон:Key.Шаблон:Sfn Шаблон:Code allowed a range of lines to be deleted, using the same range format as Шаблон:Code.Шаблон:Sfn

Another addition was the Шаблон:Code command, which had a variety of settings based on a list of numbered entries. Шаблон:Code, for "setting zero", would set up the system to respond to control-B keypresses by performing a GOSUB to line, in this case, 500. Setting 1 set the number of digits before it would switch to exponent format, 2 controls the updates to the front-panel LED display, 3 sets the width of the "print zones" that are used when printing a list separated by commas (normally 14 characters), and 4 turns the hardware clock on or off.Шаблон:Sfn Turning the clock off can speed up programs by as much as 15%.Шаблон:Sfn

Finally, a small number of new math functions were added, including Шаблон:Code and Шаблон:Code which were provided with a comma-delimited list of number of values, and Шаблон:Code.Шаблон:Sfn

Notes

Шаблон:Notelist

References

Citations

Шаблон:Reflist

Bibliography

Further reading

Шаблон:BASIC