Microsoft KB Archive/35149
Article ID: 35149
Article Last Modified on 8/16/2005
- Microsoft Visual Basic for MS-DOS
- Microsoft QuickBasic 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft BASIC Compiler 6.0
- Microsoft BASIC Compiler 6.0b
- Microsoft BASIC Professional Development System 7.0
This article was previously published under Q35149
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.
' 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