INT 21 U - DOS 3.0+ internal - GET ADDRESS OF DOS SWAPPABLE DATA AREA AX = 5D06h Return: CF set on error AX = error code (see #01680) CF clear if successful DS:SI -> nonreentrant data area (includes all three DOS stacks) (critical error flag is first byte) (see #01687) CX = size in bytes of area which must be swapped while in DOS DX = size in bytes of area which must always be swapped Notes: the Critical Error flag is used in conjunction with the InDOS flag (see AH=34h) to determine when it is safe to enter DOS from a TSR(Terminate and Stay Resident) A program which remains in memory after terminating in order to provide services to other programs or the user. The name comes from the name of the DOS function call used to remain in memory after termination. setting CritErr flag allows use of functions 50h/51h from INT 28h under DOS 2.x by forcing use of correct stack swapping the data area allows reentering DOS unless DOS is in a critical section delimited by INT 2A/AH=80h and INT 2A/AH=81h,82h under DOS 4.0, AX=5D0Bh should be used instead of this function SHARE and other DOS utilities consult the byte at offset 04h in the DOS data segment (see INT 2F/AX=1203h) to determine the SDAsee Swappable Data Area format in use: 00h = DOS 3.x, 01h = DOS 4.0-6.0, other = error. DR DOS 3.41+ supports this function, but the SDAsee Swappable Data Area format beyond the first 18h bytes is completely different from MS-DOS BUG: calling this function with certain values in DX crashes Novell DOS 7.0 prior to Update 14 SeeAlso: AX=5D0Bh,INT 2A/AH=80h,INT 2A/AH=81h,INT 2A/AH=82h Format of DOS 3.10-3.30 Swappable Data AreaThe portion of the DOS data segment containing all of the variables used internally by DOS to record the state of a function call in progress. See also INT 21h Function 5D06h and INT 21h Function 5D0Bh.: Offset Size Description (Table 01687) -34 BYTE (DOS 3.10+) printer echo flag (00h off, FFh active) -31 BYTE (DOS 3.30) current switch character -30 BYTE current memory allocation strategy (see AH=58h) -28 BYTE (DOS 3.30) incremented on each INT 21/AX=5E01h call -27 16 BYTEs (DOS 3.30) machine name set by INT 21/AX=5E01h -11 5 WORDs zero-terminated list of offsets which need to be patched to enable critical-section calls (see INT 2A/AH=80h) -1 BYTE unused padding ---start of actual SDA--- 00h BYTE critical error flag ("ErrorMode") 01h BYTE InDOS flag (count of active INT 21 calls) 02h BYTE drive on which current critical error occurred, or FFh (DR DOS sets to drive number during INT 24, 00h otherwise) 03h BYTE locus of last error 04h WORD extended error code of last error 06h BYTE suggested action for last error 07h BYTE class of last error 08h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. ES:DI pointer for last error 0Ch DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. current DTAsee Disk Transfer Address (Disk Transfer AddressThe Disk Transfer Address indicates where functions which do not take an explicit data address will read or store data. Although the name implies that only disk accesses use this address, other functions use it as well. See INT 21h Function 4Eh for an example of the DTA's use.) note: may point into SDAsee Swappable Data Area during the DOS EXEC function (see AH=4Bh), so programs which swap the SDAsee Swappable Data Area must be prepared to move the DTAsee Disk Transfer Address to a private buffer if they might be invoked during an EXEC 10h WORD current PSPsee Program Segment Prefix 12h WORD stores SP across an INT 23 14h WORD return code from last process termination (zerod after reading with AH=4Dh) 16h BYTE current drive 17h BYTE extended break flag ---remainder need only be swapped if in DOS--- 18h WORD value of AX on call to INT 21 1Ah WORD PSPsee Program Segment Prefix segment for sharing/network 1Ch WORD network machine number for sharing/network (0000h = us) 1Eh WORD first usable memory block found when allocating memory 20h WORD best usable memory block found when allocating memory 22h WORD last usable memory block found when allocating memory 24h WORD memory size in paragraphs (used only during initialization) 26h WORD last entry checked during directory search 28h BYTE flag: INT 24 returned Fail 29h BYTE flags: allowable INT 24 actions (passed to INT 24 in AH) 2Ah BYTE directory flag (00h directory, 01h file) 2Bh BYTE flag: FFh if Ctrl-Break termination, 00h otherwise 2Ch BYTE flag: allow embedded blanks in FCBsee File Control Block 2Dh BYTE padding (unused) 2Eh BYTE day of month 2Fh BYTE month 30h WORD year - 1980 32h WORD number of days since 01jan1980 34h BYTE day of week (0 = Sunday) 35h BYTE flag: console swapped during read from device 36h BYTE flag: safe to call INT 28 if nonzero 37h BYTE flag: if nonzero, INT 24 Abort turned into INT 24 Fail (set only during process termination) 38h 26 BYTEs device driver request header (see #02597 at INT 2F/AX=0802h) 52h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to device driver entry point (used in calling driver) 56h 22 BYTEs device driver request header for I/O calls 6Ch 14 BYTEs device driver request header for disk status check 7Ah DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to device I/O buffer??? 7Eh WORD ??? 80h WORD ??? 82h BYTE type of PSPsee Program Segment Prefix copy (00h=simple for INT 21/AH=26h, FFh=make child) 83h BYTE padding (unused) 84h 3 BYTEs 24-bit user number (see AH=30h) 87h BYTE OEM(Original Equipment Manufacturer) a company which purchases components that are resold as part of its own products under the company's own brand name, e.g. a Gateway 2000-branded monitor may actually be a Mag or NEC monitor. number (see #01394 at AH=30h) 88h WORD offset to error code conversion table for INT 25/INT 26 8Ah 6 BYTEs CLOCK$ transfer record (see #01688) 90h BYTE device I/O buffer for single-byte I/O functions 91h BYTE padding??? (unused) 92h 128 BYTEs buffer for filename 112h 128 BYTEs buffer for filename 192h 21 BYTEs findfirst/findnext search data block (see #01626 at AH=4Eh) 1A7h 32 BYTEs directory entry for found file (see #01352 at AH=11h) 1C7h 81 BYTEs copy of current directory structure for drive being accessed 218h 11 BYTEs FCB-format filename for device name comparison 223h BYTE terminating NUL for above filename 224h 11 BYTEs wildcard destination specification for rename (FCBsee File Control Block format) 22Fh BYTE terminating NUL for above spec 230h BYTE ??? 231h WORD destination file/directory starting sector 233h 5 BYTEs ??? 238h BYTE extended FCBsee File Control Block file attribute 239h BYTE type of FCBsee File Control Block (00h regular, FFh extended) 23Ah BYTE directory search attributes 23Bh BYTE file open/access mode 23Ch BYTE file found/delete flag bit 0: file found bit 4: file deleted 23Dh BYTE flag: device name found on rename, or file not found 23Eh BYTE splice flag (file name and directory name together) 23Fh BYTE flag indicating how DOS function was invoked (00h = direct INT 20/INT 21, FFh = server call AX=5D00h) 240h BYTE sector position within cluster 241h BYTE flag: translate sector/cluster (00h no, 01h yes) 242h BYTE flag: 00h if read, 01h if write 243h BYTE current working drive number 244h BYTE cluster factor 245h BYTE flag: cluster split mode 246h BYTE line edit (AH=0Ah) insert mode flag (nonzero = on) 247h BYTE canonicalized filename referred to existing file/dir if FFh 248h BYTE volume ID flag 249h BYTE type of process termination (00h-03h) (see AH=4Dh) 24Ah BYTE file create flag (00h = no, search only) 24Bh BYTE value with which to replace first byte of deleted file's name (normally E5h, but 00h as described under INT 21/AH=13h) 24Ch DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to Drive Parameter BlockThe DOS Drive Parameter Block stores the description of the media layout for a logical drive, as well as some housekeeping information. See also INT 21h Function 1Fh and INT 21h Function 32h. for critical error invocation temp: used during process termination 250h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to stack frame containing user registers on INT 21 254h WORD stores SP across INT 24 256h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to DOS Drive Parameter BlockThe DOS Drive Parameter Block stores the description of the media layout for a logical drive, as well as some housekeeping information. See also INT 21h Function 1Fh and INT 21h Function 32h. for ??? 25Ah WORD saving partial cluster number 25Ch WORD temp: sector of work current cluster 25Eh WORD high part of cluster number (only low byte referenced) 260h WORD ??? temp 262h BYTE Media ID byte returned by AH=1Bh,1Ch 263h BYTE padding (unused) 264h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to device header when filename is character device 268h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to current SFTsee System File Table 26Ch DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to current directory structure for drive being accessed 270h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to caller's FCBsee File Control Block 274h WORD number of SFTsee System File Table to which file being opened will refer 276h WORD temporary storage for file handle 278h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to a JFTsee Job File Table entry in process handle table (see #01378 at AH=26h) 27Ch WORD offset in DOS DS of first filename argument 27Eh WORD offset in DOS DS of second filename argument 280h WORD offset of last component in pathname or FFFFh 282h WORD offset of transfer address to add 284h WORD last relative cluster within file being accessed 286h WORD temp: absolute cluster number being accessed 288h WORD directory sector number 28Ah WORD ??? current cluster number 28Ch WORD current relative sector number within file 28Eh WORD current sector number 290h WORD current byte offset within sector 292h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. current offset in file 296h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. temp: file byte count 29Ah WORD temp: file byte count 29Ch WORD free file cluster entry 29Eh WORD last file cluster entry 2A0h WORD next file cluster number 2A2h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. number of bytes appended to file 2A6h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to current work disk buffer 2AAh DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to working SFTsee System File Table 2AEh WORD used by INT 21 dispatcher to store caller's BX 2B0h WORD used by INT 21 dispatcher to store caller's DS 2B2h WORD temporary storage while saving/restoring caller's registers 2B4h DWORDDoubleword; four bytes. Commonly used to hold a 32-bit segment:offset or selector:offset address. pointer to prev call frame (offset 250h) if INT 21 reentered also switched to for duration of INT 24 2B8h 21 BYTEs FindFirst search data for source file(s) of a rename operation (see #01626 at AH=4Eh) 2CDh 32 BYTEs directory entry for file being renamed (see #01352 at AH=11h) 2EDh 331 BYTEs critical error stack 403h 35 BYTEs scratch SFTsee System File Table 438h 384 BYTEs disk stack (functions greater than 0Ch, INT 25,INT 26) 5B8h 384 BYTEs character I/O stack (functions 01h through 0Ch) ---DOS 3.2,3.3x only--- 738h BYTE device driver lookahead flag (usually printer) (see AH=64h"DOS 3.2+") 739h BYTE volume change flag 73Ah BYTE flag: virtual open 73Bh BYTE ??? Note: the only fields which remain valid BETWEEN calls to INT 21h are those in the initial "swap-always" portion of the SDAsee Swappable Data Area SeeAlso: #01690 Format of CLOCK$ transfer record: Offset Size Description (Table 01688) 00h WORD number of days since 1-Jan-1980 02h BYTE minutes 03h BYTE hours 04h BYTE hundredths of second 05h BYTE seconds