Subject: Re: DR-DOS 7.03 Not Recognizing All Memory To: opendos AT delorie DOT com Date: Tue, 2 Jan 2001 14:28:04 +0000 (GMT) In-Reply-To: <20010102.035739.-173671.1.domanspc@juno.com> from "Robert W Moss" at Jan 02, 2001 03:42:23 X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: From: John Elliott Reply-To: opendos AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: opendos AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk : : I don't know "how" it works, but perhaps some of our programmer friends : could go into some detail on the subject. Oh gosh. Memory management on the Intel processor range is not a very nice topic. On the 8086, you have 1Mb of address space. To access more physical memory than that, you use additional hardware, to change what RAM appears at what address. Eventually a standard (EMS) was developed for controlling this hardware: somewhere in memory is a 64k "window" into the extra RAM, divided into four 16k slots. By making EMS calls you control which part of the extra RAM appears in which slot. Each memory expansion board would have its own EMS driver. On the 80286, the processor can address 16Mb, but only if it is put into protected mode. Otherwise it can only address 1.06Mb. DOS itself can't be run in protected mode, so in order to get at the memory, you have to switch to protected mode, do things with the memory, then switch back to real mode. The BIOS provides functions on INT 15h to do this, but they're not designed for more than one program to use. Usually XMS is used to stop programs fighting over the additional memory. Since the XMS driver only has to make BIOS calls, it can be the same for all 286 PCs, and supplied with DOS. In MS-DOS and DR-DOS 7, this is HIMEM.SYS; in DR DOS 6, it's HIDOS.SYS. XMS actually works by a "copy in and copy out" system - you allocate a buffer in main memory and use XMS calls to copy data from this buffer to XMS memory, or vice versa. This is partly because even in protected mode, a segment is still 64k, so you don't get much by using it - you get more segments, but that's about it. DR DOS also includes EMMXMA.SYS, which works like the 8086 EMS drivers mentioned above; it provides access to PS/2 memory cards using the EMS API. On the 80386 and higher, things become even more complicated. Firstly, protected mode now has 4G segments, so there are some good reasons to write protected-mode programs. Secondly, the processor can be switched to Virtual 86 mode, in which DOS programs will work, but you get some of the nice features of protected mode. In particular, in V86 mode you can say what physical memory appears in DOS's 1Mb of address space, just like those 8086 memory expansion boards. Hence EMM386, which allows you to do this using the EMS API. DR DOS EMM386 can either coexist with an existing XMS driver (like the MS-DOS HIMEM.SYS) or provide its own XMS services up to 64Mb. I think the 64Mb limit comes from the fact that if you count kilobytes with a 16-bit register, you can only go up to 64Mb. MS-DOS EMM386 needs HIMEM.SYS to be loaded first. These drivers need to be able to switch the CPU between real, protected and virtual 86 modes. Only one program at a time can do this, so the VCPI standard was created. This allows later programs (such as Windows) to ask the first one (eg HIMEM.SYS) to switch to protected mode, which they can't do themselves. Then we get DPMI. This is an interface that allows protected-mode user programs to run under DOS. They can directly access memory beyond 1Mb (unlike XMS, where you have to copy it to below 1Mb first). These are typically used with DOS extenders, which convert the protected-mode INT 21h calls to real-mode ones. : What in H$$$ you would need all that memory for beats me A very large database? ------------- http://www.seasip.demon.co.uk/index.html -------------------- John Elliott |BLOODNOK: "But why have you got such a long face?" |SEAGOON: "Heavy dentures, Sir!" - The Goon Show :-------------------------------------------------------------------------)