Vintage PC BIOS Modifcations

This particular article is not a technical how-to but an overview of theory based on my experience. At some point I hope to document things in a more technical manner.

Working with vintage PC’s often involves retrofitting new parts. A common example is replacing aged failing hard drives. The BIOS in many name brand 286, 386, and some 486 machines was hard-coded to support specific makes and models of hard drives and wouldn’t work with anything else. Some machines, of that era were more flexible in this regard but it’s a common issue nonetheless.

The system BIOS is just machine code stored in a chip on the mainboard. It is possible to reverse engineer and modify it but doing so typically requires in depth knowledge of Assembly Language programming and how the computer works.

There are many possible techniques but based on experience I think the steps below are a good representation of general method.

  1. Obtain the BIOS binary. This can be extracted via software, read from from the chip with an EPROM programmer, or downloaded online (if available). For most 286, 386, and 486 machines this is 64k in size, with some being 32k.
  2. If the binary is in multiple files then merge them into one complete copy. Many early machines had their BIOS stored in multiple EPROMs (usually labeled even and odd) with every other byte stored on the appropriate chip. These must be merged in the appropriate order to generate a complete single binary.
  3. Disassemble the binary, or parts of it, into Assembly Language code.
  4. Locate the appropriate section of code.
  5. Analyze the code and plan your modifications.
  6. Modify the binary.
  7. Re-checksum (I usually disable checksum testing to make testing easier).
  8. Test the result in an emulator if possible. (optional)
  9. Program the binary into the BIOS chip.
  10. Test the result.

From one extreme… Simple Hex Editing can be performed (skipping steps 2-5) by the skilled coder but this can get complicated quickly.

To the other extreme… Producing Reassemblable Code from a full disassembly is certainly possible with extreme manual effort but I don’t believe this is a common technique. I have only done this with very small binaries (not BIOS’s) and I used a purpose-built disassembler that I wrote myself specifically for the task and then much manual tweaking.

Middle Ground… A Scriptable Hex-Editor (for lack of a better term) is my personal ‘hybrid’ approach using software that I wrote for my own use. Instead of editing the binary manually it allows me to specify the changes I want to make so they can be done in applied in a controlled and reversible manner. This also eases the injection of new code.