The old FCB File I/O functions funnel all data through a program-global address called the DTA or Disk Transfer Address. Understanding and controlling the DTA is essential when working with DOS file operations and recursive directory searches.
Setting and Querying the DTA
Two DOS functions manage the DTA:
- DOS function 1aH (set DTA) — sets or changes the DTA. On entry:
AH = 1aH,DS:DXpoints to the new DTA buffer. Returns nothing. Reserve sufficient buffer area; DOS will detect and abort disk transfers that would wrap around within the segment or fall off the end of the current segment. - DOS function 2fH (query DTA) — obtains the current address of the DTA. Returns
ES:BXpointing to the current DTA.
Default DTA Location
When a program starts, its DTA is initially set to PSP:0080 — offset 80h within the Program Segment Prefix. DOS supplies a default DTA of 128 bytes at this location. See the DOS & BIOS Data Structures page for details on the PSP layout and program startup.
DOS Services That Use the DTA
The most commonly used DOS services that rely on the DTA are:
- Function 4eH — find first matching file
- Function 4fH — find next matching file
These functions are used with the FCB Read and FCB Write file operations, placing directory-entry data at the current DTA.
Important: If you use these functions in a recursive search through directories, remember to set the DTA to an instance-local area at each level. Failing to do so will cause data from deeper recursion levels to overwrite results at the parent level.
Related Interrupts
The DTA interacts with several system-level mechanisms. The INT 23H Ctrl-Break handler and PSP-based process management both play roles in how DOS maintains the DTA across program invocations. When a child process exits, the parent's original DTA and Ctrl-Break handler are restored from the PSP.