Apple Business BASIC is a dialect of the BASIC programming language for the Apple III with added features for producing business and productivity software. It belongs to the wider group of business BASICs, which first emerged on minicomputers. The main additions compared to AppleSoft BASIC on the Apple II were 19-digit long integer values in addition to floating point, better control over formatting input and output, and floppy disk commands that allowed file management without having to exit to Apple DOS. It included a rudimentary system to load and save fixed-width records, which made file handling easier. It also allowed programs to be built in parts and loaded on demand to allow the construction of larger applications. Business BASIC was the standard dialect for the Apple III. The Apple III also offered an expanded version of Microsoft BASIC, Apple III Microsoft BASIC, which ran under CP/M using 3rd party CP/M support.
Description
Program editing Apple Business BASIC used many of the editing conventions from the earlier AppleSoft BASIC, with the most noticeable change being the command prompt becoming a paren, ). This visually indicated you were in Business BASIC, as Integer BASIC used > and AppleSoft used ]. Statements entered without a line number were executed immediately, while those with a line number were instead stored for future execution, which Apple referred to as deferred mode. As was the case for AppleSoft, line numbers were limited to 0 through 63999. Editing was improved with the ability to enter a full-screen editing mode by pressing the Escape key and then using the cursor keys to move within program text. Most home computers of the era already supported this, but the Apple II predated this becoming a standard feature. Setting the value of the INDENT variable, normally defaulted to 2, provided leading spaces in front of the lines inside a FOR...NEXT loop, while the OUTREC variable controlled the maximum line length of LISTed program lines, avoiding it running off the right side of some printers. Finally, the DEL command allowed the mass deletion of program lines, for instance DEL 100 TO 500. DEL and LIST could both use TO, a comma, or a hyphen to separate the starting and ending ranges. Business BASIC was intended to support large programs, and writing such programs makes debugging difficult using traditional BASIC tools. To address this, Business BASIC added the TRACE command, which causes the system to print a # followed by the line number as statements are executed. Using this with PRINT allows the user to watch as values change and notice the line where it might occur. This can be turned off again with NOTRACE.
Data types and variables Most BASICs of the era allowed variable names to be a single letter, two letters, or one letter and one digit. A small number, including later versions of Microsoft BASIC, allowed longer variable names to be typed in the source code but only read the first two characters at runtime. This often led to a lack of suitable variable names, especially in long programs where many different variables were being used and spread across hundreds of lines of code. Business BASIC addressed this by allowing variable names up to 64 characters, all of which were significant. A variable name could include most non-space printing characters including basic punctuation, often using the period between individual works in a name, like This.Is.A.Variable.Name Names were case insensitive, so A.Variable and a.VARIABLE are the same. Variables were typed, meaning they could hold only one type of data. Most BASICs of the era had two types of data. The default type was a floating point number, or "real", normally stored in a 40-bit format (at least on MOS 6502-based machines). The other was the string, which was indicated by adding a dollar sign, $, to the end of the name of the variable. Some dialects, including Business BASIC, added an integer type, normally stored as a 16-bit binary value, indicated by a percent sign, %. To these three, Business BASIC added a fourth, the long integer, a 64-bit binary value that allowed up to 19 decimal digits of accuracy. These were denoted with an ampersand, &. Small currency values, like one penny, are represented in decimal by the fraction 0.01. This value cannot be exactly represented in binary floating point, and any manipulations, even simple ones like addition, can lead to the values being rounded incorrectly and producing odd output. Apple Business BASIC used the long integer format to address this issue, by multiplying dollar values by 100 to produce integers. A value like 0.01 would be stored as 1, and the value 10.10 would be stored as 1010. While this format does not eliminate rounding issues, it greatly reduces them in unexpected cases like addition. The downside is that all numbers have to be converted back to decimal format on output. This can be accomplished by dividing them by 100, but this may introduce the rounding errors that this system is attempting to avoid. Instead, it uses formatted output that placed the decimal point in the correct location, without changing the number itself. That is, 1010 would be printed as 10.10 by inserting the period during output. This was accomplished with the PRINT USING and the IMAGE statements. The format was represented by a string, which could be typed directly after the USING, or on a separate line using IMAGE. If the IMAGE style was used, the USING was instead followed by the line number of the IMAGE statement.
Program statements and reserved variables The list of supported statements is largely similar to those in AppleSoft BASIC, with a few additions. One is the ELSE clause on IF...THEN statements. ELSE operated as a separate statement, it could only follow a colon at the end of an IF statement. Another is the WINDOW, which allowed the text display area to be controlled, for instance, WINDOW 37,9 TO 44,16 would limit text output to a small rectangle on the right side of the screen. HOME cleared the text area and returned the cursor to the upper left of the window, and INVERSE and NORMAL set the text mode. Other new basic functionality was offered through the use of "reserved variables", like INDENT. HPOS and VPOS contained the X and Y location of the cursor, respectively, or could be set to move it, like HPOS=6.
… excerpt ends here. Continue reading the full article.