DOS conventional memory layout
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 spac开发者_如何学运维e reserved?
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.
See here for a far detailed view of the DOS Memory layout here.
This link goes into more detail:
http://www.frontiernet.net/~fys/rombios.htm
精彩评论