FRE(-3) Gives "Feature Unavailable" in Compiled .EXE
ID: Q89231
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
SUMMARY
The function FRE(-3) returns available expanded memory in the
interpreter environment (VBDOS.EXE); however, in programs compiled
with BC.EXE, FRE(-3) gives the error "Feature unavailable" (run-time
error 73). This behavior of FRE(-3) in a compiled program is not
described in the "Reference" version 1.0 manual or in online Help.
You can determine available expanded memory by calling the Expanded
Memory Manager Interrupt 67 hex, function 42 hex (Get Page Count).
MORE INFORMATION
In the Professional Edition of Microsoft Visual Basic for MS-DOS,
FRE(-3) produces error 73 even in compiled programs that utilize
expanded memory through overlays.
The following example program shows how to access an Expanded Memory
Manager (EMM) to determine available expanded memory.
Steps to Create Example Program
- Run Visual Basic and load the Quick library VBDOS.QLB that contains
the INTERRUPT procedure:
VBDOS /L
\
- Enter the following code:
DECLARE FUNCTION emm_free () AS LONG
OPTION EXPLICIT
'$INCLUDE: 'vbdos.bi'
PRINT "Free expanded memory:"; emm_free(); "bytes"
END
'
' Determine free expanded memory.
'
FUNCTION emm_free () AS LONG
DIM emm AS INTEGER ' File handle of EMM driver.
DIM ok AS INTEGER ' True if driver is present.
DIM r AS RegType ' INTERRUPT register.
emm_free = 0
' Test for existence of EMM driver.
emm = FREEFILE
ON ERROR RESUME NEXT
OPEN "EMMXXXX0" FOR INPUT AS emm
ok = (ERR = 0)
ON ERROR GOTO 0
' Make sure EMM driver name refers to a device, not a file.
IF ok THEN
r.ax = &H4400 ' IOCTL: Get Device Data.
r.bx = emm
CALL INTERRUPT(&H21, r, r)
ok = (r.dx AND &H40) <> 0 ' OK if bit 7 is set.
CLOSE emm
END IF
IF NOT ok THEN
PRINT "Expanded memory driver not present"
END IF
r.ax = &H4200 ' EMM: Get page count.
CALL INTERRUPT(&H67, r, r)
IF (r.ax AND &HFF00) = 0 THEN
emm_free = r.bx * 16& * 1024&
ELSE
PRINT "Expanded memory error code "; r.ax \ &H100
END IF
END FUNCTION
- Press F5 to run the program. The program prints the amount of free
expanded memory.
REFERENCES
"Advanced MS-DOS Programming," Ray Duncan, pages 204, 617, Microsoft
Press, 1988
Additional query words:
VBmsdos 1.00 emm ems
Keywords :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :