APPLICATION NOTE #134 TRANSLATING WORDSTAR FILES Rev. 01 This application note gives you the information you need to convert a WordStar file into XyWrite format. WORDSTAR FORMAT WordStar, a word processor produced by MicroPro International Corporation, offsets certain ASCII character values by 128 in order to create special control codes. For example, the carriage return that is created by a wordwrap character has an ASCII value of 141 (a standard carriage return has a value of 13); spaces entered by WordStar to justify lines have an ASCII value of 160 (a standard space has a value of 32); and the line feed character that is part of a page break marker has an ASCII value of 138 (a standard line feed character has a value of 10). To read a WordStar file in XyWrite, use the XLATE (Translate) command described below to remove the offset from these special control codes. XLATE COMMAND FORMAT Like the CALL command, the XLATE command loads a copy of the named document from the disk into memory and the display for viewing and editing. The XLATE command also translates upper ASCII characters (ASCII 128 through 255) into lower ASCII characters (ASCII 0 through 127). The XLATE command performs this translation by subtracting 128 from the ASCII value of all characters in the extended ASCII character set. The general form for XLATE is: CM:XLATE d:filename XLATE works by copying the file to the display. The original document remains safely on disk. Thus, you may edit or even ABORT the displayed document without disturbing the original file. (Only when you use the STORE or SAVE command to save the document back to the disk does the file on the disk change.) USING THE XLATE COMMAND Let's say you want to display a WordStar file called CHAPTER.DOC and have the upper ASCII characters translated into lower ASCII characters in the display. Start with the screen cleared of any document. Type: F5xlate chapter.doc Result: XyWrite calls a copy of the file CHAPTER.DOC to the display. In the display, all upper ASCII characters are translated to as lower ASCII characters. Not all of these characters appear on the screen. For example, the carriage return and line feed characters are invisibly embedded in the file. SAVING THE DOCUMENT XLATE loads the document into memory only. The translation is not saved on disk until you SAVE or STORE it. If you want to maintain the original WordStar version and have a XyWrite-readable version as well, you could save the document under a different name. For example, if you use XLATE to display the file CHAPTER.DOC, you could then: Type: F5save chapter.trn Type: F5ab Result: XyWrite saves the displayed document under the name CHAPTER.TRN. CHAPTER.TRN reflects the translations performed by the XLATE command. Your original document, CHAPTER.DOC, is cleared from the screen without being saved to disk, so the translation is discarded and the WordStar document is intact. Note #1 Translated Characters. Keep in mind that XLATE translates all characters in the extended character set, not just the special control codes created by WordStar. Note #2 Pointing at Filename. You can also use the XLATE command by displaying a directory and pointing at a filename. Note #3 Clearing the Screen. You can have XyWrite automatically open a new window for you (if the current window has a file in it) when you issue the XLATE command. Refer the the XyWrite Reference Guide for information on the NW (New Window) setting.