Msg: 6421 *Conference*
04-08-96 17:02:08
From: RON WIESEN
To : ANTHONY FEST
Subj: REPLY TO MSG #6420 (BASIC)
There are BASIC files, which have .BA file name extensions. There are ASCII files, which have .DO file name extensions. A BASIC program can be formed as a BASIC file, as an ASCII file, or as the unnamed BASIC file in the laptop which consumes as much memory as a BASIC file but consumes no file name slot on the main menu. Let's start with the unnamed BASIC file. The NEW statement reduces this file to two bytes, which are both binary zero. All BASIC files have their end delimited by two binary zero bytes. So the NEW statement "clears" the unnamed BASIC file. To create a new BASIC program, start with NEW. Then type in statements or MERGE in statements from ASCII files. When the program is completed, you can assign it a file name so that you may then save it to some external media such as to a diskette. With the unnamed BASIC file, the SAVE statement assigns a file name an consequently you see one file name slot of the main menu is consumed by a .BA file name. Having a file name, you can "Select" it on the main menu to invoke it. Or you can enter BASIC, use the LOAD statement to make it the "current" BASIC file, and then issue the RUN statement to invoke it. So much for BASIC files, unnamed and named. A BASIC program can be formed in an ASCII file. You can't invoke it in this form but you can MERGE it into a BASIC file (unnamed or the "current" BASIC file). Conversly you can create an ASCII file in the form of a BASIC program by using the SAVE statement with the ",A" parameter. In this case the BASIC file (unnamed or "current") is expressed as ASCII which is deposited in a .DO file. Here's an example where a BASIC program is made and ends up as both a BASIC file and as an ASCII file. NEW 'clears unnamed BASIC file and any "current" file is no longer current 10 CLS:?"BASIC program was invoked!":END SAVE"TOKENS" 'BASIC file TOKENS.BA is created and is the "current" file SAVE"BIGGER.DO",A 'ASCII file BIGGER.DO is created; TOKENS.BA is still current If at this point you use the FILES statement so that all RAM file names are shown on the screen, the names TOKENS.BA and BIGGER.DO appear among the other file names. Next to the TOKENS.BA file name an asterisk appears to denote it as the "current" BASIC file. Should you use the RUN statement, it's the "current" BASIC file that's invoked, or where there is no "current" BASIC file then the unnamed BASIC file is invoked. BASIC files are more compact than their equivalent ASCII files. Among other things, each unique BASIC keyword (CLS, PRINT, and so on) is represented by a single byte rather than by a series of ASCII character (C L S , P R I N T , and so on). These bytes are called "tokens" and they are not ASCII characters because they use a "high-bit" which makes their range of values from 128 to 255. Clearly such values are not ASCII. Because they are not ASCII values, they can't be TELEported (Modem, RS-232). Conversely, an equivalent ASCII files can be TELEported. Most shareware on this BBS is in the form of equivalent ASCII so folks can download these BASIC shareware programs (.DO). After download, a NEW followed by a MERGE statement produces a tokenized version of a program in the unnamed BASIC file. Then a SAVE statement assigns a .BA file name and consumes a slot on the main menu. At this point, a KILL statement can remove the ASCII equivalent .DO file from RAM.