ZX v 0.51ß
Zx Spectrum 48K Emulator
(C)1999 Daniele Orro

INDEX
[About] [Requirements] [Keyboard] [Z80 Emulation] [Tape Recorder ]
['File' Menu] ['Option' Menu] ['Tape Recorder' Menu] ['?' Menu ]
[FAQ/Troubleshooting] [Notes] [Thanks to]

ABOUT

ZX is a Zx Spectrum 48K emulator. All the most important caratheristics of the computer are emulated: The Z80 microprocessor, the graphic (included Flash and all the graphic effects), sound, keyboard, joystick and tape recorder. All the most common file format are supported (SNA, Z80, TAP) and besides tape recordings in WAV and RAW format, it's possible to load tape programs in real time connecting the tape recorder directly to the sound card.
This program can be freely distribuited so long as the content of it's archive it's not altered. Is however forbidden the sale of this program, and in general his distribution for commercial purposes without the authorization of the author.
The author cannot be held responsable for any loss or damage caused by the use of the program.
The actual version of the emulator contains the following files in the archive: ZX.EXE (the executable), ZX.CFG (configuration file), ZX.HTML (the file you are reading), ROM.BIN (the Spectrum ROM), Spectrum.jpg.
Being it a beta version, it could be unstable and contain errors. If anomalous behaviours are found, please contact the author.
To contact the author, (suggestions, impressions of use, bugs...): zx.emulator@lycosmail.com.
The emulator starts automatically. To go in pause or take back to the emulation, click the mouse on the window.

REQUIREMENTS

The program requires: Windows 95/98 + DIRECTX, 16MB RAM, Pentium 100 or better, any sound and video card that is supported by DIRECTX.

KEYBOARD

The Spectrum keyboard is a bit particular. Apart the famous rubber keys of the first model, the strangest thing is that to every key or combination of keys it is associated a whole command. For example, if you wanted to write PRINT, you could have done it simply pressing the P key. For help to find a particular command, we can look the sketch of the keyboard ('?' Menu - 'Keyboard'). Spectrum keys are emulated with the correnspondents of the PC keyboard. Special keys CAPS SHIFT and SYMBOL SHIFT are emulated respectively by SHIFT and CTRL of the PC. To obtain a command that appears WHITE on the keyboard, you need to press the associated key. If you need a command or a symbol written in RED on the key, you have to press the key together with SYMBOL SHIFT. For commands written in GREEN on a key, you need to press SYMBOL SHIFT and CAPS SHIFT at once first, then when a capital E blinks, release those keys and press the key associated with the command. Finally if you need a command written in RED under a key, you have to proceed in the same manner as for the commands written in GREEN and then press at once the SYMBOL SHIFT and the key in matter.

Z80 EMULATION

The Z80 microprocessor is fully emulated, even the refresh register R. It's kept track of unused bits of the flag register, that some programs can use to memorize information. 'Undocumented istructions' are also emulated,those that don't appears in normal Z80 manuals and are used not very often  by  games. Also many 'undocumented flags' are updated correctly.

TAPE RECORDER

If you have old tapes with games that you would like to load in the emulator(without the use of WAV files), it can be done in real time like a real spectrum, simply connect a tape recorder to the LINE-IN connector of the sound card. Choosing the 'Play' option from the 'Tape recorder ' menu, the emulator will be ready to receive audio data from the tape recorder.
Now you need only to lift the volume, that needs to be high, and proceed just like if you had a real Spectrum. Therefore we write LOAD "" and Return (see 'Keyboard') and wait for the loading. It's necessary to use the 'High video synchronization' option, otherwise every attempt will be vain. If you want to listen the audio, you need to use the 'Audio out ' from the 'Tape recorder' menu. When you use the 'Play' option, audio out is disabled.
When finished to load, is always better to 'Stop' the tape recorder.
An essential requisite for correct loading is to use a good quality tape recorder. Obviously also the tapes must  not be worn out (look 'Troubles with tape recorder'). If the tapes will not be in good conditions, it's better to transfer its content in a WAV file, and prooced to 'clean it' with appropriate programs.

'FILE' MENU

Open snapshot
Open a file in SNA or Z80 format. They are pretty much like snapshots of the spectrum memory and the Z80 registers. Two different types of .Z80 files are supported. If a writing like 'Hardware not supported' appears, it means that the program we are trying to load is for Spectrum 128, or that to work it needs particular pheriperals not supported by the emulator.

Save snapshot
Save a file in SNA format.

Load from memory
This option is identical to 'Open snapshot', apart from the fact that in this case the 'file' is contaned in memory. It's a command that, together with the next, is very useful when you want to load and save very fast a situation, for example to solve diffucult passages in games. I know a guy that using more times the F4(load) and F5(save) keys have finished 'Manic Miner' in less than an half hour!!!

Save to memory
Save to memory a snapshot of the Z80 registers and the content of the Speccy's RAM.

Open picture
Open a picture in SCR format. This kind of file is an exact copy of the entire video memory of the Spectrum.

Save picture
Save the content of the video memory in a SCR file.

.tap Files (Open/Configurations)
TAP files are a compact transposition of the content of a registration on tape. It's a more flessible format than the SNA or Z80, because it allows to use games that requires loading of more levels. Also loading presentation screens are visible.
TAP files are constituted by more separated blocks, and structured in manner that two or more TAP files can be linked together to constitute a unique file.
Once opened, to execute the program you need to type LOAD "" and then press RETURN (the keys to be pressed are J for 'LOAD' and SYMBOL SHIFT plus P for the quotes).
With 'Option' it is possible to choose the initial block from where start loading. The 'ROM routine intercept' option permits to intercept the ROM loading routines that start at the 0x556 address. So, this routine will be replaced by a new routine a lot faster for the emulator, and programs will be loaded immediately. But not all the programs that don't access directly to the ROM routines can be loaded  this way. If you have troubles try disabling the 'ROM routine intercept'. Using the normal mode, programs are loaded in a more compatible way, but a little bit slower. Infact, data from the virtual tape recorder are sent directly to the Speccy's port 254, obviously  respecting all the original timings.
This second type of loading is very slow. For a faster loading is possible to press the F9 key, that sets the emulator to the maximum speed available. At the end of the loading you can return to the normal speed, pressing back the F9 key. To stop the flux of input data to the port 254 you can press F12.

.wav/.raw Files
If you have games on tape and you want to load them with the emulator, you need to proceed in the following manner. First record the content of the tape in a WAV or RAW file. Data needs to be sampled at 8 bit, mono and with the highest frequency you can set(44100 Hz recommended). At this point you have to write LOAD "" and press return (see 'Keyboard'), open the WAV or RAW file and then use the option 'Configure' to choose the sample frequency. Finally press 'Rewind' and OK to restart the emulation. Now the program should be loaded; press F12 to stop the data flux or press the 'Close' button in the 'Configure' window.
Notes for recording: it's better to set volume to high.

Poke
Permits to modify the content of a memory location. Valid addresses are from 16384 to 65535, and includes entire RAM. Once a value of memory location is changed, this remains blocked during all the emulation, until a reset is done.

Reset
It resets the Spectrum, same as turning off and on the computer.

Exit
Exits from the emulator, saving the configuration in the ZX.CFG file.

'OPTIONS' MENU

Advanced
High video synchronization
Turning on this this feature, the emulator keeps track of the fact that the real Spectrum used to refresh the screen continuously and the electronic brush takes an exact amount of time to scan the entire surface of it.This way the emulator writes the screen respecting the timing in the most faithful way.Certain games are very sensitive to this characteristic and if the option is not activated they can misfunction. As examples we could quote BC'S QUEST e ARKANOID(no sprites),  AQUAPLAN(no horizon in full screen mode), GHOSTS'N GOBLINS(flickering characters) and VECTRON(no borders effects). It is therefore reccomended to turn this feature on because games will benefict of all the border and animation effects. For a better functioning this option is best used with: 'LOW RAM Emulation'.
Anyway,since this takes more CPU resources,it could not be utilizable on slower machines.
LOW RAM Emulation
A part of Speccy's RAM (the so called 'contended RAM') is, as a matter of fact, slower than the remaining one.This option keeps track of it and the algorithm (not yet perfect) do the job for common operations.
LDIR
Z80's LDIR & LDDR instructions are used to move memory blocks.Activating this option you'll get a finer emulation because these instructions are executed with the original Z80' s timing. If you want to speed up the emulation, you can turn off this option but, with games like 'Manic Miner' and 'Jet Set Willy' (which do a heavy use of these instructions), you could get problems of  time counting.
ISSUE 2
This option activates Issue 2 instead of Issue 3.Some programs are sensitive about this aspect.

Screen size
Working in windowed mode you get two possibilties of choice for dimensions ratio:normal(1:1) or doubled(2:1).Enabling
'Full screen' gives you a more accurate and faithful emulation.

Video refresh freq.
You can set the video refresh frequency between the values of 10 Hz and 50 Hz(real Spectrum video refresh rate).The higher the value,the more resources are requested to your PC.Slower machines are again advised against setting higher values,anyway 25Hz should be enough to enjoy a pretty much flickerless emulation.

Joystick
It is possible to choose among the following options: kempston, cursor and Sinclair. Joystick is emulated via PC Joystick (select 'PC Joystick') or cursor keys and 'fire' with TAB or CAPS LOCK.These two keys are both activated since,depending on the keyboard you own,one of them might not work properly being pressed at once with other keys(id es cursor keys).

Sound output
Three are the possibilities for the sound output: standard, PC's speaker and no sound.Standard output gives the best quality but probably PC's speaker resembles Speccy's original sound more.Standard sound utilizes a data buffer that is continuously both filled with informations coming from the speccy's port 254 and emptied into the sound card.As long as the emulation speed remains the 100%,you get no problem but if it drops under that value (usualy on slower PCs) a sincronization with the images on the screen will no longer exist(effects are played after the corresponding actions) and, in the worst cases, there might be no sound at all.If the situation just described should occur try to look in the 'FAQ/Troubleshooting' section.
Speaker's sound output gives often better performances when used with the option: 'High video synchronization'.

TV emulation
This option allows to emulate the TV's scanlines, otherwise you'll have a common monitor effect.However it's visible only in full screen mode.With a not so fast machine i do advise to turn this option on.

CPU speed
It is possible to change CPU's speed in a range from 10% to 800%(obviously max. speed is not achievable by every computer).When speed is different from 100%(normal speed) standard sound output is automaticaly disabled to prevent misfunctions,due to the buffer lack of  syncronization.Choosing 'set maximum speed',the emulator is forced to reach its maximum speed and is available everytime simply pressing the key F9.The F9 key also modify the 'video refresh frequency',which is considerable lowered, in order to reach a better speed.

'TAPE RECORDER' MENU

Play
This option need to be used when we need to emulate a Spectrum connected to a tape recorder. All the input data from the LINE-IN of the sound card will be sent to the port 254 of the Spectrum. Since the audio data is first memorized in a buffer, there will be a short delay between played data by the recorder and received data by the Spectrum. When 'Play' is active, the standard audio out is disabled.

Stop
With this option activated you get an emulation without a tape recorder. It  is advised to turn it on after loading a program in real time mode (see 'Play').

Audio Out
It allows to hear(via PC's speaker) the loading noise of a tape, WAV or TAP file.

'?' MENU

Keyboard
It shows a sketch of the Speccy's keyboard, in which are visible all the commands and accessible symbols from the Basic.

About ZX
Program's informations.

FAQ/Troubleshooting

Slow emulation
No matter which video mode you are using(windowed or full-screen) try to change the 'High video synchronization' option, disable 'PC Joystick', and lower the 'Video refresh frequency' value. Besides what has been just said you can try to turn on the 'TV emulation' option.

Standard sound out of sync. (or general sound problems)
This means that your PC is not fast enough to let the emulator achieve a 100% speed .See 'Slow emulation'.If no results are obtained even this way, use the PC's speaker sound output (remember to enable its functioning under windows in the volume control bar).
It is possible that other applications, running in background, could slow down the emulation. Be sure to close them before starting the emulator.

PC's speaker output is poor or buggy
Try to turn on the 'High video synchronization' option.

When i change CPU's speed, sound disappears or turns its output through the PC's speaker
It is normal because standard sound output is turned off to avoid problems with the buffer syncronization.

I just recorded the content of a tape in a .WAV file but the emulator won't load it
In order to work properly with the emulator .WAV files must be 8 bit mono sampled at a frequency of 44100 Hz.Beside this the tape recorder must be of good quality and tapes must not be worn out.Specific programs able to retrive old tapes do exist but actualy the emulator does not have a filter needed to do the job.

Some games won't respond to keyboard's input
Try to modify 'Issue 2' option. If  TAP or WAV/RAW are being used push F12.If the game has been loaded directly from a tape remember to set the recorder option on 'Stop'.

Some games won't work in TAP format
Probably these games,during the load, don't access directly to the ROM routine at the 0x556 address,for example because they have their own loading routine.Otherwise it could be that they use the same routine without calling it at the 0x556 address.Therefore if a program calls that routine at another address the emulator will not be able to finish the download with its own inner routines.To overcome this problem you have to turn off the  'ROM routine intercept' option in the  TAP file's setting window.

Troubles with Tape recorder
There are some extremely important factors for the correct loading of a program in real time:
1) The computer needs to be enought fast to allow the emulator to run at 100% of the speed.
2) A good quality tape recorder is needed.
3) You need to set the correct volume (generally you need to set it high).
4) Tapes need to be in good conditions.

NOTES

This program is done in C and Assembler languages. It's an adaption of a Zx Spectrum emulator done by me for the MS-DOS systems. This version of the program was never released to the public, because GUI isn't yet finished. It will see, maybe, the light one day...

THANKS TO

- Flavia Puddu, for the picture of the keyboard and the program icon, and for the precious suggestions during all the developement process.
- Marco Fichera, for beta testing and helping me to discover various bugs.
- Andrea Mongardini, for the crappy english translation of the first part 8)
- Leandro Dumini(BigSmurf) for the (even more) crappy english translation of the second part.