Kjetil's Information Center: A Blog About My Projects

Epson HX-20 Emulator MinGW Build

I have added a Makefile to compile hex20 for Windows with MinGW and PDCurses. Some improvements has also been made to the RS-232C emulation and it is now possible to use RS-232C to save files from BASIC as well. This can be used to read a cassette WAV file and then write it back to a text file.

Assuming the PDCurses version 3.9 and the MinGW directory is located at the same level has the hex20 source directory, the following steps can be used to build:

set PATH=..\mingw32\bin;%PATH%
set PDCURSES_SRCDIR=../PDCurses-3.9
mingw32-make.exe -f %PDCURSES_SRCDIR%/wincon/Makefile
mingw32-make.exe -f Makefile.mingw

The changes are included in the updated version 0.5 which can be downloaded here but the GitHub repository has been updated as well. For convenience, here is also a Windows binary built with the described method.

Here is a screenshot of hex20 running in the Windows Command Prompt:

hex20.exe in Command Prompt

The included MinGW Makefile does not build the sound support, but this is possible to achieve with SDL2 and some changes:

OBJECTS=main.o hd6301.o mem.o console.o rs232.o cassette.o debugger.o crc32.o piezo.o pdcurses.a
CFLAGS=-Wall -Wextra -I../PDCurses-3.9 -I../SDL2-2.0.20/i686-w64-mingw32/include -DF32_AUDIO -DPIEZO_AUDIO_ENABLE -DSERIAL_DISABLE -DMANUAL_BREAK
LDFLAGS=-lSDL2 -lm -L../SDL2-2.0.20/i686-w64-mingw32/lib

piezo.o: piezo.c
        gcc -c $^ ${CFLAGS}

SDL2 gets dynamically linked, so to run it afterwards the SDL2.dll runtime is also needed.

High speed serial support is not included since it relies on Linux specific functionality to route it to a TTY. For some strange reason the SIGINT signal handler does not get called, so instead the Ctrl+C break to enter the debugger is handled by the console emulation layer directly.

Topic: Open Source, by Kjetil @ 22/09-2023, Article Link