home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name mmfirst -- Report address of first memory control block.
- *
- * Synopsis firstblock = mmfirst();
- *
- * unsigned firstblock
- * Segment address (i.e., paragraph
- * number) of the first DOS memory block,
- * or 0 if error.
- *
- * Description This function reports the size of the first DOS memory
- * block.
- *
- * Returns firstblock Segment address (i.e., paragraph
- * number) of the first DOS memory block,
- * or 0 if error.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1989
- *
- **/
-
- #include <dos.h>
-
- #include <bmem.h>
- #include <butil.h>
-
- unsigned mmfirst()
- {
- union REGS regs;
- struct SREGS sregs;
- unsigned result;
- MEMCTRL ctlblock;
- unsigned nextblock;
- int ercode;
-
- regs.h.ah = 0x52;
- intdosx(®s,®s,&sregs);
- result = utpeekw(uttofaru(sregs.es,regs.x.bx - 2)) + 1;
-
- ercode = mmctrl(result,&ctlblock,&nextblock);
- if (ercode != 0 && ercode != 18)
- result = 0;
-
- return result;
- }