Getting the DTA Address Using INT86
ID: Q11785
|
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 2.00, 2.01, 3.00, 4.0, 4.0b, 4.5
SUMMARYProblem:
I would like to search for files with a given extension, save them in
an array, and display them on the screen for user selection using
Visual Basic for MS-DOS version 1.0 and the MS-DOS interrupt routine.
I have written a sample program that calls function 4E and 4F to find
the desired files. They appear to be working correctly, as the flag
returned in the low byte of register AX is showing 0 for each
successful find and 18 when no files exist or when the last file has
been found. However, I do not know how to read the DTA (Disk Transfer
Address) after I successfully find a file, thus I cannot store the
filename for later display.
Response:
In QuickBasic for MS-DOS versions 2.0, 2.01, and 3.0, you can perform
MS-DOS Interrupts by calling the external routine INT86. In the
Standard and Professional Editions of Visual Basic for MS-DOS version
1.0; and QuickBasic for MS-DOS versions 4.0, 4.00b, and 4.5, you can
call the external routines INT86OLD, INT86XOLD, INTERRUPT, and INTERRUPTX.
It is difficult to find the current DTA of a program (and its offset
is subject to change without notice); therefore, it is better to ask
MS-DOS (via INT 21, function Hex 1A "Set DTA") to reassign the DTA to
a location over which you have control. For the application indicated,
you should try the following:
- Issue the MS-DOS function call to change the DTA address (Interrupt
21h, function Hex 1A) to an address of a structure in your code
space (this way you will know where to find it).
- Perform your "Find first" (Interrupt 21h, function Hex 4E).
- Perform your loop of "Continue file search" (Interrupt 21h,
function Hex 4F).
Within your loop you may check your variables in the structure as
desired. The "Microsoft MS-DOS Programmer's Reference" manual includes
an example of how to set up the structure for the DTA in assembler.
The book "Advanced MS-DOS," by Ray Duncan (Microsoft Press, 1986) also
is a very helpful reference for using MS-DOS function calls.
Additional query words:
VBmsdos QuickBas BasicCom
Keywords :
Version : MS-DOS:1.0,2.00,2.01,3.00,4.0,4.0b,4.5
Platform : MS-DOS
Issue type :
|