BLOAD Statement ---------------------------------------------------------------------------- Action Loads a memory-image file created by BSAVE into memory from an input file or device. Syntax BLOAD filespec$-, offset%- Remarks The BLOAD statement allows a program or data saved as a memory-image file to be loaded anywhere in memory. A memory-image file is a byte-for-byte copy of what was originally in memory. The BLOAD statement uses the following arguments. ----------------------------------------------------------------------------- Argument Description Argument Description ---------------------------------------------------------------------------- filespec$ A string expression that specifies the file or device from which to load a memory-image file. offset% The offset of the address where loading is to start. The starting address for loading is determined by the specified offset and the most recent DEF SEG statement. If offset% is omitted, the segment address and offset contained in the file (the address used in the BSAVE statement) are used. Thus, the file is loaded at the address used when saving the file. If you supply an offset, the segment address used is the segment set by the most recently executed DEF SEG statement. If there has been no DEF SEG statement, the BASIC data segment (DGROUP) is used as the default. If the offset is a long integer, or a single-precision or double-precision number, it is converted to an integer. If the offset is a negative number between -1 and -32,768, inclusive, it is treated as an unsigned 2-byte offset. Note Programs written in earlier versions of BASIC no longer work if they use VARPTR to access numeric arrays. Because BLOAD does not perform an address-range check, it is possible to load a file anywhere in memory. You must be careful not to write over BASIC or the operating system. Because different screen modes use memory differently, do not load graphic images in a screen mode other than the one used when they were created. Because BASIC program code and data items are not stored in the same locations as they were in BASICA, do not use BLOAD with files created by BASICA programs. BLOAD and Expanded Memory Arrays Do not use BLOAD to load a file into an expanded memory array. If you start QBX with the -Ea switch, any of these arrays may be stored in expanded memory. - Numeric arrays less than 16K in size. - Fixed-length string arrays less than 16K in size. - User-defined-type arrays less than 16K in size. If you want to use BLOAD to load a file into an array, first start QBX without the -Ea switch. (Without the -Ea switch, no arrays are stored in expanded memory.) For more information on using expanded memory, see "Memory Management for QBX" in Getting Started. BASICA BLOAD does not support the cassette device. See Also BSAVE; DEF SEG; SSEG; VARPTR, VARSEG Example The following example uses BLOAD to retrieve and display a drawing of a magenta cube inside a box. The BSAVE statement programming example shows how the drawing was created and saved on disk in a file named MAGCUBE.GRH. You must create the file MAGCUBE.GRH using the BSAVE statement programming example before you can run this program. DIM Cube(1 TO 675) ' Set the screen mode. The mode should be the same as the ' mode used to create the original drawing. SCREEN 1 ' Set segment to the array Cube's segment and load ' the graphic file into Cube. DEF SEG = VARSEG(Cube(1)) BLOAD "MAGCUBE.GRH", VARPTR(Cube(1)) DEF SEG ' Restore default BASIC segment. ' Put the drawing on the screen. PUT (80, 10), Cube