Back to case studies

1995-1996 | Personal Project

A Journey into 1990s DOS Systems Programming

The Story

In 1995, working in a 16-bit DOS environment, I developed rHex, a complete and fully-featured hexadecimal file editor. As a teenager deeply passionate about understanding how software worked at its lowest levels, I needed a tool that was powerful, efficient, and highly customizable. Dissatisfied with the available options, I decided to build my own.

This project became a deep dive into systems programming. Written in Borland C++ 3.1, rHex was designed to be a professional-grade utility. It featured a sophisticated text-based user interface, advanced search algorithms, and, most importantly, the ability to handle (then) massive files—up to 2GB—on systems with very limited memory. This wasn't just a learning exercise; it was a production-quality tool that I distributed as shareware.

Thirty years later, rHex stands as the starting point of my software engineering career. The challenges I overcame and the principles I learned while creating it are the same ones that inform the high-quality, efficient, and user-focused solutions I build for my clients today.

The Challenge: Pushing the Limits of DOS

The primary challenge was to build a hex editor that could handle files far larger than the available system RAM. In the mid-90s, a typical PC had only a few megabytes of memory, yet files could easily be much larger. The editor had to be:

  1. Memory-Efficient: It needed to open and edit multi-megabyte (or even gigabyte-sized) files without loading them entirely into memory.
  2. Highly Performant: The user interface had to be instant and responsive, with no lag during navigation or editing, even on modest hardware.
  3. Feature-Rich: It needed to compete with professional utilities, offering advanced features like complex searches, a configurable UI, and robust file handling.

The Solution: rHex

rHex was my answer to these challenges. It was a complete, keyboard-driven application with a rich feature set designed for power users.

rHex Interface Screenshot (Conceptual)Click to enlarge

Key Features:

  • Dual-Pane Hex/ASCII Editor: A classic, intuitive interface for binary manipulation.
  • Large File Paging System: Could seamlessly edit files up to 2GB by intelligently loading 64KB chunks into memory.
  • High-Performance TUI: A custom-built, flicker-free UI that wrote directly to video memory for maximum speed.
  • Advanced Search: Supported searching for text (case-sensitive/insensitive), hex byte-strings, and numeric values (Byte, Word, DWord) with signed/unsigned options.
  • Deep Customization: Nearly every aspect, from the color of each UI element to the on-screen layout, was configurable and saved to a persistent .ini file.
  • Robust File Management: Included automatic detection and handling of read-only files.
  • Built-in Tools: Came with an ASCII table, a DOS shell escape, and a comprehensive help system.

Technical Achievements & What I'm Proud Of

Building rHex required solving complex problems with limited tools. The solutions demonstrate foundational engineering skills that are more relevant than ever.

Efficient Large File Handling via a Custom Paging System

To overcome memory limitations, I implemented a file paging mechanism from scratch. The editor only ever loaded a small (64KB) segment of the file into a buffer. The readpage() and writepage() functions used fseek() to navigate the file on disk, creating the illusion that the entire file was in memory. This approach to resource management is directly applicable to modern large-scale data processing and building memory-efficient applications.

High-Performance UI with Direct Video Memory Access

For a truly responsive feel, I bypassed standard DOS and BIOS screen-writing routines. Instead, I wrote a rendering engine that pushed data directly into the video memory buffer at 0xb8000000. This low-level optimization resulted in an incredibly fast and smooth user experience, demonstrating a deep understanding of hardware interaction and performance tuning. The principle of minimizing layers of abstraction to achieve performance goals is still critical in high-performance computing today.

Sophisticated Search Algorithm

The search function was optimized for large files. Instead of scanning byte-by-byte from disk, it would load large chunks into a buffer and perform the search there, minimizing slow disk I/O operations. It also featured a progress bar and was cancellable, showing an early focus on user experience during long-running tasks.

Building a Custom GUI Framework in Text Mode

I developed a reusable component-based system for the UI, including functions for creating windows (rwindow), dialog boxes, and progress bars (RJauge). This modular approach, even within a single source file, shows an early grasp of UI architecture and component design.

The Tech Stack (A 1996 Time Capsule)

  • Language: Borland C++ 3.1
  • Environment: 16-bit DOS
  • Tools: Borland Integrated Development Environment (IDE)
  • APIs: DOS interrupts, BIOS calls, and direct hardware access

From Then to Now: Timeless Engineering Principles

The experience of building rHex instilled core engineering principles that are central to my work today:

  • Performance is a Feature: My focus on UI responsiveness and efficient algorithms in rHex is the same focus I bring to building fast, scalable web applications and backend systems.
  • Resourcefulness and Efficiency: The constraints of DOS forced a deep discipline in resource management. This translates directly to writing efficient, cost-effective code in cloud environments where every CPU cycle and megabyte of memory counts.
  • A Commitment to First-Shot Quality: The compile-debug cycle on an 80286 processor was painfully slow; every mistake cost significant time. This environment instilled a crucial discipline: the need to write high-quality, correct code from the very beginning. It taught me to think problems through, anticipate edge cases, and code with precision. This "right-the-first-time" mentality has been a cornerstone of my career, leading to more robust and reliable software.
  • User-Centric Design: Even as a low-level utility, rHex was packed with features designed to improve the user's workflow—from cancellable searches to deep customization. I believe that even the most technical software should be intuitive and empower the user.
  • Ownership and Craftsmanship: As the sole creator of rHex, I was responsible for everything from architecture to documentation. I bring that same sense of ownership and attention to detail to every project I undertake for my clients.

This project wasn't just about writing code; it was about building a complete, robust, and useful product from the ground up. It's a story I'm proud of, and it laid the foundation for a 30-year journey in software engineering.