Previous
Index
Next
INT 21 - DOS 2.11+ - GET OR SET MEMORY ALLOCATION STRATEGY AH = 58h AL = subfunction 00h get allocation strategy Return: AX = current strategy (see #01679) 01h set allocation strategy BL = new allocation strategy (see #01679) BH = 00h (DOS 5+), new extended strategy (lDOS) Return: CF clear if successful CF set on error AX = error code (01h) (see #01680) Notes: the Set subfunction accepts any value in BL for DOS 3.x and 4.x; 2 or greater means last fit the Get subfunction returns the last value set setting an allocation strategy involving the Upper Memory Area does not automatically link in the UMB memory chain; this must be done explicitly with AX=5803h in order to actually allocate upper memory a program which changes the allocation strategy should restore it before terminating Toshiba MS-DOS v2.11 supports subfunctions 00h and 01h, as does the TI Professional MS-DOS v2.13 BUGS: DR DOS 3.41 reportedly reverses subfunctions 00h and 01h SeeAlso: AH=48h,AH=49h,AH=4Ah,INT 2F/AX=4310h"XMS",INT 67/AH=3Fh SeeAlso: AX=4B80h"FreeDOS" (Table 01679) Values for DOS memory allocation strategy: 00h all memory first fit 01h all memory best fit 02h all memory last fit --- DOS 5+ --- 40h upper memory first fit 41h upper memory best fit 42h upper memory last fit 80h first fit, try upper then low memory 81h best fit, try upper then low memory 82h last fit, try upper then low memory --- lDOS --- 20h to 22h LMA then UMA, first/best/last fit 10h to 12h LMA-only, first/best/last fit mask 100h ignore UMB link and 'Z' in last LMCB, force enable UMA mask 200h treat multiple areas as single area (overrides mask 400h) mask 400h treat multiple areas as dual areas Notes: with the UMB link disabled, all MS-DOS v5 strategies turn into low memory only. with UMB link enabled, the strategies without mask 40h or mask 80h are effectively "low memory then upper memory" in MS-DOS v5 apparently the mask 40h takes precedence so that if both mask 80h and mask 40h are set (and UMB link is enabled) then the result is UMA-only allocation. MS-DOS v5 treats mask 80h as dual areas (prefer UMA allocation even if later/better/larger block would be found in the LMA), whereas the 00h to 02h strategies are treated as a single area (UMA is used if it has a later/better/larger block free). in lDOS, the masks are checked from the top: mask 80h has the highest priority, then mask 40h, mask 20h, and finally mask 10h. if no mask is set, mask 20h is used. if mask 100h is clear and the UMB link is disabled, mask 10h is always used as in MS-DOS. lDOS mask 20h (LMA then UMA) defaults to being a single area, while mask 80h (UMA then LMA) defaults to being dual areas. if masks 200h or 400h are set they will override this choice.