[About] [Installation & Use] [Download] [Documentation] [Contact & License]
[About]

This is the home page of the ZX Ecosystem: a C++ library that provide your C++ programs with the look and feel of an authentic ZX Spectrum! The library includes support for the main user interfaces of the original ZX: the screen, the keyboard and the sound, replicating really closely their behaviors under the ZX operating system. It also has built-in support for the mouse, if you have one.

The uses of this library can be very diverse:

  • Write your own new 8-bit games with the same feeling as the original ZX but with all the computing power of your PC. Or remake old games!
  • Re-write your old ZX Spectrum BASIC programs easily in a modern programming language (C++) and computer (your PC).
  • Provide your current desktop C++ programs with retro, easy-to use, and lovely graphical and sound interfaces (the ZX screen interface admits sizes different from the original one, i.e., larger screens).
  • Write your own ZX Spectrum emulators.
  • Anything else your imagination can... well, imagine ;)

This library has been built upon the experience obtained through other works that I have done around the ZX Spectrum, such as the GIMP plug-in for generating ZX-like images and the Nutria ZX Spectrum emulator.

[Installation & Use]

Currently the ZX Ecosystem library is written in C++11, thus it is intended for most modern programs. For installing it, just follow these steps:

  1. Download and install the headers and library files of SDL2 and SLD2-image for your system. Make sure that all of them can be found by any C++ program at compiling time through the angle-bracketed include #include <SDL2/SDL.h>.
  2. Make sure your machine has 3D acceleration (most machines have). In the case of building inside a virtual machine (e.g., VirtualBox), make sure to activate that kind of display acceleration in the settings. This is necessary for the SDL2 libraries to work properly for the ZXEcosystem.
  3. Download the files of the ZX Ecosystem for your system (see the Download section).
  4. Include in your C++ source program the ZXEcosystem.h header.
  5. Compile.
  6. Link your compiled program against the SDL2 and SLD2_image, and the ZX Ecosystem lib/objects.
  7. Enjoy!

The structure of your programs may be diverse, since, as you will see in the documentation, there are several ways of executing code with the ZX interfaces, mainly due to the way screen refresh is done. Perharps the most common skeleton is something like this:

In this skeleton first we get the singleton object responsible for accessing the desktop of our system, then get the ZX object for that desktop, then activate the ZX, and finally call user code under some refresh mode. The example in the figure does not need anything else except substituting the ellipsis with your code; in this case (periodic refresh mode), that code will be executed in a thread different from the main one.

The ZX Ecosystem library also includes a testing program (test.cpp) that can be used as a much more complex example: it performs a thorough test of every functionality of the library, as seen in the video below. Be prepared for colors and sounds!

[Documentation]

The ZX Ecosystem library is not too small or naïve. Detailed documentation on its classes and functionalities can be found here. Better start with the ZX class and then follow the thread of the other classes and definitions as it uses them.

[Download]

These are the links to download the ZX Ecosystem Library in all its modalities (open-source, compiled for Linux or for Windows). Do not forget to read the README.txt!

  • ZX Ecosystem v1.1.1. Some improvements in the speed of basic screen operations. Source code with GNUv3 license. Tested with both g++ 4.9.2 in Debian 8 and MS Visual Studio Community 2015 in Win7 (173.2KB).
  • ZX Ecosystem v1.1.0. Compiled library. Tested with both g++ 4.9.2 in Debian 8 and MS Visual Studio Community 2017 in Win10 (12.5MB).

    • NOTE: We have found some problems when executing programs linked to the currently last version of SDL2 libraries (2.0.8) in Win10 - Release. Therefore, debug versions of the ZX Ecosystem are recommended.

  • ZX Ecosystem v1.0.0. Compiled library. Tested with both g++ 4.9.2 in Debian 8 and MS Visual Studio Community 2015 in Win7 (8.7MB).

[Contact & License]

The ZX Ecosystem library has been developed by me (Juan-Antonio Fernández-Madrigal) in Aug-Nov 2016 (v1.0.0), Oct 2018 (v1.1.0) and Dec 2018 (v1.1.1). It was originally an exercise for deepening into C++11, SDL2, and Doxygen (and into the ZX Spectrum too!).

The intended use of the library is to be free only for non-commercial use, but the open-source license does not prevent to use it for commercial products as long as the same license is forwarded. I will appreciate that you mention this web page in your programs ;) If you are interested in other uses of the library, or in some variation of it, contact me at "software" (remove quotes), jafma.net.