Kjetil's Information Center: A Blog About My Projects

Epson HX-20 Emulator External Cassette Support

There is now support for the external cassette interface on my hex20 Epson HX-20 emulator and the version number has been increase to "0.3". This is specifically for the external interface, referred to as "CAS1:" in BASIC or "C" in the MONITOR. The internal micro-cassette is still not supported, although the interface is probably similar.

The cassette emulation works through WAV files, meaning such files are either read or written. Only the specific format of 8-bit, Mono and 44100 Hz sampling rate is supported. Here is an example of converting an MP3 file to the right format using the mpg123 and sox command line utilities:

mpg123 -w file.wav file.mp3
sox file.wav -r 44100 -b 8 -c 1 good.wav

Triggering the reading (loading) or writing (saving) is done through the hex20 debugger which is accessed by Ctrl+C. After entering 'LOAD"CAS1:"' in BASIC and it is searching, enter the debugger and use the 'g' command to start reading the WAV file. Prior to entering 'SAVE"CAS1:FILENAME"' in BASIC, enter the debugger and use the 'f' command to prepare to write the WAV file. The WAV files that are created by hex20 can be played back to a real Epson HX-20 using it's EAR input, just make sure the volume is set really high.

Loading from CAS1: in BASIC

An additional feature in this release is the possibility of loading a S-record directly into the MONITOR to modify memory after the system has been initialized. This injection functions similarly to the automatic BASIC program loading. Only 16-bit S-records with the "S1" prefix are recognized, here is an example on how to convert a binary file using the srec_cat command line utility:

srec_cat file.bin -binary -offset 0x1000 -o file.s68 -motorola

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

Topic: Open Source, by Kjetil @ 02/06-2023, Article Link