How to BSAVE and BLOAD Arrays Larger Than 64K
ID: Q35149
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
-
Microsoft QuickBASIC for MS-DOS, versions 4.0, 4.0b
-
Microsoft BASIC Compiler for MS-DOS and MS OS/2, versions 6.0, 6.0b
-
Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, version 7.0
SUMMARY
Microsoft Visual Basic for MS-DOS, version 1.0 allows the use of "huge"
dynamic arrays containing more than 64K when you compile your program
with the /AH option. However, because the BSAVE and BLOAD statements
use a 2-byte unsigned integer to record the file length, only 64K may
be contained in a BLOAD/BSAVE file. To save an area of memory larger
than 64K, you must break the region into blocks (which may overlap),
each smaller than 65,536 bytes. To BSAVE each block, it is important
to do a DEF SEG and VARPTR for the start of the region. A "Path/File
Access Error" may result if those steps are omitted.
This information is also included with the Help file provided with the
Standard and Professional Editions of Microsoft Visual Basic for
MS-DOS, version 1.0.
MORE INFORMATION
' You must invoke Visual Basic 1.0 for MS-DOS with the VBDOS /AH
' option.
'
' This code BSAVEs and BLOADs a 128,000 byte array.
OPTION BASE 1
DEFINT A-Z
'$DYNAMIC
DIM nums(32000, 2)
FOR k = 1 TO 32000
FOR l = 1 TO 2
nums(k, l) = k + l
NEXT l
NEXT k
DEF SEG = VARSEG(nums(1, 1))
BSAVE "star52a.sav", VARPTR(nums(1, 1)), 64000
DEF SEG = VARSEG(nums(16000, 1))
BSAVE "star52b.sav", VARPTR(nums(16000, 1)), 64000
FOR k = 1 TO 32000
FOR l = 1 TO 2
nums(k, l) = 0
NEXT l
NEXT k
BLOAD "star52a.sav" 'Uses segment, offset recorded
BLOAD "star52b.sav" 'in the BSAVEd file.
PRINT nums(200, 2); " is 200+2"
PRINT nums(25000, 1); " is 25000+1"
Additional query words:
VBmsdos QuickBas BasicCom 4.00 4.00b 6.00 6.00b 7.00
Keywords :
Version : MS-DOS:1.0,4.0,4.0b; :6.0,6.0b,7.0
Platform : MS-DOS
Issue type :