# Hatari User's Manual

Version 2.5.0, April 2024

Manual written by: Thomas Huth, Matthias Arndt & Eero Tamminen

Hatari on the WWW: http://hatari.tuxfamily.org/

## Index

## Introduction

### General description

Hatari is an Atari ST, STE, TT and Falcon emulator for Linux, *BSD, macOS, Windows and other Systems which are supported by the SDL library. The emulator is open source software and is distributed under the terms of the GNU General Public License (GPL).

The Atari ST was a 16/32-bit computer system which was first released by Atari in 1985. Using the Motorola 68000 CPU, it was a very popular computer having quite a lot of CPU power at that time. See Appendix B for details on emulation in general.

Unlike many other Atari emulators which try to give you a good environment for running GEM applications, Hatari tries to emulate the hardware as close as possible so that it is able to run most of the old games and demos. Of course you can run normal GEM applications with Hatari, too.

### Atari hardware differences matrix

Table of hardware features belonging to each Atari machine, except for the HW common to all (FDC, IKBD, MFP, MIDI, PSG, RS-232...).

Feature: | ST | MegaST | STE | MegaSTE | TT | Falcon | Notes:
Audio HW: | X = stock machine configuration
56001 DSP |  |  |  |  |  | X |
Microphone |  |  |  |  |  | X |
Microwire/LMC1992 |  |  | X | X | X |  |
Stereo DMA |  |  | X | X | X | X |
Graphics HW: |
Blitter | [x] | X | X | X |  | X | [x] = add-on, supported since TOS 1.02
Color grades | 512 | 512 | 4096 | 4096 | 4096 | 262144 |
Max. palette size | 16 | 16 | 16 | 16 | 256 | 256 | Falcon also has a 16-bit high-color non-indexed mode
Horizontal scrolling |  |  | X | X | X | X | Only possible with tricks on the normal ST
Videl |  |  |  |  |  | X | Hatari Videl emulation is not complete
Hard disk interfaces: | You need a hard-disk driver for using these with normal TOS
ACSI | X | X | X | X | X |  |
IDE | [1] | [1] | [1] | [1] | [2] | X | [1] = add-on, requires EmuTOS or TOS 2.06 for booting [2] = add-on, requires EmuTOS for booting
SCSI |  |  |  |  | X | X | Hatari support is incomplete
Other HW features: |
Second MFP |  |  |  |  | X |  | A.k.a. TT-MFP
MMU | [x] | [x] | [x] | [x] | X | X | [x] = Needs 68030+ CPU, requires 512k/1024k EmuTOS or TOS 2.06
FPU | [1] | [1] | [1] | [1] | X | [2] | [1] = Memory mapped FPU add-ons, not supported by Hatari [2] = 68881/68882 FPU through CPU coprocessor interface
NVRAM |  |  |  |  | X | X |
Real Time Clock |  | X |  | X | X | X | The Mega RTC is different from the Falcon/TT RTC
SCC A/B serial |  |  |  | X | X | X | Full support, including LAN port on MegaSTE/TT
TT-RAM + 32-bit addressing |  |  |  |  | X | [x] | [x] = Hatari patches TT-RAM support to TOS v4.04
VME bus |  |  |  | X | X |  | This expansion bus is not supported by Hatari
Feature | ST | MegaST | STE | MegaSTE | TT | Falcon | Notes

(EmuTOS v1.3+ included with Hatari binary packages supports all Atari HW except for Falcon 16-bit Videl TrueColor mode.)

### Features

#### Emulator features

- scaling any resolution to any size (using the SDL2 scaling)
- interleaved lines rendering with TV "monitor type" for ST-medium and (scaled) ST-low resolutions
- joystick and joypad emulation via cursor keys and connected PC joysticks
- GEMDOS interface driver to mount host directories as hard drives (with optional write-protection)
- support for auto-starting Atari programs, and installing Hatari as handler for them + floppy disk images
- support for (MSA, GZip and Zip) compressed floppy disk images (with optional write-protection)
- support for whole system state snapshot save/restore
- driver for extended VDI resolutions
- sound recording as .WAV or .YM files
- screenshots in PNG, BMP, NEO or XIMG format
- AVI video capture with sound
- emulation speedup, slowdown and pause support
- Built-in debugger and profiler with readline command completion, and tracing for all system calls and many HW events
- emulator control from Atari programs through NatFeats API, and from the host through a command FIFO or a socket

#### CPU / FPU emulation

- 68000 - 68060 and MMU emulation
- cycle-accurate 68000 emulation, and several options for disabling CPU accuracy for performance
- 68881, 68882 and 68040/060 internal FPU emulation, either using host FPU (default, faster), or emulating them more accurately in SW

#### ST hardware emulation

- ST RAM from 512kiB up to 14MiB
- optional cartridge images for the ST ROM port
- ST Shifter with ST-High, ST-Medium and ST-Low resolutions, overscan effects for all borders in color resolutions
- 512 color ST palette
- Spec512 mode support for low and medium resolutions
- many raster effects
- Ricoh chipset and add-on Blitter chip emulation
- PSG YM2149 emulation (soundchip) including STFM samples
- Printer port emulation on hardware level (print to file)
- RS232 emulation
- MIDI input/output/through emulation
- IKBD emulation (keyboard, mouse and joystick) with custom keyboard mapping
- FDC (floppy disk controller) emulation using floppy disk images in standard formats (*.ST, *.MSA, *.DIM and *.STX)
- FDC emulation via the IPF support library for using *.IPF, *.RAW and *.CTR images
- ACSI emulation for hard drive support (with basic support for extended host adapter protocol to access disks > 1 GB)
- TOS versions 1.00, 1.02, 1.04 and 2.06 (and EmuTOS) can be used in ST mode.

#### Mega ST hardware emulation

- Builtin real time clock (RTC)
- IMP chipset instead of Ricoh one
- TOS versions 1.02, 1.04 and 2.06 (and EmuTOS) can be used in Mega ST mode.

#### STE hardware emulation

There is support for following additional STE features:

- Blitter chip emulation
- horizontal and vertical hardware fine scrolling
- split screen techniques / in-screen video address manipulations
- (STE specific) left border opening
- 4096 colors STE palette
- Stereo DMA sample sound
- Microwire/LMC1992 emulation
- STE joypads (a.k.a. JagPad / PowerPad)
- TOS versions 1.06, 1.62, 2.05 and 2.06 (and EmuTOS) can be used in STE mode.

#### Mega STE hardware emulation

There is support for following additional features in Mega STE and later HW:

- Builtin real time clock (RTC)
- DD/HD mode and DIP switch registers
- Experimental Mega STE/TT/Falcon SCC channel B serial port support (incomplete)
- TOS versions 2.05 and 2.06 (and EmuTOS) can be used in Mega STE mode.

#### TT hardware emulation

There is support for following additional TT features:

- TT low/med/high resolution support
- Second (TT) MFP chip
- ST/TT palette switching and video shifter
- Up to 1024 MiB of TT-RAM and 32-bit memory addressing
- Only TOS version 3.05 and 3.06 (and 512k/1024k EmuTOS) can be used in TT mode.

#### Falcon hardware emulation

There is support for following additional Falcon features:

- Partial Videl and Videl borders emulation for all Falcon screen modes
- STE/Falcon palette switching and shifter
- Mono/RGB/VGA/TV monitor types
- DSP co-processor emulation
- Up to 14 MiB of ST-RAM and 1024 MiB of TT-RAM
- Experimental microphone (jack) emulation
- Experimental Crossbar sound matrix (ADC (mic & PSG), DAC, DMA, DSP) interconnect emulation + support for the additional DMA sound sample rates
- Experimental IDE master and slave emulation for hard drive support
- Experimental NCR5380 SCSI emulation for hard drive support (incomplete)
- TOS versions 4.00, 4.02, 4.04 and 4.92 (and 512k/1024k EmuTOS) can be used in Falcon mode. There is also experimental support for TOS 2.07 (the "Sparrow"-TOS), and for Linux, but they are not recommended for use yet

Both TT and Falcon emulation support NVRAM for persistent OS configuration and RTC (real time clock).

See the developers' doc/todo.txt file (included with Hatari sources) for the details on the few remaining emulation gaps and the Hatari Atari Software Compatibility List for which Atari programs are known to be affected by them.

### System requirements

Hatari needs a fast machine (1 GHz or more for ST/STE emulation, > 2 GHz for Falcon emulation) which is running a POSIX compatible operating system (preferably GNU/Linux) that supports the SDL library. There are also some ports to other operating systems like macOS or Windows, but they are not used by the developers, so such builds are normally not very well tested.

## Compiling and running

### Compiling Hatari

Required:

- A C compiler that supports the "gnu99" C extensions. Thus any recent versions of GCC or clang should be fine.
- A working CMake installation (version 3.3 or newer). See http://www.cmake.org/ for details.
- The SDL library v2.0.6 or newer. You can get it from http://www.libsdl.org/.

Optional:

- The zLib compression library for supporting compressed disk images. You can get it from https://zlib.net/.
- The PNG image library for PNG format screenshots and to decrease AVI video recording file sizes. You can get it from http://www.libpng.org/.
- The GNU Readline library for Hatari debugger command line editing.
- The Xlib library to support Hatari Python UI window embedding on systems with the X window system (Linux and other unixes).
- The PortMidi library required for MIDI device support on macOS and Windows http://portmedia.sourceforge.net/.
- The udev library for NatFeats SCSI driver media change detection (Linux).
- The IPF support library http://www.softpres.org/download.

The versions available in your Linux distribution will be sufficient in most cases, but make sure you have also the header files installed for the libraries as well! Typically they are in a corresponding -dev package.

After you have verified that you have the required libraries and their development files, change to the hatari/ directory. Create a build/ directory under it and configure the build system for your environment:

    mkdir -p build
    cd build
    cmake ..

Then compile Hatari by typing make. If all works fine, you'll get the executable hatari in the src/ subdirectory.

Note: Instead of calling CMake directly, you can also use the supplied configure script to run CMake and to give the arguments (like install prefix) in a format familiar from GNU Autotools using programs. Type "./configure --help" to see all the options supported by this script.

### Installation of a TOS ROM

Before you can start Hatari, you have to copy a TOS ROM image to the data directory (<prefix>/share/hatari/, by default /usr/local/share/hatari/) and rename it to tos.img, or use the --tos command line option to tell Hatari where to find a TOS ROM. Hatari needs a TOS ROM image because this contains the operating system of the emulated Atari.

Unfortunately it is not possible to ship an original ROM image with the Hatari package since these images are still copyrighted. But you can easily create an image with a real Atari machine and one of those various ROM-image programs for them (search for "TOSDUMP" with your favourite internet search engine).

Another solution is EmuTOS, which is also shipped with the official release versions of Hatari. EmuTOS is an open-source TOS clone. You can find it at: https://emutos.sourceforge.io/. While it works fine with most Atari software, it is not the best solution for Falcon emulation due to missing TrueColor mode support, or for playing old (disk only) games and other software tied to specific TOS version(s) (see emutos.txt for more details). However, it is free, its 1024k version supports all Atari machines emulated by Hatari, it supports more languages than original TOS, does not require a driver to support harddisk images, and it boots faster than original TOS.

If you do not specify a TOS image on the commandline and Hatari cannot find a suitable TOS image in the default dir, you'll get the chance to select a TOS image file from the GUI.

### Installation of the binary

Type make install as "root" user to do a systemwide installation.

Assuming you didn't change the default installation prefix and that /usr/local/bin/ is in your PATH, you should be now able to start the Hatari executable from anywhere.

When you finally have got a TOS image, try starting Hatari with the option --help to find out more about its command line parameters.

### Running Hatari for the first time

Now type hatari to run the emulator for the first time. If all goes well, you should now be presented with a window showing you the familiar little green desktop of the Atari ST. Press F12 to turn on the GUI to configure Hatari to suit your needs, press F11 to toggle windowed and fullscreen mode.

### Configuration options precedence

Hatari settings can come from several sources, with later ones overriding the earlier given ones:

- Builtin Hatari default options
- Global /etc/hatari.cfg (or /usr/local/etc/hatari.cfg) configuration file
- User specific ~/.config/hatari/hatari.cfg configuration file
- Command line arguments
- Option changes done at run-time in Hatari options GUI, with the Hatari debugger "setopt" command, or through the (optionally enabled) Hatari command FIFO or control socket

Some of the run-time changes require emulation to be reset for them to take effect. In most cases, Hatari will do that automatically when needed.

## Command line options and arguments

Usage:

     hatari [options] [disk image | directory | Atari program ]

As an argument one can give either a name of:

- A floppy disk image,
- A directory that should be emulated as a virtual GEMDOS HD, or
- An Atari program that should be autostarted. In this case the program's directory will be used as the C: drive from where this program will be started.

(These arguments are shortcuts for "--disk-a", "--harddisk" and "--auto" options listed below.)

Booting will be done from the disk image or directory that's given last on the command line as an option or the argument (and which corresponds to A: or C:).

Hatari command line options are split into several categories:

### General options

-h, --help

Print command line options and terminate

-v, --version

Print version information and terminate

--confirm-quit <bool>

Whether Hatari confirms quitting

-c, --configfile <filename>

Read additional configuration values from <file>, these override values read from the global and user configuration files

-k, --keymap <file>

load keyboard mapping from <file>. "Symbolic" mapping will be used as fallback for keys not defined there

--country <x>

Set EmuTOS ROM country code on Mega/ST/STe machines lacking NVRAM, when EmuTOS indicates supporting multiple ones.

In 512k EmuTOS images, country code selects the TOS keyboard layout and screen refresh (US = 60Hz NTSC, 50Hz PAL otherwise). In 1024k EmuTOS images (coming with Hatari binaries and supporting multiple languages), country code selects also TOS language.

Alternatively, one can use "tos-lang-change" tool from EmuTOS project to modify country code in the ROM image file itself. That works also for TOS v4

--layout <x>

Set NVRAM keyboard layout value. Set NVRAM keyboard layout value. While both TT and Falcon machines have NVRAM, only TOS v4 and EmuTOS 512k / 1024k ROM versions support multiple layouts.

Regardless of whether keyboard layout change is done through the ROM country code or NVRAM setting, it may impact your key mappings in Hatari key mapping files, Hatari Python UI arguments, or key injection in your automation scripts for Hatari debugger, command FIFO or hconsole tool

--language <x>

Set NVRAM language value. While both TT and Falcon machines have NVRAM, only TOS v4 and EmuTOS 1024k ROM versions support multiple languages. Default is taken from the LANG environment variable

--fast-forward <bool>

On fast machine helps skipping (fast forwarding) Hatari output

--auto <program>

Autostarts given program, if TOS finds it. Program needs to be given with full path it will have under emulation, for example "C:\DIR\PROGRAM.PRG"

### Common display options

-m, --mono

Start in monochrome mode instead of color

--monitor <x>

Select monitor type (x = mono/rgb/vga/tv)

--tos-res <x>

Select TOS resolution for color monitors (x = low/med/high/ttlow/ttmed)

-f, --fullscreen

Start the emulator in fullscreen mode

-w, --window

Start the emulator in windowed mode

--grab

Grab mouse (also) in windowed mode

--resizable <bool>

Allow window resizing

NOTE: this is supported only by Hatari SDL2 build

--borders <bool>

Show ST/STE/Falcon screen borders (for low/med resolution overscan demos)

--frameskips <x>

Skip <x> frames after each displayed frame to accelerate emulation (0=disabled, >4 uses automatic frameskip with given value as maximum)

--slowdown <x>

Slow down emulation by factor of x (used as multiplier for VBL wait time)

--statusbar <bool>

Show statusbar (with floppy leds etc etc)

--drive-led <bool>

Show overlay drive led when statusbar isn’t shown

--max-width <x>

Preferred / maximum Hatari screen width

--max-height <x>

Preferred / maximum Hatari screen height.

Maximum width and height options are part of Hatari's Atari monitor emulation. They limit the size Hatari should aim for its internal SDL framebuffer, and how much of the Atari screen borders are visible.

On an SDL2 build, framebuffer is then scaled to the Hatari output window based on the specified Hatari zoom factor (see below).

Aim of this is to have all resolutions show up in approximately same size, like on a real Atari monitor. Hatari's internal integer scaling support sets some limits on this, so it's an expert option.

Note: Only reason to change the defaults, should be limiting this to a smaller resolution for performance reasons, e.g. for video recording, or on really underpowered systems, to make monitor do all of the ST-low resolution scaling by forcing Hatari to ask SDL for CGA / QVGA resolution.

-z, --zoom <x>

This option overrides max width/height options so that e.g. ST-low resolution gets always doubled, and all resolutions (except TT-high) have approximately the same size, like on a real CRT monitor.

Zoom factor is then used to scale that up (or down) to the Hatari output window. This way scaling results always in approximately same sized Hatari window.

With non-integer zoom factors, linear scaling is used to smooth out the output, with integer zoom factors, scaling is done using nearest neighboring pixels for sharper output. This applies also to window resizes.

To avoid zooming for low ST resolutions, use "--zoom 1 --max-width 416 --max-height 276" (if you don't need borders, 320x200 size is enough). Disabling low resolution doubling like this is not recommended for Falcon emulation because TOS v4 bootup and some demos switch resolutions frequently.

--disable-video <bool>

Run emulation without displaying video (audio only)

### ST/STE specific display options

--spec512 <x>

Hatari uses this threshold to decide when to render a screen with the slower but more accurate Spectrum512 screen conversion functions (0 <= x <= 512, 0=disable)

--video-timing <x>

Wakeup State for MMU/GLUE (x=ws1/ws2/ws3/ws4/random, default ws3). When powering on, the STF will randomly choose one of these wake up states. The state will then affect the timings where border removals and other video tricks should be made, which can give different results on screen. For example, WS3 is known to be compatible with many demos, while WS1 can show more problems.

### TT/Falcon specific display options

Zooming to sizes specified below is internally done using integer scaling factors. This means that different Atari resolutions may show up with different sizes, but they are never blurry.

--desktop <bool>

Whether to use desktop resolution on fullscreen to avoid issues related to resolution switching. Otherwise fullscreen will use a resolution that is closest to the Hatari window size. (enabled by default)

--force-max <bool>

Hatari window size is forced to specified maximum size and black borders used when Atari resolution doesn’t scale evenly to it. This is most useful when recording videos of Falcon demos that change their resolution. (disabled by default)

--aspect <bool>

Whether to do monitor aspect ratio correction (enabled by default)

### VDI options

--vdi <bool>

Whether to use VDI screen mode. Doesn't work with TOS v4. TOS v3 memory detection isn't compatible with larger VDI modes (i.e. you need to skip the detection at boot). Original TOS desktops use wrong window size in 2-plane (4 color) VDI mode when screen height >= 400 pixels. Because of these issues, using EmuTOS is recommended for VDI mode

--vdi-planes <x>

Use extended VDI resolution with bit depth <x> (x = 1, 2 or 4)

--vdi-width <w>

Use extended VDI resolution with width <w> (320 < w <= 2048)

--vdi-height <h>

Use extended VDI resolution with height <h> (160 < h <= 1280)

Because TOS and popular GEM programs have problems with certain screen sizes, Hatari enforces restrictions on VDI screen size. In total VDI screen size is limited to 32-300kB, width to multiple of 16 pixels, and height to multiple of 8 pixels (smaller system font height). That translates to following maximum standard resolutions for the VDI mode:

monochrome

FullHD (1920x1080), WUXGA (1920x1200) and QWXGA (2048x1152)

2 plane mode (4 colors)

HD (1280x720), WXGA (1280x768) and XGA+ (1152x864)

4 plane mode (16-colors)

qHD (960x540), DVGA (960x640) and WSVGA (1024x600)

### Screen capture options

--crop <bool>

Remove statusbar from the screen captures

--avirecord

Start AVI recording. Note: recording will automatically stop when emulation resolution changes.

--avi-vcodec <x>

Select AVI video codec (x = bmp/png). PNG compression can be much slower than using the uncompressed BMP format, but uncompressed video content takes huge amount of space.

--png-level <x>

Select PNG compression level for AVI video (x = 0-9). Both compression efficiency and speed depend on the compressed screen content. Highest compression level (9) can be really slow with some content. Levels 3-6 should compress nearly as well with clearly smaller CPU overhead.

--avi-fps <x>

Force AVI frame rate (x = 50/60/71/...)

--avi-file <file>

Use <file> to record AVI

--screenshot-dir <dir>

Save screenshots in the directory <dir>

--screenshot-format <x>

Select screenshot file format (x = bmp/png/neo/ximg).

### Devices options

-j, --joystick <port>

Emulate joystick with cursor keys in given port (0-5)

--joy<port> <type>

Set joystick type (none/keys/real) for given port

--printer <file>

Enable printer support and write data to <file>

--midi <bool>

Enable MIDI support (when Hatari is built with PortMidi support)

--midi-in <filename>

Enable MIDI support and write MIDI data to <file> (when not built with PortMidi support)

--midi-out <filename>

Enable MIDI support and read MIDI data from <file> (when not built with PortMidi support)

--rs232-in <filename>

Enable MFP serial port support and use <file> as the input device

--rs232-out <filename>

Enable MFP serial port support and use <file> as the output device

--scc-a-in <filename>

Enable SCC channel A serial port support and use <file> for the input (only for Mega-STE, TT and Falcon)

--scc-a-out <filename>

Enable SCC channel A serial port support and use <file> for the output (only for Mega-STE, TT and Falcon)

--scc-a-lan-in <filename>

Enable SCC channel A LAN port support and use <file> for the input (only for Mega-STE and TT)

--scc-a-lan-out <filename>

Enable SCC channel A LAN port support and use <file> for the output (only for Mega-STE and TT)

--scc-b-in <filename>

Enable SCC channel B serial port support and use <file> for the input (only for Mega-STE, TT and Falcon)

--scc-b-out <filename>

Enable SCC channel B serial port support and use <file> for the output (only for Mega-STE, TT and Falcon)

### Floppy drive options

--drive-a <bool>

Enable/disable drive A (default is on)

--drive-b <bool>

Enable/disable drive B (default is on)

--drive-a-heads <x>

Set number of heads for drive A (1=single sided, 2=double sided)

--drive-b-heads <x>

Set number of heads for drive B (1=single sided, 2=double sided)

--disk-a <file>

Set disk image for floppy drive A

--disk-b <file>

Set disk image for floppy drive B

--fastfdc <bool>

Speed up FDC emulation (can cause incompatibilities)

--protect-floppy <x>

Write protect floppy image contents (on/off/auto). With "auto" option write protection is according to the disk image file attributes

### Hard drive options

-d, --harddrive <dir>

GEMDOS HD emulation. Emulate hard disk partition(s) with <dir> contents. If directory contains only single letter (C-Z) subdirectories, each of these subdirectories will be treated as a separate partition, otherwise the given directory itself will be assigned to drive "C:". In the multiple partition case, the letters used as the subdirectory names will determine to which drives/partitions they’re assigned. If <dir> is an empty string, then harddrive's emulation is disabled

--protect-hd <x>

Write protect hard drive <dir> contents (on/off/auto). With "auto" option the protection can be controlled by setting individual files attributes as it disables the file attribute modifications for the GEMDOS HD emulation

--gemdos-case <x>

Specify whether new dir/filenames are forced to be in upper or lower case with GEMDOS HD emulation. Off/upper/lower, off by default

--gemdos-time <x>

Specify what file modification timestamps should be used, emulation internal (atari) ones, or ones from the machine (host) on which the machine is running. While Atari emulation and host clocks are in sync at Hatari startup, they will diverge while emulation is running, especially if you use fast forward. Default is "atari". If you modify files accessed by the Atari side, directly from the host side while Hatari is already running, you may want to use "host" option

--gemdos-conv <bool>

Whether GEMDOS file names with 8-bit (non-ASCII) characters are converted between Atari and host character sets. On Linux, host file name character set is assumed to be UTF-8. This option is disabled by default, in case you have transferred files from Atari machine without proper file name conversion (e.g. by zipping them on Atari and unzipping on PC)

--gemdos-drive <drive>

Assign (separately specified) GEMDOS HD to given drive letter (C-Z) instead of default C:, or use "skip" to specify that Hatari should add GEMDOS HD after IDE and ACSI drives (assumes Hatari and native HD driver parse same number of partitions from the partition tables in HD images)

--acsi <id>=<file>

Emulate an ACSI hard drive with given bus ID (0-7) using image <file>. If just a filename is given, it is assigned to bus ID 0

--scsi <id>=<file>

Emulate a SCSI hard drive with given bus ID (0-7) using image <file>. If just a filename is given, it is assigned to bus ID 0

--ide-master <file>

Emulate an IDE 0 (master) hard drive with an image <file>

--ide-slave <file>

Emulate an IDE 1 (slave) hard drive with an image <file>

--ide-swap <id>=<x>

Set byte-swap option <x> (off/on/auto) for given IDE <id> (0/1). If just option is given, it is applied to IDE 0

### Memory options

--memstate <file>

Load memory snap-shot <file>

-s, --memsize <x>

Set amount of emulated RAM, x = 1 to 14 MiB, or 0 for 512 KiB. Other values are considered as a size in KiB. While Hatari allows 14 MiB for all machine types, on real HW, ST/STE can have up to 4 MiB, MegaSTE/TT up to 10MiB, and Falcon up to 14 MiB RAM.

--ttram <x>

Set amount of emulated TT RAM (for Falcon and TT mode), x = 0 to 1024 MiB (in 4MiB steps)

### ROM options

-t, --tos <imagefile>

Specify TOS ROM image to use

--patch-tos <bool>

Use this option to enable/disable TOS ROM patching. Experts only! Leave this enabled unless you know what you are doing!

--cartridge <imagefile>

Use ROM cartridge image <file> (only works if GEMDOS HD emulation and extended VDI resolution are disabled)

### CPU/FPU/bus options

--cpulevel <x>

Specify CPU (680x0) to use (use x >= 1 with EmuTOS or TOS >= 2.06 only!)

--cpuclock <x>

Set the CPU clock (8, 16 or 32 MHz)

--compatible <bool>

Use a more compatible 68000 CPU mode with better prefetch accuracy and cycle counting

--cpu-exact <bool>

Use cycle exact CPU emulation (cache emulation)

--addr24 <bool>

Use 24-bit instead of 32-bit addressing mode (24-bit is enabled by default)

--fpu <x>

FPU type (x=none/68881/68882/internal)

--fpu-softfloat <bool>

Use full software FPU emulation (Softfloat library)

--mmu <bool>

Use MMU emulation

### Misc system options

--machine <x>

Select machine type (x = st, megast, ste, megaste, tt or falcon)

--blitter <bool>

Enable blitter emulation (ST only)

--vme <x>

Hatari doesn't have proper MegaSTE/TT VME emulation yet, but this controls access to related SCU registers (MegaSTE/TT only). With "dummy", (no-op) access is allowed (=VME HW), otherwise TOS v2 and v3 crash on bootup on MegaSTE and TT. Supports VME tracing. With "none", register access causes errors (=no VME HW), which is needed for Linux to boot with TT emulation until there's full SCU interrupt support. No VME tracing support.

--rtc-year <x>

With the default value 0, RTC date and time are taken from the host. If application does not handle current dates, this can be used to change RTC year to a more compatible one. See also "--gemdos-time" option.

--dsp <x>

Falcon DSP emulation (x = none, dummy or emu, Falcon only)

--timer-d <bool>

Patch redundantly high Timer-D frequency set by TOS. This can increase Hatari speed significantly (especially for ST/e emulation) as the original Timer-D frequency causes large amount of extra interrupts to emulate.

--fast-boot <bool>

Patch TOS and initialize the so-called "memvalid" system variables to by-pass the memory test of TOS, so that the system boots faster.

### Sound options

--mic <bool>

Enable/disable (Falcon only) microphone

--sound <x>

Sound frequency: 6000-50066. "off" disables the sound and speeds up the emulation. To prevent extra sound artifacts, the frequency should be selected so that it either matches evenly with the STE/TT/Falcon sound DMA (6258, 12517, 250033, 50066 Hz) or your sound card frequencies (11025, 22050, 44100 or 6000...48000 Hz). Check what your sound card supports.

--sound-buffer-size <x>

SDL’s sound buffer size: 10-100, or 0 to use default buffer size. By default Hatari uses an SDL buffer size of 1024 samples, which gives approximately 20-30 ms of sound depending on the chosen sound frequency. Under some OS or with not fully supported sound card, this default setting can cause a bigger delay at lower frequency (nearly 0.5 sec). In that case, you can use this option to force the size of the sound buffer to a fixed number of milliseconds of sound (using 20 is often a good choice if you have such problems). Most users will not need this option.

--sound-sync <bool>

The emulation rate is nudged by +100 or 0 or -100 micro-seconds on occasion. This prevents the sound buffer from overflowing (long latency and lost samples) or underflowing (short latency and repeated samples). The emulation rate smoothly deviates by a maximum of 0.58% until synchronized, while the emulator continuously generates every sound sample and the crystal controlled sound system consumes every sample.
(on|off, off=default)

--ym-mixing <x>

Select a method for mixing the three YM2149 voice volumes together. "model" uses a mathematical model of the YM voices, "table" uses a lookup table of audio output voltage values measured on STF and "linear" just averages the 3 YM voices.

### Debug options

-W, --wincon

Open console window (Windows only)

-D, --debug

Toggle whether CPU exceptions invoke the debugger

--debug-except <flags>

Specify which exceptions invoke debugger, see "--debug-except help" for available (comma separated) exception flags.

--bios-intercept <bool>

Enable/disable XBios command parsing. Allows Atari programs to use all Hatari functionality and change Hatari state through Hatari specific XBios(255) calls. XBios(20) printscreen calls produce also Hatari screenshots. XBios(11) Dbmsg call can be used to invoke the debugger.

--conout <device>

Enable console (xconout vector functions) output redirection for given <device> to host terminal. Device 2 is for the (CON:) VT52 console, which vector function catches also EmuTOS panic messages and MiNT console output, not just normal BIOS console output.

--disasm <x>

Set disassembly options. 'uae' and 'ext' select the disassembly engine to use, bitmask sets disassembly output options and 'help' lists them.

--natfeats <bool>

Enable/disable (basic) Native Features support. E.g. EmuTOS uses it for debug output.

--trace <flags>

Activate debug traces, see "--trace help" for available tracing flags

--trace-file <file>

Save trace output to <file> (default=stderr)

--msg-repeat

Toggle whether successive repeats of identical log or trace messages will be suppressed, so that only their count is shown (default=suppress). Disassembly, register and (multi-line) AES traces bypass this feature

--parse <file>

Parse/execute debugger commands from <file>

--saveconfig

Save Hatari configuration and exit. Hatari UI needs Hatari configuration file to start, this can be used to create it automatically.

--control-socket <path>

Hatari connects to given local socket file and reads commands from it. Use when the control process life-time is longer than Hatari's, or control process needs response from Hatari

--cmd-fifo <path>

Hatari creates the indicated FIFO file and reads commands from it. Commands can be echoed to FIFO file, and are same as with the control socket. Hatari outputs help for unrecognized commands and subcommands

--log-file <file>

Save log output to <file> (default=stderr)

--log-level <x>

Log output level (x=debug/todo/info/warn/error/fatal)

--alert-level <x>

Show dialog for log messages above given level

--run-vbls <x>

Exit after X VBLs

--benchmark

Start in benchmark mode (use with --run-vbls). This allows to measure the speed of the emulation in frames per second by running at maximum speed (don't wait for VBL). Disable audio/video output to have as little OS overhead as possible

Type hatari --help to list all the command line options supported by a given version of Hatari.

See Hatari Debugger Manual for more information on debugging and profiling Atari programs.

## Using the emulated system

Once you have started Hatari successfully, you can use the emulator as an almost complete Atari ST computer system.

### The GUI

Press F12 to enter the GUI. Navigate it with the mouse. The GUI is rather self explanatory.

#### The Main Menu

You can reach the other setup dialogs from the main menu by clicking on the appropriate buttons.

You can load the current settings from a configuration file by clicking on the Load config button, and save the current settings to a configuration file by clicking on the Save config button.

Click OK to go back and continue the emulation. All changed options will be applied.

NOTE:Any changes to machine ROM or HW configuration mean that emulation is reset to apply the change. Don't do that unless you're OK to lose your current emulation state.

Select the "Reset machine" option if you want the emulated machine to perform a cold reset. This is equal to switching the power off and on again on a real Atari machine.

Click Quit to terminate Hatari and return to the host OS.

Click Cancel to abandon any changes that you have made.

(There are also keyboard shortcuts to do several of these actions.)

#### The File Selector Dialog

The file selector dialog appears whenever you are prompted to choose a file or folder.

To enter a folder or choose a file, simply click on the entry in the main box of the dialog. To navigate in the file list, you can use the scrollbar on the right with mouse, use mousewheel, keyboard up + down arrow (with Alt), or page up + down keys.

You can use the three buttons in the upper right corner for additional folder navigation. Click the .. button to go up one level in the directory tree. The CWD button takes you to the current working directory (i.e. the folder that was current when Hatari has been started). Click the ~ button to return to your home directory. The / button can be clicked to go to the root directory of the file system.

When you tick the "Show hidden files" setting, Hatari will also show files that start with a dot in the file selection dialog.

#### The System Dialog

The system dialog can be used to define the basic hardware attributes of the machine that should be emulated.

The machine type option is used to select the type of Atari computer to be emulated:

- The ST was the very first 16/32-bit computer from Atari. Most older games and demos require an ST. TOS 1.00, 1.02, 1.04 or 2.06 is required for running in ST mode.
- The Mega-ST was an slightly improved version which also provided the so-called blitter chip (for accelerating certain graphic operations) and a Real Time Clock (RTC) chip. A note for experts: Hatari emulates the Mega-ST with the so-called IMP chipset, while the normal ST is emulated with the Ricoh chipset. This gives a slightly different behavior between the two machine types with regards to bus errors.
- The STE was introduced some years later and had some more advanced hardware features, like the blitter chip, hardware scrolling and DMA sample sound (but no Real Time Clock). There are not that many demos or games that really require an STE but since most normal ST games/demos also work with an STE, it is normally safe to always work in STE mode. Also make sure to use TOS version 1.06, 1.62 or 2.0x with this machine type.
- The Mega-STE was an improved version of the STE, with 16 MHz (instead of 8 MHz) CPU frequency, a built-in Real Time Clock chip, and a VME bus.
- The TT was the advanced workstation from Atari. It featured a 32MHz 68030 CPU, a very high monochrome resolution, and a lot of interfaces. However, compatibility was not as high as with the other machines. For TT emulation you need TOS 3.0x.
- The Falcon was Atari's last computer, using a 16 MHz 68030 CPU and some more interesting new hardware feature, like the Videl graphic chip and DSP 56001 for audio processing. You need TOS 4.0x for running in Falcon mode.

Note: Falcon and especially TT emulation are still considered as experimental and incomplete, so quite a bunch of programs do not work very well yet. Also a lot of old games and demos do not work with these machine types anymore since the hardware is quite a bit different. There were only very few programs that were made for the TT exclusively, while there were some interesting games and demos specially made for the Falcon.

The video timings ("wakestate") settings influence the internal timings of the ST video chip emulation. You normally do not have to change these unless you know what you are doing, only some very few demos require a special setting here.

For Falcon mode, you can choose whether you want to disable DSP emulation, fake it or enable full emulation. Most Falcon programs only play sound or work correctly when you enable the DSP emulation, but it needs a lot of host CPU power (more than 2 GHz) for full emulation. So if you have a slow host CPU, you can try if your Falcon program also runs with DSP disabled or in the "dummy" fake mode. Note that you cannot change this option while the DSP based program already runs.

The check boxes in the "CPU and system parameters" section can be used to fine-tune the machine and CPU types.

The Blitter option can be set to enable Blitter emulation in plain ST mode. The Blitter is a custom chip that accelerates some graphical operations. Note that in Mega-ST, STE and Falcon mode, the Blitter is always enabled (since these machines have always been sold with a Blitter chip). The TT was always shipped without the Blitter chip.

The "Patch Timer-D" option changes the Timer-D initialization from TOS. TOS uses the MFP timer D as a baudrate generator for RS232. However, the TOS default value slows down the emulation. The patch gives you a better performance. It is normally safe to enable the patch, but if you encounter a program that does not work, you can try to disable the patch to see if it works better.

With the "Boot faster" option, Hatari patches the TOS ROM and some system variables, to speed up the boot process of the emulated system, e.g. by simulating a warm reset. This is a convenient option, but some very few old programs rely on an unmodified boot process, so in rare cases this option has to be switched off to get those programs running.

NOTE: The emulated Atari system is very very sensitive to all of these options so Hatari will automatically reset the emulation when changes to (most of) these settings are applied. Rest of the settings apply to next boot.

Most settings are also selected automatically when one uses the --machine command line option.

#### The CPU Dialog

##### CPU type

The CPU type option can be used to select the level of the central processing unit. If you are not sure what to use, simply select 68000 for ST and STE machines and 68030 for TT and Falcon emulation, since these were the original configurations used in the Atari computers. In case you want to vary the CPU type, you should be aware of some constraints:

- Atari ST and STE have only been shipped with a 68000 CPU, so for best compatibility with old programs, you should choose this CPU type.
- If you are going to use TOS 1.0x, you also have to select the 68000 CPU, since these TOS versions are not aware of the higher CPU levels yet. If you want to use a higher CPU level with the ST or STE machine type, you have to use TOS 2.0x instead.
- Atari TT and Falcon computers were using the 68030 CPU, so you should select the 68030 CPU type for these machines.
- TOS 3.0x and 4.0x also only work with a CPU >= 68020.
- 68010 and 68040, 68060 have never been used in official Atari computers, so don't use these CPU types without a good reason.
- The 68060 option is currently considered as experimental, so do not use this option unless you know what you are doing.

##### CPU options

The CPU clock option can be used to select the frequency that is used to clock the CPU. 8 MHz is the standard for ST and STE and the most compatible frequency for old software. The CPU in the TT was clocked with 32 MHz. The original Mega STE and Falcon could be run in both, 8 MHz and 16 MHz with the possibility to toggle between the two frequencies during runtime via software. Hatari supports this feature, too, so it is possible to switch between 8 and 16 MHz from the emulated side, e.g. with certain accessories or CPX. However, if you select 32 MHz or a non-standard CPU in the Hatari GUI, this feature is disabled, since Hatari assumes that you rather want to emulate a system with an accelerator CPU board (which don't implement this the software frequency switching).

The "Prefetch mode" option is used to enable the emulation of 68k address errors and the so-called CPU prefetch buffer. This is needed for best compatibility, but it slows down emulation a little bit so you can disable it if you don't need it and if you have a slow host system.

The "Cycle exact", the "MMU emulation" and "24-bit addressing" options are considered as experimental and should only be changed if you know what you are doing.

##### FPU type

The FPU settings can be used to select the type of floating point unit of >= 68020 CPUs. (68882) FPU is enabled by default only for TT machines, as they were only ones that originally shipped with one.

When emulating the Motorola FPU, PC host FPU can be used to do the math. This is the default and fastest method, but its results have some slight differences compared to a real Motorala FPU.

For higher precision, you can select the "Accurate FPU emulation" mode: this will emulate all the FPU operations using only the CPU and with the same rules as the Motorala's FPU. This emulation is bit-exact (except for the last few bits in trig/log functions), and a little slower than using host FPU.

#### The Floppy Disks Dialog

This dialog can be used to choose which floppy disks should be emulated in the disk drives. You can use most standard Atari ST disk image files. You may select and browse also zipped disk images. See "Floppy disk images" section for details.

Each drive can be enabled or disabled (as if it was not connected or turned off). You can also choose to emulate a single sided drive instead of a double sided one (some games or demos will have a different behaviour in single sided mode).

Click on the button Browse next to the A: and B: option to go to the fileselector to choose a disk image for the corresponding drive.

Click on Eject to eject a disk image from the emulated drive. The emulated ST will act as if had no floppy disk in its drive.

You can specify a default directory where Hatari will start to browse the filesystem.

Check the "Auto insert B" option if you want Hatari to be smart and insert the second disk of a two disk game automatically. Some games then use the second drive automatically. In the case that a game is not able to find the disk in the second drive, you have to insert the second disk in drive A: manually when prompted.
NOTE: This option only works properly if the file name of the first disks ends with an 'a' before the extension and the second disk name ends with a 'b'.

Select if you want to use fast FDC (Floppy Disk Controller) emulation. "Fast floppy access" option will speed up disk accesses, but this can cause incompatibilities with programs that expect correct delays (some games/demos don't expect data to be read too fast from the disk). For example, when using STX images, most protections will fail if fast floppy access is enabled.

If you want, you can set Hatari to write-protect your disks. Atari ST viruses can spread on disk images, so that can be a good idea. However, note that some programs won't work correctly (or at all) with write protected disks, and things like saving highscores in games will fail.

If you need to create a new blank disk image, click on Create blank image. Parameters for the new image can be set in the following dialog. HD and ED disk sector counts are for larger, non-Atari disk sizes, they can be useful with programs that don't work from hard drive, or with with GEMDOS HD emulation. Click on Create to save the new image or on Back to return to the disk dialog.

After clicking Create, a fileselector appears. You can browse the filesystem now. Select the target directory, click beside "File:" and type in a name for the new disk image. The name should terminate with .st or .msa.

Hatari can currently create plain .ST and .MSA disk images exclusively. hmsa command line utility can be used to convert disk images between .ST and .MSA formats.

#### The Hard Disks Dialog

This dialog can be used to change the hard disk settings.

Here you can select a hard disk image file for ACSI, SCSI or IDE hard drive emulation, or you can select a host directory to be emulated as the Atari hard drive. Use the arrow buttons to select the ID of the drive that you want to set, then click on Browse to choose a file which should be used for providing the contents of the hard disk, or click on Eject to disable the current ID.

IDE controllers are using a 16-bit interface, so depending on where the contents of a real hard disk have initially been created (on an Atari machine or on a PC), and depending on where the contents have been read out from the disk, 16-bit values in the image might be byte-swapped. Hatari can either try to detect this situation automatically (when "Auto" is selected), or you can tell Hatari whether it should always byte-swap the disk image contents or not.

GEMDOS HD emulation can be used to provide a folder on your host computer file system as hard drive(s) to the emulated Atari. Select Browse to choose a folder, or Eject to disable the drive(s) again.
The "Atari <-> host 8-bit filename conversion" setting can be used to tell Hatari whether it should try to convert the character set of the file names on the host to the Atari character set, since modern operating systems use different character sets than Atari TOS. File name conversion option is best-effort conversion between the host OS and Atari character set for the non-ASCII file names exposed by the GEMDOS HD emulation.
GEMDOS HD emulation can override partition(s) from HD images. With "Add GEMDOS HD after ACSI/SCSI/IDE partitions" option Hatari tries to assign it to a drive after the partitions on HD images, instead of C: (whether that works correctly depends on whether your emulated Atari hard disk interprets the HD images partition tables similarly to Hatari, and whether it starts assigning them from C: onwards). As a last resort, you can use "--gemdos-drive" command line option to explicitly specify which drive should be used for GEMDOS HD.
Finally, you can also choose whether you want to provide the files on GEMDOS HD only as write-protected to the Atari environment or not, or whether you want Hatari to select this status automatically depending on the file attributes of the file in the host file system.

Check "Boot from HD" to set given hard disk image / directory as TOS boot device (if ACSI or IDE is enabled, it is C:, otherwise it is the first specified GEMDOS HD drive). With command line options, the value of this setting depends on whether you specify floppy image or harddisk later on the command line (later one takes precedence).

Note that you need TOS version >= 2.05 to boot from IDE hard drive. ACSI hard drive emulation does not work with TOS 4.0x in Falcon mode. For SCSI emulation, you either need to run with TT or Falcon emulation. Please also refer to the Hard disk support section for more details about hard disk emulation.

#### The Memory Dialog

You can select the amount of RAM for the emulated machine here. While Hatari allows 14 MiB for all machine types, on real HW, ST/STE can have up to 4 MiB, MegaSTE/TT up to 10MiB, and Falcon up to 14 MiB RAM. Of values below 4 MiB, only ones that were valid on a real unmodified STFM are available

TT RAM size allows to emulate up to 1024 MiB of 32-bit RAM. This is only useful in Falcon and TT mode, and require to disable "24 bit addressing" mode in the CPU options (Hatari needs to patch Falcon TOS v4 for this)

Here you will find the options to save memory snapshots as well.

Click on Save to save a memory snapshot to file. You can select a new filename here.

Click on Restore to restore a memory snapshot from a file. Use the fileselector to select the snapshot to be restored.

NOTE: Memory snapshots are not interchangeable between different versions of Hatari. e.g. if you compile a newer Hatari, you cannot load your old memory snapshots back.

#### The ROM Dialog

Here you can select the TOS image to use. Click on Browse to select it via the fileselector. You can also select an optional cartridge image to use. Click on Browse to select one via the fileselector. Click on Eject to disconnect the custom cartridge image.

Depending on the machine type that you want to emulate, you can either use EmuTOS (see emutos.txt for more info), or a TOS version that supports the machine type. For ST mode, use TOS 1.00, 1.02, 1.04 or 2.06. For STE mode, use TOS 1.06, 1.62, 2.05 or 2.06. If you want to use the TT mode, you must specify a TOS 3.05 or 3.06 image here. And in Falcon mode, you have to use either TOS 4.00, 4.02, 4.04 or 4.92. However, you should always use TOS 4.04 for Falcon mode, it is the most common one. Also note that TOS 4.92 cannot be booted from a boot disk (like it is done on a real Falcon), you have to specify it directly in the TOS ROM setup dialog here.

Keep in mind that any custom cartridge image will not work together with GEMDOS HD emulation or the VDI extended resolution emulation since some additional driver code will be used in the cartridge memory space for these emulations.

#### The Joystick Dialog

In this dialog, you can configure the emulated joysticks. With the upper two arrows, you can choose the joystick which you want to configure.

Joystick 1 is the normal ST joystick port and 99.9% of all ST games use this port. Joystick 0 emulates a joystick plugged into the ST mouse port and is often used in games for two players.

With STE joypad A and B, you can enable the emulation of Jaguar joypads which are plugged in the enhanced joystick ports of the Atari STE. Only very few STE games support these joypads, so you often won't need this (but some Falcon games require them).

Finally, Hatari also emulates joysticks which were plugged on the parallel port with a special adapter on a real ST. These were used in some few multi-player games like "Gauntlet 2".

For each ST joystick, choose whether you want to disable it, use the keyboard for emulation or use a real PC joystick.

For keyboard emulation, you can select the keys by pressing the Define keys button. You will be prompted to press the keys for up, down, left, right and fire.

If you want to use a real PC joystick for the emulation, you should connect it to your PC before you start Hatari. Then you can choose the joystick with the two lower arrows.

Check the "Enable autofire" option if you are too lazy to pound on the fire button in shoot'em-up games. However, this option only works with certain games. In some other games, it gets worse if you enable this option.

"Button 2" options select whether (real joystick) fire button 2 emulates joystick up or a SPACE key press. Unless game explicitly queries other joysticks, latter will work only for joystick 1 (queried also by TOS). If SPACE key gets stuck down (can happen if querying given joystick stops while button 2 is kept down), visiting Joystick setup dialog will fix that.

See Emulated joystick section for details.

#### The Atari Monitor Dialog

Here you control the video output of the emulated Atari.

You can select which sort of monitor to use. This option depends on the machine type which you have selected in the "System options" dialog. In ST and STE mode, you can choose between monochrome mode (select "Mono") and color mode (select one of the other monitor types). When you select "TV" and use zoomed low resolution or switch to ST medium, you get TV-like screen with half the intensity on every other line. VGA is not a valid setting in ST and STE mode, so if you select VGA for an ST/STE, Hatari will emulate an RGB monitor instead. Switching between mono and a color monitor acts like a monitor switch on a real ST - so beware, this will reboot your emulated system!

In TT mode, you can only choose between TT-high resolution ("Mono") and normal modes (select one of the other monitor types). Finally the Falcon mode supports all four types of monitors. Note that most Falcon demos/games require a RGB or TV mode, and do not work with VGA, although there are also few VGA-only games and demos.

"Show ST/STE borders" toggles the displaying of the borders around the ST / STE. Some demos and games use the screen borders for displaying additional graphics. As enabling this option increases CPU computing time, don't enable it if you have a very slow computer. Borders are shown also in Falcon emulation, but Videl emulation doesn't yet support palette effects. This option doesn't affect TT screen mode or extended VDI resolutions.

Extended VDI resolutions will emulate a sort of extended graphics card in the emulated machine, which gives you larger (2-16 color) resolutions for GEM. Select a resolution and color depth. Check to activate. This mode isn't affect by the other video options mentioned above. Uncheck to get back to a normal ST behaviour.

Note that there are several gotchas with extended VDI resolutions:

- Only GEM conformant applications work with them, 99% of all games and demos don't.
- GEM programs accessing screen directly (like NVDI) may crash with large enough screen sizes.
- Memory reserved for (larger) extended resolutions breaks TOS v3 memory detection, so you need to interrupt boot up memory detection.
- TOS v4 isn't compatible with them. In Falcon emulation you need to use EmuTOS with extended resolutions.

Because TT and Falcon support natively larger resolutions, VDI mode is most useful with ST / STE emulation.

#### The Hatari Screen Dialog

Here you control how the video output of the emulated Atari appears on your screen.

Check "Fullscreen" to run Hatari in fullscreen. By default Hatari runs in windowed mode.

The "Frame Skip" option can be used to speed up the emulator if it is running too slow on your system. Disable frame-skip if you have a fast computer. When selecting 1, 2 or 4, drawing of corresponding number of frames will be skipped after each frame actually shown by Hatari. Select "Auto" to let the emulator to decide whether, and how many frames will be skipped.
Note: The frameskip option also affects the frame rate of the screen animation recording!

Indicators that you can have on the Hatari window:

- "Statusbar" at the bottom of the screen. The statusbar shows the floppy drive LEDs, the current frameskip value, the machine type including TOS version and memory size, and whether recording is currently active.
- "Drive led" is a colored rectangle shown on top of the Hatari window contents. It will show any disk (floppy or hard drive) activity.
- "None" turns both of above options off.

"Keep desktop resolution" option will use your desktop resolution for fullscreen to avoid issues related to resolution switching, especially on LCD monitors (they're slow). If this isn't enabled, values from the "Max zoomed win" option are used in selecting a suitable resolution.

"Max zoomed win" option controls up to which size Hatari tries to scale the Atari resolutions and how much of the borders (enabled in Atari Monitor dialog) will be shown. Note that there are several limitations in this and the "Keep desktop resolution" option, partly because Hatari has different implementations for different video modes:

- VDI resolutions (selectable in Atari Monitor dialog) aren't scaled.
- ST and STE video emulation supports only doubling of the ST-low resolution.
- Hatari doesn't support downscaling. If the original Atari resolution is larger than the specified size (e.g. TT-high), the Hatari screen size will also be larger than requested. Hatari Falcon/TT window size will be limited to the Desktop size though.
- TT and Falcon resolutions support only integer scaling ratios. If the scaling ratio cannot match the requested size exactly, Hatari will use a ratio that will produce smaller size closest to the requested one.

You should set these values to a size that suits best your monitor resolution. It is intended to help in getting Hatari to best use your monitor space on a windowed mode and in fullscreen avoiding "fuzzy" scaling done by your LCD monitor.

Giving "-z 2" option on command line will reset max zoomed size to default values and "-z 1" will disable all zooming. Note that zooming takes additional CPU computing time and should not be enabled on very slow computers.

Click the Screenshot button to create a screenshot in the selected format to the current working directory. PNG and BMP formats will match the visual output of Hatari. NEO and XIMG formats will produce Atari ST native images, but will not include borders, or raster palette effects. NEO is limited to the 3 standard ST resolutions.

Click the Record AVI button to record an AVI format video of Hatari screen (and audio) output.

Selecting "Crop statusbar" option will leave statusbar out from the screenshots and recorded videos.

#### The Keyboard Dialog

Here you can select the keyboard mapping to use. Two different mappings called "Symbolic" and "Scancode" are predefined.

"Symbolic" tries to map the symbolic values of your PC keys to the ST keys. It should be working pretty good on all systems as long as your keyboard layout looks close to the standard English keyboard layout. However, you might experience some problems with special keys like brackets etc.

"Scancode" uses the scancode values of your PC keys for keyboard mapping. If it works on your system, this often gives better results than the symbolic mapping. Note that you also need a TOS version with the right language (e.g. use a French TOS if you are using a French keyboard).

You can also load a custom keyboard mapping file here if you wish. Please note that the custom keyboard mapping will use the "symbolic" mapping for all keys that are not defined by your map file. Have a look at the supplied example mapfile (keymap-sample.txt) to see how to create your own keyboard mapping.

The "Shortcuts" section can be used to configure the keyboard shortcuts that can be activated while the emulation is running. Hatari supports two sets of keyboard shortcuts: The first type is activated by pressing a modifier key (AltGr / right Alt by default, Cmd key on macOS) together with the key, and the second type is directly activated by pressing a single key, without additional modifier key. Use the arrow buttons to select the shortcut that you want to change, then press one of the Define buttons to change the key for the shortcut. You'll be prompted to press the key that should be used. If you reconsider and don't want to change the key, you can press the left mouse button instead. By pressing the right mouse button during the prompt, you can also erase the current shortcut setting.

The last setting in this dialog can be used to disable the key repetition in fast forward mode. When the emulator runs in fast forward mode, and you want to type text, it can be annoying that the emulated system detects multiple key events due to the key repetition of the emulated system. So this can be avoided by enabling this option.

#### The Sound Dialog

Here you can control the sound subsystem.

Check "Enabled" if you want emulated sound at all. Emulation is faster if sound emulation is turned off.

If you experiment latency issues with your OS audio's output, you can check the "Synchronize" option to adjust Hatari's video emulation to match your OS audio.

Nine frequencies from low to high quality are available. Experiment a little bit to find out which fits best for your setup. For most modern computers, 44100 Hz or 48000 Hz should be fine. For older or slower host systems, you should use a lower frequency. 12517, 250033 and 50066 Hz are frequencies supported by the STE/TT/Falcon sound DMA.

YM voices volume mixing "ST table" method uses a lookup table of audio output voltage values measured on STF, "Math model" uses a complex model to mix the 3 YM voices and "Linear" just averages the 3 YM voices. Use "ST table" or "Math model" for accurate sound's emulation.

You can select to record a piece of sound here. Use the Browse button to choose a file. The file name extension that you use (.WAV or .YM) determines in which format the sound is recorded in. The Record sound button is a toggle so you will need to return to the GUI to switch sound recording off again (or to use the keyboard shortcut for that).

#### The Devices Dialog

Check the first checkbox to enable printer support. See the Emulated printer section for details.

As Hatari currently only supports printing to file, click on Browse to select the file to print to. You can enter a new filename as well.

Check the second checkbox to enable RS232 support. The RS232 device is configured according to the settings of the emulated MFP RS232 of the Atari ST/STE/TT. This means Hatari will automatically use baudrate and handshaking as configured for the emulated machine.

Click on Browse to select suitable device files for serial input and output. On Linux a good choice is /dev/ttyS0 or /dev/ttyS1.

Check the third checkbox to enable MIDI support.

##### MIDI support

Hatari MIDI support can be provided either with a PortMidi library (required on Mac / Windows), or using "raw" MIDI device files. Latter supports also MIDI networking in games, and can be used for debug output, while PortMidi handles only MIDI events, but makes it easier to connect Hatari to host MIDI programs (software synthetizers etc).

###### "raw" MIDI device file selection

Click on Browse to select a suitable MIDI device files for MIDI input and output.

midi-linux.txt file explains how to select the correct MIDI device file, how to set up software sound synthesizing on Linux (using ALSA and virtual MIDI devices) if your sound card/driver doesn't support MIDI, and how to set up MIDI networking between multiple Hatari instances, even over internet.

###### PortMidi MIDI device selection

Click on arrow buttons to select a suitable MIDI devices for MIDI input and output.

PortMidi lists only MIDI devices that were active when Hatari was started. To see ones added after that, Hatari needs to be restarted.

PS. For MIDI devices which names are not constant, but include e.g. instance identifier at end, Hatari supports matching device by first part of the name when there's no full match. To use this, remove the device identifier part from the end of the device name in saved Hatari configuration file. Note that using GUI Devices dialog afterwards, will override prefix in config with a full name of a device (that matched the prefix at that point).

### Keyboard shortcuts for the SDL GUI

There are multiple ways to interact with the SDL GUI.

TAB and cursor keys change the focus between UI elements. Home key moves focus to the first dialog item, End key to the last one. Initially focus is on the default UI element, but focus changes are remembered between dialog invocations.

Enter and Space invoke the focused item, ESC key invokes the dialog cancel option (if there is one).

UI element which name has an underlined character can be invoked directly by pressing Alt + key with that character. Alt + arrow keys will act on dialog arrow buttons.

Main keyboard interactions:

- Options GUI main view: Enter accepts configuration, ESC cancels it.
- Options GUI dialogs: Enter (or End + Enter if focus was moved) returns back to main view.
- Fileselector: Page up and down keys move the file list by one page, mouse wheel and Alt + cursor keys scroll it by one item. Enter on the focused file name selects it. Enter on the OK button accepts the selected file. ESC cancels the dialog/selection.
- Alert dialogs: Enter accepts and ESC cancels the dialog.

### Keyboard shortcuts during emulation

While the emulator is running, you can activate or toggle various features via Hatari keyboard shortcuts. Most of them require the AltGr (right Alt) modifier key. On Mac macOS, the Cmd key ⌘ is used instead. Below are listed the default shortcut key bindings:

Shortcut | Purpose
--- | ---
AltGr+a | record animation
AltGr+g | grab a screenshot
AltGr+i | boss key: leave full screen mode, pause Hatari and iconify its window
AltGr+m | (un-)lock the mouse into the window
AltGr+r | (warm) reset the ST
AltGr+c | cold reset the ST (same as the original power switch)
AltGr+d | open dialog to select/change disk A
AltGr+s | enable/disable sound
AltGr+q | quit the emulator
AltGr+x | toggle normal speed/fast forward
AltGr+y | enable/disable sound recording
AltGr+k | save memory snapshot
AltGr+l | load memory snapshot
AltGr+j | toggle joystick emulation via cursor keys on/off between ports 0 and 1
AltGr+F1 | switch joystick type on joy port 0
AltGr+F2 | switch joystick type on joy port 1
AltGr+F3 | switch joystick type for joypad A
AltGr+F4 | switch joystick type for joypad B
AltGr+b | toggle borders on/off
AltGr+f or F11 | toggle between fullscreen and windowed mode
AltGr+o or F12 | activate the options GUI
Pause | pause emulation
AltGr+Pause | invoke the internal Hatari debugger

You can change the key bindings from the Hatari configuration file. See keymap-sample.txt file for instructions.

### Emulated Atari ST keyboard

All other keys on the keyboard act as the normal Atari ST keys so pressing SPACE on your PC will result in an emulated press of the SPACE key on the ST. The following keys have special meanings:

Key | Meaning
--- | ---
Alt | will act as the ST's ALTERNATE key
left CTRL | will act as the ST's CONTROL key
Print Screen | will emulate the ST's HELP key
Scroll Lock | will emulate the ST's UNDO key
Page Up | will emulate the ST's ( key in the keypad
Page Down | will emulate the ST's ) in the keypad
Num Lock | Toggle cursor emulation mode in the keypad (see below)

You can use the Num Lock key to toggle between normal Atari ST keypad mode and a special cursor key mode. The cursor key mode is designed for Atari programs and games that expect the original Atari cursor key layout (like the game "Dungeon Master"), i.e. where the "Insert" and "Clr-Home" keys are right next to the cursor keys. The 7 on the keypad is then mapped to the "Insert" Atari key, and the 9 key on the keypad is mapped to the "Clr-Home" Atari key. The keypad numbers 8, 4, 5 and 6 are mapped to the ↑, ←, ↓ and → cursor keys on the Atari side respectively.

If joystick emulation via keyboard is enabled, by default cursor keys are used for the directions and right CTRL key as the fire button. Otherwise they act as corresponding keys of the emulated Atari ST.

NOTE: Problems with simultaneous keypresses most likely are not an issue in Hatari, but with the keyboard itself. Many modern keyboards report/support only three simultaneous key presses (or even just two depending on which keys are in question). Expensive gaming keyboards support more.

### Emulated mouse

For obvious reasons your PC mouse will act as the emulated Atari ST mouse. In fullscreen mode it will act as expected, directly controlling the ST mouse pointer.

However it is a little bit different in windowed mode as mouse cursor positions between host and emulated Atari can get out of sync. This can be worked around by constraining the mouse to the Hatari window. Pressing the AltGr+m hotkey combination or starting Hatari with the --grab command line option grabs the mouse i.e. locks its movements to the Hatari window. Press the shortcut key (again) to go back to normal mouse behaviour which allows you to move mouse outside the Hatari window while Hatari is up and running. Note: pausing the emulation will also (temporarily) release the mouse grab.

Middle button click emulates double click, which is very useful in Fast Forward mode (where normal double clicking is nearly impossible).

Mouse scrollwheel will act as cursor up and down keys.

### Emulated joystick

The Atari ST joysticks are emulated of course allowing you to play your favourite games with Hatari.

The default mode is to use a connected PC joystick. You can use any joystick that is supported by your kernel / SDL library. If your joystick works with other applications, it will likely work with Hatari as well. Make sure it is calibrated and then off you go. Move the stick to point into the desired direction. Please note that Hatari will not detect analogue movement as the Atari ST only had digital joysticks.

First firebutton will act as the normal firebutton on the Atari ST. Second firebutton will emulate either joystick up (jump), or a keypress of the SPACE key on the ST. Many ST games utilize the SPACE bar for secondary game functions (for example Xenon), and jump functionality can be useful for platformers. Third firebutton has always autofire enabled, regardless of the (first firebutton) autofire option.

If you do not have a PC joystick or joypad, then you do not need to desperate. You can emulate one of the two Atari ST joysticks via the cursor keys. Just activate it in the GUI. Then the cursor keys will act as the joystick directions, the right CTRL key will act as the firebutton. You can still use the cursor keys as the ST's cursorkeys in this mode as long as you press SHIFT along with the cursorkeys. You can also configure these keys from the joystick options.

### Emulated video

Hatari emulates all screen modes of the original machine.

ST/STE shifter overscan effects are emulated, but due to the fact that these effects are achieved by using quirks and glitches in the original chips to do things beyond their specification, emulation is a bit tricky for these effects. As a result, some demos using these techniques might not be displayed correctly in Hatari, known ones are listed in the compatibility.html file.

Beside that you can setup extended VDI mode. It works well only with GEM-compliant applications, but allows using larger screen resolutions than the standard ST ones. VDI mode is not accelerated, so better optimized VDI implementation (e.g. NVDI) is recommended, especially for larger screen sizes.

Make sure to disable extended VDI mode for (non-GEM) games as 99% of all ST games will not be able to make use of higher resolutions.

### Emulated printer

Due to the fact that printer handling is different on Atari and current machines, emulation of the printer is achieved by writing all printer output to a file.

The file will contain a sequence of data, the same that would appear on the data pins of the Atari ST printer port. That would include control characters and commands for graphic printing. Clicking "Print desktop" on the GEM desktop would result in a messy data dump in the printer output.

Printer emulation works best for plain text files or programs that do not format the output for a specific printer. The file contents can be used with your favourite text editor for further processing and printing to a real printer.

To get real direct printing out of Hatari you may set up a suitable (e.g. PostScript) GDOS or NVDI printer driver on the emulated Atari and set your printer device file as Hatari's printer output.
NOTE: If the driver doesn't match or there's some other problem, this can cause your printer to print out hundreds of pages of garbage.

### Emulated RS232

Serial communications in Hatari is designed to directly use a serial port on your PC.

Communications parameters are set automatically upon the settings of the emulated machine. This means all you do is to set the communication parameters like baudrate from the emulated communications software. Hatari will do the rest and handle the serial input and output for you.

Note that the “normal” RS232 port of Hatari is the one that is connected to the MFP chip of the selected system. This port is only wired on the ST, STE and TT machines, but not on the Falcon. To use serial port emulation in Falcon mode, you have to use the “SCC channel B” emulation instead.

There're several programs that can be used with RS232 and the various ports

"CoNnect 95" is recommended as it supports all the ports of each machine (ST/STE, MegaSTE, TT and Falcon). Although this program was commercial and needed to be registered, his author released it later as freeware in 1998

The following table shows all the available ports (serial or lan) depending on the machine type, as well as the corresponding options used to setup each port

Port Name | HW | Physical Port | Corresponding Options | Notes
ST / STE / MegaST
Serial | MFP | RS232C DB-25 | --rs232-in and --rs232-out |
MegaSTE
Modem 1 | MFP | RS232C DB-25 | --rs232-in and --rs232-out |
Serial 2 | SCC A | RS232C DP-9P | --scc-a-in and --scc-a-out | Using daughter board in the VME slot
Lan | SCC A | RS422 MiniDIN 8p | --scc-a-lan-in and --scc-a-lan-out |
Modem 2 | SCC B | RS232C DP-9P | --scc-b-in and --scc-b-out |
TT
Modem 1 | MFP | RS232C DB-25 | --rs232-in and --rs232-out |
Serial 1 | TT MFP | RS232C DP-9P |  | Only 3 wires, not really usable (not emulated), using daughter board in the VME slot
Serial 2 | SCC A | RS232C DP-9P | --scc-a-in and --scc-a-out | Using daughter board in the VME slot
Lan | SCC A | RS422 MiniDIN 8p | --scc-a-lan-in and --scc-a-lan-out |
Modem 2 | SCC B | RS232C DP-9P | --scc-b-in and --scc-b-out |
Falcon
Lan | SCC A | RS422 MiniDIN 8p | --scc-a-lan-in and --scc-a-lan-out |
Modem | SCC B | RS232C DP-9P | --scc-b-in and --scc-b-out |
Port Name | HW | Physical Port | Corresponding Options | Notes

## Floppy disk images

Hatari does not use floppy disks directly but disk images due to differences between the floppy disk controllers of the ST and the PC. Several types of disk images are currently supported :

- the raw "ST" type
- the similar "DIM" type (not widely used)
- the compressed "MSA" (Magic-Shadow-Archiver) type
- the "STX" type that can store low level disk layout. This format is mainly used to dump original games with their protection. Those images are created on a real ST using pasti.prg
- the "IPF", "RAW" and "CTR" types require the caps library. Similar to STX, they record disk layout, but at a much precise level by storing MFM data. Most of these dumps are made with the Kryoflux board

The raw type (file suffix should be "*.st") is simply a sector by sector image of a real floppy disk. You can easily create such an image with the dd program which should normally be pre-installed on every Unix-like system. Simply type something like dd if=/dev/fd0 of=myimage.st to create a disk image. Of course you need access to /dev/fd0, and depending on your system and the type of floppy disk you might have to use another device name here (for example I use /dev/fd0u720 for 720kB disks). However, if the disk is copy-protected or doesn't use a MSDOS compatible file system, this might fail. So be very careful if you are not sure about the disk format.

The other possibility is to image the disk on a real Atari ST. For non-protected disk, there are programs like the Magic Shadow Archiver for this task. Hatari supports this slightly compressed MSA disk images, too. Note that Hatari only supports the "old" MSA format, there are some Magic Shadow Archiver clones (like Jay-MSA) that create better compressed but Hatari-incompatible disk images. However, if you have got such a MSA disk and want to use it with Hatari, you can still run the corresponding MSA program within Hatari to extract the incompatible disk image to a normal floppy disk image.

For protected disk, the most widely used method is to run pasti.prg on a real Atari ST and get a .STX image.
For more complex protections or altered disk, one can use *.IPF or *.CTR which include tools to check MFM data and possible problems when dumping a disk.

While *.ST, *.MSA and *.STX are more or less the "standard" types of Atari disk images, you might sometimes also find STT or ADF images on the internet. These currently do not work with Hatari.

Hatari can now also utilize *.DIM images just as *.ST ones without any problems. Note that DIM images are nearly the same as the raw ST images (they only have an additional 32 bytes header), so you can easily transform the DIM images into ST images by stripping the header from the files. For example try something like: dd if=input.dim of=output.st bs=32 skip=1

If you have got a disk image that has been created with the old ST emulator PaCifiST (for DOS) or with early versions of the program Makedisk, and the disk image does not work with Hatari, then the disk probably suffers from the "PaCifiST bootsector bug" (Hatari will display a warning message then). In this case, the bootsector of the disk contains some illegal data, so that the disk even does not work on a real ST any more. However, if it is a .ST and not a .MSA disk, you can easily fix it by using a hex-editor to change the byte at offset $D (13) from 0 to 1 (don't forget to backup your disk image first, since you can also easily destroy your disk image when changing a wrong byte there). If the disk contains a bootsector program, you probably have to adjust the boot sector check sum, too (it can be found at offset $1FE + $1FF).

Hatari supports disk images that are compressed with (Pk-)ZIP (file suffix must be ".zip") or GZip (file suffix must be ".st.gz" or ".msa.gz"), so you can archive your disk images into zip archives. You can also directly run the zip archives you may download from the net as long as the archive contains a disk image in .ST or .MSA format.

Note: Hatari does not save disk images back to *.ZIP files so your highscores and savegames are lost if you load the game from such a zipped disk image.

### Floppy formatting

Low level floppy formatting uses write track FDC command. Because simpler floppy image formats like ST / MSA don't have such low level information, they can't be low level formatted. For empty ST floppy images, one can use "create blank disk" in Hatari options "Floppy disks" dialog (see "The Floppy Disks Dialog" section).

Hatari supports low level track writes (and formatting) only for the STX format. Hatari implements that by doing all track writes to a separate *.wd1172 overlay file. To test it, copy some .STX file for example to "empty.stx". Format it from desktop, or use a separate formatting program like Fastcopy. This should create an additional "empty.wd1172" file.

(Note: IPF format itself is complete enough, but capslibrary doesn't yet have the required write support.)

## Hard disk support

Hatari supports three ways of emulating Atari hard drives: The low-level ACSI and IDE hard drive emulation and a GEMDOS based HD emulation. In most cases the GEMDOS HD emulation is best as it allows exchanging files easily between the emulated and the host environment.

Please note that changing the HD-image or the GEMDOS HD-folder will reset the emulated Atari since it is not possible to switch the hard drive while the emulator is running.

On a 32-bit host system, the size of a hard disk image is limited to 2 GB. On 64-bit host systems, bigger images might be possible but the support for bigger images is not tested very well yet.

The maximum size of partitions inside the hard disk (images) depends on the TOS version. TOS 1.00 and 1.02 support up to 256 MiB, TOS 1.04 to 3.06 up to 512 MiB and TOS 4.0x supports up to 1 GB partitions.

NOTE: you need to be careful when mounting device files. Depending on the system setup (e.g. udev settings) partitions on memory cards etc. can be mounted automatically. When Hatari is started and uses a device file with partitions that are already mounted, data can be destroyed (when several programs independently write to the same device). Disable your desktop automount, or remember to manually unmount devices before giving them to Hatari.

### GEMDOS based hard drive emulation

With GEMDOS HD emulation, you can easily "mount" a folder from the host file system to a drive of the emulated Atari.

If you provide Hatari a directory containing only single letter (C-Z) subdirectories, each of these subdirectories will be treated as a separate partition, otherwise the given directory itself will be assigned to drive "C:". In the multiple partition case, the letters used as the subdirectory names will determine to which drives/partitions they're assigned. For example following directory setup:

    partitions/
      + C/
      + D/

That is given to Hatari as "hatari -d partitions", will give you GEMDOS HD emulated C: and D: drives.

GEMDOS HD emulation is an easy way to share files between the host system and the emulated Atari, but there are also several limitations:

- Directory entries are returned in a (case-insensitively) sorted order, for consistency. E.g. moving files to a different directory and back (without changing their names) like AUTOSORT does, doesn't change that order. You need to rename the files.
- Names which aren't valid TOS directory or file names, are converted to a valid format. If there are multiple files which converted names are identical in TOS-format, you see only one of those.
- Host file paths need to be shorter than 256 characters currently (like Atari side TOS file paths).
- It is not possible to use a cartridge image at the same time with GEMDOS HD emulation (Hatari has its own cartridge code that is used for GEMDOS HD emulation).
- Anything that installs its own GEMDOS handler, like MiNT, does not work with GEMDOS HD emulation. Such things need to be run from a real hard disk image, or in case of MiNT, use OLDTOSFS for GEMDOS HD access.
- GEMDOS HD file handles start from index 64. If programs have more files open on non-GEMDOS HD drives, i.e. their indexes increase over 64, accesses to those indexes could get routed (incorrectly) to GEMDOS HD drive instead
- GEMDOS HD supports up to 64 file handles (TOS supports slightly more).
- GEMDOS HD drive assignment can conflict with the ACSI and IDE hard drives. If you want to use GEMDOS HD directory and ACSI/IDE disk images together, either use the GEMDOS HD option for skipping ACSI & IDE partitions, or use a multiple partition GEMDOS HD emulation setup and select the partition subdirectory names (see above) so that they do not conflict with the drive letters for ACSI/IDE partitions. With HD Driver you have also another option, see Using HD Driver with GEMDOS HD partitions.
- The GEMDOS HD emulation does not work (very well) with TOS 1.00 and 1.02. Use at least TOS 1.04 if you want the GEMDOS HD emulation to work properly.
- Ddelete() directory removal works only for directories which have no files.
- Fforce() file handle redirection works only for standard handles used with GEMDOS file functions, such as Fwrite() to standard output that is redirected to a file. File redirection is NOT supported e.g. for GEMDOS Ccon* console functions.
- Host and emulation have their own clocks, which will drift apart after emulation is started, especially when emulation is fast-forwarded or paused. Because of this, anything inside emulation that relies on file timestamps (e.g. build utilities) may not work as expected if you modify the files on the host after emulation is already running.

If your programs complain that they could not find/read/write files on the GEMDOS emulated drive, you can copy and use them from a floppy disk image or a real hard disk image instead.

### ACSI & IDE hard drive emulation with EmuTOS

Accessing HD image files is easiest with EmuTOS. It supports both ASCI and IDE interfaces, regardless of emulated machine type, and understands DOS partition tables without additional drivers. atari-hd-image.sh script coming with Hatari can be used to create such image files and to copy initial data to them.

If you have an hard drive (image) with Atari format partition table, that should already have hard disk driver on it and work fine. Only partitioning/formatting them is the problem. Creating such images from scratch is described in following sections.

Note that while EmuTOS supports Atari format partition tables, and could access also hard disks with them, it doesn't run hard disk driver installed to the drive. For such drives, it may be better to use a suitable Atari TOS version.

### ACSI hard drive emulation

To use the ACSI hard drive emulation, you need a hard disk image file with a pre-installed HD driver in it. You can try to get an image of your old ST hard disk or grab one from the internet (e.g. from the Hatari website). Please note that the size of ACSI hard drive is normally limited to 1 GB due to some addressing constraints of the ACSI bus. Bigger disks were only possible with certain host adapters – this behaviour is emulated by Hatari, too, but you need a hard disk driver that supports these extensions.

To create a new ACSI hard disk image, you can start with an empty image that you have created for example with the following command: dd if=/dev/zero of=hd.img bs=512 count=xxx (where 'xxx' is size in 512 byte blocks). Copy the complete AHDI 5.0 package to a floppy disk image, then boot Hatari with this floppy disk image and the fresh hard disk image like this: --acsi hd.img ahdi.st. Then start HDX.PRG from the floppy disk and format + partition the hard disk image with it.

Formatting and partitioning works currently only with AHDI 5, but you can install the AHDI 6 driver to the hard disk after it is formatted. Restart the emulated system, run AHDI.PRG from the floppy disk to access the hard disk image from the emulated Atari and then run HINSTALL.PRG. After installing the hard disk driver to the fresh HD image with HINSTALL.PRG, you can boot directly from the hard disk image.

HD Driver (v9) partitioning is also compatible with Hatari ACSI emulation. CBHD and ICDPro AdSCSI drivers work on images which have been partitioned elsewhere.

### IDE hard drive emulation

As the IDE disk format (little endian) differs from the ACSI disk format (big endian), you need separate disk images for them. Hatari doesn't currently support partitioning IDE disks with AHDI, but you can do it with Cécile.

First create an empty image file with the size of your choice with: dd if=/dev/zero of=hd.img bs=1k count=xxx. Then get the Cécile hard disk driver from http://centek.free.fr/atari/softs/s_cecile.htm and put it on a floppy disk image (e.g. to one named "cecile.st" using: zip2st.sh cecile.zip).

Run Hatari with hatari --machine falcon --tos tos404.rom --ide-master hd.img cecile.st, switch to larger color resolution and warm up your French language skills. Then start the Cécile hard disk driver CECILE.PRG and run CC_TOOLS.APP to partition your hard disk image. Click the "Partition" button, select "Hatari IDE disk" and set suitable partition size with the arrows (below type field). Then click "Valider".

If you only want to use your HD image in Falcon mode, you can install the Cécile hard disk driver to the image from the Cécile CC_TOOLS.APP: Click the "Installer" button and save the Cécile driver to the 1st partition on "Hatari IDE disk". If you want to also use your HD image in ST/STE mode, you need to get and install either HD Driver or AHDI 6 driver on it instead (see ASCI hard drive emulation section).

Then you can boot from your hard disk image by simply specifying it with the --ide-master parameter.

## Moving files to/from hard disk images

Moving files to and from Atari hard disk images can be done either through GEMDOS HD partitions (host directories mounted inside Hatari emulation) or accessing the images directly on the host (outside the emulation). Both have their own limitations.

If it is fine for the IDE/ACSI partitions to be first, you can either use ACSI/IDE partition skip option, or a multipartition GEMDOS HD setup as described in above sections.

If you want to boot from a GEMDOS HD partition i.e. such to be before hard disk image partitions, and still to be able to access all the IDE/ACSI partitions, you need to use HD Driver. Note: this is the preferred method with EmuTOS (v0.9.x), because it doesn't run/use driver installed to the IDE/ACSI image directly and has some limitations in its partition table/type support.

### Using HD Driver with GEMDOS partitions

Uwe Seimet's HD Driver works fine with both the Hatari GEMDOS HD partitions and normal hard disk images.

First copy the HDDRIVER.PRG binary into your GEMDOS HD emulation directory AUTO folder. Then start the HDDRUTIL.APP configuration utility, locate HDDRIVER.PRG, open the "Devices and Partitions" dialog and select the "Preserve Existing Partitions" option. Then you can just start Hatari with your hard disk image and this GEMDOS HD directory, for example like this: "hatari --harddrive gemdos-hd/ --ide-master ide-hd.image".

If you're using the demo version of HD Driver, you can write files only to the C: partition, i.e. in above case only copy files from the hard disk image partition to the GEMDOS HD partition (with some write slowdowns included into the demo version). If you want to copy files to the hard disk image with the demo version of the HD Driver, you need to set the hard disk image as drive C:.

To accomplish this, set the GEMDOS HD partitions to be from D: forward, i.e. have a directory which contains only single letter subdirectories, starting from "D" like in "mkdir gemdos-hd; mkdir gemdos-hd/D". Then give Hatari (as the last parameter) a boot floppy image containing the demo version of HDDRIVER.PRG in its AUTO folder, like this: "hatari --ide-master ide-hd.image --harddrive gemdos-hd/ hd-driver-floppy.st". You can convert HD Driver ZIP package to floppy image with the zip2st utility.

### Accessing HDD image partitions outside of Hatari

If you want to access the hard disk image partitions also outside the emulation, the disk image needs to have a DOS partition table. The atari-hd-image script included with Hatari can be used to create such an image.

Inside the Hatari emulator, EmuTOS can access partition(s) on these kind of images directly without any driver software. Of the Atari HD drivers mentioned above, Centek's Cécile and Uwe Seimet's HD Driver (demo) work fine with these partitions. E.g. AHDI and CBHD don't. Cécile works only with TT or Falcon.

To summarise; if EmuTOS is enough, use that. Otherwise, if you want to use TT or Falcon emulation, use Cécile (or full HD Driver version if you have it), otherwise use HD Driver (demo).

To access the content of the partitions on Linux host, there are two possibilities:

#### Using Mtools

For this you need to add an entry for the hard disk image to your ~/.mtoolsrc and specify which partition you want to access from the image. For an image created with the above mentioned script, the line in the configuration file should look something like this:

    MTOOLS_NO_VFAT=1
    drive c: file="/home/user/hatari/hd.img" partition=1

Note that Mtools is instructed to use FAT compatibility mode because EmuTOS cannot deal properly with VFAT file information. If you don't want this setting for all your Mtools drives, you can set it also via the environment like this ("::" refers to the drive image given with the "-i" option):

    MTOOLS_NO_VFAT=1 mcopy -spmv -i hd.img files/* ::

#### Using a loopback device

This is recommended even by Mtools documentation, but it is less convenient as it requires root rights. First you need to "loop" mount the image:

    $ su
    # image="hd.img"; mountdir="hd"
    # start=$(parted $image unit s print | awk '/ 1 /{print $2}' | tr -d s)
    # losetup -f $image -o $((512*$start))
    # loop=$(losetup -a | grep $image | cut -d: -f1)
    # mkdir -p $mountdir
    # mount -t msdos $loop $mountdir

This uses parted to find out the first partition offset in sectors and then tells losetup to bind the first free loop device to a corresponding offset from the hd.img image. mount is then used to mount the file system from the loop device on top of the "hd" directory.

After you have copied the relevant files to the "hd" directory, you need to unmount the file system and remove the loop device binding before using the disk image from Hatari:

    # umount $mountdir
    # losetup -d $loop

## Performance

Hatari performance varies between Atari programs, depending on what features Hatari needs to emulate for them. Less accurate Atari emulators may be faster as emulation accuracy has a performance overhead.

The operating system and libraries below Hatari can also sometimes have a noticeable effect on performance.

Hatari can be sped up considerably by giving up some emulation or emulator accuracy. With ST/STe emulation, these options should be needed only on slow devices, typically ARM and/or mobile ones (e.g. Raspberry Pi).

### Operating system components performance

Finding out whether there's a performance problem with the system components (like SDL) in your setup, requires profiling Hatari and rest of the system. How to do that is OS specific. On Linux that would involve running "perf record -a" command (as root) on the background for few minutes while Hatari is running, and then investigating the results with "perf report" command.

Some other process eating CPU cycles from Hatari one can see just with the (Linux/Unix) "top" command.

### Build options impact on performance

Compiler: Unless you have disabled compiler optimizations (like GCC's -O2 or -O3 options) in the Hatari build, the extra optimization flags (like GCC's "-mtune=i686") don't seem to have very large effect on Hatari performance. Using GCC -O3 option instead of -O2 can give minor (5-10%) performance improvements for things (mainly demos) that use very heavily interrupts.

Older versions: If nothing else helps, try (building) much earlier Hatari version. More accurate emulation in newer Hatari versions means that they can be slower despite optimizations.

### Run-time emulation options

Emulation options have the largest impact on Hatari performance. These options can be changed from the Hatari GUI System and CPU dialogs and the emulation needs to be rebooted for any of these changes to take an effect! They are enabled by default.

#### DSP (Falcon)

Emulating the Falcon DSP is performance-wise several times more demanding than emulating the m68k; DSP runs at higher frequency, executes many instructions for each m68k instruction and emulation isn't as mature and optimized. Unless some Falcon program needs DSP, none or dummy DSP emulation mode could be used. Even of the programs that do use DSP, many use it only for background music and work fine without the real DSP emulation.

#### CPU: cycle exact (030/TT/Falcon)

CPU core supports 030 cache emulation for cycle accuracy. This is very heavy. Unless program needs cycle accuracy to work correctly, you can disable it. Many Falcon demos need it, applications and games normally don't.

#### Timer-D

With ST/STe, the single largest factor contributing to general Hatari emulation performance is the handling of interrupts. Enabling Timer-D patching option greatly improves Hatari ST/STE emulation performance as it significantly reduces the number of interrupts generated by the emulated Atari machine. Using this has adverse effect only for very rare programs.

#### FDC

While accurate FDC emulation doesn't take that much CPU, it slows down floppy image accesses (and Hatari startup) a lot. Only very few demos and games require accurate FDC emulation for their copy protection, so enabling fast floppy access is fairly safe.

#### CPU: prefetch

After the DSP, cycle accuracy and interrupts, m68k emulation takes most time. Disabling the "Prefetch" / "Compatible" option can speed up the emulation noticeably, but it will be less accurate. This can be fine for many games and other programs, but won't work e.g. for demos using overscan or rasters. This is recommended only as a last resort.

Roughly speaking, for Falcon DSP emulation with cycle exact 030 cache emulation, one needs at least 3Ghz machine. For normal (unpatched) Timer-D frequency on some specific cases (like demos with overscan 512 color animations) one may need over 1GHz machine for ST/STE emulation, but some rare demos may require over 1GHz machine even with Timer-D patching.

NOTE: Above options may cause some programs to work incorrectly. The Hatari Software Compatibility List lists programs known to need real Falcon DSP emulation, Timer-D frequency or accurate FDC timings.

### Emulator options

Emulator options don't usually have as large effect on performance as emulation options, but they don't affect the emulated programs at all, just the quality of the emulation "output". These options can also be toggled at run-time without rebooting the emulation.

#### Sound

Internal Hatari sound handling and the SDL_mixer sound thread libALSA sound processing can account up to 1/3 of the Hatari CPU usage in normal ST/STE emulation. Disabling sound will get rid of that. Using low sound frequency or one matching your sound card may also help. Best is if you disable also background music from the programs you run in Hatari as this can significantly reduce the number of generated interrupts.

If program supports both ST and STE, use STE. Emulating DMA sound, is more lightweight than interrupt heavy ST sound.

If problem is occasional performance related audio glitches, increasing the sound buffer size (with "--sound-buffer-size" option) may help, but it increases sound latency.

#### Frame skipping

Screen rendering can take noticeable amount of CPU time. The default Hatari "auto" frame skipping should be used unless there's a good reason not to. It will skip converting and showing some of the frames if there's not enough time for them.

Also, if your monitor refresh frequency is lower than the selected Hatari monitor frequency (e.g. LCD monitors usually use 60Hz whereas Atari monochrome monitor uses 71Hz), you should use frameskip of one. The reason is that if your SDL library uses VSync to synchronize the output to screen, with zero frame skip that forces the emulation to run slower than a real Atari. If SDL doesn't use VSync, Hatari does redundant work to convert frames you can't see.

#### Zooming

If you are not using frame skip, disabling zooming can have noticeable improvement on performance. You can do this by specifying suitably low "Max zoomed" resolution (--zoom 1 command line option sets it to 320x200 for ST-low resolution). If you still want to have a nice fullscreen mode, you should rather add the right resolution mode-lines (e.g. "320x200") to your xorg.conf file. If you still want to use zooming, disabling borders may help a bit.

#### Spec512 color handling

Handling Spec512 color modes which change the ST/e palette constantly takes some extra CPU. If you have problems with CPU usage in such screens and you care more e.g. from the sound quality than visuals, you can either increase the threshold or disable the Spec512 mode handling completely by zeroing the threshold for that with the --spec512 0 option.

#### Statusbar and drive LED

If your version of the SDL library uses VSync to synchronize the screen output, drawing of the statusbar or the drive LED may have some minor impact on performance too. Normally they shouldn't.

### Measuring the performance

There are a couple of ways to monitor and measure Hatari performance.

By default Hatari has Statusbar visible and automatic frameskip enabled. When Hatari has enough time that it can sleep a little each frame, the statusbar frame skip ("FS") value keeps at zero. If Hatari is completely busy, it will increase to the maximum specified (automatic) frame skip value.

Hatari has also a facility to measure FPS i.e. Frames Per Second. Enable frame skipping with --fast-forward yes option (or use the corresponding keyboard shortcut) and set --log-level info. Then after a while, press the "Pause" key. Whenever Hatari emulation is paused, Hatari will output on console info on how many VBLs it could show per second, along with some other numbers.

It depends on what you want to measure, but usually it is best to disable sound and set high frame skip like --sound off --frameskips 60 so that the associated external overheads are minimized. E.g. video output can on some platforms do VSync and measurements would then show your monitor refresh frequency instead of the actual Hatari performance.

On Unix systems with times() function call, only the time spent by the Hatari process itself is measured. On other systems, much less accurate SDL "wall clock" timings are used. To make latter more accurate you could use also --run-vbls option to specify how many VBLs Hatari should run before it exits. In this case it is best to either have the test-case run automatically from the AUTO-folder or given as memory snapshot to Hatari with the frame skip set equal to the VBL count.

Note that these numbers can fluctuate quite a bit, especially when the SDL timings are used, so for (statistically) reliable numbers you may need to repeat the measurement several times. You should of course make also sure that the system doesn't have any other activity at the same time you are making the measurements.

## Appendix

### Copying

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

The GNU Project and the Free Software Foundation | The GNU General Public License

### Introduction to Emulation

Emulation via software is an art and Hatari is an example of this.

Emulation is to make a computer behave like a (probably) completely different machine on the lowest possible level. This includes CPU and custom chip emulation allowing software written for the emulated machine to be run without it noticing a difference.

The key to emulation is to simply do those things with a software program, the emulator, that normally chips would perform. So you have an CPU emulator that basically consists of a large loop that does exactly what the real thing would do:

- fetch an instruction from virtual memory
- interpret this instruction
- fetch operands from the emulated registers and memory
- perform the operation like addition or changing the program counter on a jump instruction
- writes results back into the intended registers or memory locations
- increment of the program counter and loop

The typical von-Neumann CPU can be emulated very fast, stable and error-free using such a simple loop system.

But in most cases the CPU emulation is the simplest part. Correct emulation of the various custom chips and hardware parts of the emulated system, and their proper synchronization, is much trickier.