Classic Computer Magazine Archive COMPUTE! ISSUE 75 / AUGUST 1986 / PAGE 80

Commodore SpeedScript To Basic

Frank Colosimo

Mike Kozakiewicz

This utility program provides a convenient way to convert text in a SpeedScript word processing file into BASIC PRINT or DATA statements. The result is a BASIC program which you can load and run as a stand-alone program or add to existing programs of your own. The utility program requires a Commodore 64 or 128 (in 64 mode), a copy of Commodore 64 SpeedScript, and a disk drive. SpeedScript was published in the March 1985 issue of COMPUTE! and also is available in SpeedScript: The Word Processor for the Commodore 64 and VIC-20 from COMPUTE!. Books.

One of the first commands a BASIC programmer learns to use is PRINT, yet no matter how advanced you become, formatting a text display with PRINT can involve a lot of trial and error. If you PRINT past the right edge of the screen, words may break in the middle rather than wrapping completely around to the next line. And changing just one PRINT statement can affect the appearance of an entire screen.

"SpeedScript to BASIC" provides an answer for anyone who wants an easy way to format text neatly on the screen. It takes a text file created with Commodore 64 SpeedScript and converts it into PRINT or DATA statements ready to be merged with your own program. Some uses for SpeedScript to BASIC include creating instruction screens for BASIC programs, preparing self-contained educational or advertising programs, or converting word processing files into BASIC programs that can be read without the use of a word processor.

If you're a nonprogrammer, you may find it particularly useful for turning word processing files into BASIC programs. The programs it automatically generates are completely self-contained and display the text onscreen without use of the word processor itself.

Format Without Frustration

Type in the program listing below, then save a copy to disk. Before you can use the program, you must create a text file for it to process. Load and run SpeedScript, then type in as much text as you wish. When that's done, save the SpeedScript document as usual, then exit the word processor and load and run this program.

The program begins by asking you whether you want its output in the form of DATA statements or PRINT statements. The answer depends on your goal. The PRINT option is most useful if you intend to add the resulting display routine to an existing program of your own. If you want a stand-alone program, choose the DATA option; this creates an independent program that will display formatted text, one screen at a time, as you press a key.

After choosing the output type, you are asked for the name of the input file. Enter the filename of your previously prepared SpeedScript file, then press RETURN. If you're not sure of the exact file name, you can enter a dollar sign ($) to view the disk directory. If you ask for a file that does not exist, the program lets you try again. Enter Q at this prompt if you want to end the program.

The program now reads your word processing file and constructs a series of new BASIC statements in a large buffer area within memory. The file conversion routine is written in machine language for maximum speed. To keep you updated, the program increments the counter display each time it processes another 256 characters of text.

Once the work is done, the program asks you to insert an output disk in the drive. You then enter a name for the output program file to be created. If the file already exists on your output disk, you are asked if you want to erase the existing file, If you choose not to erase, you are asked to enter a new filename. You may also end the program by entering Q at this prompt. The output file is then saved to disk, and you are given the opportunity to save a copy to another disk.

Accurate Reproduction

The result is a set of BASIC program lines which accurately recreate the original text display. Just as in SpeedScript, the program wraps words instead of splitting them at the right edge of the screen. It also ignores SpeedScript formatting codes, which are relevant only when printing a document on paper, All other characters are faithfully reproduced, except for quotation marks. Since the PRINT command itself requires the use of double quotes, the program substitutes a single quote wherever a double quote appears in the original text.

Once you learn how easy it is to use, you'll probably find more and more uses for this program. To simplify the job of adding the new program lines to existing programs, the line numbers start at line 10000 and use increments of 10. A 21block word processing file takes about 38 seconds to be processed into a 26-block BASIC program (not counting the time you spend answering the prompts).

If you're interested in examining the machine language routine that makes this utility work, you can find it at locations 49152 and above.