Re: Assembly Question
From: Beth (BethStone21_at_hotmail.NOSPICEDHAM.com)
Date: Sat, 09 Oct 2004 02:50:02 GMT
Herman Dullink wrote:
> > The reason I ask is because 32bit asm programs don't run under 16bit
> > dos, even though the CPU is excatly the same.
> 32-bit programs do run under 16-bit DOS, but DOS has no loader for
> them. Most 32-bit programs either have 16-bit loader a part of the
> program (e.g. a DOS extender), or rely on another 32-bit program
> already running (e.g. Emm386, pre-NT Windows).
Actually, does anyone remember WIN32S? This allowed 32-bit Windows programs
to be executed under 16-bit Windows (which itself was a DOS
application)...so, actually, 32-bit programs could - to an extent -
actually be run via WIN32S and 16-bit Windows under what was essentially
the DOS operating system...basically, though, "why use WIN32S rather than
just use Windows 95?" was the mentality most people had and, hence, it was
never really used for anything but basic "compatibility" stuff...after all,
if your machine was good enough to run WIN32S, it was equally good enough
to run 32-bit Windows directly, so why not deal direct with the real thing?
Microsoft only created for "transition" with companies that, for some
reason, couldn't simply switch straight away to 32-bit Windows but might
need to run a Win32 app or two...
This add-on to 16-bit Windows was basically adding on the appropriate PE
loader, Win32 API set and that kind of thing...
Also, DOS was used by Microsoft as a "boot loader" for 32-bit Windows...and
you can use 32-bit "DOS extenders" to add 32-bit capabilities to DOS...
DOS itself doesn't support 32-bit programs simply because it was never
written that way...indeed, the design of DOS is firmly fixed in too many
"16-bit-isms" (real mode addressing "segments" are completely different in
16 bit and 32 bit mode on the x86 CPUs...well, you can use V86 mode for
"compatibility" but, really, you wouldn't want to do that, anyway, because
then suddenly you can only access 1MB of RAM only, as the 16-bit addresses
can't address more than that, thanks to Intel's nightmare "real mode
addressing" scheme :) to be easily converted...
Remember, DOS _predates_ the x86 becoming 32-bit with the '386 (it started
out life as a 16-bit CPU :)...and it really wasn't designed or written with
any "future proofing" in mind for going to 32-bits...and Intel completely
changed 32-bit addressing to work on a different scheme entirely to 16-bit
addressing (rightly so, from the perspective that 16-bit real mode
addressing was a horrid "hack" of a design...really ugly and reason numero
uno why the x86 got the reputation as such a horrid CPU to program)...
DOS itself doesn't run 32-bit programs (not without the required
"extenders" and such added on, anyway :), simply because it was never
designed to do so...if you like, this is similar to asking why "caveman
Bob" didn't use a flame thrower to "invent fire" back in the Stone
Age...because, simply, flame throwers weren't invented yet...DOS was
written for 16-bit x86 CPUs and when those CPUs went 32-bit, DOS stayed
where it was (basically because it was almost "hard-coded" in the way it
operated to be 16-bit and because Intel delibrately made changes to 32-bit
operation of the CPU - most specifically memory addressing, as the 16-bit
stuff was seriously flawed - as they added on the capability...the
rationale being simply "well, if programmers are going to have to rewrite
things to use the 32-bit capabilities, we might as well as also 'fix' a few
mistakes in the CPU design at the same time...