Microsoft KB Archive/34407

From BetaArchive Wiki
Knowledge Base


BSAVE/BLOAD File Format Explained for Basic; 7-Byte Header

Article ID: 34407

Article Last Modified on 10/23/2003



APPLIES TO

  • Microsoft BASIC Professional Development System 7.0
  • Microsoft BASIC Professional Development System 7.1



This article was previously published under Q34407

SUMMARY

A file saved with the BSAVE statement has a 7-byte header with the following hexadecimal format:

     ww xx xx yy yy zz zz

   ww:     A signature byte equal to 253, which tells DOS and other
           programs that this is a Basic BSAVE/BLOAD format file.
   xx xx:  The segment address from the last BSAVE.
   yy yy:  The offset address from the last BSAVE.
   zz zz:  The number of bytes BSAVEd.
                

This information applies to Microsoft QuickBasic versions 3.00, 4.00, 4.00b, and 4.50 for MS-DOS; to Microsoft Basic Compiler versions 6.00 and 6.00b for MS-DOS; and to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS.

This information is provided as is. The BSAVE format is not guaranteed to be the same in a future release.

MORE INFORMATION

Microsoft GW-Basic Interpreter (versions 3.20, 3.22, and 3.23) uses the same 7-byte header string, and also repeats the 7-byte string, appending it after the final data byte. BasicA (provided in IBM or Compaq ROM on some computer models) does not repeat the 7-byte string at the end. GW-Basic and BasicA both terminate the file with ASCII 26, also known as a CTRL+Z character (hex 1A). QuickBasic and Microsoft Basic Compiler don't append CTRL+Z or repeat the 7-byte string at the end.

To determine whether a file was BSAVEd by GW-Basic, BasicA, or QuickBasic, compare the length of the memory saved against the file length. The difference is 15 bytes in GW-Basic, 7 bytes in QuickBasic, and 8 bytes in BasicA.

Despite the slight format differences, files BSAVEd under any of the three above Basic dialects correctly BLOAD into each other Basic.


Additional query words: QuickBas BasicCom

Keywords: KB34407