Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✅ PROJECT COMPLETE

XyWrite III v3.58b — EDITOR3.EXE (185,138 bytes) Binary-exact reconstruction achieved.

Final Build Verification

Metric Result Status
File size 185,138 / 185,138 ✅ MATCH
MZ header fields 14 / 14 ✅ MATCH
Relocations 1,333 / 1,333 ✅ MATCH
Relocation zones 58 / 58 ✅ MATCH
MZ Checksum 0x5CE2 ✅ MATCH
MD5 CE49205B339D1C29569A292A4CBFFE5F ✅ MATCH

This is the first bit-perfect reconstruction of XyWrite III v3.58b in history.

Build Command

mount C F:\RE\REVERSE\XyWrite\XyWrite3\build
mount D F:\RE\REVERSE\XyWrite\Tools
C:
BUILD40_364.BAT

Project Summary

Objective: Reconstruct XyWrite III Plus EDITOR3.EXE from binary disassembly into binary-accurate x86-16 assembly source code that assembles to a byte-identical executable.

Target Binary:

  • File: EDITOR3.EXE (XyWrite III Plus word processor, circa 1989–1990)
  • Size: 185,138 bytes
  • MD5: CE49205B339D1C29569A292A4CBFFE5F
  • Platform: MS-DOS, 8086/8088 real mode (16-bit)

Toolchain Used:

  • Assembler: Microsoft MASM 4.0 (1985)
  • Linker: Microsoft LINK 3.64.1
  • Environment: DOSBox-X (host: Windows)
  • Verification: PowerShell scripts on Windows

Result: Binary-identical reconstruction achieved on February 19, 2026, after 59+ working sessions spanning approximately 3 months.

Build Process

REM BUILD40_364.BAT — assembles 40 XY3_*.ASM files, links with response file
D:\MASM40\MASM XY3_XXXX.ASM,LINK3641\XY3_XXXX.OBJ,LINK3641\XY3_XXXX.LST;
D:\LINKVERS\V3.64\LINK @LINK3641.RSP

Link order is critical — controlled by LINK3641.RSP to produce correct relocation ordering. All files follow the XY3_XXXX.ASM naming convention (8.3 DOS compatible).

XYWrite3 – Refactor & Modernization TODO

Code Documentation

  • Comment all assembly routines (purpose, inputs, outputs, side effects)
  • Add file-level headers describing each module
  • Document calling conventions used across routines
  • Explain any non-obvious optimizations or low-level tricks

Code Organization

  • Split large assembly files into smaller, logical modules
  • Group related subroutines into dedicated files (e.g., text handling, I/O, UI)
  • Standardize file naming conventions
  • Ensure each file has a clear, single responsibility

Labels & Naming

  • Identify all ambiguous or auto-generated labels
  • Rename labels to meaningful, descriptive names
  • Establish naming conventions for:
    • Functions
    • Local labels
    • Global labels
    • Constants and macros
  • Remove unused or duplicate labels

Build System

  • Organize build scripts for modular assembly files
  • Ensure reproducible builds
  • Add debug vs release build configurations
  • Document build steps clearly

Code Cleanup

Testing & Validation

  • Verify behavior matches original XYWrite functionality
  • Create small test cases for critical routines
  • Check edge cases (large files, unusual input)
  • Validate stability after refactoring

Modernization Preparation

  • Identify reusable algorithms and logic
  • Separate platform-dependent code (DOS-specific parts)
  • Mark areas for future C++/Qt reimplementation
  • Define clean interfaces for porting components

Project Management

  • Track progress per module
  • Maintain changelog of refactors
  • Set milestones for incremental cleanup

Bugs & Limitations

  • Identify and document all existing bugs
  • Reproduce bugs consistently with test cases
  • Categorize bugs (critical, major, minor)
  • Identify architectural or design limitations
  • Document constraints imposed by legacy DOS environment
  • Fix confirmed bugs systematically
  • Refactor or redesign areas causing major limitations

Feature Planning

  • Identify missing or desirable features for XYWrite3
  • Prioritize features (core vs optional)
  • Ensure new features align with lightweight philosophy
  • Avoid feature bloat—define strict inclusion criteria
  • Create a roadmap for feature implementation

Toolchain & Assembly Accuracy

  • Identify the original assembler used (if possible) for XYWrite sources

  • Evaluate modern compatible assemblers (MASM, TASM, NASM, FASM)

  • Select the assembler that produces the most accurate binary output

  • Identify and configure a compatible linker for the chosen assembler

  • Ensure the build toolchain replicates original binary behavior as closely as possible

  • Audit all db-encoded instruction sequences

    • Example: db 81h, 0FFh, 6, 0 → replace with cmp di, 6
    • Example: - db 32h, 0E4hxor ah, ah - db 8Bh, 0C8hmov cx, ax - db 36h, 29h, 0Eh, 3Ah, 37hsub word ptr ss:[0x373a], cx - db 7Eh, 2jle <label> - db 0F3h, 0A4hrep movsb - db 8Bh, 0F3hmov si, bx
  • Replace raw opcode (db) sequences with proper assembly mnemonics wherever possible

  • Identify why raw opcodes were originally used:

    • Assembler limitations
    • Optimization tricks
    • Self-modifying code
    • Macro/workaround behavior
  • Validate that rewritten instructions produce identical machine code

  • Use disassembly tools to verify correctness of transformations

  • Preserve behavior in edge cases (flags, segment overrides, etc.)

  • Document any instructions that must remain as raw opcodes and explain why

  • Establish guidelines for when db usage is acceptable vs prohibited

  • Create automated or semi-automated process for opcode-to-mnemonic conversion (if feasible)

  • Ensure final codebase is readable, maintainable, and assembler-friendly

About

This is the first bit-perfect reconstruction of XyWrite III v3.58b in history.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages