SuperH-based fx calculators
fx legacy: Spreadsheet format

Filetype in the non-inverted StandardHeader is 0x31

Specific header

Offset (b) Size (b) Description
0x20 0x10 main_ID (S-SHEET; zero padded)
0x30 4 MCS_SubItemCount; count of items under this main_ID (usually 1)
0x34 8 MCS_DIRNAME ("@SSHEET"; zero padded)
0x3C 8 MCS_ITEMNAME (FILENAME; without extension; zero padded)
0x44 1 MCS_DirType (0xFE)
0x45 4 MCS_DataLength; hint: the datatype "int" fails because of bad alignment
0x49 3 Unknown purpose (maybe 4-alignment), appears insignificant
0x4C 1 1
0x4D 3 CC; column count (max. 26)
0x50 4 { 0, 0, 0, 0 }
0x54 4 length the column definitions (see below)
0x58 4 { 0, 0, 0, 0 }
0x5C 4*CC CDS[]; Column directory (size of the datastructure defining the whole column)
0x5C+4*CC sum of CDS[] Column definitions; use the sizes in CDS[] to calculate the offsets to the column-definitions.

A column definition starts with a 0x80 byte row directory.

struct ColumnDefinition {
        unsigned char RowDirectory[0x80];       /* every bit set in this array represents an non-empty cell, max. 999 */
        struct Cell cells[n];    /* n according to the count of non-empty cells in the RowDirectory */
};

struct Cell{
  char BCD_value[9];
  char stuff[3]; /* 4-alignment, insignificant */
}
 

Empty columns occur in the ColumnDirectory with a SizeOfColumnDefinition=0. They have no entry in the ColumnDefinitions.

The BCD-coded value consists of a three digit exponent (base 10) and a 15 digit mantissa, giving 9 bytes. Generally 3 insignificant bytes are added for 4-alignment.
The exponent is biased by 100, t. i. you have to subtract 100, if you want to yield the real exponent.
F. i. 100 = 0; 098 = -2 a.s.o..
If the mantissa is negative, 500 is added to the exponent.
600123000000000000 would be -1.23
100230400000000000 would be 2.304
098456000000000000 would be 0.0456
597786000000000000 would be -0.00786

SpreadSheet-files reside in main memory. If an add-in wants to write a SpeadSheet-file directly into main memory, special dispositions are to make.
Before calling Bfile_CreateMainMemory the AppName has to be changed to "@SSHEET\0\0". Only thus the file is positioned in the right directory <S-SHEET>. Furthermore SSHEET_FileHeader must not be written! Bfile_CreateMainMemory prepares SSHEET_FileHeader automatically.

 

(12.05.2012 10:29:58)