User:Dennisroczek/Startexter

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.

to do

 * analyze PTB files
 * Test with C64 variants (esp. version 3+)
 * get related applications:
 * StarDatei (a Base-like application)
 * For Mailmerge used:
 * StarKontor (no clue)
 * Clipper
 * dBase

= Actual content file = to save as

File extension is .txt, but every file format seems to be allowed...

File Header
The file always starts with 0x 01020304205379626578205175617474726F2054657874766572617262656974756E6720040302010A == " Sybex Quattro Textverarbeitung "

File Body

 * FileHeader
 * 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.

 Examples: 


 * RAC is saved as: 0x1B02 52 41 1B02 43
 * S y is saved as: 0x53 1B01 79.

Here is the full formatting table for all combinations:

Special charaters
StarTexter uses the codepage 437 of MS-DOS as can be seen at ascii.ca.

Line separator
1LS = 1st line separator LLS = last line separator


 * 2550: if the file doesn't contain any additional separated PTB file
 * 265E: if the file contains additional PTB file

Hash tags
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.

Margins
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.

Other formatting
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).

File End
No direct indication, ends always with a LF

= Printer file = 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.

"Text" Header and "Text" Footer
What is undisclosed (until now) in the PTB file? 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
 * Printer name
 * Faltblattmarkierung
 * Blocksatz
 * separating help (GER: Trennhilfe)

= Resources =
 * c64-wiki.de with downloads of StarTexter 2.0, 4.0, 4.01, and 5.2
 * StarTexter at the German Wikipedia
 * StarTexter at DOSBox's Wiki