Commodore BASIC: Difference between revisions

Content deleted Content added
m Technical details: Remove red link, when the article is written then link to it.
Line 9:
A convenient feature of Commodore's [[read-only memory|ROM]]-resident BASIC [[interpreter (computer software)|interpreter]] and [[KERNAL]] was the full-screen editor, which allowed users to enter direct commands or to input and edit program lines from anywhere on the screen&mdash;simply by pressing the <code>RETURN</code> key whenever the [[cursor (computers)|cursor]] happened to be on a line containing a valid BASIC statement. This marked a significant change in program entry interfaces compared to other common home computer BASICs at the time, which typically used [[line editor]]s, invoked by a separate <code>EDIT</code> command, a "copy cursor," [[Escape sequence]]s, or the like.
 
It also had the capability of saving named files to any device, including the [[Compact Cassette|cassette]] &ndash; initially a popular storage device in the days of the [[Commodore PET|PET]]. Most systems of the era only supported filenames on [[diskette]], which made saving multiple files on other devices more difficult, requiring the operator to note the recorder's counter display at the ___location of the file, which was inaccurate and prone to error. Most non-Commodore users worked around the problem by only recording one file per tape. With the PET, when the user requested to load a file by name from the cassette, the device would read data sequentially, ignoring any non-matching filenames until the named file was located and read into memory. The file system was also supported by a powerful [[storage record|record structure]] that could be loaded or saved to files. Another difference between the cassette transfer implementations of the Commodore and other systems was that Commodore tapes were encoded digitally, where other manufacturers usually used a less expensive analog interface which enabled the use of a standard tape recorder, but was much less reliable.
 
Like the original [[Microsoft BASIC]] [[interpreter (programming)|interpreter]], on which it is based, Commodore BASIC is slower than native [[machine code]]. Test results have shown that copying 16 [[kilobytes]] from [[read-only memory|ROM]] to [[random-access memory|RAM]] takes less than a second in machine code, but over a minute in BASIC. To execute faster than the interpreter, programmers started using various techniques to speed up execution. One was to store often-used integer values in variables rather than using literal values, as interpreting a variable name was faster than interpreting a literal number. When speed was important, some programmers converted sections of BASIC programs to [[MOS Technology 6502|6502]] assembly language and executed them from BASIC using the <code>SYS</code> command; at other times, when speed was too fast, programmers dropped back to BASIC, and polled various addresses in memory (such as $A6 for the C-64, or $D0 for the C-128, denoting size of the keyboard queue) before they could start executing again.