ASCD 1.00 - Documentation

ASCD is an emulator of Sam Coupé and ZX Spectrum. This version runs in Windows; supported is Windows 2000 and later, DirectX 6. DirectX 9 is recommended for better display experience. Older versions of ASCD supported also Windows 9x and MS-DOS. You can download all versions from www.keprt.cz.

This program is free for noncommercial use. ROM files are not part of this software, their belong to their authors and respective copyright holders.

Hardware requirements

There are almost no requirements. ASCD is written in C++ and compiled with Visual Studio 2008, which makes it run on almost any computer with Windows 2000/XP/Vista/7 or newer version of Windows. It uses standard soundcard if a soundcard is present. The current version is intended for nowadays fast computers, while the old versions (prior 0.98) run well on old slow computers with low memory. Minimum requirement is DirectX 6 (which is always present in all Windows), and DirectX 9 is recommended for better display.

What is emulated

ASCD was originally written as a Sam Coupé emulator. Later, ZX Spectrum and ZX Spectrum 128 support was added. The CPU timings aren't 100% perfect, as those computers are different, but here they share the common Z80 CPU emulation core. You can select emulation mode with generic command line switch -zxmode, with specific command line switches -zx, -128 or -sam or in the main menu.

Sam Coupé mode

You can select Sam Coupé mode with -zxmode 0 or -sam switch or in the main menu. Emulated features are:

Note that ASCD supports digital speech on beeper bit and also external DAC on ZX Spectrum, but not on SAA1099. SAA's output is updated 50x per second, beeper bit is updated 15625x per second.

ZX Spectrum mode

You can select ZX Spectrum mode with -zxmode 1 or -zx switch or in the main menu. Emulated features are:

Note that the Fullerbox AY and 3x8bit DAC use the same output ports. This means that these two devices can't be used together. ASCD always starts in Fullerbox mode, and switches to DAC as soon as it detects that the running program uses the shared ports for DAC output. The emulation is switched back to Fullerbox mode on next reset. This way users can use both Fullerbox and DAC and don't need any manual configuration.

ZX Spectrum 128 mode

ZX Spectrum 128 is very similar to the original ZX Spectrum. The emulation is very similar as well, there are just a few new features in 128K mode. You can select this extended ZX Spectrum 128 mode with -zxmode 2 or -128 switch or in the main menu. Emulated features are the same as in ZX Spectrum mode, plus the following:

Many games provide nice AY music even in 48 KB mode. That's why the AY emulation is always on even in 48 KB mode. Also, the paging disable bit of ZXS128 is ignored, and paging is always enabled when you run the emulator in ZXS128 mode. When you switch the emulator to ZXS48 mode (-zxmode 1 or -zx), then paging register is not available, memory fixed to 48 KB, but AY audio is still active.

Note that ASCD supports digital speech on beeper bit and also external DAC, but not on AY-3-8910. AY's output is updated 50x per second, beeper bit and DAC is updated 15625x per second. (You can try MQM5 demo to hear the difference.)

Supported fileformats

ASCD supports several fileformats, and also brings some new fileformats where no standard fileformats do exist.

Note about TAP files on Sam Coupé: Sam Coupé has very advanced tape routines in ROM which support some features not present on ZX Spectrum. In order to keep the standard TAP file format on Sam Coupé, I had to solve one particular problem: Sam Coupé can have particular files larger than 48 KB in one uninterrupted tape block, but this is not possible in a regular TAP file. ASCD currently limits the file size on a tape to 65533 bytes, which is the maximum size possible in TAP file. The resulting file is still a 100% standard TAP file and can be loaded on ZX Spectrum 128 using some 128KB copiers with paging support. You can test TAP files in Mr.Copy+ copier program, which is directly supported in ASCD (there is a special Mr.Copy+ hack in ASCD which make it work even without any low level EAR/MIC bit emulation).

New .SCS file format is fully documented, you can find the latest documentation version here.

OpenAir recording

OpenAir library is an open implementation of older famous AIR input recording system. The main difference between AIR and OpenAir is in encryption: AIR was intended for computer game tournaments and used a multilevel encryption system, the file format was closed, and the software was quite complicated. The new OpenAir library supports the same application programming interface (API) but uses new unencrypted simple file format.

AIR files record keyboard, and possibly digitla joysticks, but not mouse. You must control the input recording from command line: -record <file.air> starts the emulation in recording mode. You must also specify the name of disk image or snapshot or tape as another parameter. Name of the disk/snap/tape file is stored to AIR file, so you can replay the recording later using the switch -playback <file.air>.

Audio-video recording

One of the new features in ASCD 0.98 is the ability to record audio-video to an AVI file. It is strongly recommended to install a good video coded prior to the video recoring, because there is a 2.0 GB limit on standard AVI files. (ASCD uses WfV library in Windows API to write AVI files and there is 2.0 GB limit in there.) Actually, ASCD can write up to 4 GB to a single file, but some players and editors won't be able to read it correctly.

The #1 codec for ASCD is SCLS, the #2 option is MSUD. Both these codecs are lossless, so they provide the best image quality. SCLS is superior to MSUD, because it is faster and has a significantly higher compression ration. These two codesc and can be obtained at Moscow State University. (Enter MSU SCLS codec to Google, or click here: SCLS MSUD.) If neither of these codecs is present, ASCD tries to use MJPEG codec. MJPEG is a codec used by many personal camcorders, it is a native format on DV digital video casettes. But MJPEG codec is usually not free. You need to obtain VfW codec (not DirectShow). I successfully tested ASCD with Morgan MJPEG codec, it is just necessary to set compression quality to 100%.

AVI video recording must be started from command line using switch -writeavi <file.avi>. Video is always recorded in resolution 320x240, it always contains the border, and it is compressed if a suitable video codec is found. Codecs are tried in this order: SCLS, MSUD, MJPG. If neither of these codecs is found, the video is written in RGB24 uncompressed form and you can record only 5.5 minutes of gameplay. Audio is always recorded in 44100 Hz stereo, even in ZX Spectrum mode (where audio is mono), and it is always compressed by Microsoft ADPCM codec. This audio codec is always present in Windows, so you don't need to install anything. The audio bitrate is always 384 kbps.

You should be able to replay AVI's created by ASCD in any standard video player. Successfully tested were: MPlayer and its clones, Media Player Classic, also VirtualDubMod editor work perfectly. The SCLS and MSUD aren't supported work in VLC player.

Quicksave/Quickload

Another new interesting feature in ASCD 0.98 is the ability to do a quicksave/quickload. The saved files reside in quicksave directory, so you can find them in there and make a copy of one particular quicksave if you wish, but the main goal of this feature is to let you play easily many games, because you can reload the game when you die etc. In other words the quicksave feature is like rewinding the game to a prior point in time. :-) This powerful feature can be also combined with -record switch to record the game. ASCD record the optimum best gameplay, i.e. it skips all parts which you "rewind" by quickload. :-)

Advanced options

ASCD was originally controlled by command line switches only. Later an INI file was added. Now some options can be also controlled from a standard Windows' main menu, but not all. Some advanced options must be set in ascd.ini or can be set using command line switches. Command line uses the same set of switches as ascd.ini file, you just need to add - in front of it. (For example you write zxmode 1 in ascd.ini, but you write -zxmode 1 at the command line.)

Also note that some special command line switches aren't saved to ascd.ini and must be always entered on command line. You can see the list of all cupported command line switches in menu Help - Command Line Switches.

Note that on the original Sam Coupe keyboard there are keys F0 to F9 in place where a PC has numeric keypad. Beacuse of that Sam Coupé's F-keys are emulated with PC's numeric keypad. It means that if a program says "press F1", you need to press numpad-0, not F1. Real PC F-keys are used to control some emulator's settings on the fly. Also note that these keys can change from version to version. You can see the list of control keys in menu Help - Keyboard shortcuts.

Hardware Devices

Keyboard

Keyboard is emulated including special keys on PC keyboard. There is also a special code for handling CapsLock key, because that key is problematic on some hardware.

Joystick

Original MS-DOS version of ASCD supported real digital joysticks (those same joysticks as used on real ZXS/Sam), but this is not possible in Windows, so joysticks can be emulated only with a keyboard. Arrow keys + right ctrl are used for this purpose. You can press F8 to swich joystick emulation mode (it switches between Cursor and Kempston joystick in ZXS mode; it turns on/off Kempston emulation in Sam mode). You can also use autofire option on this pseudo-joystick. Use Ctrl+F8 key to turn autofire on/off, you can also use command line switch -autofire to set it to a different speed.

You can select other joysticks (other than Kempston and Cursor) in configuration file. Note that Curosr and Fuller joysticks aren't supported in Sam Coupé mode.

Disk drives

Two standard floppy disk drives are supported in Sam Coupé mode. They are always connected. You can use DSK/MGT and SAD disk images, also can be GZ or ZIP compressed. Note that ZIP-compressed files are read-only, while GZ-compressed files are writable.

Tape

Tape emulation is available in all modes, including Sam Coupé, and is always on. It is implemented with ROM-hooks, which means that custom loaders and copy-protected tape images are not supported. (There are some exceptions to this, as some custom loaders do work because they use some ROM code.)
Tape files TAP and TZX can be loaded, these files are always read-only (i.e. never modified). You can also load GZ or ZIP compressed tape files. If you SAVE something to tape, it is written to a new file tape.tap in the current directory. If that file already exists, new content is appended at the end of it. (Name tape.tap can be changed in configuration file.)

Printer

ASCD emulates printers but it doesn't print on real printers. Instead, it saves the print output to files.

Standard parallel printer is emulated in Sam Coupé mode, and printed text is saved to printout.txt file. When a program uses graphic output, it is saved to that output file as a plain sequence of bytes without further processing. Sam Coupé printer is emulated on port level, so all programs work, not just ROM.

Sinclair ZX Printer is emulated in ZX Spectrum 48/128 mode. This is a graphics printer and its output is saved to zxprint.bmp file. It is saved as a monochrome (black on white) image, always 256 pixels wide. The ZX Printer is emulated on port level, so all programs work, not just ROM.

Memory

ASCD was designed in simplicity of usage in mind, so the ZX Spectrum memory is always fixed to 48/128K and no configuration is needed. When you are in 128K mode, the page-disable bit is ignored, so you can always switch to 48K Basic and get back to 128K mode even without reset. Sam Coupé can be configured in more detail. You can select 256K or 512K mode with -sam512/-nosam512 switch. You can also configure fast external memory in Sam Coupé mode with switch -extmem <num> where num is number of external megabytes (0 to 4). This external memory is always connected from higher banks to lower in order to let it be compatible with Master DOS.

Note that memory contention is emulated only partially and all emulated computer models share the same memory speed schema.

Audio emulation

ASCD emulates standard beeper of ZX SPectrum and Sam Coupé, AY8910 soundchip of ZX Spectrum 128, SAA1099 soundchip of Sam Coupé and also 3-way DAC based on IC 8255. AY and SAA cannot be active at once, because it would cause unwanted degradation in audio volume and sound quality due to limited bitwidth for each of it when both are active but unused most of time. Instead of this, ASCD keeps only one of these soundchips active at a time, and switches between them as needed.

Sam Coupé starts in SAA mode and switches to AY mode as soon as it detects significant activity on AY port. It goes back to SAA mode after reset (F12).

ZX Spectrum 48/128 starts in AY mode and switches to SAA mode as soon as it detects SAA port 28 is set to 1 on SAA ports 1FF and 0FF. It goes back to AY mode after reset (F12). It also goes back to AY mode after OUT FFFE,FE (bits D4-D7 are set, other bits ignored, as used by russian soundcards). Note that Fullerbox AY ports can be also used to control the AY soundchip.

3x8bit DAC on ports 31,63,95 is normally off. It is activated with OUT 127,128 and when it is activated, beeper bit emulation is off until next reset. Both of these devices has sampling accuracy approximately 15625 Hz. AY and SAA cannot be used for digital music output, only beeper bit and this 3x8bit DAC. This device shares the same ports as Fullerbox AY audio. Fullerbox is normally on, it is switched off when DAC is active, and it's switched back on after next reset (F12). You can try this nice DAC in demo MQM 5.