DOS/4GW made Windows 95 game compatibility easier, but with higher stakes
devblogs.microsoft.com
devblogs.microsoft.com
But to try to give you an idea: I was in an OS/2 seminar (because, well, OS/2 was the future at that point in time) when someone from Microsoft circulated photocopies of an early DPMI document.
This instantly divided the audience in two groups: those who got it (and abandoned the OS/2 hype train that instant), and those who did not.
When (some years later: Internet time was not yet invented either) Windows 95 came out with pretty much flawless DOS compatibility, whereas OS/2 was still struggling to run more than one DOS app simultaneously (with DOS apps still being very much the only revenue-positive game in town), OS/2 was effectively dead.
Sure, NT put the nails in the coffin, but it would be a few years before typical consumer/business hardware could reliably run that. With DPMI (an API, not even a product...), Microsoft settled the OS wars (as they were at the time...) decisively.
Why? Was there something stopping OS/2 from implementing DPMI as well?
OS/2 2.0 added DPMI support so it can run there, although this anecdote is presumably from the OS/2 1.x era.
GUI? Multitasking?
But was it even viable to use anything but DOS for gaming back then? WinG/DirectX took a good while to show up, and I'm not sure if OS/2 ever developed anything comparable.
Windows gaming was mostly things like chess and solitaire until then.
Unless you actually bought an IBM machine, it probably didn't have OS/2 installed. So you would need to actually buy OS/2, (and also a RAM upgrade, with OS/2 needing more than Windows 3.x), and if you wanted to run (16bit) Windows Apps, I believe you needed to buy the more expensive "Blue Spine" version.
This doesn’t match my recollection. Yes, 16-bit OS/2 1.x did poorly with DOS because it couldn’t use the 386 virtualization capabilities, but 32-bit OS/2 2.x was a great environment for multitasking DOS apps. It definitely supported DPMI too.
Many people ran complex apps like 3D Studio under OS/2 rather than plain DOS. It even had the ability to preemptively multitask Windows 3.0 apps which Windows itself didn’t.
IBM used to have a marketing slogan for OS/2:
“A better DOS than DOS and a better Windows than Windows.”
Unfortunately that was a fairly niche market after all. People didn’t want a somewhat better environment for running Windows apps in parallel sandboxes when it came with so much installation hassle and such high system requirements. With practically no native apps and losing the ability to run Windows soon (since IBM’s license only covered Windows 3.x), it had no chance.
I remember this as well. For a while I was running Windows apps on OS/2 Warp instead of Windows for just this reason.
This did not work in Windows95. OS/2 did it almost perfectly (it missed the occasional frame but not enough to matter)
I used to work with Impulse Tracker and spend lots of time with the Demoscene and IIR there was a way to kill Win95 and drop back to pure DOS (or boot into DOS instead) and things worked fine there. Windows 95 in that sense still just felt like a very powerful shell over MS-DOS like Windows 3.1 and it wasn't until we got the NT derivatives (XP etc.) that I, and the demoscene, reluctantly gave up on DOS mode software.
It took the scene a very long time to bounce back from that transition, and in some ways it came out of it a very different scene.
https://news.ycombinator.com/item?id=35919612
tldr: https://devblogs.microsoft.com/oldnewthing/20160411-00/?p=93... Intel screwed up implementing v86 mode by missing one privileged accesses trap - Protected Mode program (CPL 3) executing CLI and expecting POPF to restore interrupt flag. CLI will correctly trap, but POPF is silently ignored AND doesnt trap. No easy workarounds available.
However I think some versions of Windows used to run V86 code with IOPL = 3. At least I remember being able to run "CLI, HLT" instructions in DEBUG inside a DOS box and locking up the entire system.
"Intel screwed up implementing Protected Mode by missing one privileged accesses trap - Protected Mode program (CPL 3, IOPL < 3) executing CLI and expecting POPF to restore interrupt flag. CLI will correctly trap, but POPF is silently ignored AND doesnt trap. No easy workarounds available."
One of the prominent victims is Doom. Works in Windows only due to hacks.
The same thing happened when Microsoft backed down with hardware OEM's and let them ship Vista on laptops with 512MB of memory
I'm sorry, but I was on the internet before 1995
That was hardly universal. I remember running multiple dos-native _games_ on os/2. Yeah, they were slow; they were slow when running under DOS as the only app running, but they ran. I never had any compatibility issues. It was one of the most "fun" OS's I've ever hit.
Of course, no way IBM would have done that.
It's funny because at that moment in time I was running DOS games, and most of them worked without issues and I was thinking that Win95, wasn't too different and just a UI, like it was Win 3.1x
Something about the multitasking in Win95 (among other things) was so different in Windows 3.1, even on the same hardware. You could clearly see processes passing control to each other and updates were so slow.
Was it the Happy Days music video that came on the Win95 CD? :)
[1] https://www.youtube.com/watch?v=kemivUKb4f4 [2] https://www.youtube.com/watch?v=iqL1BLzn3qc
That's exactly what was different: Windows 3.1 used only co-operative multitasking (for 16-bit Windows apps anyway), where apps have to yield control to eachother, whereas Windows 95 added pre-emptive multitasking where apps will give up control when the OS wants them to, whether they like it or not.
I mean, if I’m using an old closed-source application, what would be the advantage of changing its extender?
Maybe for very specialized stuff like 3D Studio it'd make a difference.
> Once a game uses this, it is expected to run faster and better in DOSBox.
The references on Wikipedia could shed some light https://en.wikipedia.org/wiki/DOS/32
The most concrete I've noticed is
https://web.archive.org/web/20171224010653/http://dos32a.nar... > DOS/32 Advanced DOS Extender provides full compatibility with Watcom C/C++ and features one of the most complete software emulations of DOS/4GW, thus allowing the users to "plug" it into the protected mode programs which use DOS/4G, DOS/4GW, DOS/4GW Professional and any other compatible DOS Extenders without the need to modify a single line of code.
>
> DOS/32 Advanced DOS Extender has been designed to be fast, flexible and reliable. It features very fast mode translation and interrupt servicing, ability to configure and bind the DOS Extender to applications, protected mode executable compression, support for allocation of up to 2 GB of memory, Null-pointer protection and more.
There's also HTML docs in the repo: https://github.com/yetmorecode/dos32a-ng/tree/main/docI guess Dosbox is accurate enough for a 386dx with an ega card, and this book ( https://www.amazon.ca/Programmers-Guide-Ega-Vga-Cards/dp) is good enough for the guide?
For development tool I plan to use vscode with openwatcom C compiler.
Any other book I should take to learn assembly and DOS C? I already know some C but I guess it's a bit different than the old C.
With few exceptions, C++ can mostly be treated as a superset of C.
1) Mixed declarations and code. All variables must be declared at the top of a basic block.
2) Along similar lines, declaring variables in control statements like for().
3) // comments. (Hardly a critical feature, but you're probably used to having them.)
Perhaps not coincidentally, I think these were all features which began their life in C++, and were backported to C in C99.
OpenWatcom (the compiler the parent post mentioned) supports C99.
This is still idiomatic to the C community, even if it isn't strictly required any longer. About the only place it's ignored is inline variables for loops.
This will fail to compile with an "undeclared identifier" error:
if ( x > 0 )
{
int y = 1;
}
printf("%d", y);
It is a feature that was long overdue in C IMHO.As a side note, if you want to go Commander Keen style, you won't have the pleasure to use DOS/4G. CK, alike Wolfenstein 3D, use real mode. Personnaly, I find having to deal with near/far pointers a huge turn off from programming this way.
I'll try out real mode and see what happens. I read about near/far pointers some 30+ years ago in one of my father's programming books so that's the only thing I know about them -- I heard about them :D
You will also want to start with a 16-bit C compiler like Borland Turbo C or Microsoft C, a lot of the code is very different from the 32 but protected mode versions
There's always DJGPP which Quake was written in, but again 16-bit DOS code isn't going to run as-is.
TBH I don't know if Commander Keen is using protected mode. I do not understand the code and I assume not. I need to know how to program and compile for DOS 16-bit, as you said, and how to inline assembly, and how to use assembly to put pixels on screen using a virtual ega card provided by dosbox.
The parent post mentioned they're going to use OpenWatcom which is an actively developed[0] C and C++ compiler that targets 16bit DOS (among others).
86Box was forked from PCem which is kinda similar but PCem development has practically stopped and all development nowadays goes towards 86Box.
Also FWIW do not use plain Dosbox, it has longstanding bugs that haven't been fixed in years (some have been fixed in SVN but they haven't made a new major release for a very long time). Use Dosbox-X or at least Dosbox Staging instead (Dosbos-X is more accurate). As an example Post Apocalyptic Petra[1], a game i made ~3 years ago for a DOS game jam doesn't work on plain Dosbox because of some timing issues (you may get a black screen or visual glitches) - you need either Dosbox-X or Dosbox Staging.
Also note that these projects have slightly different goals: 86Box tries to emulate the hardware as precisely as it can whereas Dosbox(-X/Staging/etc) tries to provide a compatibility layer for running older software (plain Dosbox is only focused on games but other forks expand that to include all software). This means that Dosbox(/etc) will be more likely to ignore "bad" programming that wouldn't work on (or only work on some) real hardware - e.g. its Sound Blaster emulation is very forgiving and if you write some SB code and test it only on Dosbox chances are it wont work on the real hardware.
I know you said you're using openwatcom, but if you're not familiar with DOS, I'd suggest running through https://fabiensanglard.net/Compile_Like_Its_1992/index.php to build Wolfenstein with Borland C 3.1. The public Keen Dreams repo is very similarly structured and will build with BC3.1 as well.
Others have mentioned the Abrash black book. The example code is available in OCR'd form (and compiled!) at https://github.com/othieno/GPBB/tree/master/codebase/source . Some scrolling examples (but not in color mode!) are in https://github.com/othieno/GPBB/tree/master/codebase/source/... - you can use them to see the difference between Virtualbox (which doesn't emulate the finer details of a VGA) and emulators like 86box/PCem/DosBox.
Getting data into and out of the more accurate emulators can be a pain. Personally I use VirtualBox with a 32-bit Windows image to do builds. It has network access and VirtualBox shared folders connect it to my desktop. It can run DOS and 32-bit windows toolchains, which covers everything that existed in the DOS programming days. To get things to either PCem, or my real 386sx, I mount a virtual floppy image in VirtualBox, or connect a Sabrent USB drive to write a real floppy, respectively.
(Something like PC-NFS or Microsoft's DOS SMB client would be the easiest way to get data into PCem/86box/etc. I'm yet to set it up).
I'll read Abrash's book too but I'll go very slowly. First step is to compile a Hello World using the dev env, and I'll go from there.
That is Microsoft-speak for "We're going to patch SimCity because we need that to run absolutely." and I have nothing but the utmost respect and admiration.
It also made me realize that changing anything in windows is probably very expensive.
DOS/4GW was not the only game in town, there were a few of those 32bit extenders, I recall using sth called WDosX to run Delphi compiled (win32) exe in DOS. DOS/4GW was probably the most popular one partly thanks to the popularity of Watcom C compiler.
Another one was CWSDPMI. Just found it on my old backups.
As for DOS4GW popularity, it all exploded when DOOM was released :)
And you could mix and match (if u have written good parametrized makefile/s that is), i had like 6 compilers vs 3-4 diff.extenders (but not all combinations possible)
interesting times these were. internet? what's that?
Unfortunately it looks like the X32 DOS extender link on the page below is dead.
I wouldn't expect too much from Apple in terms of game compatibility (they'd much rather see developers port games and sell them in the App Store). Traditionally, they have put very little care into video games on their desktop grade machines.
You could probably write a lutris-like Game Porting Toolkit wrapper, I imagine you may be able to make some cash off of that too.
MacOS got lots of OpenGL fixes around 2010 when Steam for Mac launched. Problem was most Macs at the time didn't have competitive graphics hardware so unless you had a Mac Pro only older games ran properly.
The Mac wasn't really built for gaming and there's nothing wrong with that. Sadly, that does make me believe that Apple won't put serious effort into cross platform gaming like Valve has done on Linux; they will probably bring out porting tools every now and then, but I don't think they'll make game compatibility a first class citizen like Valve has done for Linux. If that was their intention, they wouldn't have put the distribution restrictions on their game porting toolkit.
I'm not sure how a Vulkan-to-Metal translation engine is supposed to help with porting, though; including a custom Wine build makes sense, but without Apple's Vulkan/DX translation layers you won't get much out of Wine directly. It's also not as if the toolkit spits out code that'll turn Vulkan calls into Metal calls. The whole thing just feels like a proof of concept to me, a demonstration in the sense of "look at the 30-60fps you can get on low-medium settings on our hardware!" rather than an intent to actually port existing games to macOS.
I believe I had to do that to run some games in SVGA mode. It might've been KKND or some other game...
[0] It didn't help what I had a 40Mb HDD as the primary master, because nobody knew the proper jumper settings to change it to the slave and 120Mb DBLSPACEed WD as the slave. I think the regular working setup had only ~580Kb of low memory.
Fun fact, Win95/98 could of course run 32 bit DPMI apps without a problem, and many of the relevant OS interrupts such as 21h could be invoked directly from protected mode.