ConTEXT

16K Disk
by Vern L. Mastel


This program is written to run on any Atari computer with 48K of memory and at least one disk drive. Letter Perfect is the only Atari word processor that does not use the standard Atari file management system. Because of this, it is impossible to load Letter Perfect text files using another word processor, such as Text Wizard, or check the spelling using a standard spelling checker.

ConTEXT is a program which bridges this gap. It will take any text file prepared with Letter Perfect and reformat it into a conventional file that can be accessed with a word processor like Text Wizard. It will handle files up to 160 sectors in length (this can be increased) and works with one or two disk drives.

At its heart, the program is really quite simple. Letter Perfect uses a directory located from sectors 363 to 371 on the disk. ConTEXT uses a direct sector read routine to extract the file information and display it in file, starting sector and number of sectors format. Once the particular file to be converted is chosen, the text is read from the Letter Perfect file into a string for temporary storage. When the read process is complete, the string is then written back out to a new file on a standard Atari-formatted disk. This file can then be accessed by any conventional Atari word processor. The program offers options for using one or two disk drives.

The operation of the program is as follows:

Lines 10-80 do all of the initialization. There are two very short machine language subroutines used in ConTEXT. The first, INSTR$, calls the CIO get sector routine. The second, in OUTSTR$, calls the CIO record move routine. TRANSFER$ holds the text from the Letter Perfect file and can be adjusted in size to accommodate the average size of file used.

Lines 100-190 do the Letter Perfect directory read. The directory information is put into BUFFER$.

Lines 200-300 pull the individual file names, sizes and locations out of the information in BUFFER$.

Lines 310-480 handle the user input regarding which text file is to be converted.

Lines 490-640 do the work of reading the individual sectors of the Letter Perfect file and putting the text into TRANSFER$.

Lines 650-710 allow one- or two-drive option to be used for the output file.

Lines 720-780 call the CIO and pass the necessary values it needs to move TRANSFER$ to a standard Atari disk file.

Lines 790-830 handle prompting for a disk swap, if needed, upon completion of conversion and continuation or exit from the program.

Using ConTEXT

The first thing to do when using ConTEXT is to copy the files to be converted onto a new Letter Perfect formatted disk. This is to insure that all of the sectors are in consecutive order for each file. ConTEXT is not smart enough to figure out where the right sectors are for a given file, if they are scattered about on a disk (a common situation on discs that are heavily edited). If you have two drives, the LP text disk will go into drive 1 after ConTEXT has been loaded into the computer. RUN the program and select the file to be converted. When you enter the starting sector and number of sectors, be sure to enter them correctly. An error can produce a totally scrambled output file, because the wrong sectors were read.

Letter Perfect has one very strange quirk which can cause a problem with conversion. An LP-formatted disk has sectors 8 through 55 reserved for some specific purpose, meaning that a 10-sector file will be written from sectors 3 to 7 and then from 56 to 61. Obviously, this file will not convert properly, because ConTEXT reads consecutive sectors. The solution is to save the file twice and ignore the first file. The program could also be rewritten to handle this situation, but I decided that the extra code was not justified. The destination disk for the converted file is a standard Atari-formatted disk. It can be a blank disk or one already containing text or program files. I prefer to keep converted files on their own disks. Once the converted file is written out to the destination disk, you are done unless you wish to convert more files. Load in your Text Wizard or Atari Writer and proceed to use the new files.

One final note. Nearly all converted files will need some cleanup. Watch out for embedded control characters in the text and garbage at the very end. This garbage comes from the fact that rarely does a text file completely fill the last sector. Because ConTEXT reads complete sectors only, any "stuff" past the end-of-file in the last sector will be read in as well. It is this that produces the garbage displayed at the end of the text, which must be cleaned up.

BASIC Listing

CONTEXT.LST is available in ATASCII format.

This BASIC listing uses an image to display special characters


Checksum Data
10 DATA 397,689,174,40,802,370,682,79,
922,229,195,583,569,431,129,6291
160 DATA 557,546,258,182,321,341,514,6
65,870,564,617,431,101,349,163,6479
310 DATA 327,956,367,869,105,516,858,4
68,789,174,328,902,483,637,951,8730
460 DATA 284,371,355,964,394,358,839,5
89,771,189,255,221,621,149,549,6909
610 DATA 538,250,174,805,640,262,143,5
77,551,681,181,51,507,343,419,6122
740 DATA 793,332,720,8,148,965,731,1,6
76,517,4891

Previous | Contents | Next

Original text copyright 1984 by ANALOG Computing. Reprinted with permission by the Digital ANALOG Archive.