BLOAD

Format

BLOAD string1, number1, number2

Description

This function loads data previously saved by BSAVE from a file to memory.
String1 should be the name of the file previously created by BSAVE.
Number1 should be the memory offset to load the data to. Number2 should be the number of bytes to read from the file (in the range of 1 to 32767). If DEFSEG has been set, it will be used as the data segment, otherwise, the default ASIC data segment will be used.

Example

DEFSEG = &hexB800
BLOAD "SAVED.DAT" 0 100

After execution of these statements 100 bytes will be read from the file "SAVED.DAT" and stored in memory start at 0 bytes from the start of the override data segment (which in this case happens to point to the beginning of video memory for a CGA card). Assuming a CGA card was present, the first 50 characters on the screen would contain data read from the file (don't forget that each screen character is represented by two bytes data and attribute, that's why only 50 characters will be displayed, assuming you are not in graphics mode).

Comments

This function is recommended only for advanced programmers. this statement will allow you to overlay any area of memory, and it is very easy to accidentally overlay your program or the memory used by DOS.

If ASIC detects an error executing this command, it will set the system ERROR variable. These error codes are listed in the Error Messages Chapter of the ASIC Manual.

This statement is slightly different from GWBASIC/BASICA in that you must specify how many bytes to read from the file. Also, the memory offset is not stored in the file by BSAVE, so you must specify the offset as number1 in ASIC. Offset is optional in GWBASIC/BASICA.

ASIC uses a slightly different file format than GWBASIC/BASICA, however, it is relatively easy to convert the GWBASIC/BASICA to ASIC format. GWBASIC/BASICA files have a seven byte header that ASIC does not have. If you strip off these 7 bytes and rewrite the file, ASIC should be able to process the file.

See Also

  • DEFSEG
  • BSAVE