Skip to content

MartianGirl/SpecIde

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpecIde

What is it?

SpecIde is (yet another) ZX Spectrum (and, partially, Amstrad CPC) emulator. Currently, the ZX Spectrum emulation is quite accurate. The Amstrad CPC emulation is still a work in progress, but it is mostly enough for playing most games. Some of the supported features are:

  • Emulation of ZX Spectrum 48K (Issue 2/3), 128K, +2, +2A and +3.
  • Emulation of Amstrad CPC 464/664/6128. No support for Plus models yet!
  • FDC765 disk drive emulation. (Scan commands are missing yet)
  • Emulation of Spanish 128K, +2, +2A and +3.
  • Emulation of Pentagon timings (but no BetaDisk yet! Sorry for that!)
  • PSG (AY-3-8912/YM-2149) sound emulation.
  • Turbosound emulation. Supports two and four PSG modes.
  • Covox/Soundrive emulation.
  • Loading of tapes via .tap and .tzx tape images, and .csw files.
  • Loading of disks via .dsk disk images.
  • Flashloading of .tap files and .tzx that use the ROM routines.
  • Saving to .tap files.
  • Full screen video mode detection.
  • Double scan interlaced modes. (Gigascreen modes)
  • Kempston/Sinclair joystick emulation from the PC joystick/gamepad.
  • Works in GNU/Linux, Windows, and MacOS.

How to get it?

From time to time, (when I remember to do it), I update these:

For GNU/Linux and MacOS I'm not providing binaries, but SpecIde can be compiled quite easily.

How to compile it?

Compiling for GNU/Linux:

  1. Install libboost. At least chrono, system, thread and unit_test_framework are required.
  2. Install libsfml. Audio, graphics, window and system components are required.
  3. Install cmake.
  4. Install zlib1g.
  5. Clone the repository: git clone https://github.com/MartianGirl/SpecIde.git
  6. Go into the 'source' directory.
  7. Run: cmake -DCMAKE_BUILD_TYPE=Release .
  8. Run: make clean && make install
  9. The binaries will be installed in 'source/bin'. The test binaries will be installed in 'source/bin/tst'
  10. Copy the roms from the spectrum-roms package (or find them online) to the $HOME/.SpecIde/roms directory.
  11. Download this font to the $HOME/.SpecIde/font directory.
  12. Run: bin/SpecIde [options] <TZXFile.tzx|TAPFile.tap|DSKFile.dsk>

Compiling for MacOS

  1. Install brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install cmake: brew install cmake
  3. Install boost: brew install boost
  4. Install sfml: brew install sfml
  5. Install zlib: brew install zlib
  6. Install pkgconfig: brew install pkgconfig
  7. Simlink FindSFML.cmake in cmake modules ln -s $(brew --prefix sfml)/share/SFML/cmake/Modules/FindSFML.cmake $(brew --prefix cmake)/share/cmake/Modules/FindSFML.cmake
  8. Clone the repository: git clone https://github.com/MartianGirl/SpecIde.git
  9. Go into the 'source' directory.
  10. Run: cmake -DCMAKE_BUILD_TYPE=Release .
  11. Build it!: make clean && make install
  12. Copy the roms from the spectrum-roms package (or find them online) to the $HOME/Library/Application Support/SpecIde/roms directory.
  13. Download this font to the $HOME/Library/Application Support/SpecIde/font directory.
  14. Run: bin/SpecIde [options] <TZXFile.tzx|TAPFile.tap|DSKFile.dsk>

Compiling for Windows

I've successfully compiled SpecIde with MinGW32 and Visual Studio 2015 & 2017.
I've included a script RunCMake.bat that helps in the build process.

  1. Install and compile boost. Add the binaries to the PATH.
  2. Install and compile sfml. Add the binaries to the PATH.
  3. Install and compile zlib. Add the binaries to the PATH.
  4. Install cmake.
  5. (Optional) Install ninja-builds. It really helps building SpecIde.
  6. Edit the RunCMake.bat script. You need to change the lines: set BOOST_ROOT=\<Path_to_Boost_root_directory\> and set SFML_ROOT=\<Path_to_SFML_binaries\>
  7. Run: RunCMake \[GNU|MS|NINJAGNU|NINJAMS\] RELEASE
  8. Build it!: ninja clean & ninja install or mingw32-make clean & mingw32-make install (or use Visual Studio IDE)
  9. Copy the roms from the spectrum-roms package (or find them online) to the %APPDATA%/SpecIde/roms directory.
  10. Download this font to the %APPDATA%/SpecIde/font directory.
  11. Run it!: bin\SpecIde [options] <TZXFile.tzx|TAPFile.tap|DSKFile.dsk>

How to use it?

SpecIde is invoked from the command line. To run SpecIde, type: SpecIde [options] [tapefiles|diskfiles]

Supported formats are TAP, TZX and DSK.

Command line options

The following command line options are available:

Model selection options:
--issue2               Spectrum 48K, issue 2.
--issue3 | --48        Spectrum 48K, issue 3. (Default)
--48sp                 Spectrum + 48K. (Spanish ROM)
--128                  Spectrum 128K.
--128sp                Spectrum 128K. (Spanish ROM)
--plus2                Spectrum +2.
--plus2sp              Spectrum +2. (Spanish ROM)
--plus2a               Spectrum +2A.
--plus2asp             Spectrum +2A. (Spanish ROM)
--plus3                Spectrum +3.
--plus3sp              Spectrum +3. (Spanish ROM)
--pentagon             Pentagon 128.
--cpc464               Amstrad CPC 464.
--cpc664               Amstrad CPC 664.
--cpc6128              Amstrad CPC 6128.

Joystick options:
--kempston             Map joystick to Kempston interface.
--sinclair             Map joystick to Sinclair interface. (Default)
--pad|--nopad          Map pad extra buttons to keys.

PSG options:
--psg|--nopsg          Emulate AY chip in 48K Spectrum.
--abc|--acb|--mono     Select stereo mode.
--ay|--ym              Select PSG: AY-3-8912/YM-2149.
--turbo                Select TurboSound with 2 PSGs. (mono)
--turboacb|--turboabc  Select TurboSound with 2 PSGs. (stereo ACB/ABC)
--turbonext            Select Next-style TurboSound with 4 PSGs.

Covox options:
--covox                LPT Covox on port 0xFB (Mono)
--covox2               Stereo Covox (ports 0xFB and 0x4F)
--covox3               Czech Covox (ports 0x1F, 0x3F, 0x5F)
--soundrive1           Soundrive on ports 0x0F, 0x1F, 0x4F, 0x5F.
--soundrive2           Soundrive on ports 0xF1, 0xF3, 0xF9, 0xFB.
--nocovox              No Covox present.

Misc hardware options:
--sd1                  Emulate Dinamic SD1 hardware protection.
--cmos|--nmos          Emulate CMOS/NMOS Z80. (Affects OUT(C),0 instruction)

Video options:
--fullscreen           Start SpecIde in full screen mode.
--window               Start SpecIde in windowed mode.
--scanlines            Render PAL double scan mode.
--average              Render PAL double scan mode, averaging scanlines.
--nodoublescan         Single scan mode. (Default)
--sync                 Sync emulation to PC video refresh rate (only 50Hz)

Sound options (add prefix 'no' to disable. Eg. --nosound):
--sound                Enable buzzer/PSG sound. (Default)
--tapesound            Enable tape sound.

Emulation options (add prefix 'no' to disable. Eg. --noflashtap):
--flashtap         Enable ROM traps for LOAD and SAVE.

Function keys

When the emulator is running, pressing F1 displays help about the function keys.

Key Function
F1 Display help.
F2 Switch between fullscreen and windowed mode.
F3 Save DSK file to disk.
Shift-F3 Create blank DSK file.
F4 Select next disk image.
Shift-F4 Select previous disk image.
F5 Reset the Spectrum.
F6 Clear SAVE buffer.
Shift-F6 Add FlashTAP to SAVE buffer.
F7 Write SAVE buffer to disk.
Shift-F7 Use SAVE buffer as FlashTAP.
F8 Toggle PSG: AY-3-8912/YM-2149.
F9 Turn sound on/off.
Shift-F9 Turn tape sounds on/off.
F10 Exit the emulator.
F11 Play/Stop the tape.
Shift-F11 Remember tape position. (Reset tape counter to zero).
F12 Rewind tape to start.
Shift-F12 Rewind tape to saved position. (Rewind to tape counter zero).

The config directories

Finally, SpecIde looks for a configuration file (SpecIde.cfg) in the following places:

  1. Current directory: ./SpecIde.cfg
  2. On GNU/Linux: $HOME/.SpecIde/SpecIde.cfg
  3. On MacOS: $HOME/Library/Application Support/SpecIde/SpecIde.cfg
  4. On Windows: %APPDATA%\SpecIde\SpecIde.cfg

A template SpecIde.cfg.template is provided in the source code.

System ROMs can be placed also in the config directory:

  • On GNU/Linux: $HOME/.SpecIde/roms
  • On MacOS: $HOME/Library/Application Support/SpecIde/roms
  • On Windows: %APPDATA%\SpecIde\roms

The following ROMs are included in the binary packages:

File Name Model Size
48.rom Spectrum 48K 16K
128-0.rom Spectrum 128K (ROM 0) 16K
128-1.rom Spectrum 128K (ROM 1) 16K
plus2-0.rom Spectrum +2 (ROM 0) 16K
plus2-1.rom Spectrum +2 (ROM 1) 16K
plus3-0.rom Spectrum +2A/+3 (ROM 0) 16K
plus3-1.rom Spectrum +2A/+3 (ROM 1) 16K
plus3-2.rom Spectrum +2A/+3 (ROM 2) 16K
plus3-3.rom Spectrum +2A/+3 (ROM 3) 16K
128-spanish-0.rom Spanish Spectrum 128K (ROM 0) 16K
128-spanish-1.rom Spanish Spectrum 128K (ROM 1) 16K
plus2-spanish-0.rom Spanish Spectrum +2 (ROM 0) 16K
plus2-spanish-1.rom Spanish Spectrum +2 (ROM 1) 16K
plus3-spanish-0.rom Spanish Spectrum +2A/+3 (ROM 0) 16K
plus3-spanish-1.rom Spanish Spectrum +2A/+3 (ROM 1) 16K
plus3-spanish-2.rom Spanish Spectrum +2A/+3 (ROM 2) 16K
plus3-spanish-3.rom Spanish Spectrum +2A/+3 (ROM 3) 16K
pentagon-0.rom Pentagon 128 (ROM 0 - 128K + TR-DOS support) 16K
pentagon-1.rom Pentagon 128 (ROM 1 - 48K BASIC) 16K
trdos.rom TR-DOS ROM for BetaDisk 128 16K
amsdos.rom AmsDOS ROM for CPC 664/6128 16K
cpc464.rom BASIC ROM for CPC 464 32K
cpc664.rom BASIC ROM for CPC 664 32K
cpc6128.rom BASIC ROM for CPC 6128 32K

Also, the font can be placed in here:

  • On GNU/Linux: $HOME/.SpecIde/font
  • On MacOS: $HOME/Library/Application Support/SpecIde/font
  • On Windows: %APPDATA%\SpecIde\font

And why?

This is an attempt at writing a ZX Spectrum emulator using SFML for video, audio and user interface. The goals I set for myself were:

  • Accuracy. The emulator should work as much as possible like a real Spectrum. It should be easy to start in full screen mode, without having to select a video mode or care about difficult settings.
  • Simplicity. The UI should be as simple as possible, and the emulator should operate only with the function keys as much as possible.
  • Reliability. The emulator should never crash.
  • Portability. The emulator should be easy to run in different platforms. I've been writing SpecIde mostly for learning and for trying to do a big project. So far, I am happy with the outcome! After I had the ZX Spectrum working, I thought I could try to emulate the Amstrad CPC series too, because many components are shared. So far, I've got the first three machines running, but there are still many details and problems to be fixed.

Credits and acknowledgements:

  • David Garijo: For taking the time and helping with the MacOS build process.
  • JFSebastian: For his wonderful ZXSpectrum.ttf font.
  • Ast_A_Moore: For all his help with the +2A timings and port 0x0FFD.
  • César Hernández Bañó: For his help with the initial values for IR register, his comments, and his own emulator ZesarUX.
  • Miguel Mesa: For pointing out that the FLASH attribute was running at half speed.
  • Weiv (for his tests), ICEknight (for his videos), and all the people who helped describing the ULA Snow Effect on 48K/128K/+2 machines.
  • People from the #emulation discord for their ongoing testing efforts to discover every detail on the ZX Spectrum machines.