Kjetil's Information Center: A Blog About My Projects

Epson HX-20 Emulator Sound Support

I have added piezo speaker sound support to my hex20 Epson HX-20 emulator and increased the version number to "0.2". On the real hardware the speaker is controlled by an I/O pin from the slave MCU and timed to produce a square wave pulse with different frequencies. I tried some different approaches to emulation but ended up with simply sampling this I/O pin and writing the value into a FIFO at the MCU clock frequency of 612900 Hz. The FIFO is then read by the SDL audio callback 14 times and averaged for each sample to closely match the 44100 Hz audio sample rate. Not exactly Hi-Fi but it is simple and it works.

The main goal with this update was to the able to run the "Attack of the Sine Wave from Outer Space" game in the emulator. In addition to producing a lot of sound, this game also relies on the POINT() instruction in Epson BASIC which reads data from the LCD display. Reading the uPD7227 LCD display controllers happens through a clocked serial interface which has been partially implemented.

The game can be found in the pjspot collection. Here is a video from 10 years ago running it on real hardware, and here is a video running it on the the updated emulator.

Attack of the Sine Wave from Outer Space

Version 0.2 can be downloaded here but the GitHub repository has also been updated.

Topic: Open Source, by Kjetil @ 17/03-2023, Article Link