tags:

views:

146

answers:

3

Conventional memory under DOS (fist 640kB) contains the operating system, drivers, and possibly one executing program. How is this memory laid out to avoid conflict between those programs? For example, is part of that address space reserved?

+1  A: 

See here for a far detailed view of the DOS Memory layout here.

Hope this helps, Best regards, Tom.

tommieb75
I don't think this article answers the question of conflict within the real mode address space.
abc
+1  A: 

This goes into more detail

http://www.frontiernet.net/~fys/rombios.htm

Arthur Kalliokoski
Good map, but I am interested in the 653,056 bytes from address 0x900. How does a compiler guarantee that my program (running in real mode) won't conflict with say a driver?
abc
DOS itself loads your program into the bottom of free memory, and you have the remainder of free memory to use for yourself (since DOS isn't multitasking). Drivers, TSR's and the like will be allocated memory which will either raise the "bottom of memory" your program is loaded to, or cut into the top of memory (BIOS extensions usually do this). If you're using a C compiler, it'll ask DOS for free memory, if you're doing it in assembler, the second 16 bit word holds the segment of reserved memory above your programhttp://docs.huihoo.com/help-pc/table-Program_Segment_Prefix.html
Arthur Kalliokoski
+vote. That comment and Eric J.'s answer is what I was looking for. Thanks.
abc
+3  A: 

DOS loads the program into memory, using information in the EXE header to relocate memory references to be correct relative to the memory block assigned by DOS when the EXE is loaded.

Having said that, nothing prevents your program from interfering with the OS, device drivers, etc. You can read and write any memory location. This technique was commonly used e.g. by TSR programs (rewriting the interrupt vector table) to hook the keyboard, timer, mouse, or similar and then terminate while remaining in memory.

Eric J.