The disk transfer area is a buffer DOS writes results into, at an address the program chooses. The name comes from CP/M: the FCB services (14h, 15h, 21h, 22h) read and write their records through it. Today its main user is the directory search, INT 21h AH=4Eh and 4Fh, which put each entry they find in the DTA.
1Ah sets the DTA to DS:DX. DOS only stores the far address; it does not check or clear the buffer. 2Fh returns the current address in ES:BX, which means it changes ES: in a .COM, PUSH CS / POP ES puts it back.
The default DTA
When a program starts, its DTA is PSP:0080h, the 128 bytes that hold the command tail. A find first with that DTA overwrites the program's arguments, so either read the tail first, or give the search a DTA of its own: 43 bytes are enough for 4Eh and 4Fh, 128 for FCB records.
MOV AH, 2Fh ; DOS: get the DTA in ES:BXINT 21hMOV OLDOFS1, BXMOV OLDSEG1, ESMOV DX, OFFSET ATM1MOV AH, 09hINT 21hMOV AX, OLDOFS1CALL PHEX ; 0080MOV DX, OFFSET INPSP1MOV AX, CSCMP AX, OLDSEG1 ; in a .COM, CS is the PSPJE SAY1MOV DX, OFFSET OTHER1SAY1:MOV AH, 09hINT 21hMOV AH, 1Ah ; DOS: the DTA is DS:DX from now onMOV DX, OFFSET DTA1INT 21hMOV AH, 2Fh ; ask againINT 21hMOV DX, OFFSET NOWM1CMP BX, OFFSET DTA1JE SAY2MOV DX, OFFSET OTHER1SAY2:MOV AH, 09hINT 21hPUSH CS ; 2Fh changed ESPOP ESMOV AH, 1Ah ; and the DTA back where it wasMOV DX, 80hINT 21hOLDOFS1 DW 0OLDSEG1 DW 0ATM1 DB "DTA at $"INPSP1 DB " in our PSP", 13, 10, "$"OTHER1 DB " somewhere else", 13, 10, "$"NOWM1 DB "DTA now at our buffer", 13, 10, "$"DTA1 DB 128 DUP(0)PHEX PROC NEAR ; print AX as four hex digits (changes AX BX CX DX)MOV BX, AXMOV CX, 4PHEX1:PUSH CXMOV CL, 4ROL BX, CL ; the top digit to the bottomPOP CXMOV DL, BLAND DL, 0FhADD DL, "0"CMP DL, "9"JBE PHEX2ADD DL, 7 ; "A" to "F"PHEX2:MOV AH, 02hINT 21hLOOP PHEX1RETPHEX ENDP
Whose DTA
DOS keeps a single DTA address, the running program's. EXEC sets it to the child's PSP:0080h, and a parent should not count on finding its own again after INT 21h AH=4Bh: set it again. A resident program or an interrupt handler that searches for files must save the DTA with 2Fh, set its own with 1Ah, and restore it before returning, or it destroys the search state of whatever program it interrupted.