MCPcopy Create free account
hub / github.com/NetHack/NetHack / memavail

Function memavail

outdated/sys/msdos/ovlinit.c:19–41  ·  view source on GitHub ↗

* memavail() Returns the amount of RAM available (in paragraphs which are 16 * bytes) - the amount to be reserved for heap allocations. * */

(minovl)

Source from the content-addressed store, hash-verified

17 *
18 */
19unsigned
20memavail(minovl)
21unsigned minovl; /* minimum size of overlay heap */
22{
23 unsigned available;
24
25 unsigned farparaavail;
26 unsigned tmp;
27
28 /*
29 * _dos_allocmem will return the maximum block size available.
30 * It uses DOS (int 21h) service 0x48.
31 */
32
33 _dos_allocmem(0xFFFF, &farparaavail);
34 available = farparaavail - RESERVED_PARAGRAPHS;
35 tmp = RESERVED_PARAGRAPHS + minovl;
36 if (farparaavail < tmp) {
37 panic("Not enough free RAM to begin a game of NetHack (%ld bytes)",
38 (long) ((long) tmp * 16L));
39 }
40 return available;
41}
42#endif /*_MSC_VER*/
43
44#ifdef __BORLANDC__

Callers

nothing calls this directly

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected