The question is rhetorical, the simple answer is that it is NOT DOS. There have been a number of questions from some of our newer members related to console mode programming and some of the answers have not been helpful.

There is a fundamental difference between DOS and win32 in the way that a console mode program functions. In DOS you can output text to the screen with int 21h 09h, write to file or device or write directly to b800 in CGA colour text mode.

In win32 you can only write to the console supplied by Windows and you can only write to this console by using standard windows API functions. It is important to note that these 2 types of code cannot be mixed, if you want to use DOS functions like int 21h, you write either a DOS MZ EXE file or a DOS COM file.

The addressing modes in DOS are different to win32. DOS is a segment/offset addressing mode where win32 is a FLAT memory model that does not have segments at all. DOS cannot address the linear memory that win32 uses and win32 cannot access the memory addresses that DOS uses, they are in fact different animals altogether.

The reason why some people are confusing the two is that they simply look the same and both will run in a Windows console. The difference is that a win32 program will not run in DOS at all. Some things can be done well in DOS, display in DOS in text mode is generally faster than the win32 console but alternatively, DOS programs will never be able to use greater than the 640k of DOS memory where win32 programs can access hundreds of megabytes of memory and process information a lot faster than DOS ever could.

If someone needs to write 16 bit DOS code, they will need to use a 16 bit OMF linker to link the preogram after it is assembled and they will need to learn the options in both ML.EXE and the 16 bit LINK.EXE to build the file correctly.

NASM, TASM and MASM can all build DOS EXE and COM files from memory so if yiou are interested in writing this older style of code, simply look up the documentation for the assembler you are using and run the options required to build DOS code.

Regards,

hutch@movsd.com
Posted on 2002-01-22 08:43:18 by hutch--
Well, nice that there's now a thread to refer to when confusion
arises and people can't get dos/console right ;).

Got a comments, though. Might be seen as pedantic, but...
here goes :).


The difference is that a win32 program will not run in DOS at all.
DOS programs will never be able to use greater than the 640k of DOS memory.

Well, that's not *entirely* true. Dos extenders makes both of this
possible - check out WDOSX at http://michael.tippach.bei.t-online.de/wdosx/ .
Heck, WDOSX even supports DLLs and has some limited win32 API
support.

Anyway, perhaps we should put some links, snippets, and API names
for console-mode programming here?
Posted on 2002-01-22 09:59:21 by f0dder
Posted on 2002-01-22 11:01:40 by BradB
Brad,

The various console toys written for MASM32 were written with the PowerBASIC console compiler and I am guilty of plugging it myself but we have to cater for many people here from many different language backgrounds so its probably not fair to make direct plugs for any product, no matter how biased I am in using it myself.

f0dder,

Its not like it matters but a DOS extender is no longer DOS in the historical sense. They could have been useful if windows had not completely destroyed DOS in terms of user base.

Regards,

hutch@movsd.com
Posted on 2002-01-23 02:23:15 by hutch--