Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Article Q34407
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
BSAVE/BLOAD File Format Explained for BASIC; 7-Byte Header - Q34407
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 MS-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:
- The Standard and Professional Editions of Microsoft Visual Basic
version 1.0 for MS-DOS.
- Microsoft QuickBasic versions 3.0, 4.0, 4.0b, and 4.5 for MS-DOS
- Microsoft Basic Compiler versions 6.0 and 6.0b for MS-DOS
- Microsoft BASIC Professional Development System (PDS) versions 7.0
and 7.1 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.2, 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's or
Compaq's ROM BIOS 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 (1Ah). Visual Basic,
QuickBasic and the Microsoft BASIC Compiler does not append a CTRL+Z
character or repeat the 7-byte string at the end of the file.
To determine whether a file was BSAVEd by GW-BASIC, BASICA,
Visual Basic, or QuickBasic, compare the length of the memory saved
against the file length. The difference is 15 bytes in GW-BASIC,
7 bytes in Visual Basic, 7 bytes in QuickBasic, and 8 bytes in BASICA.
Despite the slight format differences, files BSAVEd under any of the
four above BASIC dialects correctly BLOAD into each other's BASIC.