blob: 67400d9f9ae868385338fb43a53a671f5f994c8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
** MEMAVAIL.C - Report available DOS memory
**
** public domain by Thor Johnson
*/
#include <dos.h>
long memavail(void)
{
union REGS regs;
/* Request impossibly large number of 16-byte paragraphs from DOS */
regs.h.ah = 0x48;
regs.x.bx = 0xFFFF;
int86(0x21,®s,®s);
return((long)regs.x.bx * 16L);
}
#ifdef TEST
#include <stdio.h>
main()
{
printf("Available DOS memory = %ld bytes\n", memavail());
}
#endif /* TEST */
|