Compiling programs for Windows 95 and Pentium in 2021

I’ve recently wanted to get some programs compiled for Windows 95 running on a Pentium and faced the typical challenge of finding a compiler that will emit an executable suitable for a 25-year-old computer. While I knew which MS compilers would allow me to do it (Visual Studio .NET 2003 or Visual Studio 2005 SP1 with some exe patching, you can read more on Visual Studio versioning and compatibility), I didn’t want to install a copy of Visual Studio 2005 only to get the compilers (the standalone Visual Studio Build Tools weren’t available back then), I also skipped trying Microsoft Visual Toolkit 2003. But lets start with describing the target system.

The machine I wanted to compile for is a 1996 PC with a 200 MHz Pentium (non-MMX) CPU on an Intel Advanced/AS (Atlantis) motherboard with the 430FX (Triton) chipset, with 64 MB RAM and Windows 95 OSR2. I did install some updates:

  • Internet Explorer 3.02. OSR2 comes already with IE3 integrated, this is just an update, since some programs specify this as a minimum. On vanilla Windows 95 many programs will complain about missing SHLWAPI.DLL until you install IE3.
  • Visual Studio C runtime (MSVCRT.DLL) version 6.00.8797.0. This is the DLL Visual C++ from version 4.2 to 6.0 compile against. This version is included in (vc6redistsetup_enu.exe). Apparently you can find a more recent one in a Windows 2000 update (Q932590.exe), but I haven’t checked it out. This is also the DLL required by MinGW.
    • Common Controls Library (COMCTL32.DLL) version 5.80.2614.3600. Many programs expect these controls to be installed on your system and some will not work or look buggy with earlier versions. Windows 95 ships with 4.00.950 by default. Version 5.80 is included in vc6redistsetup_enu.exe linked above (it’s inside the 50comupd.exe file).
  • No IE4 Shell Update. The IE4 shell (the one integrated in the OS with Windows 98) is not as efficient as the classic 95 one, especially on a Pentium. I don’t see any good reasons to run 95 with the Shell Update instead of Windows 98.

I found it difficult to run programs even from the late 90s without these updates, so I consider these necessary for any box with Windows 95 installed.

What are the requirements to run programs on this system?

  • They must not be linked against KERNEL/USER/GDI functions introduced in later versions of Windows. I wanted something that works out of the box, with only necessary updates installed, with no DLL imports patching, no KernelEx.
  • They must not use instructions unavailable on the original Pentium in libraries. Even if you compile your program targeting the Pentium, if the libraries were targeting a newer CPU, your program won’t work when linked with them.

I’ve tested several GCC distributions: MinGW.org, MinGW-w64 and TDM-GCC in several versions. To check them I build some test programs. I found the wxWidgets samples to be quite good for testing, since they contain quite a bit of non-trivial code. I’ve also tested the CodeBlocks OpenGL template.

Here are the results:

versiondistributiontyperesult
4.9.2TDM-GCCposix-sjljPASS
5.1.0TDM-GCCposix-sjljPASS
5.3.0MinGW-w64i686-posix-dwarfFAIL – illegal operation
9.2.0MinGW.orgPASS
CodeBlock OpenGL template results

wxWidgets 2.8.12 samples tests, which require threads:

versiondistributiontyperesult
4.7.1TDM-GCCwin32-sjljPASS
4.8.1MinGW-w64x32-win32-sjljFAIL
KERNEL32.DLL:
InterlockedCompareExchange
4.8.2MinGW-w64i686-posix-dwarfFAIL
KERNEL32.DLL:
SetCriticalSectionSpinCount
4.9.2
5.1.0
TDM-GCCposix-sjljFAIL
KERNEL32.DLL:
InterlockedExchangeAdd
6.3.0MinGW.orgwin32-dwarfPASS
9.2.0MinGW.orgFAIL – Compilaton error
9.2.0TDM-GCCFAIL – illegal operation
wxWidgets 2.8.12 samples results

And last a quick test with wxWidgest 3.0.5, since 2.8.12 samples won’t with newer GCC distributions.

versiondistributiontyperesult
9.2.0MinGW.orgfail
GDI32.DLL:
SetLayout
wxWidgest 3.0.5 samples results

The GCC distribution most compatible with Windows 95 on a Pentium is the MinGW.org one, as it is still compiled targeting the first Pentium and has a version with Win32 threads.

Any distribution linking with winpthreads will fail on a Windows 95 machine, because winpthreads use APIs not available on Windows 95. This makes TDM-GCC versions newer than 4.7.1 unusable for any program using threads.

MinGW-w64 since version 5.3.0 need at least a P6 class CPU, unless you compile it yourself targeting the Pentium (haven’t tried this myself). The same is true for TDM-GCC 9.2.0. These errors manifest themselves as “Illegal operations”.

If you want to use wxWidgets, then wxWidgets 2.8.12 being quite old and no longer updated fails compiling on newer GCC versions. wxWindgest 3.0.5 started using APIs not available on Windows 95. So, unless you want to patch wxWidgets 2.8 yourself, you have to use an older toolchain.

Posted in Uncategorized | Tagged | Leave a comment

Transition to English

To make this blog accessible to a larger audience I decided to make some changes:

  • All new posts will be in English. This way they will be useful to more people.
  • Polish specific posts will remain Polish.
  • Older posts will be translated to English or deleted if they contain no important information.

English is not my native language so any corrections are appreciated.

Posted in Z życia bloga | Leave a comment

Flashing ARC console on AXPpci33

If you haven’t booted the motherboard yet, prepare it for booting:

  1. You need an AT power supply. Connect power to the J33 connector (make sure you don’t swap the two AT plugs – ground should be on the middle 4 pins). The J34 connector is optional, it provides 3.3V for the PCI slots (if you have PCI cards which need it).
  2. If you want to use the graphics console, you have to connect a keyboard. Make sure the keyboard works, especially when using a PS/2 connected through a PS/2->AT adapter. Otherwise you will have to use the serial console on COM1 (I don’t know what connection parameters are right).

You have to prepare the floppy with the most recent firmware. The one I found is version 1.6. It contains SRM X4.7-1860 and ARC 4.50. You can get it here. You will also need the mkboot utility to prepare the floppy. If you have a SCSI CD-ROM and want to use a CD, the AXPpci33 firmware is present on the Alpha Systems Firmware v5.7 CD, but booting it is not covered here – you have to use the documentation on the CD.

I assume you’re using the graphics console. You should see the SRM screen after about 20-30 seconds, it will then then turn to blue with a cursor, then you should see POST messages, but there is a possibility that you won’t be able to enter anything for another minute – if this is the case just press any key after a minute or so. The ‘>>>’ prompt should appear. If you haven’t seen any messages except for the prompt, it means the console is set to serial. You can check it with show console. If it responds with serial, then type set console graphics.

To boot the floppy enter b -fl 0,0 dva0. It should display some messages and end with jumping to bootstrap code. The computer will restart and after POSTing you should see the firmware update utility. If you it seems the system hung – you see only a cursor on blue background and the keyboard is not working – it means you have not set to console to graphics. Follow the instructions in the previous paragraph to do it.

Now you can update the firmware by issuing update arc. After the update run verify arc to make sure everything is all right. You can reboot now.

Posted in Uncategorized | Tagged , | Leave a comment

Debian GNU/Linux on 164LX

Although Windows NT runs well on the 164LX it is a quite old OS with limited software support. That’s why I decided to install Linux on that box. The process of installing Linux on an Alpha is similar to installing it on a PC, but there are several key differences.
Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Wstaw ‘Ze skanera lub aparatu fotograficznego’ w Word 2007

Wersje 2003 i 2007 pakietu Office zawierają funkcjonalność skanowania. Niestety Microsoft postanowił się z niej wycofać i w wersji 2007 najprostsze rzeczy wymagają przeróżnych obejść. Jedną z funkcji, których brakuje w Office 2007 jest opcja wstaw ‘Ze skanera lub aparatu fotograficznego’.

Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment