﻿======================================
DanSpec - A Sinclair Spectrum emulator
======================================

Version:      0.9.556beta

Release date: 13h Oct 2026

Author:       Dan Offer
Email:		  dans.remakes@gmail.com


================
What is DanSpec?
================

Put simply, DanSpec is a Sinclair Spectrum emulator for Windows.

It emulates 48K, 128K and +2 models of the Sinclair Spectrum, and can run most software written for these machines.

Joysticks are automatically supported, but only one joystick at a time, with Button 1 being Fire, Button 2 mapping to UP on the joystick, and Button 3 mapping to SPACE.


=================================
So Why Another Spectrum Emulator?
=================================

Well, there are a few reasons, but probably the main one is that I haven't written one and it was on my "bucket list" of things to do.

Back in 2021 I'd started writing a generic front end for Spectrum Emulators, and have been tinkering with it for the last five years (or so) in my spare time.  As it progressed it ended up as a front end for one specific Emulator (Zesarux), which is a great emulator but supports a lot more stuff than I really need, and the small but unavoidable delay in launching it from the front end took away some of the immediacy of just running a game.  That takes us to the end of 2025.  Like I said, it was a "spare time" project, and not necessarily something I was intending for public consumption.  It did what I needed to manage my collection of Spectrum games, and that was that.

As part of the front end I'd already written code to read the screen memory from SNA files, and to extract the loading screen from TAP files.  Both are fairly simple to do, and the next step was to do the same for Z80 snapshots and TZX files too. Z80 snapshots are a bit more complex and involved essentially re-creating the Spectrum's memory model so that I could decompress the Z80 snapshot and pull out the screen memory.  And once you've got that far, you have already started to write a Spectrum emulator.

That brings us in a very round about way to earlier this year when I decided to try and add the extra parts to make an emulator.  The memory model was already there albeit in a basic form, so that would mean that I needed to add Z80 CPU emulation, and the ULA.  The Z80 CPU is thankfully well documented, and although there are a few open source ones available I wanted to write my own.  Again - there are a few resources showing how to do that, and as I was using VB.NET there weren't as much existing code to look at (although I have since found that other ones do exist).  Once that was done (at least the basic instruction set) then adding a basic ULA was relatively straightforward*, and DanSpec was born.

Getting the basics done is one thing, making it work correctly is another, and that has been the much longer part of the process.  Trying to get the timing right, and the video output correct, not to mention memory contention and the multitude of other gotchas that exist has been the real challenge.  Building some unit tests to check the CPU and ULA against results based on test software already written by others has been invaluable (thanks will be listed at the end of this novel), and much better than trying to fix it by trial and error by running games and trying to work out why they don't work correctly.

That brings us up to date

* OK, not actually THAT straightforward, but seeing as some of the bits such as decoding the screen memory to build our video signal had already been done, so it was more to do with adding the missing parts such as keyboard handling, tape support and sound.


==================
Supported Features
==================

The following systems are currently emulated:
---------------------------------------------

48K Spectrum
48K Spectrum + AY chip
Sinclair 128K Spectrum
Sinclair +2 Spectrum

Snapshots loading supported: SNA, Z80
Tape files loading supported: TAP, TZX
Snapshot Saving: Z80

Front end database of games, with optional screenshots (saved and embedded), instructions, file information, game art and adverts.
Current list of games is saved between sessions, preventing the need from re-scanning the list every time the emulator starts, although there is an option to make it rescan at every startup if you want.
Turbo loading TZX files.
Accurate 48K ULA emulation, including border effects.
Reasonably accurate 128K ULA emulation, including border effects.
Beeper and AY support.
Optional tape loading sounds for TZX files.
Windows gamepad / joystick support (automatically detected).
Kempson, Sinclair 1, Sinclair 2 and Cursor joystick supported.
Full screen mode (with or without border artwork)


=====
Usage
=====

Launch DanSpec.EXE to launch the front end.


When you first start DanSpec the options screen will appear, you can select separate folders for 48K and 128K images.  This makes more difference for TAP/TZX files than for snapshots - 48K snapshots dropped into the 128K folder will still open in 48K mode, and visa versa.

Options Screen
==============

Emulator:
---------

Basic emulator settings.

Start Full Screen		-	Whether the emulator launches games full-screen or in a window.
TZX Loading sound on	-	Play Spectrum loading sound whilst loading TZX files.
TZX Turbo load			-	Accelerates the emulator whilst loading TZX files.  TZX loading sound is disabled automatically if turbo load is enabled.
Joystick				-	Select what sort of Emulated joystick the emulator defaults to.  This can be changed whilst the emulator is running if required.

Machine:
--------

Choose which model will be used to load TAP / TZX files for the 48K and 128K folders.

48K						-	Choose between 48K and 48K + AY Sound support.
128K					-	Choose between original Sinclair 128K (Black Toastrack) Spectrum, and the Sinclair 128K +2 (Grey Amstrad) model.

File Paths:
-----------

Select folders to hold 48K and 128K files.

48K Files				-	Select area where 48K files are loaded from.  Sub-folders in there will be checked for games.
128K					-	Select area where 128K files are loaded from.  Sub-folders in there will be checked for games.

Interface:
----------

Select what will be shown in the emulator front end.  For Screenshots, Loading Screens, Instructions etc will be visible.  To add a screenshot, Loading Screen, Instructions or cover art these can be dragged into the preview window and will be automatically copied into the correct subfolder (see Subfolders section).

View Embedded Screenshots	-	Select whether embedded screenshots will be shown in the front-end.  Embedded screenshots are automatically decoded from TAP, TZX, SNA and Z80 images where possible.
Show Screenshots			-	Select whether game screenshots will be shown in the front end. JPEG, PNG, BMP, GIF images are supported.
Show Loading Screens		-	Select whether loading screen images will be shown in the front end. JPEG, PNG, BMP, GIF images are supported.
Show Cover Art				-	Select whether cover art will be shown in the front end. JPEG, PNG, BMP, GIF images are supported.
Show Adverts				-	Select whether game Adverts will be shown in the front end. JPEG, PNG, BMP, GIF images are supported.
Show Instructions			-	Show game instructions.  These should be added as text files (TXT).
Show file information		-	Show file information, such as snapshot image details for Z80 and SNA files, and tape image listings for TAP, TZX files.
Rescan files at launch		-	By default the front end maintains a database of the files in the 48K and 128K folders.  These are saved to your user profile and will be re-loaded the next time the emulator launches.  However if you would like to re-scan the files every time the front-end launches then select this option.
Fullscreen Border			-	Select optional border art when running in full-screen mode.

Subfolders:
-----------

Select the name of the sub-folders to store / retrieve screenshots, cover art, instructions etc for the emulator.  These folders will be automatically created in the root of the main 48K and 128K game folders as needed.


Front-end
=========

The front-end itself is fairly straight forward.

The file menu itself will allow you to re-scan the game folders if you have added new files, view artwork in emdedded files / snapshots, launch a "stand alone" version of the emulator where you can select files that are not in the 48K and 128K folders, View / change the emulator options and view the version information.

By default the game folders are collapsed.  Click the + sign next to the 48K and 128K folders to expand the folder, any sub-folders will also be collapsed but can be expanded in the same way.

Clicking on a game will highlight it, the "details" pane of the emulator will show either the embedded screenshots, screenshots, cover art etc. and can be changed to a different mode using the arrow icons.  The bottom "File Information" screen will show either "Instructions" or "File Information" and can be changed using the arrow icons as well.

To launch a game, either double-click the name in the file browser, press "Enter" when the game is selected, or press the "Play" icon in the icon bar above the "Details" pane.

There is also a text box above the file browser, which can be used to search for games in your collection.  To the right of the search box are a number of icons.

Magnifying Glass		-	Search
Eraser					-	Clear search filter
Two arrows pointing in	-	Close all sub-folders
Two arrows pointing out	-	Open all sub-folders
Circle with triangle in	-	Play button.  Play currently selected game


===================
Future Development:
===================

Better TZX tape handling for multiload games.  Multiload games may give you problems currently, but single-load (ie. most games) should be fine.  Special loaders work (at least those that I've tested), but if you find one that doesn't load you'll probably need to find a Z80 snapshot of the game instead.

Other models?  ZX81 is a definite maybe.  Pendragon and other Russian clones, Sinclair Timex etc - probably not.  We will not be touching other non Z80 systems, unless I decide to code a separate one at some point.  Who knows?

Currently Z80 snapshots are saved uncompressed, this will be changed to compressed at a later date.


=======
License
=======

This is currently freeware, but closed source.  Feel free to donate to the developer if you want to say thanks, but that is purely voluntary.  Copy for your friends if you think it's good enough, but don't charge money for it.  If you have had to pay to get hold of this then you've been taken advantage of.


========
Warranty
========

There is no warranty (implied or otherwise) with this software. As it is free you use it at your own risk, and if it eats your cat, makes sweet love to your sofa, raids the biscuit tin when you aren't looking, blows up your computer, deletes your files or just doesn't work - you're on your own.  By using it you accept responsibility for what happens.  You are the master of your destiny - embrace it!


===========================
Thanks and useful resources
===========================

Big thanks to:
--------------

Patrik Rak - for his Z80 CPU test suite, which has been invaluable in getting the CPU emulation something close to correct.
https://github.com/raxoft

Richard Butler - for his timing_tests-48k_v1.0.tzx, which was a godsend in working out some of the finer points in the ULA timing for the 48K Emulation.
https://zxspectrum4.net/op_timing.php

The team behind the ZOT timing tests.
https://github.com/redcode/ZXSpectrum/wiki/Tests

Other useful resources:
-----------------------

https://github.com/redcode/ZXSpectrum/wiki/Technical-literature
https://worldofspectrum.net/documentation/
https://turbo80.com/fidelity.html

