![]() The whole 1M byte memory space is available for both code and data. large Both code and data addresses are (segment, offset) pairs, always reloading the segment addresses. ![]() Data accesses don't change the DS and ES registers, allowing 64K of data. medium Code addresses include the segment address, reloading CS on access and allowing up to 1M of code. Code accesses don't change the CS register, allowing 64K of code. compact Data addresses include both segment and offset, reloading the DS or ES registers on access and allowing up to 1M of data. small All memory accesses are 16-bit (segment registers unchanged). Tiny All memory accesses are 16-bit (segment registers unchanged). ![]() The basic concept is to cleverly set different segment registers in the x86 CPU (CS, DS, ES, SS) to point to the same or different segments, thus allowing varying degrees of access to memory. One way MS-DOS compilers got around the 64K memory limitation was with the introduction of memory models. Notice that MS-DOS COM files (short for "command" files) are not the same as Component-Object Model files, which are an object-oriented library technology. Windows provides support for COM files via a special CPU mode. Note that COM files, by definition, cannot be 32-bit. The space before that would be used for passing data to and from DOS (for example, the contents of the command line used to invoke the program). (The programs could perform 'near' jumps by just giving an offset to jump to.)ĬOM files are loaded into RAM at offset $100. The good thing about this approach, however, was that no extra work was needed by DOS to load and run a COM file: just load the file, set the segment register, and jump to it. The downside was that the offset registers were only 16-bit and, therefore, since COM files could not change the segment registers, COM files were limited to using 64K of RAM. The offset registers, however, were fair game and served (for COM files) the same purpose as a modern 32-bit register. ![]() The segment register would be set by DOS and the COM file would be expected to respect this setting and not ever change the segment registers. Two 16-bit registers determine the actual address used for a memory access, a “segment” register specifying a 64K byte window into the 1M+64K byte space (in 16-byte increments) and an “offset” specifying an offset into that window. This is possible due to the segmented memory model of the early x86 line. 7 Imports and Exports - Linking to other modulesĬOM files are loaded into RAM exactly as they appear no change is made at all from the harddisk image to RAM. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |