Optimized Systems Software: Difference between revisions

Content deleted Content added
Line 80:
A bank-selected cartridge version of the language that replaced BASIC A+. It fixed bugs and added even more commands and features. The '''BASIC XL Toolkit''' contains additional code and examples for use with the BASIC XL language. Included a runtime package for redistribution. No compiler was available.
 
A significant change in BASIC XL concerned the handling of line number lookups in GOTO/GOSUB and FOR...NEXT loops. In Atari BASIC, any GOTO had to search the entire program for the provided line number, and FOR...NEXT loops used the same code. In contrast, Microsoft BASIC included a small additional bit of logic that could search forward from the current line number for a small boost in performance, but much more importantly, used the address of the FOR line rather than its line number when performing NEXT, offering an enormous performance boost. These two differences made MS BASIC much faster than Atari in the common case where the program used a number of loops.
 
To address this, and leapfrog MS, BASIC XL included the new FAST command. When encountered in a program, the language searched the entire program looking for instances of GOTO/GOSUB with a simple line number (as opposed to a formula that returned a number) and replaced it with the address of the line. It did the same for NEXT statements. This offered a huge performance boost, making loops run as fast as MS, and the program as a whole even faster. The downside is that the address became invalid if the program was edited during runtime and it could not be CONTinued, unlike Atari BASIC which generally allowed this after any edit, but this had always been the case in MS anyway.