fsxNet Wiki

BBS Development & Resources

User Tools

Site Tools


probbs:sauce

ANSI SAUCE

One of the problems with ANSI files, was a way to truly track via META data who the author was, and what group they represented. In 1994 SAUCE became a standard way of appending this META data and it continues to be in use today as a de facto standard within the ANSI art community. However, being created so many years ago, some of the common assumptions made back then are now cause for confusion. So, there is a revised version also in HTML format.

SAUCE was initially created for supporting only the ANSI and RIP formats.

HOW DOES IT WORK

Appended to a file, SAUCE has 4 parts: The original file contents, an End-Of-File or EOF character (Decimal 26, 0x1A, Ctrl+Z), an optional comment block and the SAUCE record.

The EOF character is an important part of what makes SAUCE work for text files. When processing a text file, the DOS / Windows TYPE command, most BBS terminal software and ANSI-viewers will all stop processing at the end of the file or when a EOF character is encountered with the EOF character itself not being rendered.

SPECIFICATIONS

FieldnameTypeSizeDescriptionRequired [1]Revision [2]
IDCharacter [3]5SAUCE identification. This should be equal to “SAUCE”.yes00.0
Version[6]Character [3]2SAUCE version number, should be “00”.yes00.0
TitleCharacter [3]35The title of the file.no00.0
AuthorCharacter [3]20The (nick)name or handle of the creator of the file.no00.0
GroupCharacter [3]20The name of the group or company the creator is employed by.no00.0
DateCharacter [3]8The date the file was created. The format for the date is CCYYMMDD (century, year, month, day). Example: 4 may 2013 would be stored as 20130504.no00.0
FileSizeUnsigned [4]4The original file size not including the SAUCE information.no [8]00.0
DataTypeUnsigned [4]1Type of data.yes00.0
FileTypeUnsigned [4]1Type of file.yes00.0
TInfo1 [7]Unsigned [4]2Type dependent numeric information field 1.no00.0
TInfo2 [7]Unsigned [4]2Type dependent numeric information field 2.no00.0
TInfo3 [7]Unsigned [4]2Type dependent numeric information field 3.no00.0
TInfo4 [7]Unsigned [4]2Type dependent numeric information field 4.no00.0
CommentsUnsigned [4]1Number of lines in the extra SAUCE comment block. 0 (zero) indicates no comment block is present.no00.0
TFlags [7]Unsigned [4]1Type dependent flags.no00.1
TInfoS [7]ZString [5]22Type dependent string information fieldno00.5

COMMENTS

A SAUCE comment block is an optional, variable sized structure that holds up to 255 lines of additional information, each line 64 characters wide. There are as many comment lines as is mentioned in the Comments field of the SAUCE record. If the Comments field is set to 0, there should not be a comment block at all. The comment block has the following layout:

Field nameTypeSizeDescriptionRequired [1]Revision [2]
IDCharacter [3]5SAUCE comment block identification. This should be equal to “COMNT”.yes00.0
Comment Line 1Character [3]64Line of text.yes00.0
Comment Line xCharacter [3]64Line of text.yes00.0

NOTES

  1. You need to provide a correct value for all required fields. A non-required field should either be set to the correct value, or when not used should be filled with spaces for the Character fields, set to 0 for the Unsigned fields or filled with binary zeroes for the ZString field.
  2. The revision this field was introduced. Before its introduction, it was a filler and should have been set to binary 0.
  3. The Character type is a string of characters encoded according to code page 437 (IBM PC / OEM ASCII). It is neither a pascal type string with a leading length byte nor is it a C-style string with a trailing terminator character. Any value shorter than the available length should be padded with spaces.
    • A Character field should be filled with spaces to indicate it is empty / unused.
      • Example: the ID field is 5 bytes long and contains the string “SAUCE”.
    • I have seen SAUCE where Character fields were terminated with a binary 0 with the remainder containing garbage. When making a SAUCE reader, it is a good idea to properly handle this case. When writing SAUCE, stick with space padding.
    • Character fields should contain only plain text, do not insert formatting codes such as ansi escape codes, pcboard color codes, html tags, …
    • Do not assume that a viewer will display this in a particular font or even if the font is fixed width or not.
    • Prior to revision 5, the SAUCE specifications specified ‘ASCII characters’ which implies code page 437. There are ANSI files out there however where the artist assumed an ANSI according to his native code page and also has SAUCE assumed as such.
  4. An unsigned binary value of 1 byte (0 to 255), 2 bytes (0 to 65535) or 4 bytes (0 to 4294967295) stored in intel little-endian format.
    • Note that the FileSize field prior to revision 5 was listed as signed. This was an artifact of Turbo Pascal – a dominant programming language in the early 1990s – supporting a signed integer of 4 bytes but not having an unsigned integer of 4 bytes. Since a file size can never be negative, it is safe to assume unsigned.
    • SAUCE prior to revision 5 only allowed SAUCE on files up to 2Gb in size, which back then was hardly a problem since hard disks were typically smaller.
  5. A C-style zero terminated string of characters encoded according to code page 437 (IBM PC / OEM ASCII). The part of the string not used should be filled with binary zero. Prior to revision 00.5 this field was a filler and was expected to be set to all binary zero, the different approach compared to the other Character fields serves as extra backwards compatibility.
  6. If you read a SAUCE record with a version number your software does not support, do not try to interpret the rest of the SAUCE record according to the 00 version spec.
  7. The interpretation of the TInfo1, TInfo2, TInfo3, TInfo4, TFlags and TInfoS fields are dependent on the DataType and FileType fields.
  8. FileSize was required in SAUCE prior to revision 5, it is now optional to be more in line with established reality. Many SAUCEd files have an incorrectly set FileSize. If you need to add SAUCE to a file larger than 4Gb, set FileSize equal to 0.
struct SAUCE
{
    char           ID[5];
    char           Version[2];
    char           Title[35];
    char           Author[20];
    char           Group[20];
    char           Date[8];
    unsigned long  FileSize;
    unsigned char  DataType;
    unsigned char  FileType;
    unsigned short TInfo1;
    unsigned short TInfo2;
    unsigned short TInfo3;
    unsigned short TInfo4;
    unsigned char  Comments;
    unsigned char  TFlags;
    char           TInfoS[22];
};
probbs/sauce.txt · Last modified: 2019/11/18 07:26 by ozz