The Challenge

This was the most ambitious project in the collection. Could AI analyze original Z80 assembly code, understand the I/O ports and register-level control of both the MSX-AUDIO (Y8950) and MSX-MUSIC (YM2413) sound chips, and build a faithful emulation of the full MoonBlaster 1.4 sound engine on modern hardware?

🛠

The Process

The AI started by attempting to convert existing MSX-AUDIO and MSX-MUSIC chip emulators to C#, while simultaneously analyzing the original Z80 replayer assembly to convert that as well. The goal was a pure C# command-line player. It struggled. It quickly abandoned the chip emulator rewrite and instead built a wrapper around existing proven emulation DLLs — a smart pivot.

The replayer logic was harder. The AI made many mistakes, so we fed it the C source code of the Roboplayer as additional reference material. Progress was slow and it was difficult to figure out how to move forward step by step. The breakthrough came from narrowing the focus: first MSX-MUSIC only, then adding a command-line parameter to dump song data in MoonBlaster's own format so we could compare output side by side with the real thing.

Step by step, pattern data and voice data started working. But many songs still sounded wrong. Eventually we told the AI to ignore the Roboplayer entirely and focus purely on matching the MoonBlaster Z80 sources. This helped — it turned out the AI kept getting confused by the difference between USER and EDIT mode in the song headers.

Once playback was solid, everything else came together fast. The WPF user interface was added quickly. The oscilloscope took less than an hour. The Lissajous goniometer took less than half an hour. Then came the idea to scrape well-known MSX download sites for songs — the AI built and ran the scraper so efficiently that a full XML inventory was ready in about an hour. From there, support was layered on incrementally: first raw .MBM/.MBK files, then .DSK disk images, then .ZIP and .LZH archives containing disk images. That got us to 95% of the final player. The rest was just tweaking and minor bug fixes.

🎲

Surprises & Disappointments

It was genuinely impressive watching the AI read Z80 assembly and produce working C# from it — and even more impressive when it could later go back and compare its own C# logic against the original Z80 to find discrepancies. The speed at which the oscilloscope and goniometer visualizations were added was remarkable, and the song scraper plus .DSK/.ZIP/.LZH support came together so fast it felt almost effortless compared to what it would take to find and integrate existing libraries manually.

The biggest disappointment was keyboard handling for the command-line player. The AI kept making the same mistakes over and over — processes getting stuck, failed attempts at graceful shutdown, repeated rewrites that all broke in the same way. Considering how few lines of code the eventual fix required, the amount of time burned on this was disproportionate and frustrating. A humbling reminder that AI can struggle with deceptively simple problems while excelling at genuinely complex ones.

Back to MBM Player