locked
Generating real-mode, 16-bit, DOS executable with Visual C++ 5.0

    Question

  • I am going over the electronic doc in order to findout information about this but I can't find any answer for this.

    If anyone can answer me that would be great.

    Also, I'd like to build 16-bit (Real-mode) or 32-bit (protected mode) DOS applications using the Microsoft Visual C++ Express (5.0) compiler and I'd like to find out if it can support these kind of code generation.

    Would I need a special linker (such as Pharlap) or any DOS extender for linking 32-bit code?

    thanks in advance!

    Sylvain

    P.S: Dont reply back asking why on ewould want to generate DOS based programs in 2006 :)  I have a special need for this !

    Saturday, September 09, 2006 9:00 PM

Answers

  • 16 bit real mode is definitly out of the question. All current Microsoft compilers and linkers are 32/64 bit.

    32 bit protected mode can only work if you find a DOS extender that is able to load a PE image (the exe format generated by the Visual C++) but I never heard of such a thing. In those time different exe file formats were used... Technically it should be possible... I wrote a small kernel that can be compiled with Visual C++ and booted from a floppy disk...

    There is also the problem of licensing... Usually Microsoft tools are licensed for creating software for the Windows platform. I haven't read the Visual  C++ Express license but if this is the case you probably cannot use it legally to create an application for FreeDOS...

    Probably oldies like Borland C/C++  5.01 would be a better choice...

     

    Saturday, September 09, 2006 10:37 PM
  • Microsoft Visual C++ 1.52 is the only available version of a Microsoft C++ compiler that supports compiling 16-bit code.

    You need an MSDN Subscription to get it.

    Sunday, September 10, 2006 1:58 AM

All replies

  • I suppose you are talking about Visual C++ Express 2005 and not Visual C++ 5.0...

    Anyway, 16 bit is out of the question. None of these two IDEs support producing 16 bit executables. I think the last version of Visual C++ that supported 16 bit was 2.0...

    And even if you use a DOS extender I doubt you can make a Visual C++ generated executable work in DOS. You would need to avoid any call to Win32 functions and even the runtime library so you're left with pretty much no function to call...

     

    Saturday, September 09, 2006 10:10 PM
  • Mike,

    yes I mean Express 2005.

    I don't intend to use any IDE, just simple command line compilation.  I just need the compiler to be able to generate either 16-bit (real mode) or fro some other cases 32-bit (protected code).

    This is for target execution on a FreeDOS environment so I don't need any Win32 runtime library.  The target is a "PC on a chip" (PC104) that has a pentium on it.

    I have used V C++ 2.0 a long time ago but it could not generate protected mode code.

    So do you know for sure that I can't generate real-mode code (limited to that good old 640K limit) with this latest free compiler from Microsoft?

     I intend to do some experimentation with it but I figured it was faster to ask on this forum rather than wasting time trying things.

    I am also looking at other alternatives (such as DJGPP GNU, Borland C/C++ 5.01 and Metaware High-C)

    So please again let me know what I can generate with this MS EXpress C++ 2005 compiler (real mode for DOS ? protected mode for DOS?)

    cheers,

    Sylvain

    Saturday, September 09, 2006 10:18 PM
  • 16 bit real mode is definitly out of the question. All current Microsoft compilers and linkers are 32/64 bit.

    32 bit protected mode can only work if you find a DOS extender that is able to load a PE image (the exe format generated by the Visual C++) but I never heard of such a thing. In those time different exe file formats were used... Technically it should be possible... I wrote a small kernel that can be compiled with Visual C++ and booted from a floppy disk...

    There is also the problem of licensing... Usually Microsoft tools are licensed for creating software for the Windows platform. I haven't read the Visual  C++ Express license but if this is the case you probably cannot use it legally to create an application for FreeDOS...

    Probably oldies like Borland C/C++  5.01 would be a better choice...

     

    Saturday, September 09, 2006 10:37 PM
  • Microsoft Visual C++ 1.52 is the only available version of a Microsoft C++ compiler that supports compiling 16-bit code.

    You need an MSDN Subscription to get it.

    Sunday, September 10, 2006 1:58 AM
  • Thanks Mike, Thanks Peter!

    With regards to Microsoft Visual C++ 1.52, would you know if it c an also generate protected mode code?  (I used it many years ago to generate real mode but never tried it to generate protected mode).

    Pharlap Dos Extender  is a good linker to produce an extended environment for any compiler that can generate the right obj file format.  I have used it (Pharlap) with Metaware Pascal 10 years ago or so at the shop I was working.

    Again the requirement to generate a DOS executable does not come from me but from a customer who has tasked me to investigate a good C compiler for cross development to run on a PC-104 running FreeDOS. 

    I agree that the licensing portin could be tricky !

    let me know if you have any knowledge about Visual C++ !.52 capability to generate (or not) protected mode OBJ files.

    best regards,

    Sylvain

     

     

    Sunday, September 10, 2006 3:40 AM
  • It seems that Visual C++ 1.52 includes "Pharlap's 286/DOS Extender Lite". See this page for some details:

    http://www.emsps.com/oldtools/mscpp.htm

     

    Tuesday, September 12, 2006 12:04 AM
  • Probably naughty posting it here, but have you tried looking at the Open Watcom C++ compiler. It supports the environments that you want.

    Thursday, September 14, 2006 10:48 PM