Misplaced Pages

Color BASIC

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

Color BASIC is the implementation of Microsoft BASIC that is included in the ROM of the Tandy/Radio Shack TRS-80 Color Computers manufactured between 1980 and 1991. BASIC (Beginner's All-purpose Symbolic Instruction Code) is a high level language with simple syntax that makes it easy to write simple programs. Color BASIC is interpreted , that is, decoded as it is run.

#425574

93-419: The nucleus of Color BASIC was Microsoft BASIC-69 which Tandy licensed from Microsoft. Color BASIC 1.0 was released with the original 4k TRS-80 Color Computer in 1980. It resides on 8k bytes of ROM, and is responsible for all 'housekeeping' duties on the system. This includes hardware initialization, memory management , interrupt processing, etc. Like most implementations of BASIC, each line of code starts with

186-404: A PRINT CHR$ ( X ) command where X corresponds to the control code to be issued (for example, PRINT CHR$ ( 147 ) is the control code to clear the screen) or by pressing the key in question between quote marks, thus pressing ⇧ Shift + CLR HOME following a quote mark will cause BASIC to display the visual representation of the control code (in this case, a reversed heart) which

279-511: A REM (BASIC statement to add a comment to the code) followed by a {Shift-L} , when trying to view the program listing, the BASIC interpreter would immediately abort the listing, display a ?SYNTAX ERROR and return to the READY. prompt. This glitch was used to some effect by programmers who wanted to try and protect their work, although it was fairly easy to circumvent. By abbreviating keywords, it

372-584: A SYSTEM keyword. A modified version published later by OS provider Logical Systems, in the LS-DOS Version 6.3 update, added single-letter access to BASIC control functions (like LIST and EDIT ) and direct access to LS-DOS supervisor calls. The program edit environment was still line-oriented. The facility available in Level II to sort arrays ( CMD"O" ) was not available; programmers and users had to devise their own workarounds. The first implementation as

465-551: A $ 3 per unit fee, stating, "I'm already married," and would pay no more than $ 25,000 for a perpetual license. The original PET version was very similar to the original Microsoft implementation with few modifications. BASIC 2.0 on the C64 was also similar, and was also seen on C128s (in C64 mode) and other models. Later PETs featured BASIC 4.0, similar to the original but adding a number of commands for working with floppy disks . BASIC 3.5

558-476: A "snapshot" file of the physical machine. Color BASIC understands one type of numeric variable and string variables. Variable names in Color BASIC have the first two characters significant. The first character of the variable name must be a letter. The second can be either a letter or number. String variables are indicated by adding a dollar sign ($ ) after the variable name. Numeric variables have only one type,

651-471: A PET was by modifying the first two bytes with a disk sector editor as the CBM-II series had their BASIC program area at $ 0, which would result in a PET attempting to load into the zero page and locking up. Commodore BASIC keywords could be abbreviated by entering first an unshifted keypress, and then a shifted keypress of the next letter. This set the high bit , causing the interpreter to stop reading and parse

744-615: A ROM-based MSX BASIC for use in MSX home computers , which used a Z80 processor. This version supported the graphics and sound systems of the MSX computers; some variants also had support for disk drives. No variety of Microsoft BASIC ( BASICA , GW-BASIC , QuickBasic , QBasic ) is currently distributed with Microsoft Windows or DOS . However, versions that will still run on modern machines can be downloaded from various Internet sites or be found on old DOS disks. The latest incarnation of Microsoft BASIC

837-453: A backwards jump, they will return to the start of the program to begin searching. This will slow down larger programs, so it is preferable to put commonly used subroutines near the start of a program. Variable names are only significant to 2 characters; thus the variable names VARIABLE1 , VARIABLE2 , and VA all refer to the same variable. Commodore BASIC also supports bitwise operators — AND, OR , and XOR , although this feature

930-456: A binary floating point implementation. Each numeric variable uses 5 bytes of memory and can be in the range from -1E+38 up to 1E+37. Unlike most implementations of Microsoft BASIC, Color BASIC requires the user to reserve space for string variables via the CLEAR statement. Multidimensional arrays are also supported with both numeric and string variables. In the case of an array, the element address

1023-470: A few months this was replaced by a port of BASIC-80 which incorporated some of Level I BASIC's command set, particularly the commands for setting graphics characters. Level II BASIC contained some of the features of Extended BASIC, although due to the need to include Level I commands such as SET and PSET , other features such as descriptive error messages still had to be left out; these were subsequently added into TRS-80 Disk BASIC. The TRS-80 Model 4 had

SECTION 10

#1732856026426

1116-414: A game or when waiting for user input, programmers could poll by reading selected memory locations (such as $ C6 for the 64, or $ D0 for the 128, denoting size of the keyboard queue) to delay or halt execution. A unique feature of Commodore BASIC is the use of control codes to perform tasks such as clearing the screen or positioning the cursor within a program; these can be invoked either by issuing

1209-478: A host of bad programming traps for the programmer. As most of these issues derived from Microsoft BASIC , virtually every home computer BASIC of the era suffered from similar deficiencies. Every line of a Microsoft BASIC program was assigned a line number by the programmer. It was common practice to increment numbers by some value (5, 10 or 100) to make inserting lines during program editing or debugging easier, but bad planning meant that inserting large sections into

1302-481: A line number and consists of one or more statements with variables and operators. 16k of memory is required for the next level of BASIC, Extended Color BASIC ("ECB"). Extended BASIC is required for the floppy disk controller , which then gives you Disk Extended Color BASIC ("DECB"). Emulators of the Color Computers running this interpreter and the others are available for modern computers, some of which require

1395-451: 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 floating point values in variables rather than using literal values, as interpreting a variable name was faster than interpreting a literal number. Since floating point is default type for all commands, it's faster to use floating point numbers as arguments, rather than integers. When speed

1488-444: A momentary delay in program execution if a large array is dimensioned. String variables are represented by tagging the variable name with a dollar sign. Thus, the variables AA$ , AA , and AA% would each be understood as distinct. Array variables are also considered distinct from simple variables, thus A and A(1) do not refer to the same variable. The size of a string array merely refers to how many strings are stored in

1581-462: A newer disk-based BASIC that utilized the BASIC-80 5.x core, which included support for 40-character variable names. Thus the ability to crunch program lines (without spaces between keywords and arguments) was no longer possible as it had been in Level II. It was no longer necessary to reserve string space. New features included user defined functions ( DEF FN ) and access to TRSDOS 6 system functions via

1674-420: A nuisance to edit. The LIST command displayed the entire command keyword - extending the program line beyond the 2 or 4 screen lines which could be entered into program memory. Like the original Microsoft BASIC interpreter , Commodore BASIC is slower than native machine code . Test results have shown that copying 16 kilobytes from ROM to RAM takes less than a second in machine code, compared to over

1767-480: A number of disk-related commands, including the ability to read a disk directory without destroying the program in memory. Its features were subsequently incorporated in various third-party extensions, such as the popular Epyx FastLoad cartridge. Other BASIC extensions added additional keywords to make it easier to code sprites, sound, and high-resolution graphics like Simons' BASIC (1983) and Vision BASIC (2022). Although BASIC 2.0's lack of sound or graphics features

1860-400: A one digit number. The order of execution of Commodore BASIC lines was not determined by line numbering; instead, it followed the order in which the lines were linked in memory. Program lines were stored in memory as a singly linked list with a pointer (containing the address of the beginning of the next program line), a line number, and then the tokenized code for the line. While a program

1953-565: A percent sign) in the range -32768 to 32767, in practice they are only used for array variables and serve the function of conserving memory by limiting array elements to two bytes each (an array of 2000 elements will occupy 10,000 bytes if declared as a floating point array, but only 4000 if declared as an integer array). Denoting any variable as integer simply causes BASIC to convert it back to floating point, slowing down program execution and wasting memory as each percent sign takes one additional byte to store (since this also applies to integer arrays,

SECTION 20

#1732856026426

2046-504: A program often required restructuring the entire code. A common technique was to start a program at some low line number with an ON...GOSUB jump table , with the body of the program structured into sections starting at a designated line number like 1000, 2000, and so on. If a large section needed to be added, it could just be assigned the next available major line number and inserted to the jump table. In addition, all variables are treated as global variables. Clearly defined loops beyond

2139-529: A selected increment. Earlier BASICs from Commodore also lack debugging commands, meaning that bugs and unused variables are hard to trap. IF...THEN...ELSE structures, a standard part of Z80 Microsoft BASICs, were added to BASIC 3.5 after being unavailable in earlier versions of Commodore BASIC. In common with other home computers , Commodore's machines booted directly into the BASIC interpreter. BASIC's file and programming commands could be entered in direct mode to load and execute software. If program execution

2232-572: A separate EDIT command, or a "copy cursor" that truncated the line at the cursor's position. It also had the capability of saving named files to any device, including the cassette – a popular storage device in the days of the PET, and one that remained in use throughout the lifespan of the 8-bit Commodores as an inexpensive form of mass storage. Most systems only supported filenames on diskette , which made saving multiple files on other devices more difficult. The user of one of these other systems had to note

2325-450: A standalone disk-based language system was for Seattle Computer Products S-100 bus 8086 CPU card in 1979. It was utilizing an 8-bit FAT file system. Microsoft also offered a version of Standalone BASIC-86 for SBC-86/12 for Intel's 8086 Single Board Computer platform in 1980. This is the version of BASIC used on the TI-99/4A home computer. Although very similar to Microsoft BASIC, it

2418-451: A strong following. The release of Visual Basic reboosted its popularity and it remains in wide use on Microsoft Windows platforms in its most recent incarnation, Visual Basic .NET . The Altair BASIC interpreter was developed by Microsoft founders Paul Allen and Bill Gates using a self-written Intel 8080 emulator running on a PDP-10 minicomputer . The MS dialect is patterned on Digital Equipment Corporation 's BASIC-PLUS on

2511-550: A three-byte mantissa is only about 6.5 decimal digits, and round-off error is common. 6502 implementations of Microsoft BASIC utilized 40-bit floating point arithmetic, meaning that variables took five bytes to store (four byte mantissa and one byte for the exponent) unlike the 32-bit floating point found in BASIC-80. While 8080/Z80 implementations of Microsoft BASIC supported integer and double precision variables, 6502 implementations were floating point only. Although Commodore BASIC supports signed integer variables (denoted with

2604-427: A variable, or other operation or function that returns a numeric quantity. str indicates a string expression is required. This can be a static string value (in quotes), a string variable, or other function or expression that returns a string of characters. device number indicates a device. By default, device 0 (screen and keyboard) is assumed. In Color BASIC, device #-1 (cassette) and #-2 (printer) are available to

2697-492: Is Visual Basic .NET , which incorporates some features from C++ and C# and can be used to develop Web forms, Windows forms, console applications and server-based applications. Most .NET code samples are presented in VB.NET as well as C#, and VB.NET continues to be favored by former Visual Basic programmers . In October 2008, Microsoft released Small Basic . The language has only 14 keywords. Small Basic Version 1.0 (12 June 2011)

2790-460: Is assigned two system variables in BASIC, TI and TI$ , which both contain the current time. TI is read-only and cannot be modified; doing so will result in a Syntax Error message. TI$ may be used to set the time via a six number string (an error results from using a string other than six numbers). The clock is not a very reliable method of timekeeping since it stops whenever interrupts are turned off (done by some kernal routines) and accessing

2883-461: Is enclosed with a parenthesis: Multiple dimensions are separated by commas Color BASIC provides several operators for both mathematic and, to a lesser extent, string operations. Parenthesis ( ) are used to override mathematical order of operation For testing, the following operators are used: Other symbols used in BASIC: num indicates a numeric expression is required. This can be a fixed number,

Color BASIC - Misplaced Pages Continue

2976-635: Is executed and if there are many string variables and arrays that have been manipulated over the course of a program, clearing them can take more than an hour under the worst conditions. It is also not possible to abort garbage collection as BASIC does not scan the RUN/STOP key while performing this routine. BASIC 4.0 introduced an improved garbage collection system with back pointers and all later implementations of Commodore BASIC also have it. The FRE function in BASIC 2.0 suffered from another technical flaw in that it cannot handle signed numbers over 32768, thus if

3069-415: Is not declared with a DIM statement, it is automatically set to ten elements (in practice 11 since array elements are counted from 0). Larger arrays must be declared or BASIC will display an error when the program is run and an array cannot be re-dimensioned in a program unless all variables are wiped via a CLR statement. Numeric arrays are automatically filled with zeros when they are created, there may be

3162-479: Is possible to fit even more on a line. BASIC 7.0 displays a ?STRING TOO LONG error if the user enters a program line over 160 characters in length. Earlier versions do not produced an error and simply display the READY prompt two lines down if the line length is exceeded. The line number is counted in the number of characters in the program line, so a five digit line number will result in four fewer characters allowed than

3255-691: Is the dialect of the BASIC programming language used in Commodore International 's 8-bit home computer line, stretching from the PET (1977) to the Commodore 128 (1985). The core is based on 6502 Microsoft BASIC , and as such it shares many characteristics with other 6502 BASICs of the time, such as Applesoft BASIC . Commodore licensed BASIC from Microsoft in 1977 on a "pay once, no royalties " basis after Jack Tramiel turned down Bill Gates ' offer of

3348-520: Is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler (s) adapted for many different microcomputers . It first appeared in 1975 as Altair BASIC , which was the first version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer. During the home computer craze of

3441-505: Is then acted upon at program execution (directly printing out the control codes uses less memory and executes faster than invoking a CHR$ function). This is in comparison to other implementations of BASIC which typically have dedicated commands to clear the screen or move the cursor. BASIC 3.5 and up have proper commands for clearing the screen and moving the cursor. Program lines in Commodore BASIC do not require spaces anywhere (but

3534-445: Is used via a fixed 5-byte seed value stored at power on in memory locations $ 8B-$ 8F on the C64 (the location differs on other machines). RND with any number higher than 0 will generate a random number amalgamated from the value included with the RND function and the seed value, which is updated by 1 each time an RND function is executed. RND with a negative number goes to a point in

3627-507: The LIST command will always display one between the line number and the statement), e.g., 100 IF A = 5 THENPRINT "YES" : GOTO 160 , and it was common to write programs with no spacing. This feature was added to conserve memory since the tokenizer never removes any space inserted between keywords: the presence of spaces results in extra 0x20 bytes in the tokenized program which are merely skipped during execution. Spaces between

3720-460: The LOAD command will always load at the first two bytes contained in the program file. This created a problem when trying to load BASIC programs saved on other Commodore machines as they would load at a higher address than where the PET's BASIC expected the program to be, there were workarounds to "move" programs to the proper location. If a program was saved on a CBM-II machine, the only way to load it on

3813-537: The PRINT USING statement. As compensation for not having double precision variables, Microsoft included 40-bit floating point support instead of BASIC-80's 32-bit floating point and string allocation was dynamic (thus the user did not have to reserve string space like in BASIC-80). However, vendors could still request BASIC with 32-bit floating point for a slightly smaller memory footprint ; as one example, Disk BASIC for

Color BASIC - Misplaced Pages Continue

3906-575: The Epson HX-20 portable computer, which has two Hitachi 6301 CPUs, which are essentially a "souped up" 6801. Most of the core features in BASIC-68 and BASIC-69 were copied directly from BASIC-80. BASIC-69 was notably also licensed to Tandy, where it formed the nucleus of Color BASIC on the TRS-80 Color Computer . Not to be confused with BASIC09 , a very different BASIC created by Microware as

3999-492: The File Allocation Table (FAT) was a BASIC adaptation for an Intel 8080 -based NCR 7200 , 7520 , or 7530 data-entry terminal with 8-inch floppy disks in 1977/1978. Microsoft offered a BASIC compiler for BASIC-80 under CP/M, by 1980 or before. The compiler executable was named BASCOM or BASCOM32. The TRS-80 computer was offered initially with an adaption of Li-Chen Wang's Tiny BASIC ( Level I BASIC ); within

4092-872: The PDP-11 , which Gates had used in high school . The first versions supported integer math only, but Monte Davidoff convinced them that floating-point arithmetic was possible, and wrote a library which became the Microsoft Binary Format . Altair BASIC was delivered on paper tape and in its original version took 4  KB of memory. The following functions and statements were available: LIST , NEW , PRINT , INPUT , IF...THEN , FOR...NEXT , SQR , RND , SIN , LET , USR , DATA , READ , REM , CLEAR , STOP , TAB , RESTORE , ABS , END , INT , RETURN , STEP , GOTO , and GOSUB . There were no string variables in 4K BASIC and single-precision 32-bit floating point

4185-615: The user interface of many home computers' rudimentary operating systems . By 1981, Microsoft BASIC was so popular that even companies that already had a BASIC licensed the language, such as IBM for its Personal Computer , and Atari , which sold both Atari Microsoft BASIC and its own Atari BASIC . IBM's Don Estridge said, "Microsoft BASIC had hundreds of thousands of users around the world. How are you going to argue with that?" Microsoft licensed similar versions to companies that competed with each other. After licensing IBM Advanced BASIC (BASICA) to IBM, for example, Microsoft licensed

4278-612: The 6502 during the summer of 1976; it was mostly a straight port of the 8K version of BASIC-80 and included the same prompts asking for memory size and if the user wanted floating point functions enabled or not (having them active used an extra 135 bytes of memory). The earliest machines to use 6502 BASIC were the Ohio Scientific Model 500 and KIM-1 in 1977. 6502 BASIC included certain features from Extended BASIC such as user-defined functions and descriptive error messages, but omitted other features like double precision variables and

4371-478: The Atari 8-bits used 32-bit floating point rather than 40-bit. Standard features of the 9K version of Microsoft 6502 BASIC included: 6502 BASIC lacked a standardized set of commands for disk and printer output; these were up to the vendor to add and varied widely with each implementation. Later implementations of 6502 Basic (1983–) had many vendor specific improvements; for example later versions of Commodore BASIC had

4464-638: The FOR...NEXT construct are hard to create, often causing the programmer to rely on the GOTO command (this was later rectified in BASIC 3.5 with the addition of the DO, LOOP, WHILE, UNTIL , and EXIT commands). Flag variables often needed to be created to perform certain tasks. Later BASIC versions on Commodore and other platforms included a DELETE and RENUMBER command, as well as an AUTO line numbering command that would automatically select and insert line numbers according to

4557-496: The IEC (or IEEE port on the PET) port will slow the clock update by a few ticks. The RND function in Commodore BASIC can use the clock to generate random numbers; this is accomplished by RND(0) , however it is of relatively limited use as only numbers between 0 and 255 are returned. Otherwise, RND works the same as other implementations of Microsoft BASIC in that a pseudo-random sequence

4650-465: The X and Y registers: POKE 780 , 0 : POKE 781 , 0 : POKE 782 , 192 ; and the load routine would be called: SYS 65493 . A disk magazine for the C64, Loadstar , was a venue for hobbyist programmers, who shared collections of proto-commands for BASIC, called with the SYS address + offset command. From a modern programming point of view, the earlier versions of Commodore BASIC presented

4743-440: The ability to crunch program lines. The core command set and syntax are the same in all implementations of Microsoft BASIC and, generally speaking, a program can be run on any version if it does not use hardware-specific features or double precision numbers (not supported in some implementations). After the initial success of Altair BASIC, Microsoft BASIC became the basis for a lucrative software licensing business, being ported to

SECTION 50

#1732856026426

4836-546: The array, not the size of each element, which is allocated dynamically. Unlike some other implementations of Microsoft BASIC, Commodore BASIC does not require string space to be reserved at the start of a program. Unlike other 8-bit machines such as the Apple II, Commodore's machines all have a built-in clock that is initialized to 0 at power on and updated with every tick of the PIA/VIA/TED/CIA timer, thus 60 times per second. It

4929-638: The command WAIT 6502, 1 would result in Microsoft! appearing on the screen. (The easter egg was well-obfuscated—the message did not show up in any disassembly of the interpreter.) The popular Commodore 64 came with BASIC v2.0 in ROM even though the computer was released after the PET/CBM series that had version 4.0 because the 64 was intended as a home computer, while the PET/CBM series were targeted at business and educational use where their built-in programming language

5022-445: The command, GOTO , could be abbreviated G{Shift-O} (which resembled G Γ onscreen). Most such commands were two letters long, but in some cases they were longer. In cases like this, there was an ambiguity, so more unshifted letters of the command were needed, such as GO{Shift-S} ( GO♥ ) being required for GOSUB . Some commands had no abbreviated form, either due to brevity or ambiguity with other commands. For example,

5115-432: The command, INPUT had no abbreviation because its spelling collided with the separate INPUT# keyword, which was located nearer to the beginning of the keyword lookup table . The heavily used PRINT command had a single ? shortcut, as was common in most Microsoft BASIC dialects. Abbreviating commands with shifted letters is unique to Commodore BASIC. This tokenizing method had a glitch such that if one included

5208-408: The compatible GW-BASIC to makers of PC clones , and sold copies to retail customers. The company similarly licensed an Applesoft -compatible BASIC to VTech for its Laser 128 clone . Known variants: MBASIC is available for CP/M-80 and ISIS-II . Also available for TEKDOS . MBASIC is a stripped-down BASIC-80 with only hardware-neutral functions. However, due to the popularity of CP/M,

5301-570: The following: Microsoft catalogs from the 1980s also showed the availability of BASIC-68 and BASIC-69 for the Motorola 6800 and 6809 microprocessors respectively, running the FLEX operating systems , and also mention OEM versions for Perkin-Elmer , Ohio Nuclear , Pertec and Societe Occitane d'Electronique systems. It seems likely this is what is also the basis for the Microsoft/Epson BASIC in

5394-435: The function is invoked on a C64 (38k BASIC memory), a negative amount of free BASIC memory will be displayed (adding 65535 to the reported number will obtain the correct amount of free memory). The PET and VIC-20 never had more than 32k of total memory available to BASIC, so this limitation did not become apparent until the C64 was developed. The FRE function on BASIC 3.5 and 7.0 corrected this problem and FRE on BASIC 7.0

5487-412: The great majority of Z80 machines ran MBASIC, rather than a version customized for specific hardware (TRS-80 BASIC was one of the few exceptions). Microsoft's CP/M card for the Apple II included a modified version of MBASIC that incorporated some of the graphics commands from Applesoft BASIC, such as HPLOT , but the full command set is not supported. The first implementation to use an 8-bit variant of

5580-428: The language. Later on, Microsoft released the 12K Extended BASIC, which included double precision 64-bit variables, IF ... THEN ... ELSE structures, user defined functions, more advanced program editing commands, and descriptive error messages as opposed to error numbers. Numeric variables now had three basic types, % denoted 16-bit integers, # denoted 64-bit doubles, and ! denoted 32-bit singles, but this

5673-499: The late-1970s and early-1980s, BASIC was ported to and supplied with many home computer designs. Slight variations to add support for machine-specific functions, especially graphics, led to a profusion of related designs like Commodore BASIC and Atari Microsoft BASIC . As the early home computers gave way to newer designs like the IBM Personal Computer and Macintosh , BASIC was no longer as widely used, although it retained

SECTION 60

#1732856026426

5766-621: The line number and program statement are removed by the tokenizer. Program lines can be 80 characters total on most machines, but machines with 40 column text would cause the line to wrap around to the next line on the screen, and on the VIC-20, which had a 22 column display, program lines could occupy as many as four. BASIC 7.0 on the Commodore 128 increased the limit of a program line to 160 characters (four 40-column lines or two 80-column lines). By using abbreviations such as ? instead of PRINT , it

5859-567: The line. 's' searches for the next instance of a character. For the 's', 'c' and 'd' commands you can also enter a number (#) before pressing any of them which will: 's' - search for the # instance of the character, 'c' - allow you to change # of characters, 'd' - delete # amount characters. There are a few subroutines available for machine language programs in the Color BASIC ROM that are available for general purpose programming. Microsoft BASIC#BASIC-68 and BASIC-69 Microsoft BASIC

5952-730: The main language for its OS-9 , the other OS available on the Color Computer (Microware also wrote version 2.0 of Extended Color BASIC when Microsoft refused to do it). Microsoft BASIC was also included in the Dragon 32 / 64 computers that were built in Wales and enjoyed some limited success in the UK home computer market in the early 1980s. Dragon computers were somewhat compatible with the Tandy TRS-80, as they were built on very similar hardware. Microsoft produced

6045-464: The majority of the numerous home and other personal computers of the 1970s and especially the 1980s, and extended along the way. Contrary to the original Altair BASIC, most home computer BASICs are resident in ROM , and thus are available on the machines at power-on in the form of the characteristic " READY ". prompt. Hence, Microsoft's and other variants of BASIC constitute a significant and visible part of

6138-622: The optional parameter ,1 which will load a program into the memory address contained in the first two bytes of the file (these bytes are discarded and not retained in memory). If the ,1 parameter is not used, the program will load into the start of the BASIC program area, which widely differs between machines. Some Commodore BASIC variants supplied BLOAD and BSAVE commands that worked like their counterparts in Applesoft BASIC , loading or saving bitmaps from specified memory locations. The PET does not support relocatable programs and

6231-414: The original 32-bit version. This new 40-bit format became the most common as it was used on most 6502-based machines of the era. It was also ported to the 16-bit BASIC-86 ( 8086/88 ). The final major release of BASIC-80 was version 5.x, which appeared in 1981 and added support for 40-character variable names, WHILE ... WEND loops, dynamic string allocation, and several other features. BASIC 5.x removed

6324-416: The program. Line numbers can range from 0 to 65520 and take five bytes to store regardless of how many digits are in the line number, although execution is faster the fewer digits there are. Putting multiple statements on a line will use less memory and execute faster. GOTO and GOSUB statements will search downward from the current line to find a line number if a forward jump is performed, in case of

6417-420: The program. This is in contrast to business-oriented operating systems of the time like CP/M or MS-DOS , which typically booted into a command line interface . If a programming language was required on these platforms, it had to be loaded separately. While some versions of Commodore BASIC included disk-specific DLOAD and DSAVE commands, the version built into the Commodore 64 lacked these, requiring

6510-539: The programmer should avoid using them unless very large arrays are used that would exceed available memory if stored as floating point). Also, it is not possible to POKE or PEEK memory locations above 32767 with address defined as a signed integer. A period (.) can be used in place of the number 0 (thus 10 A = . instead of 10 A = 0 or 10 FOR A = . TO 100 instead of 10 FOR A = 0 to 100 ), this will execute slightly faster. The SYS statement, used to start machine language programs,

6603-557: The programmer. If you make a mistake typing in a line, you can either retype it from scratch (or DEL it).. or you can EDIT it. When in EDIT mode, you get a reprint of the line, and a second copy that you SPACEbar across chars. You cannot use arrow keys. backspace takes you left, but does not actually erase it in the buffer. 'i' puts you in insert mode. pressing return gets you out of it. 'c' changes one char, 'd' deletes one char. 'x' takes you to end of line, allowing you to e'x'tend it. 'l' redraws

6696-422: The recorder's counter display at the location of the file, but this was inaccurate and prone to error. With the PET (and BASIC 2.0), files from cassettes could be requested by name. The device would search for the filename by reading data sequentially, ignoring any non-matching filenames. The file system was also supported by a powerful record structure that could be loaded or saved to files. Commodore cassette data

6789-520: The screen). Since Commodore 8-bit machines other than the C128 cannot automatically boot disk software, the usual technique is to include a BASIC stub like 10 SYS 2048 to begin program execution. It is possible to automatically start software after loading and not require the user to type a RUN statement, this is done by having a piece of code that hooks the BASIC "ready" vector at $ 0302 . As with most other versions of Microsoft BASIC , if an array

6882-447: The screen. If a line was prefixed with a line number, it was tokenized and stored in program memory. Lines not beginning with a number were executed by pressing the RETURN key whenever the cursor happened to be on the line. This marked a significant upgrade in program entry interfaces compared to other common home computer BASICs at the time, which typically used line editors , invoked by

6975-450: The sequence of the current seed value specified by the number. Since true random number generation is impossible with the RND statement, it is more typical on the C64 and C128 to utilize the SID chip's white noise channel for random numbers. BASIC 2.0 notoriously suffered from extremely slow garbage collection of strings. Garbage collection is automatically invoked any time a FRE function

7068-422: The statement according to a lookup table. This meant that the statement up to where the high bit was set was accepted as a substitute for typing the entire command out. However, since all BASIC keywords were stored in memory as single byte tokens, this was a convenience for statement entry rather than an optimization. In the default uppercase-only character set, shifted characters appear as a graphics symbol; e.g.

7161-420: The user to specify the disk drive's device number (typically 8 or 9) to the standard LOAD command, which otherwise defaulted to tape. Another omission from the Commodore 64s BASIC 2.0 was a DIRECTORY command to display a disk's contents without clearing main memory. On the 64, viewing files on a disk was implemented as loading a "program" which when listed showed the directory as a pseudo BASIC program, with

7254-523: Was added by Commodore and was not in the original Microsoft BASIC code, which featured only the USR function for invoking machine language routines. It automatically loads the CPU's registers with the values in $ 30C-$ 30F (C64, varies on other machines)--this can be used to pass data to machine language routines or as a means of calling kernal functions from BASIC (as an example, POKE 780 , 147 : SYS 65490 clears

7347-456: Was also "split" into two functions, one to display free BASIC program text memory and the other to display free variable memory. Many BASIC extensions were released for the Commodore 64, due to the relatively limited capabilities of its native BASIC 2.0. One of the most popular extensions was the DOS Wedge , which was included on the Commodore 1541 Test/Demo Disk. This 1 KB extension to BASIC added

7440-515: Was being entered, BASIC would constantly reorder program lines in memory so that the line numbers and pointers were all in ascending order. However, after a program was entered, manually altering the line numbers and pointers with the POKE commands could allow for out-of-order execution or even give each line the same line number. In the early days, when BASIC was used commercially, this was a software protection technique to discourage casual modification of

7533-429: Was frustrating to many users, some critics argued that it was ultimately beneficial since it forced the user to learn machine language. The limitations of BASIC 2.0 on the C64 led to use of built-in ROM machine language from BASIC. To load a file to a designated memory location, the filename, drive, and device number would be read by a call: SYS 57812 "filename" , 8 ; the location would be specified in

7626-520: Was halted using the RUN/STOP key, variable values would be preserved in RAM and could be PRINTed for debugging. The 128 even dedicated its second 64k bank to variable storage, allowing values to persist until a NEW or RUN command was issued. This, along with the advanced screen editor included with Commodore BASIC gave the programming environment a REPL -like feel; programmers could insert and edit program lines at any screen location, interactively building

7719-400: Was important, some programmers converted sections of BASIC programs to 6502 or 6510 assembly language that was loaded separately from a file or POKEd into memory from DATA statements at the end of the BASIC program, and executed from BASIC using the SYS command, either from direct mode or from the program itself . When the execution speed of machine language was too great, such as for

7812-565: Was not written by Microsoft as was widely rumored. According to TI Engineer H. Schuurman, "They (in the form of Bob Greenberg of Microsoft) were contracted to develop BASIC for the SR-70 (which is also sometimes referred to as the 99/7), but the BASIC for the 99/4 was developed in-house." TI-99/4 BASIC was based on Dartmouth BASIC and complies to the American National Standard for minimal BASIC (ANSI X3.60-1978). Microsoft ported BASIC-80 to

7905-399: Was part of the core Microsoft 6502 BASIC code, it was usually omitted in other implementations such as Applesoft BASIC . The native number format of Commodore BASIC, like that of its parent MS BASIC , was floating point . Most contemporary BASIC implementations used one byte for the characteristic ( exponent ) and three bytes for the mantissa . The accuracy of a floating point number using

7998-401: Was part of the unreleased Commodore 65 . Commodore took the source code of the flat-fee BASIC and further developed it internally for all their other 8-bit home computers. It was not until the Commodore 128 (with V7.0) that a Microsoft copyright notice was displayed. However, Microsoft had built an easter egg into the version 2 or "upgrade" Commodore Basic that proved its provenance: typing

8091-489: Was possible to fit more code on a single program line (which could take up two screen lines on 40-column displays - i.e., C64 or PET, or four lines on the VIC-20's 22-column display). This allowed for a slight saving on the overhead to store otherwise necessary extra program lines, but nothing more. All BASIC commands were tokenized and took up 1 byte (or two, in the case of several commands of BASIC 7 or BASIC 10) in memory no matter which way they were entered. Such long lines were

8184-487: Was presumed to be more heavily used. This saved manufacturing costs, as the V2 fit into smaller ROMs. A convenient feature of Commodore's ROM -resident BASIC interpreter and KERNAL was the full-screen editor . Although Commodore keyboards only have two cursor keys which reversed direction when the shift key was held, the screen editor allowed users to enter direct commands or to input and edit program lines from anywhere on

8277-453: Was recorded digitally, rather than less expensive (and less reliable) analog methods used by other manufacturers. Therefore, the specialized Datasette was required rather than a standard tape recorder. Adapters were available that used an analog-to-digital converter to allow use of a standard recorder, but these cost only a little less than the Datasette. The LOAD command may be used with

8370-530: Was released with an updated Microsoft MSDN Web site that included a full teacher curriculum, a Getting Started Guide, and several e-books. Small Basic exists to help students as young as age eight learn the foundations of computer programming and then graduate to Visual Basic via the downloadable software, Visual Studio Express , where they can continue to build on the foundation by learning Visual C# , VB.NET , and Visual C++ . Commodore BASIC Commodore BASIC , also known as PET BASIC or CBM-BASIC ,

8463-427: Was the default format so the ! is rarely seen in programs. The extended 8 KB version was then generalized into BASIC-80 (8080/85, Z80 ), and ported into BASIC-68 ( 6800 ), BASIC-69 ( 6809 ), and 6502 -BASIC. The 6502 had somewhat less dense assembler code and expanded in size to just under 8K for the single precision version, or 9K for a version using an intermediate 40-bit floating point format in place of

8556-515: Was the first to really deviate, adding a number of commands for graphics and sound support on the C16 and Plus/4 . BASIC 7.0 was included with the Commodore 128 , and included structured programming commands from the Plus/4's BASIC 3.5, as well as keywords designed specifically to take advantage of the machine's new capabilities. A sprite editor and machine language monitor were added. The last, BASIC 10.0,

8649-436: Was the only numeric type supported. Variable names consisted of one letter (A–Z) or one letter followed by one digit (0–9), thus allowing up to 286 numeric variables. For machines with more memory, the 8 KB version added 31 additional statements and support for string variables and their related operations like MID$ and string concatenation . String variables were denoted with a $ suffix, which remained in later versions of

#425574