Create a 16bit application? - c

I want to create a 16 bit Dos application and want it to run using the NTVDM.exe on my 32bit windows 7 machine. How do I do it?
I basically want my application to do the file operations through the NTVDM and for that I think I'll need a 16 bit application first, Is there any other way?
I don't need an Emulator, I need to create an 16-bit app

A couple free C/C++ compilers that claim 16-bit (MS-DOS and Win16) support are the Digital Mars compiler and the Open Watcom Compiler.
The Open Watcom webpage is unresponsive at the moment... There's a SourceForge download page though.

The last Microsoft Visual C++ compiler for 16-bit was 1.52c, available on MSDN Subscriber Downloads.
For free ones, see Looking for 16-bit x86 compiler.

Related

E2045 Bad object file Format:"XXX.obj"

I am working on one migration project from x32 bit to x64.
Here I am using this code:
{$L com_1.obj}
{$L com_is1.obj}
{$L com_2.obj}
But while compiling code I am getting error as
[dcc64 Error] XXX.dpr(919): E2045 Bad object file format: 'E:\MyProj\com_sha.obj'
I am not able to trace why it is happening.
Is it due to 32 bit obj file used for compiling x64 bit delphi project?
If it is I have also tried to create a obj file with x64 bit environment.
Can anyone please help me on this?
I am using Delphi 10 Seattle.
You cannot use a 32 bit object with the 64 bit compiler. You must recompile your code with a 64 bit compiler.
You can use a number of different compilers to do this. Although I have heard of people succeeding with gcc I have never managed to do that. I believe that the modern Clang based Embarcadero compiler can be used, but I personally have no experience of that. I have always used the Microsoft compiler to create 64 bit objects. And certainly this is how Embarcadero themselves have done it for libraries like zlib that they link to their RTL.
Yes you need to convert those .obj files to 64 bit.
Converting 32-bit Delphi Applications to 64-bit Windows states:
64-bit External .obj Files: If you expect your 64-bit Windows application to link to an external .obj file, keep in mind that you will need a 64-bit version of the .obj file to link with a 64-bit Windows application.

Need C compiler for Windows 7 64-bit, to compile to DOS target

I'm trying to find a solution to allow me to compile C code to a DOS executable from Windows 7 64-bit. I recently updated from XP 32-bit to Win7 64-bit, and now my Borland C++ 5.0 compiler won't work. I get an error when it tries to call tlink.exe 16-bit. I'm trying to avoid bringing over another computer with XP but that will have to be my course of action if I can't figure something else out soon.
My target is an embedded x86 running FreeDOS. As much as I'd like to transition to Linux I can't afford the time that would transition would take. Aside from the learning curve of never having used Linux, much of my code is DOS-dependent and would have to be re-written.
I'm hoping there's a windows setting I can just change but my research so far leads me to believe I need a more drastic change to my process. I've sniffed around at Turbo C 2.01, DJGPP, DOSbox... not really too confident to go down any of those alleys without some outside input
Run Virtual XP or VirtualBox and install Borland C++ inside. BTW, there is version 5.02 with some fixes (in case your version is exactly 5.0).
If you can find an old Microsoft Compiler, like 16 bit C / C++ 1.52 (which is included on the 32 bit C / C++ 4.1 cd-rom), or C 8.00 or earlier, it runs using a dos extender or in a 32 bit dos console window.
Why can't you run the Borland compiler using FreeDOS?
You could try to create a virtual machine with MSDOS on it, but you'd have to find a way to install MSDOS 6.22 on the virtual machine. At Microsoft's support site, they have links to a bootable ISO file for MSDOS 6.22. I still have the original floppies and started with those on an old system that has a floppy drive. It's a bit awkward to import / export files to / from the virtual machine.
This is the config.sys that I use that seems to work with Win 7 virtual machine. I had to increase buffers, stacks, and files to avoid a stack overflow problem with this setup.
dos=high,umb
buffers=40,0
files=60
lastdrive=e
shell=c:\command.com c:\ /e:1024 /p
stacks=64,512
switches=/f
device=c:\dos\himem.sys /numhandles:64 /testmem:off
device:c:\dos\emm683.exe ram i=b100-b7ff i=c600-c7ff i=cc00-cfff i=e600-efff frame=d000 a=32 d=128 notr
devicehigh=c:vmadd\cdrom.sys /d:mscd001
This is the autoexec.bat that I use (smartdrv is a bit pointless in this case so I commented it out with "rem" prefix) .
c:\dos\emm386 auto
lh c:\dos\mscdex.exe /d:mscd001 /m:7
rem lh c:\dos\smartdrv.exe
lh c:\vmadd\mouse.com
set path=c:\dos
set blaster=a220 i5 d1 h5 p330 t6
prompt $p$g
As for a compiler, Open Watcom seems to me to be the best choice in your situation. FrameworkPascal (written in the old version of Watcom) provides a 32 bit extender. Regarding the creation of a FreeDOS virtual machines, pickup the tools from Microsoft SysInteral. They include a tool that create a VHD. Once you get a FreeDOS running in a VM you can simply SYS the VHD and start it anywhere. There are plenty ready to run ISO images for FreeDOS, one worth mentioning is Seagate Seatools for DOS which is being distributed with the FreeDOS kernel.
Your best (but not only) solution for running all that is probably XPMode on Windows 7 Pro. It runs Windows XP 32 which of course provide 100 percent transparent compatibility via its NTVDM with DOS 16 bit real mode, 16 bits protected (Windows 3.1), and DOS 32 bit extenders.
NTVDM by the way is a feature that can be activated on Windows 10 Pro but it yet to be seen what exactly can be done with it there.
XPMode is a free downnload from Microsoft that installs a free version of Windows XP 32 bit in a virtual machine on Windows 7 Pro with full sharing of the cutpaste/copy buffer, USB, drives, screen and network card (web access). It can be toggled between a Window and full screen. The installation of XPMode is automated (after activation of the Windows 7 Pro VM). Microsoft provide various downloadable hot fixes that update the registry to activate the VM. There is an MS support downloadable hot fix that has to be run to allow the installation on the AMD Bulldozer architecture. XPMode hibernate its desktop and virtual hard drives making it a much more productive environment than a hardware based system.
With a little extra work Windows XP 32 bits can be installed on any virtual machine including Microsoft Virtual Machine on Windows XP 64 bits as well as Oracle Box and VMWare. XPMode however is probably the smoothest solution since some installations such as MS Virtual Machine for Windows XP 64 bits do not utilized the full physical display in full screen (only about 90 percent of it). If you install your browser and email in XPMode you can live in the full screen and forget about new versions of Windows.

need a way to run intel 16 bit MASM on a 64 bit machine, is this possible?

I am taking a computer architecture class, and we are learning assembly language on 16 bit machines. On-campus department labs have these machines available, but I want to be able to work on labs at home.
Where can I download MASM that can run 16bit code, I,m sure there is a way to do it, i just have to link 16 bit.
You can use dosbox, dosemu, or something similar to emulate an old x86 DOS machine, and run your 16-bit code on that.
I know this is 6 years ago, but to help others. Current MASM on Microsoft website is mainly for 32 and 64bit but you can get old versions here: http://bytepointer.com/masm/index.htm. and another one here http://www.masm32.com/licence.htm
I found that only old versions of MASM with FreeDOS, XP, DosBox etc will enable you to run the 16 bit code. You cant run 16bit executatable in a 64bit System.
Please let me know if it works.

how to make winxp ms-dos virtual machine work like win98 ms-dos especially graphics

Initially...
I started programming in C. that was was 10 years back(college). The IDE i used was Turbo C++ IDE.
All my c programs were 16bit.
Memory Model : Huge.
Graphics : 4bit (16 colors).
Graphics Driver: EGAVGA.BGI
Resolution: 640x480.
OS: MS-DOS 6.0 (under windows98 it is 7.0 - which always gave an accelerated execution of code)
Sample programs were [my computer like win3.1 still have some pending work], [paint brush - 16 colors], [graphics mouse pointer generator], 16 bit font generator... and so on..
(these i have not yet published anywhere).
It is huge(memory model) because i extensively used C Graphics Library of Borland Turbo C.
Here is my request...
I wanted to document my work. Just in leisure time. and to just rewind the old concepts
and to implement the same in win32 api.
I like the way i wrote the codes and i really enjoyed seeing the outout as expected but still wanting more for which i never gave up but it got outdated and i am with win32api.
The emulation of win98 16bit graphics was perfect. BUT in windows xp the virtual machine output was totally different and the graphics was shabby when i run my graphics programs(GUI).
Because of this i could not take a print screen of a module.
One alternative i have is to use a win98 machine... run my programs and then can do the print screen.
What i thought was there should be an option to emulate the real 16 bit environment in windows xp like in windows98. So i am here to get some suggestions. Thank you.
Have you tried DOSBox? It's something people use to emulate an old DOS environment for games. Try it out.
DOSBox comes with the emulated hardware most games and graphical applications from that era need (VESA VGA modes, Soundblaster/Adlib sound...)
Also, see the comparison of platform virtual machines on Wikipedia
For running MS-DOS applications you may use DOS-Box. It runs even on Windows Vista and 7.

Flash ocx "Class not registered" on Windows 7 x64

I have a WPF app that uses Flash10c.ocx developed on a 32 bit machine. I didn't have to register the ocx on my dev machine, I just installed the latest flash, added a reference and started coding. When testing on a 64 bit system I get ye old "Class not registered" which I think mean I need to regsvr the ocx. Is it Ok to just copy the 32 bit ocx (I'm pretty sure its 32 bit as its located in C:\Windows\System32\Macromed on the dev system) to a 64 bit system and register it?
Update: regsvr32 /i flash10c.ocx errors out with "The module flash10c.ocx las loaded but the call to DllRegisterServer failed with error code 0x80004005"
Update 2: I've given up on this and decided to run Flash on 32 bit systems only. If anyone has a better answer I'd like to hear it but I'm marking the current suggestion as answered to give due credit for the effort.
The reason it's not working for you is that your WPF application is running as 64-bit.
A .NET application is able to run as 32-bit or 64-bit; and the CLR is JITing your app to whatever architecture the application is running on - in this case 64-bit.
Except you now want your 64-bit application to load a 32-bit dll. This is not possible. A 64-bit process can only load 64-bit dlls. A 32-bit process can only load 32-bit dlls. No amount of fiddling with COM object registration will change this; it's not a question of missing registry entries.
Adobe Flash only comes as a 32-bit dll. Adobe does not now (and hopefully will never) have a 64-bit version.
In order for your WPF .NET application to load the 32-bit flash dll, it needs to be running as 32-bit process. There is a way, in Visual Studio's build configuration, to force your .NET application to only target x86, rather than Any CPU.
The choices of CPU targets are:
Any CPU
x86
x64
Itanium
Flash, for what it's worth, doesn't have an Itanium version, either.
See StackOverflow: Visual Studio “Any CPU” target for more discussion about target cpus.
May be the flash installer is meant to be only for 32 bit OS. Hence it did not install properly on a 64 bit machine. The error means that you will need to manually register the ocx but will it register successfully that's a totally different question.
Edit 1: here is Adobe's statement of support for 64-bit systems (there is none) (I assume you are using 64 bit browser on a 64 bit machine)
Edit 2: Another forum message about Flash on 64-bit Windows.

Resources