Emulating my old computers

Few things take me back to my childhood as effectively as my old computers. As a child, I’ve spent countless hours on them, not only playing but also learning a lot. They are getting very old now and can stop working any day in the future. But can I do anything to preserve them and the software that ran on them?

This is a journey that started a few years ago and is now mostly complete.

Enter PCem

PCem is a very interesting emulation project: it aims not just to run old software, but to emulate all the components from the old computers, this includes using the original BIOS.

Never having done any useful emulation myself, I’ve spent a few years checking this project from a certain distance, without doing any contributions. Things changed when the project began supporting hardware that was very similar to the ones present in my computers: I realized that I could use that as a base to learn and hopefully emulate them.

Doing the first computer: Hyundai Super-286TR

Me playing LHX Attack Chopper on my first computer, probably in 1991 or 1992

These are the specifications from my first computer, the Hyundai Super-286TR, which was bought circa 1991. The second column shows the status in PCem for each component.

Hyundai Super-286TRStatus on PCem
Award 286 Bios, for Chips and Technologies Single-Chip AT (SCAT) chipsetOK
F82C710 Super I/O with 1x IDE, 1x FDC, 1x Serial and 1x ParallelMISSING
AMD 286 12 MHz (have to check if it is 12 or 12.5)OK
1MB RAMOK
VGA OAK OTI-037C 256KBOTI-067 exists, should be similar enough to serve as a base
PC Speaker AudioOK
Drives A: (1.2MB 5 1/4″) and B: (1.44MB 3 1/2″)OK
~40MB HDD – don’t know the model, I was 5 when it broke. Probably a Connor CP3000 or another with the same geometry (type 33 in the BIOS)OK
8042 AT Keyboard controllerCPU turbo commands missing

This one was easy! After dumping all my ROMS (System BIOS MD5: 19a0e6a13c3b8df827add273468ebe02, VGA BIOS MD5: 0fd29240900f1fdc31aacf4c139b3457) all I had to do was implement the VGA adapter using a very similar one as a base and then implement the Super I/O configuration registers to handle PCem’s peripherals. The CPU turbo commands in the AT keyboard controller were even easier. Everything took just a few hours in total!

This system came with MS-DOS 4.01 and was later upgraded to MS-DOS 5. I don’t know if it was upgraded further before the HDD broke and unfortunately a few of the programs and games were not preserved and I can’t even remember their names! Nevertheless, I still have dozens preserved here.

The most used non-gaming programs were by far Word Perfect 5.1, BannerMania and SAS. I’ve played lots of games on this and I don’t have them all, but some are still with me. Some examples sorted alphabetically: Barbarian, Battle Chess, Blockman, California Games, Castle Adventure, Dangerous Dave, Grand Prix Circuit, Hocus Pocus, LHX Attack Chopper, Prince of Persia, Sokoban. I can’t also forget about the QBasic examples Nibbles.bas and Gorilla.bas.

POST screen
CMOS setup
MS-DOS shell in all its glory
Prince of Persia
LHX Attack Chopper
BannerMania
Word Perfect 5.1

Overall, it is a success!

Doing the second computer: Itautec Infoway Multimídia

It looked like this. Mine didn’t have the remote control or the TV capture card, though. Image from a magazine ad

This one was acquired circa 1995 and is called the Itautec Infoway Multimídia. We had no Windows 3.1 phase, jumped straight from DOS to Windows 95.

Itautec Infoway MultimidiaStatus on PCem
Intel Zappa (Advanced/ZP, Triton chipset, 256KB cache)Advanced/EV existed and was used as base
Pentium 75MHz Socket 5OK
8MB RAMOK
VGA Cirrus Logic CL-5434 1MB (Model: VI-720)OK, but hardware cursor only works with 2MB VRAM
Sound Aztech Sound Galaxy Pro 16 AB (FCC ID I38-MMSN824)MISSING
Drive A: 1.44MB 3 1/2″OK
850MB HDD Western Digital Caviar E-IDE WDAC2850 10ms 64K 4500RPM 16.6MB/s (810MB on base 2)OK, but identification is generic
CD-ROM 4x speed AZT 468-01I or AZT 468-02II had to implement the identification so that the included drivers are able to identify it
From the NS PC87306 I/O chip: 2x serial, 1x LPT, 1x at keyboardMISSING
14.400 modem (USRobotics I think! I don’t have it anymore)MISSING

This one was a little more complex. Implementing the motherboard, I/O chip and CD-ROM drive identification was easy with what PCem already had in place. I didn’t make the 1MB VRAM work (but attached the VGA to the same PCI slot to avoid re-configuration when using a dumped HDD image), didn’t implement the HDD identification and neither implemented the modem (but I SURE do miss those sounds!).

Lastly, the sound card: these Aztech cards are based on the AZT2316A chipset and are capable of acting as WSS (Windows Sound System) or as an Sound Blaster Pro v2. PCem implements both, but the problem is that there was absolutely no Aztech documentation to be found anywhere.

Because of the lack of docs, I’ve resorted to the Linux driver first. It included basic information on a few of the configs and initialized it to WSS mode using magic numbers, but it was not enough to make the original drivers work.

The next step was reverse-engineering by disassembling the original drivers and utilities, followed by testing my findings by poking at the registers on my real card. I’m not very good at reverse engineering but eventually I managed to get the card to work, including the option to save the settings to the onboard EEPROM!

After all this work, I’ve also added support to emulate cards with the related AZT1605 chip. Cards based on both the AZT2316A and AZT1605 were very popular with OEMs of the time, so I believe this will be useful to emulate many systems.

Settings testing
Playing test sounds
WSS / SBProV2 switching
The Windows utilities installed after every testing was done

Finally I put everything together. I can’t give a BIOS MD5 because there is a configuration space in the flash (and the BIOS upgrades for this motherboard should still be available on-line anyway). The VGA BIOS MD5 is 7f2c1fd555c2b8cf4d67e2c4fc13767f for the first 32KB of the 64KB ROM, the upper 32KB is all 0xFF.

During testing, I’ve encountered a curious behavior that I still don’t know if I should consider a driver bug or a game bug: the Windows 95 version of Descent II couldn’t play the Redbook (CD-Audio) tracks!

What happens is that the game calls auxGetNumDevs() to check if any of the AUX devices has caps.wTechnology == AUXCAPS_CDAUDIO, but this fails because the Aztech Win95 driver only returns a “Line-In” device. I’m not aware of any other game that does this and this is completely unnecessary. Other games that play CD audio correctly have the exact same initialization code, minus this check that only Descent 2 Win95 does. It would work if it just skipped this check and progressed with calling mciSendCommand() with mciOpenParms.lpstrDeviceType = "cdaudio", like other games do. There are some sound cards listed as incompatible in the game’s README.TXT file that are probably due to this.

Proving the Descent II Redbook audio hypothesis

For this computer, I still have all the included programs and games (properly dumped) along with everything I used in the following years. Going forward nothing is missing and every media I have put my hands on is properly dumped and archived with redundancy.

This one came with various CD-ROM titles:

  • Compton’s Family Choice (educational titles, including The Berenstain Bears stuff)
  • Compton’s Interactive Encyclopedia 1995 Edition
  • F-15 Strike Eagle III
  • The Berenstain Bears – Learning At Home Vol. 1
  • Neo, Neo Kids and Neo Wave (This was the era of “digital magazines” and these were from Brazil)
  • Zoo-opolis

Of course I also played too many MS-DOS and Windows games from the 90’s to list here, maybe someday I write something about them.

POST screen
Windows 95 booting
New users were met with a warning to create backup disks and register the computer
This is the standard frontend from the manufacturer
OEM data
Descent

What about printing?

The Epson LX-810 printer (picture from the manual)

We used an Epson LX-810 printer with these two computers. Maybe I could emulate it too? There is no printer support at all in PCem, but the LPT ports are implemented. Luckily, I’ve found and old never merged DOSBox patch from the 2000’s that implemented the ESC/P commands used to control the Epson printers. This patch alone was 99% of the way of emulating my old printer! After this, I’ve decided to tackle printing.

After porting the patch to PCem, I’ve discovered that it contained numerous printer communication, drawing and printer logic errors. After fixing all of those that I could trigger (by trying every combination of operating system, driver, program and print mode that I could think of), I think I have a reasonable emulation of the Epson LX-810.

The draft printing modes uses the font variations from here. Unfortunately these fonts do not have all the printable characters on my printer, they only support 7-bit ASCII.

The DIP-switch-selected high-speed draft printing isn’t implemented and the NLQ (Near Letter Quality) Roman and Sans Serif fonts should be specified by the user. Any good TTF font should have support for all possible characters and I’ve also completed the codepages and international character sets conversion to unicode.

For printing bitgraphs, there is an option to emulate the pins or just print continuously. I’ve also incremented PCem’s context menu to handle the front panel of the printer.

I hope to get rid of the truetype fonts and just use the same functions as the bitgraph printing if I somehow dump and understand the character ROM. Too bad I’ve skipped the printer when dumping the ROMs of my systems.

Analyzing a zoomed printer output in comparison to the original file inside Microsoft Word 6.0. When I took this screenshot I wasn’t fixing spacing in proportional TTF fonts yet.
Printing from Word Perfect 5.1. Not all positioning problems were fixed at the time of this screenshot, but at least nothing was being thrown around the page anymore.
The available options
The front panel is handled via PCem’s context menu

Bonus

While I was at it, in addition to fixing a few small PCem bugs, I’ve also added support for the Xi8088 IBM PC-XT clone project. This project is a XT clone with more “modern” peripherals (VGA, 1.44MB floppy disks, Adlib sound, CF-card adapter, PS/2 keyboard and mouse, etc.) and its GPL bios was a perfect fit for PCem. Works just like the real one that I’ve built!

XI8088’s GPL’d XT-compatible BIOS

Closing words

So, that’s it. A small summary of my journey to emulate part of my childhood. I couldn’t have done all of this without the great work of lots of people, so I’m really grateful to all of them.

One thing is still missing though: all the sounds made by the HDDs, floppies, PSUs, etc. Those are really fundamental to getting the experience “right”. Some very nice people are working on this, maybe someday it happens and then I can contribute before my hardware breaks forever!

Spinal’s “ToTaL DeSTRuCTioN II” Quake Server

“Total Destruction 2” was a very popular mod for Quake 1 in Brazil during 1999-2002. During the end of its lifetime, I was the maintainer after the original creator Fábio “Spinal” Reis Cecin decided that he was bored with Quake.

I also didn’t maintain it for long, but it was a fun experience. Recently I’ve found a small last patch that I don’t remember releasing and I’ve decided to finally release it as version 2.10. It’s dated May 14 2003 and wasn’t even compiled. Fixes two small bugs (weapon cycling selecting the axe when you don’t have it and the infamous “revenant zombie” lockup bug caused by the forced respawn introduced in the 2.08 version.) The archive contains a full manual.

Download (td210_with_sources.rar)

Update Mar 29 2016: More bugfixes and random respawns! Download (td211_with_sources.rar)

(Warning: brazilian portuguese mod! The english version was never updated past 2.063)

Game replay value

Sometimes I wonder, is it just me getting old or have the new games (from the mid-2000’s to nowadays) increasingly lost their replay value? I can easily replay many, many pre-2000 games from start to finish yet again, but most new games I buy only get one playthrough, if that much.

First person shooters are the worst offenders. While I can replay Doom or Quake as many times as I want, the oldest FPS that I replayed was Half-Life 2, which is now over ten years old!

Sometimes I think this is related to nostalgia and everything that comes with getting old, sometimes I think that it’s just the excessive attention to graphics detail and general gameplay blandness (in other words, more graphics, less gameplay) that make this happen. Either way, with all the retro-mania that’s going on lately, I can find places to buy old games (not just fancy new indie games that pretend to be retro but have mostly the same gameplay blandness as the newer ones) at affordable prices and that I will replay much more than the expensive new AAA ones. Also, Nintendo gets my kudos for releasing most of the new games that I can withstand replaying.

OpenBSD, a surprise

puflogh1000X248I will start this blog talking about OpenBSD, a very nice and often controversial Unix system that has really captivated me when all I wanted from it was a quick firewall.

News about OpenBSD are usually about its proactive security or the perceived toxicity of it’s leadership, so I will refrain from talking about any of that. Instead, I will focus on how someone that used linux for more than 15 years would feel when interacting with it for the first time.

It first should be noted that the base system is very compact but functional – a somewhat common feature with other BSDs, but even more so with OpenBSD because the team is very small. In the BSD world, the entire base system is kept under the same source tree. This is in contrast to the typical Linux distribution which is built from sources scattered around upstream developers, which then get configured and patched by the distribution maintainers. By doing this, the BSD developers can have a very integrated system, where every component is developed amongside the rest of the system, which is great for consistency and security.

For anything not in the base system, volunteers maintain a set of binary packages and a “ports tree”. The ports tree is based on the FreeBSD one, just a set of makefiles, patches and instruction on how to fetch and build the binary packages which are then installed, with dependency checking. The user can choose between installing a binary package directly or using the ports tree to build from source. Also in contrast from the typical Linux distribution, the packages get installed to /usr/local, since they are not technically part of the monolithic operating system. In Linux, /usr/local is typically populated by programs built from source without any sort of package management. Since I’m a Gentoo Linux user, using the ports tree was straightforward for me.

The installation and configuration are incredibly easy, everything is very well explained and no problems ocurred. It was also very fast, it even autoconfigured my wi-fi connection during installation, asking just for the SSID and WPA passphrase. This is great, most operating systems just try to run DHCP on the interface as if it was a wired connection and we generally have to put the installer in the background and configure a wireless connection from the console. (I’m looking at you, NetBSD.)

This was to be expected, however. I’ve heard more than once that OpenBSD developers tend to used notebooks for development, so their support for wi-fi and notebook hardware in general is very good, even ahead of Linux. Sometimes even Linux wi-fi drivers are derived from OpenBSD.

This brings me to another surprise, it detected and configured the Radeon GPU on the notebook. Another benefit of open source: wi-fi drivers in Linux benefit from OpenBSD and GPU drivers in OpenBSD benefit from the Linux DRM (Direct Rendering Manager – not the evil DRM) infrastructure. I don’t know about the GPL vs. BSD licensing in these matters.

With that all said, OpenBSD apparently makes a very fine and secure desktop operating system. I wasn’t expecting this and it was a great surprise. Very secure base system with driver support for lots of stuff (maybe not the latest and greatest, but just give it time) and a huge (9000+) package collection, plus a great documentation and easy configuration.

Speaking about documentation and configuration, OpenBSD takes the saying that BSDs have great documentation and takes it one step further, every single question I had was already answered in manpages and the two FAQs (OpenBSD FAQ and PF FAQ), meaning that I didn’t once had to ask google or someone else. In less than an hours I had the firewall installed on the notebook hardware (low power usage) with PF configured and the wi-fi acting as an access point, effortlessy.

Which brings me to the last point of this post: security updates. Since the team is very small, this is an area that suffers a lot, in my opinion. Firstly, security updates are only available for the -current branch and the last stable release. Second, the security updates are only released in source form. Yes, you have to recompile to get security updates for the system and for the binary packages you may have installed. For stuff compiled through the ports tree it’s okay, you installed from source anyway. But here we have no choice, it’s source only. Thankfully the system is very secure and security updates are few and far between, and you can analyze each one carefully and see if it applies for your use case, and even create release packages on you fastest system to install on the other ones. But still, a bummer in an otherwise very fine system – I loved it anyway!