# DTPC

DECtalk PC Emulator.

## How to use

You need to download and set up a few things in order to get the emulator up and running:

1. COM0COM: See below.
2. DECtalk PC ROMs: Rename the downloaded file to `dtpc.zip`, then create a folder called `roms` in the directory where you've extracted the ZIP containing this document and `dtpc.exe`, and place the file there.
3. DECtalk PC software modules: This package contains modules for all known DECtalk versions. The emulator is optimized for version 4.2CD, but all versions will work. Create a folder called `modules` in the directory where you've extracted the ZIP containing this document and `dtpc.exe`, and copy the files from the version you want into it. In the case of version 4.6, you have several languages to choose from, each in their own subfolder.

### How to set up COM0COM

Install COM0COM as you would any other program. Nothing needs to be changed during the installation before the finish screen. If you get any warnings about installing new drivers during the installation, just press install. When you get to the finish screen, be sure to check the box called "Launch Setup", then press finish.

The COM0COM setup will now open, and you should be in the first of two text fields. In the first, enter the COM port the DECtalk PC sends data to, and in the second, enter the COM port you communicate through, i.e. the one you set in your DECtalk Express driver, or use when sending text to the emulator. As an example, enter COM8 in the first field and COM9 in the second. Then navigate to the apply button and press enter. You should now be all set with COM0COM, and you may close the window.

### How to launch the DECtalk PC emulator

Press Windows+R, type cmd, then press Enter. Now navigate to the directory containing `dtpc.exe`, along with the `roms` and `modules` folders. For example, if you've put them in C:\dtpc, use the following command:

    cd C:\dtpc

For convenience, a file called `dt.bat` is included, containing the recommended settings. It sets the COM port to COM8 and the audio gain to 1.75 (which works well for screen reader use), and then launches the emulator. To run it, simply type:

    dt.bat

and press Enter. The DECtalk software will now be loaded to the DECtalk PC card, and you will then hear the startup message: "DECtalk PC is running.". You should now be able to send text to the DECtalk PC emulator through the other COM port you set up, COM9 in this example.

If you set up a different COM port in COM0COM, open `dt.bat` in a text editor from File Explorer and change the port to match. Inside the file, the COM port is set like this:

    set DTPC_PORT=COM8

and the audio gain is set like this:

    set DTPC_GAIN=1.75

## List of available variables

The following is a complete list of variables that can be changed before launching the emulator. Every variable is set with the command `set DTPC_VARIABLE=VALUE`.

Variable | Default value | Description
--- | --- | ---
`DTPC_LOG` | `0` | If set to 1, the emulator will log everything happening. This makes the emulation incredibly slow, and should only be used for debugging.
`DTPC_MODULES` | `modules` | This can be used to specify a different folder containing the software modules.
`DTPC_PORT` | `none` | This is used to specify the COM port that the emulator connects to, and is the only obligatory one.
`DTPC_DSPMHZ` | `80` | This can be used to change the speed of the DSP for testing purposes. The actual DECtalk PC card uses a speed of 20 MHz, but since this produces damaged audio in the emulator, 80 is the default. It takes a value between 5 and 160.
`DTPC_ANALOG` | `1` | Setting this to 0 will disable the emulated analog output chain, and the emulator will instead render the original, digital audio stream.
`DTPC_GAIN` | `1` | This can be used to adjust the gain of the audio output. It takes a value from 0.0 to 8.0.
`DTPC_PUMPUS` | `5` | This can be used to change the runtime polling interval in microseconds. It takes a value between 2 and 500.

## Current status of the emulator

- All modules and the dictionary load correctly, proven by a RAM dump.
- A few crashes have been fixed.
- All languages are supported through fallback to other file names for each relevant module.
- The emulator has a latency of about 400 milliseconds from pressing a key in a screen reader (or sending text) until speech is heard.
- The code is currently a bit cluttered, and could use a clean-up.