Heh, I did exactly the same thing! I still remember parts of the specs.
There's a series of header blocks that define global properties of the document, and can be pretty much safely ignored. In the first dozen bytes or so there's a word (i.e. 16 bit value) that contains the offset in the file that is the first byte past the header blocks. I don't remember the offset, nor do I remember the endianness.
After the header blocks it's pretty simple. Characters 0x00-0x7f are emitted as is. There are also fixed-length and variable-length blocks embedded in the stream that you have to deal with. (These correspond to the WordPerfect markup, à la "Reveal Codes").
Fixed length blocks are introduced with a marker byte in the range of 0xc0-0xcf. There follows a fixed amount of characters, followed by a matching 0xc0-0xcf.
Variable-length blocks are a bit trickier. They are introduced with a marker byte in the range of 0xb0-0xbf. The first word after the marker byte encodes the length of the block. At the end of the block you also have a matching 0xb0-0xbf marker byte.
With a hex-viewer you should be able to puzzle it out. It's funny how time changes things. The format used to be documented in several places on the Web. Right now I can't find a single useful/complete definition any more. Hmm, nor do I have my old source code to this application anymore either. Hmmmm.
|