Startexter 3 for DOS; aka. Sybex Quattro Texterverarbeitung had it's own file format.
I'm trying to "decode" the file format and want to build an importfilter as an extension.
- analyze PTB files
- Test with C64 variants (esp. version 3+)
- get related applications:
- StarDatei (a Base-like application)
- For Mailmerge used:
- StarKontor (no clue)
Actual content file
to save as▸
File extension is .txt, but every file format seems to be allowed...
The file always starts with
0x 01020304205379626578205175617474726F2054657874766572617262656974756E6720040302010A == " Sybex Quattro Textverarbeitung "
- Line separator, formatting, character,formatting, character, (...), 0xA0, restart
Formatting of characters
The formatting is very simple: if a character is not formatted, it is simply attached to the last character (so Sy is 0x5379);
For th e case a charcter has any formatting, 0x1B is attached after the last character and 2 bytes of formatting are after the 1B.
- RAC is saved as: 0x1B02 52 41 1B02 43
- Sy is saved as: 0x53 1B01 79.
Here is the full formatting table for all combinations:
StarTexter uses the codepage 437 of MS-DOS as can be seen at ascii.ca.
1LS = 1st line separator LLS = last line separator
|XXXX||1LS: 0000||First Hash Code|
|0041||see margins section|
|0000||000D||if no 0x80 is in a line, alter is used|
|6D or 6E or 74||depends on the next character; if 0x80 then 0A|
- 2550: if the file doesn't contain any additional separated PTB file
- 265E: if the file contains additional PTB file
The second hast tag is always identical with the first has tag two "lines later" (so hash tag 2 of 3rd separation line is identical with hash tag 1 of separation line 4)
I still have no clue how they are "generated" / calculated or why they are needed. Seems somehow any kind of CRC16, but I won't invest any time as it is more or less completely ignored if I change the Hash with something totally different - the file is still correctly displayed without any warning or any reparation / "rescue" test.
The right margin is described above always as 0x42; so a right margin of 80 (dec) is creating a 0x50 in the source code. The left margin is added directly before the right margin: so 0x2142 is displayed as 33 free space on the left and up to 47 (80-33) characters a line.
If a text is centered, Startexter is "filling up" the rest of the line at the left side with 0x80.
The standard tabulator is 6 times 0x80; but it depends on the text before and where the user set the manual tabulator marks.
As a result the import filter has to count the characters to detect if a line is centered or only a tabulator was added.
If a line has only a LF (0xA0), then the line gets automatically a whitespace (0x20).
No direct indication, ends always with a LF
A *.PTB file is only generated if a printer needs additional information which isn't saved in the actual file format.
The file consists always on 0x41F (dec 1055) characters.
Starting with the first bit with the actual Name of the printer (driver) which is in StarTexter configured.
What is undisclosed (until now) in the PTB file?
- Printer name
- separating help (GER: Trennhilfe)
Byte 01 to Byte XY Printer name (selected in StarTexter) Byte 3C character spacing(0x00: 10; 0x01: 12; 0x02: 15; 0x03: 17) Byte 3E line spacing (0x00: 1; 0x01: 1.5; 0x02: 2) Byte 40 LTP Printer port (0x00 for LTP-1 and 0x01 for LTP-2) Byte 42 see above (?) Byte 44 No. of lines between the header and the upper page end Byte 46 No. of lines between the header and the text Byte 48 No. of lines between the footer and the text Byte 4A No. of lines between the footer and the rest of the page end Byte 4C "Rows" to the left page border Byte 4E No. of lines fitting on a page Byte 50 to Byte D5 Header Line 1 (134 char) Byte F2 to Byte 177 Header Line 2 (134 char) Byte 194 to Byte 219 Header Line 3 (134 char) Byte 236 to Byte 2BB Footer Line 1 (134 char) Byte 2D8 to Byte 35D Footer Line 2 (134 char) Byte 37A to Byte 3FF Footer Line 3 (134 char) Byte 41C line spacing Hex-Code Meaning 42 1 2A 1.5 1E 2 Byte 41E character spacing Hex-Code Meaning 50 10 60 12 78 15 88 17