The second way is used to create DOS programs in which is necessary to bore with segments.
In the flat model memory of Windows we can work more easily. 'Forget' the segments limitations (64kb).
The #2 mode is for unprotect mode. Limited to 64kb. You can forget it.
I think that when you use the #1 to do DOS programs you are in the console mode of Windows.
Hope this help.
In my opinion, segments are a leftover from DOS, in Win32 they are not really nesscery, except for maybe security in WinNT (Security is not a feature at all in Win9x).
All that is defined above are segments ('.data', '.code', etc.). In dos they actuly had a meaning, cause there where 64kb physical memory limits. Under protected mode and Windows segmentation method, all limits as such have disappeared, and the term segment now is thought of as where data & code etc is stored in a PE file.
disease,
The guys are right here, segments are part of the addressing mode
for DOS memory, in 32 bit FLAT memory model, they MUST not be used
as all of the normal segment values are set to the same offset.
the .386 or higher processor is necessary to force building 32 bit
code, without it you get 16 bit code. Segment addressing was two
part addressing, 16 bit has a 64k limit so to get around this an
extra 4 bytes were used to determine which segment was being used.
The problem was that memory was only available in 64k bits and this
meant some very messy tiling schemes to use large amounts of memory.
Of the 1 meg you could address with segments and offsets, above 640k
was reserved for the operating system so memory size was always a
problem in DOS code.
In FLAT memory model, you have the range of 32 bit which is theoretically
4 gigabytes. Machines and operating systems are not that big yet
but it means you can use far more memory in your applications without any
problems.
The lack of segments is why 32 bit PE files can mix code and data, the correct
term for these is SECTIONS, not SEGMENTS and these are defined by the
structure of the PE file, not the addressing mode. This is why 32
bit FLAT memory model code is a lot more fun to write and it is a
lot faster as well.
Regards,
hutch@pbq.com.au
by the way, it might interest someone, you can actually make an application that run in windows and in dos mode, you have to change the exe stub. there' s an assembly journal about that. check http://asmjournal.freeservers.com
This message was edited by roy, on 5/7/2001 5:56:24 PM