rkl@cbnewsh.att.com (kevin.laux) (02/26/91)
In article <1991Feb25.232426.26002@digi.lonestar.org>, ghuffman@digi.lonestar.org (Gregory Huffman) writes: > > ;************************************************************************ > ;* This is the section of code that I can not get to work. * > ;* Whatever I do, the carry flag is always set after the memory request* > ;* and the error code in ax on return is 0008h which is Memory not * > ;* available (I think). * > ;************************************************************************ > > mov ah,048h > xor al,al > mov bx,01h ;Request one paragraph of memory > int 021h ;Call DOS to allocate memory > jc All_Error ;Error occured durring allocation > mov [All_Mem],ax ;Save allocated base This is correct usage and error code 08h is indeed insufficient memory. But you also need to check what's in BX when this error occurs as it will contain the size of the largest available block. The *other* thing you must take note of is whether or not the program ends up as .exe or .com. Com programs get *all* available RAM assigned to them by the EXEC loader function so function 48h will always fail unless memory has first been released after entering the program. In fact for Com programs the EXEC loader puts FFFFh in BX, calls function 48h knowing it will fail, then calls it immediately again because now BX contains the maximum available memory. -- ________________________________________________________________________________ R. Kevin Laux Email: rkl1@hound.att.com AT&T Bell Labs Voice: (908) 949-1160