I have to read some legacy data files used by a MS-DOS program. Most of it is quite straightforward, but I can't figure out one data type; a 6-byte sequences representing whole numbers.
Some examples:
+-----+-------------------+
| num | bytes as hex |
+-----+-------------------+
| 0 | 00 00 00 00 00 00 |
| 1 | 80 7b 14 ae 47 61 |
| 2 | 80 20 d0 91 7b 14 |
| 3 | 80 20 d0 92 5c d0 |
| 4 | 80 20 d0 92 7b 14 |
| 5 | 80 20 d0 93 5c d0 |
| 6 | 80 20 d0 93 d0 bb |
| 7 | 80 20 d0 93 7a 14 |
| 8 | 80 20 d0 93 09 e2 |
| 9 | 80 20 d0 94 d1 9b |
| 10 | 80 20 d0 94 14 d0 |
| 16 | 84 48 e1 7a 14 7e |
| 20 | 85 0a d7 a3 70 1d |
| 32 | 86 ec 51 b8 1e 20 |
| 48 | 86 86 eb 51 b8 40 |
| 73 | 87 00 00 00 00 12 |
| 100 | 87 00 00 00 00 48 |
| 130 | 88 00 00 00 80 01 |
+-----+-------------------+
Does anybody know what type format this is?
Things that may be useful to know:
- The file format is from the MS-DOS era (1994 to be precise);
- The file format does not use special types anywhere else;
- Increasing the value of the first byte by one typically doubles the numeric value;
- (Other) bytes and integers are typically signed.
Any help is very welcome!
Quick Update
The example above shows a sequence of bytes, represented here as hex value, cut from the file and pasted here. I'm sure the byte sequence is meant to represent a number, since I can change the numeric value inside the MS-DOS program, save to file, and compare the results.
Reading & Writing the data
In order to read and write 48 bit real to and from binary form, you could take a look at:
PHP: Convert double to Pascal 6-byte (48 bits) real format