--- hatari/doc/manual.html 2019/04/09 08:52:20 1.1.1.16 +++ hatari/doc/manual.html 2019/04/09 09:00:43 1.1.1.23 @@ -1,16 +1,14 @@ - - + + Hatari User's Manual - - - - - - - + @@ -55,129 +64,54 @@

Hatari User's Manual

-

Index

- +

Index

+
+ +
-

Introduction

+

Introduction

-

General description

+

General description

-Hatari is an Atari ST, STE, TT and Falcon emulator for Linux, OSX, +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 +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 ST emulators which try to give you a good +Unlike many other Atari emulators which try to give you a good environment for running GEM applications, Hatari tries to emulate the hardware -of a ST as close as possible so that it is able to run most of the old ST games +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. -Recent versions of Hatari even feature STE, Falcon and basic TT emulation.

-

Features

+

Features

-

STE hardware emulation

There is support for following additional STE features:

+

+Hatari can also emulate a Mega-STE, which had slightly different hardware +compared to a normal STE (like a built-in real time clock chip). +

-

Experimental TT hardware emulation

There is support for following additional TT features:

+

+Note that TT emulation is incomplete – e.g. the second MFP is not +emulated yet. +

-

Falcon hardware emulation

There is support for following additional Falcon features:

+

+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 @@ -261,41 +212,20 @@ Software Compatibility List for whic to be affected by them.

-

System requirements

- -

Hatari currently has the following minimum system requirements:

- +

System requirements

-In the course of time Hatari has successfully been tested by various people on -the following systems: +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 and running

-

Compiling Hatari

+

Compiling Hatari

Required:

The versions available in your Linux distribution will be sufficient @@ -328,7 +263,7 @@ package.

-After you've verified that you have the required libraries and their +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: @@ -350,7 +285,7 @@ prefix) in a format familiar from GNU Au to see all the options supported by this script.

-

Installation of a TOS ROM

+

Installation of a TOS ROM

Before you can start Hatari, you have to copy a TOS ROM image to the data @@ -365,23 +300,23 @@ 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 ST and one of those various -ROM-image programs for the ST (search for "TOSDUMP" with your -favourite internet search engine). If your old ST does not work anymore, you -can also try to search the internet directly for corresponding TOS ROM image, -but don't ask the Hatari team where to get one.

+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: http://emutos.sourceforge.net/. -It is not the best solution for playing games or running other old software -due to compatibility issues (see emutos.txt for -more details), but it's free and compatible with Hatari.

-

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

+It is not the best solution for Falcon emulation, playing old games +or running other old software due to compatibility issues (see +emutos.txt for more details), +but it is free, compatible with Hatari, doesn't require driver to +support harddisk images, and it boots much 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

+

Installation of the binary

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

@@ -392,7 +327,7 @@ be now able to start the Hatari executab option --help to find out more about its command line parameters.

-

Running Hatari for the first time

+

Running Hatari for the first time

Now type hatari to run the emulator for the first time. If all goes @@ -403,8 +338,29 @@ to turn on the GUI to configure Hatari to suit your needs, press F11 to toggle windowed and fullscreen mode.

-

Command line options -and arguments

+

Configuration options precedence

+ +

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

+ +

Some of the run-time changes require emulation to be reset for them +to take effect.

+ + +

Command line options and arguments

Usage:

@@ -414,15 +370,14 @@ and arguments
 

As an argument one can give either a name of:

+(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 @@ -433,1310 +388,574 @@ corresponds to A: or C:).

-

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>
- - - - -
-use the given file as configuration file instead of -~/.hatari/hatari.cfg -
- - - - -
--k, --keymap -<file>
- - - - -
-load keyboard mapping from <file> -
+

-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>

+

--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) -
- - - - -
--f, --fullscreen
- - - - -
-Start the emulator in fullscreen mode -
- - - - -
--w, --window
- - - - -
-Start the emulator in window mode -
- - - - -
---grab
- - - - -
-Grab mouse (also) in window mode -
- - - - -
---fast-forward <bool>
- - - - -
-On fast machine helps skipping (fast forwarding) Hatari -output -
- - - - -
---frameskips <x>
- - - - -
-Skip <x> frames after each displayed frame to -accelerate emulation (0=disabled, >4 uses automatic -frameskip with given value as maximum) -
- - - - -
---statusbar <bool>
- - - - -
-Show statusbar (with floppy leds etc etc) -
- - - - -
---drive-led <bool>
- - - - -
-Show overlay drive led when statusbar isn’t shown -
- - - - -
---bpp <bool>
- - - - -
-Force internal bitdepth (x = 8/15/16/32, 0=disable) -
+

-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 window width +for borders / zooming

+

--max-height +<x>

+

Preferred / maximum window height +for borders / zooming

+

--bpp +<bool>

+

Force internal bitdepth (x = +8/15/16/32, 0=disable)

+

--disable-video +<bool>

+

Run emulation without displaying video (audio only)

-

ST/STE specific display options

- - - - -
---borders <bool>
- - - - -
-Show screen borders (for low/med resolution overscan demos) -
- - - - -
---desktop-st <bool>
- - - - -
-Whether fullscreen mode uses desktop resolution to avoid: messing -multi-screen setups, several seconds delay needed by LCD monitors -resolution switching and the resulting sound break. As Hatari ST/E -display code doesn't support zooming (except low-rez doubling), it -doesn't get scaled (by Hatari or monitor) when this is enabled. -Therefore this is mainly useful only if you suffer from the described -effects, but still want to grab mouse and remove other distractions -from the screen just by toggling fullscreen mode. (disabled by default) -
- - - - -
---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) -
- - - - -
--z, --zoom <x>
- - - - -
-Zoom low resolution (1=no, 2=yes) -
+

--desktop-st +<bool>

+

+NOTE: this has effect only for SDL1 Hatari build. In SDL2 build, +--desktop option controls also ST/STe mode.

+

Whether to use desktop resolution on fullscreen +to avoid issues related to resolution switching (messing multi-screen +setups, several seconds delay needed for resolution switching by some +LCD monitors and the resulting sound break). Otherwise fullscreen will +use a resolution that is closest to the Hatari window size.

+

As Hatari ST/STe display code doesn't support +zooming (except low-rez doubling), it doesn't get scaled (by Hatari or +monitor) when this is enabled, and you may get large black borders +around ST/STe screen. Therefore this is mainly useful only if you +suffer from the described effects, but still want to grab mouse and +remove other distractions from the screen just by toggling fullscreen +mode. (disabled by default)

+

--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)

+

-z, --zoom +<x>

+

Zoom (double) low resolution (1=no, +2=yes)

+

--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)

- -

Falcon/TT 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) -
- - - - -
---max-width <x>
- - - - -
-Maximum window width for zooming -
- - - - -
---max-height <x>
- - - - -
-Maximum window height for zooming -
- - - - -
---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 -
- - - - -
---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 <= 1280) -
- - - - -
---vdi-height <h>
- - - - -
-Use extended VDI resolution with height <h> (200 < h <= 960) -
+

--vdi +<bool>

+

Whether to use VDI screen 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> (200 < h <= 1280)

+

+TOS and popular GEM progams add extra restrictions for the VDI screen +size. In total screen can take at maximum 300kB, width needs to be +multiple of 128/planes, and height multiple of 16 pixels (or 8, +depending on system font height). That translates to following maximum +standard resolutions for the VDI mode: +

+

monochrome

+

+FullHD (1920×1080), 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 -
- - - - -
---avi-vcodec <x>
- - - - -
-Select avi video codec (x = bmp/png) -
- - - - -
---avi-fps <x>
- - - - -
-Force avi frame rate (x = 50/60/71/...) -
- - - - -
---avi-file <file>
- - - - -
-Use <file> to record avi -
+

--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

-

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-in <filename>
- - - - -
-Enable MIDI support and write MIDI data to <file> -
- - - - -
---midi-out <filename>
- - - - -
-Enable MIDI support and read MIDI data from <file> -
- - - - -
---rs232-in <filename>
- - - - -
-Enable serial port support and use <file> as the input device -
- - - - -
---rs232-out <filename>
- - - - -
-Enable serial port support and use <file> as the output device -
+

-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 (PortMidi only)

+

--midi-in +<filename>

+

Enable MIDI support and write MIDI data +to <file> (Linux only)

+

--midi-out +<filename>

+

Enable MIDI support and read MIDI data +from <file> (Linux only)

+

--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-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

- -

Disk options

- - - - -
---disk-a <file>
- - - - -
-Set disk image for floppy drive A -
- - - - -
---disk-b <file>
- - - - -
-Set disk image for floppy drive B -
- - - - -
---protect-floppy <x>
- - - - -
-Write protect floppy image contents (on/off/auto). With "auto" option -write protection is according to the disk image file attributes. -
- - - - -
---protect-hd <x>
- - - - -
-Write protect harddrive <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 hard disk emulation. -
- - - - -
--d, --harddrive <dir>
- - - - -
-Emulate harddrive partition(s) with <dir> contents -
- - - - -
---acsi <file>
- - - - -
-Emulate an ACSI hard disk with an image <file> -
- - - - -
---ide-master <file>
- - - - -
-Emulate an IDE master hard disk with an image <file> -
- - - - -
---ide-slave <file>
- - - - -
-Emulate an IDE slave hard disk with an image <file> -
- - - - -
---fastfdc <bool>
- - - - -
-speed up FDC emulation (can cause incompatibilities) -
- -

Memory options

- - - - -
--s, --memsize <x>
- - - - -
-Set amount of emulated RAM, x = 1 to 14 MiB, or 0 for 512 -KiB -
- - - - -
---memstate <file>
- - - - -
-Load memory snap-shot <file> -
+

+--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

+

--ttram +<x>

+

Set amount of emulated TT RAM (for Falcon and TT +mode), x = 0 to 512 MiB

-

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) -
+

-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)

+ +

Common CPU 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, but slower 68000 +CPU mode with better prefetch accuracy and cycle counting

+ +

WinUAE CPU core options

+

--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

- -

CPU 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 but slower 68000 CPU mode -
- -

Misc system options

- - - - -
---machine <x>
- - - - -
-Select machine type (x = st, ste, tt or falcon) -
- - - - -
---blitter <bool>
- - - - -
-Enable blitter emulation (ST only) -
- - - - -
---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 about doubles -Hatari speed (for ST/e emulation) as the original Timer-D frequency causes -most of the interrupts. -
- - - - -
---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. -
- - - - -
---rtc <bool>
- - - - -
-Enable real-time clock -
+

+--machine <x>

+

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

+

--blitter +<bool>

+

Enable blitter emulation (ST only)

+

--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 about doubles Hatari speed (for ST/e +emulation) as the original Timer-D frequency causes most of the +interrupts.

+

--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 approximatively 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 is the 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. -
+

--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

- - - - -
--D, --debug
- - - - -
-Toggle whether CPU exceptions invoke the debugger -
- - - - -
---bios-intercept
- - - - -
-Toggle Bios/XBios call interception and BIOS CON: output -(e.g. EmuTOS console) redidirection to host terminal. -Needed for Bios/XBios call tracing. Allows Atari programs -to modify Hatari state through XBios 255 calls. -
- - - - -
---trace <trace1,...>
- - - - -
-Activate debug traces, see --trace help for available tracing options -
- - - - -
---trace-file <file>
- - - - -
-Save trace output to <file> (default=stderr) -
- - - - -
---parse <file>
- - - - -
-Parse/execute debugger commands from <file> -
- - - - -
---control-socket <file>
- - - - -
-Hatari reads options from given socket at run-time -
- - - - -
---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 -
- +

-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 dissasembly engine to use, bitmask sets output options for the +external disassembly engine 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)

+

--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.

+

--no-parachute

+

Disable SDL parachute to get Hatari +core dumps. SDL parachute is enabled by default to restore video +mode in case Hatari terminates abnormally while using non-standard +screen resolution.

+

--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.

-

Using the emulated system

-

Once you've started Hatari succesfully, you can use the emulator as +

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

+

The GUI

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

-

The Main Menu

+

The Main Menu

-Hatari's GUI - the main menu + Hatari's GUI - the main menu

@@ -1745,16 +964,16 @@ the appropriate buttons.

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

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

-Select the Reset machine option if you +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.

@@ -1768,10 +987,11 @@ changes that you have made.

-

The File Selector Dialog

+

The File Selector Dialog

-Hatari's GUI - the fileselector + Hatari's GUI - the fileselector

@@ -1779,118 +999,235 @@ changes that you have made. or folder.

- To enter a folder or choose a file, simply click on the entry in the main box - of the dialog. You can use the arrows at the right, the cursor up and down - keys and the page up and down keys to navigate through the list. + 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, or use keyboard up + down arrow, + page up + down, Home and End keys.

You can use the three buttons in the upper right corner for additional folder - navigation. Use the .. button to go up one level - in the directory tree. Use the ~ button to return - to your home directory. The / button can be used - to go to the root directory of the file system. + 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

+
+ Hatari's GUI - 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: +

+ +

+ 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 and it is strongly recommended to reset the emulation after + changing them (for most things that's done automatically). + Most settings are also selected automatically when one uses the + --machine command line option. +

+ + +

The CPU Dialog

-Hatari's GUI - the system dialog + Hatari's GUI - the CPU dialog

- First you can select the CPU type here. Here are some important hints for - choosing the correct 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 this were the original + configurations used in the Atari computers. In case you want to vary + the CPU type, you have got to be aware of some constraints:

- Beside the CPU type, you can also choose the machine type to emulate. - The ST was the very first 16/32-bit computer from Atari. Most older games - and demos require an ST. The STE was introduced some years later and had - some more advanced hardware features. 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's normally safe to always work in STE mode. -
- TT and Falcon are more advanced, but they are not as compatible to the ST as - the STE was. Therefore many old games and demos do not work with these machine - types anymore. 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. - Note: TT and Falcon emulation are incomplete. They may not work - very well. -

-

- For STE emulation a STE compatible TOS image, e.q. version 1.06, 1.62 or - 2.x, is strongly recommended. For TT emulation you need TOS 3.0x and for Falcon - emulation you need TOS 4.0x. EmuTOS can be used on all machine types. + 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. + Use 16 MHz for Mega STE and Falcon emulation. + The CPU in the TT was clocked with 32 MHz.

+

- Select the CPU clock you want to use. 8Mhz is ST standard and the most - compatible. Use 16MHz for Mega STE and Falcon emulation. - The CPU in the TT was clocked with 32 MHz. + 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.

-

With the "Slower but more compatible CPU" option, you can enable - the emulation of 68k address errors and the 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.

- For Falcon mode, you can choose whether you want to enable DSP emulation, - fake it or completely disable it. 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). So if you have a slow host CPU, you can try if your - Falcon program also runs with DSP disabled or in "dummy" mode. - Note that you can not change this option while the DSP based program already - runs. + The "Cycle exact", the "MMU emulation" and + "24-bit addressing" option are only available in the + "WinUAE" builds + of Hatari. They are considered as experimental and should only be changed + if you know what you are doing. +

+

+ The FPU settings are also only available with the "WinUAE" builds + of Hatari. They can be used to select the type of floating point unit of CPUs + >= 68020. In the non-WinUAE builds of Hatari, the FPU is always enabled for + 68030 and 68040 CPUs.
+ When emulating the FPU, you can use your own PC's CPU/FPU to do the math. + This is the default and fastest method, but recent CPU might have some slight + differences in rounding when compared to a real Motorala FPU.
+ For higher precision, you can select the "Softfloat" emulation mode : this will + emulate all the FPU operations using only the CPU and with the same rules as the + Motorala's FPU. In that case, FPU emulation will be a little slower.

-

You can also enable/disable Blitter emulation here. The Blitter is a custom - chip that accelerates some graphical operations. This switch only toggles the - Blitter in plain ST mode. In STE mode, the Blitter is always enabled (since all - STEs have been sold with a Blitter chip).

-

If you enable the "Real time clock emulation" switch, a RTC will - be emulated based on the time of the host computer. Note that you need at least - TOS 1.02 for proper RTC emulation, TOS 1.00 does not support this.

-

The Timer-D patch 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 then.

-

NOTE: The emulated Atari is very very sensitive to these options - and it is strongly recommended to reset the emulation after changing - them (for most things that's done automatically). The correct - CPU type and clock are automatically selected when one uses the - --machine command line option.

-

The Floppy Disks Dialog

+

The Floppy Disks Dialog

-Hatari's GUI - the floppy disks dialog + Hatari's GUI - 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 the chapter - "Floppy disk images" for details. + "Floppy disk images" 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 @@ -1908,34 +1245,39 @@ insert the second disk of a two disk gam 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" will speed up disk accesses, but this could give - some incompatibilities with some programs that expect correct delays. - (some games/demos don't expect data to be read too fast from the disk) + + "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.

- You can choose if you want Hatari to write-protect your disks. Atari ST virii - can spread on disk images too so it might be a good idea to enable the write - protection option. However you can't save highscores or games to your disk - images in that case. + 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.

-Hatari's GUI - the new floppy dialog + Hatari's GUI - the new floppy dialog

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 non-Atari disk sizes, but such - disks are useful for programs that don't work with GEMDOS emulation. + 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.

@@ -1952,48 +1294,93 @@ ends with a 'b'.

-

The Hard Disks Dialog

+

The Hard Disks Dialog

-Hatari's GUI - the hard disks dialog + Hatari's GUI - the hard disks dialog

- This dialog can be used to change the harddisk settings. -

-

- You can select a harddrive image for ACSI, IDE master or slave hard drive - emulation via image file here or you may select a directory of your local - filesystem to be emulated as the harddrive of the emulated system. -

-

- Check "Boot from HD" if you want Hatari to execute the AUTO folder - on the harddrive. - This option is checked by default if you specify a harddrive image or - a directory via the command line. -

-

- Removing the check from the "Allow GEMDOS drive modification" option - will prevent Atari programs from modifying the files in GEMDOS HDD - emulation directory or creating new files under it. + This dialog can be used to change the hard disk settings.

- Note that for IDE hard disk emulation you also need a TOS version >= 2.05. - And ACSI hard disk emulation does not work with TOS 4.0x in Falcon mode. + 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 + chapter for more details about hard disk emulation.

-

The Memory Dialog

+

The Memory Dialog

-Hatari's GUI - the memory dialog + Hatari's GUI - the memory dialog
-

You can select the amount of RAM for the emulated ST here. Only +

You can select the amount of RAM for the emulated machine here. Only amounts that were valid on a real unmodified STFM can be selected.

Note: This option is critical and you are strongly advised -to reset the emulated ST +to reset the emulated machine when changing this option.

+

TT RAM size allows to emulate up to 512 MiB of 32-bit RAM. This is only +useful in Falcon or TT mode and require to disable "24 bit addressing" mode +in the CPU options

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.

@@ -2001,14 +1388,15 @@ to file. You can select a new filename h 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.q. if you compile a newer Hatari, you +different versions of Hatari. e.g. if you compile a newer Hatari, you cannot load your old memory snapshots back.

-

The ROM Dialog

+

The ROM Dialog

-Hatari's GUI - the ROM dialog + Hatari's GUI - the ROM dialog

Here you can select the TOS image to use. Click on Eject to disconnect the custom cartridge image.

+Depending on the machine type that you want to emulate, you can either use +EmuTOS, or you must use 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.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's the most common one. -Also note that TOS 4.92 can not be booted from a boot disk (like it's done on a +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 hard disk emulation or the VDI extended resolution emulation +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.

@@ -2039,10 +1429,11 @@ when changing one of these option.

-

The Joystick Dialog

+

The Joystick Dialog

-Hatari's GUI - the joystick dialog + Hatari's GUI - the joystick dialog

In this dialog, you can configure the emulated joysticks. @@ -2072,11 +1463,11 @@ certain games. In some other games, it g

See also the chapter "Emulated Joystick" for details.

-

The Atari Monitor Dialog

+

The Atari Monitor Dialog

-Hatari's
-GUI - the Atari monitor dialog + Hatari's GUI - the Atari monitor dialog

@@ -2091,38 +1482,52 @@ GUI - the Atari monitor dialog"> switch to ST medium resolution, you will get a TV-like screen rendering which is a little bit faster but darker compared to the normal "RGB" monitor mode. Switching between mono and a color monitor acts like a monitor - switch on a real ST - so beware, this will reboot your emulated system!
+ 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. + 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 screen. Some demos and games use the screen borders for displaying + 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. - This option affects only the ST and STE modes, TT and Falcon modes are - always displayed without borders. + 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:

+

-Extended VDI resolutions will emulate a sort of extended graphics -card in the emulated ST which give you larger resolutions with a higher -colordepth for GEM. Select a resolution and color depth. Check to -activate. It will disable all other video options mentioned above. -Uncheck to get back to a normal ST behaviour.
-Note: Using an extended resolution will only work with GEM -conformant applications. 99% of all games and demos will not run if you -activate any extended resolution here. +Because TT and Falcon support natively larger resolutions, +VDI mode is most useful with ST / STE emulation.

-

The Hatari -Screen Dialog

+

The Hatari Screen Dialog

-Hatari's
-GUI - the Hatari screen dialog + Hatari's GUI - the Hatari screen dialog

@@ -2140,7 +1545,7 @@ on your screen. 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.
+ how many frames will be skipped.
Note: The frameskip option also affects the frame rate of the screen animation recording!

@@ -2153,7 +1558,7 @@ The statusbar shows the floppy drive LED 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 disk) activity.
  • +contents. It will show any disk (floppy or hard drive) activity.
  • "None" turns both of above options off.
  • @@ -2184,7 +1589,7 @@ has different implementations for differ

    You should set these values to a size that suits best your monitor -resolution. It's intended to help in getting Hatari to best use your +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.

    @@ -2204,22 +1609,23 @@ Selecting "Crop statusbar" option will l the screenshots and recorded videos.

    -

    The Keyboard Dialog

    +

    The Keyboard Dialog

    -Hatari's GUI - the keyboard dialog + Hatari's GUI - 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 + 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. This only works on certain architectures like Linux where the - scancodes are similar to the ST scancodes (e.g. it does not work on Mac OS X). +

    "Scancode" uses the scancode values of your PC keys for keyboard mapping. + This only works on certain architectures like Linux where the scancodes are + similar to the ST scancodes (e.g. it does not work on macOS with SDL1.2). 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).

    @@ -2229,17 +1635,34 @@ the screenshots and recorded videos. at the supplied example mapfile (keymap-sample.txt) to see how to create your own keyboard mapping.

    - 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. To avoid this you can - disable the key repetition in fast forward mode here. + 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

    +

    The Sound Dialog

    -Hatari's GUI - the sound dialog + Hatari's GUI - the sound dialog

    Here you can control the sound subsystem.

    @@ -2272,167 +1695,218 @@ for accurate sound's emulation.

    -

    The Devices Dialog

    +

    The Devices Dialog

    -Hatari's GUI - the device dialog + Hatari's GUI - the device dialog
    -

    Check the first checkmark to enable experimental printer support. -See the Emulated printer section for +

    Check the first checkmark 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 checkmark to enable experimental RS232 support. +

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

    +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 checkmark to enable experimental MIDI support. +

    Check the third checkmark to enable MIDI support. 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 -synthetizing on Linux (using Alsa) if your sound card/driver doesn't +synthesizing on Linux (using Alsa) if your sound card/driver doesn't support MIDI, and how to set up MIDI networking e.g. between multiple Hatari instances.

    -

    Keyboard shortcuts

    +

    Keyboard shortcuts for the SDL GUI

    + +

    There are multiple ways to interact with the SDL GUI.

    + +

    TAB and cursor keys change focus between UI elements. Additionally +Home key moves focus to first item, End key to last one. Initially +focus is on default UI element, but focus changes are remembered +between dialog invocations. Enter and Space invoke focused item. UI +elements with underlined characters can be invoked directly with Alt + +key with that character. Alt + arrow keys will act on arrow +buttons.

    + +

    Most importantly:

    + + + +

    Keyboard shortcuts during emulation

    While the emulator is running, you can activate or toggle various -features via Hatari keyboard shortcuts. Below are listed the default -shortcut key bindings:

    - - +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:

    +
    + - - + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + +
    ShortcutPurposeShortcutPurpose
    AltGr+arecord animation
    AltGr+ggrab a screenshot
    ALTGR+arecord animationAltGr+iboss key: leave full screen mode, pause Hatari + and iconify its window
    ALTGR+ggrab a screenshotAltGr+m(un-)lock the mouse into the window
    ALTGR+iboss key: leave full screen mode, pause Hatari -and iconify its windowAltGr+r(warm) reset the ST
    ALTGR+jtoggle joystick emulation via cursor keys -on/off between ports 0 and 1AltGr+ccold reset the ST (same as the original power switch)
    ALTGR+m(un-)lock the mouse into the windowAltGr+dopen dialog to select/change disk A
    ALTGR+r(warm) reset the STAltGr+senable/disable sound
    ALTGR+ccoldreset the ST (same as the original power -switch)AltGr+qquit the emulator
    ALTGR+dopen dialog to select/change disk AAltGr+xtoggle normal speed/fast forward
    ALTGR+senable/disable soundAltGr+yenable/disable sound recording
    ALTGR+qquit the emulatorAltGr+ksave memory snapshot
    ALTGR+xtoggle normal speed/fast forwardAltGr+lload memory snapshot
    ALTGR+yenable/disable sound recordingAltGr+jtoggle joystick emulation via cursor keys + on/off between ports 0 and 1
    ALTGR+ksave memory snapshotAltGr+F1switch joystick type on joy port 0
    ALTGR+lload memory snapshotAltGr+F2switch joystick type on joy port 1
    ALTGR+f or F11toggle between fullscreen and windowed modeAltGr+F3switch joystick type for joypad A
    ALTGR+o or F12activate the options GUIAltGr+F4switch joystick type for joypad B
    PAUSEpause emulationAltGr+btoggle borders on/off
    AltGr+PAUSEinvoke the internal Hatari debuggerAltGr+f or F11toggle between fullscreen and windowed mode
    AltGr+o or F12activate the options GUI
    Pausepause emulation
    AltGr+Pauseinvoke the internal Hatari debugger

    You can change the key bindings from the Hatari configuration file. -The required key values can be seen in the SDL_keysym.h include file -(usually in /usr/include/SDL/).

    +See keymap-sample.txt file for instructions.

    -

    Emulated Atari ST keyboard

    +

    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:

    - - + +
    + - - + + + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyMeaningKeyMeaning
    Altwill act as the ST's ALTERNATE keyAltwill act as the ST's ALTERNATE key
    left CTRLwill act as the ST's CONTROL keyleft CTRLwill act as the ST's CONTROL key
    Print Screenwill emulate the ST's HELP keyPrint Screenwill emulate the ST's HELP key
    Scroll Lockwill emulate the ST's UNDO keyScroll Lockwill emulate the ST's UNDO key
    Page Upwill emulate the ST's ( key in the keypadPage Upwill emulate the ST's ( key in the keypad
    Page Downwill emulate the ST's ) in the keypadPage Downwill emulate the ST's ) in the keypad
    @@ -2442,35 +1916,40 @@ are used for the directions and -

    NOTE: Problems with simultenous keypresses most likely aren't an +

    NOTE: Problems with simultaneous keypresses most likely aren't an issue in Hatari as many modern keyboards report/support only three -simultenous key presses (or even just two depending on which keys +simultaneous key presses (or even just two depending on which keys are in question). Expensive gaming keyboards support more.

    -

    Emulated mouse

    +

    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. To make the -mouse work there as expected you need to grab it first or lock it into -the Hatari window. Do this by pressing the ALTGR+m +

    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. +--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 outside the Hatari window while +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

    +

    Emulated joystick

    -

    The Atari ST joysticks are emulated ofcourse allowing you to play +

    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. If your joystick works with -other applications, it will likely work with Hatari as well. Make sure +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. The first @@ -2489,7 +1968,7 @@ cursorkeys in this mode as long as you p along with the cursorkeys. You can also configure these keys from the joystick options.

    -

    Emulated video

    +

    Emulated video

    Hatari emulates all screen modes of the original machine.

    @@ -2506,11 +1985,11 @@ into your Mega ST.

    Make sure to disable extended VDI modes for playing games as 99% of all ST games will not be able to make use of higher resolutions.

    -

    Emulated printer

    +

    Emulated printer

    -

    Due to the fact that printer handling is very different between Unix -style machines and the Atari ST, emulation -of the printer is achieved by writing all printer output to a file.

    +

    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 @@ -2520,29 +1999,55 @@ in a messy data dump in the printer outp 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 on a PostScript printer, -you may set up a GDOS printer with a PostScript driver on the emulated -Atari and set your printer device file as Hatari's printer output.
    -NOTE: This has not been tested yet and the Hatari team cannot -guarantee that it will work.

    +

    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

    +

    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 ST. This means all you do is to set -the communication parameters like baudrate from your ST communications -software. Hatari will do the rest and handle -the serial input and output for you.

    +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.

    -

    Floppy disk images

    +

    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. -Three types of disk images are currently supported: The raw "ST" type, -the similar "DIM" type and -the compressed "MSA" (Magic-Shadow-Archiver) type.

    +Several types of disk images are currently supported : +

    + + +

    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 @@ -2557,7 +2062,7 @@ 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. -There +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 @@ -2568,8 +2073,15 @@ Hatari-incompatible disk images. However 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.

    -

    While *.ST and *.MSA are more or less the "standard" types of Atari +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 @@ -2581,7 +2093,7 @@ the DIM images into ST images by strippi For example try something like: dd if=input.dim of=output.st bs=32 skip=1

    -

    If you've got a disk image that has been created with the old ST +

    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 @@ -2607,82 +2119,139 @@ your highscores and savegames are lost i a zipped disk image.

    -

    Hard disk support

    +

    Hard disk support

    -Hatari supports three ways of emulating Atari hard drives: The low-level -ACSI and IDE hard disk emulation and a GEMDOS based drive emulation. -In most cases the GEMDOS based hard disk emulation is best as it allows +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 disk +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. How large partition sizes -are supported inside the hard disk (images) depends on the TOS version. -TOS 1.0x supports up to 256MB partitions and TOS 4.0x up to 1GB ones. +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 MB, TOS 1.04 to 3.06 up to +512 MB 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 disk emulation

    +

    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. +

    -With the GEMDOS based drive emulation, you can easily "mount" a -folder from the host file system to a drive of the emulated Atari. To -use the GEMDOS based drive emulation, you should use a folder on your -hard disk that only contains files and folders with valid TOS -filenames i.e. file and folders names shouldn't contain invalid GEMDOS -filename characters and their length shouldn't exceed the 8+3 file name -length limit. +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/
    +

    -If you provide --harddisk option -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. +That is given to Hatari as "hatari -d partitions", will give you +GEMDOS HD emulated C: and D: drives.

    -GEMDOS drive emulation is an easy way to share files between the -host system and the emulated Atari, but there are also some known -limitations which are due to the way the GEMDOS drive emulation is -implemented: +GEMDOS HD emulation is an easy way to share files between the +host system and the emulated Atari, but there are also several +limitations:

    -So, if your programs complain that they could not find/read/write -files on the GEMDOS emulated drive, you should try to copy them to a -floppy disk image or a real hard disk image! +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 hard disk emulation

    + +

    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. +Partitioning/formatting them is the problem. Creating such images +from scratch is described in following sections. +

    + + +

    ACSI hard drive emulation

    -To use the ACSI hard disk emulation, you need a hard disk image file +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 @@ -2697,19 +2266,24 @@ 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's formatted. +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.

    - -

    IDE hard disk emulation

    +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 formatting IDE disks with AHDI, but you can do it with +currently support partitioning IDE disks with AHDI, but you can do it with Cecile.

    @@ -2735,9 +2309,9 @@ If you only want to use your HD image in the Cecile hard disk driver to the image from the Cecile CC_TOOLS.APP: Click the "Installer" button and save the Cecile 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 AHDI 6 driver on it -instead (see ASCI hard disk -emulation section). +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 @@ -2745,62 +2319,66 @@ with the --ide

    -

    Moving files -to/from hard disk images

    +

    Moving files to/from hard disk images

    Moving files to and from Atari hard disk images can be done -either through GEMDOS partitions (host directories mounted inside +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's fine for the IDE/ACSI partitions to be first, you can use -hard disk images with AHDI or Cecile driver and a multipartition -GEMDOS setup as described in above sections. If you want to boot from -a GEMDOS 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.

    +

    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. +

    -

    Using HD Driver -with GEMDOS partitions

    +

    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 although its own +partition table/type support is very limited.

    + +

    Using HD Driver with GEMDOS partitions

    Uwe Seimet's HD -Driver works fine with both the Hatari GEMDOS partitions and normal -hard disk images. However, it doesn't work with EmuTOS so you need -real TOS (at least version v1.04). +Driver works fine with both the Hatari GEMDOS HD partitions and normal +hard disk images.

    -

    First copy the HDDRIVER.PRG binary into your GEMDOS drive emulation +

    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 directory, for example like this: -"hatari --harddisk gemdos-hd/ --ide-master +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 partition (with -some write slowndowns 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:.

    +

    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 partitions to be from D: forward, +

    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 --harddisk gemdos-hd/ hd-driver-floppy.st". -

    +--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

    +

    Accessing HDD image partitions outside of Hatari

    -If you want to access the harddisk image partitions also outside +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. @@ -2810,14 +2388,12 @@ Inside the Hatari emulator, EmuTOS can a kind of images directly without any driver software. Of the Atari HD drivers mentioned above, Centek's Cecile and Uwe Seimet's HD Driver (demo) work fine with these partitions. E.g. AHDI and CBHD don't. +Cecile works only with TT or Falcon.

    -Note that plain EmuTOS supports only ACSI and the listed HD drivers -support only IDE (emulation). Cecile needs TT or Falcon and HD Driver -doesn't work with EmuTOS. To summarise; if ASCI emulation and -EmuTOS are enough, use those. Otherwise, if you want to use TT or -Falcon emulation, use Cecile (or full HD Driver version if you have -it), otherwise use HD Driver (demo). +To summarise; if EmuTOS is enough, use that. Otherwise, if you want to +use TT or Falcon emulation, use Cecile (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 @@ -2848,9 +2424,8 @@ MTOOLS_NO_VFAT=1 mcopy -spmv -i hd.img f

    Using a loopback device

    -This is recommended even by Mtools documentation, but it's less -convenient as it requires root rights. First you need to "loop" -mount the image: +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
    @@ -2870,51 +2445,81 @@ the hd.img
     

    -After you've copied the relevant files to the "hd" directory, you need -unmount the file system and remove the loop device binding before using -the disk image from Hatari: +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
     
    -

    The debugger

    + +

    The debugger

    Hatari has a built-in debugging interface which can be used for -analyzing code that runs in the emulated system. To invoke the -debugger, press the AltGr + Pause -key combination. +analyzing code that runs in the emulated system.

    -If you start Hatari with the "-D" command line option, m68k -exceptions will automatically invoke the debugger. You can -toggle this also later from the debugger with the "setopt -D" -command. +On Unix (Linux / macOS) debugger uses Hatari's parent console window, so +make sure you run Hatari from the command line when you want to use +the debugger. On Windows you need to use "-W" option to get console +window. You can add an icon to your desktop that does it. On Linux +it should do something like this (replace "xterm" with your favorite +terminal program): +

    +
    +xterm -T "Hatari debug window" -e hatari
    +
    + +

    +To run debugger commands from a file at Hatari startup, one can use +the "--parse <file>" command line option. This is useful e.g. +for debugging TOS or some demo startup code, or if you always want to +use some specific debugger setup (breakpoints etc).

    -To run debugger commands at Hatari startup, one can use the "--parse -<file>" command line option. This is useful e.g. for debugging -TOS or some demo startup code, or if you always want to use some -specific debugger setup (breakpoints etc). +Note that when debugger scripts are run, current directory is set to +the currently running script's directory i.e. all file operations are +relative to it. After script finishes, earlier current directory is +restored. To set current directory from a setup script, e.g. for +scripts run at breakpoints, you need to give '-f' option for the +'cd' command.

    + +

    Invoking the debugger

    +

    -The debugger uses Hatari's parent console window, so make sure you run -Hatari from the command line when you want to use the debugger. On -Linux you can add for example an icon to your desktop that does it -with something like this (replace "xterm" with your favorite terminal -program): +You can invoke the debugger manually by pressing the +AltGr + Pause key combination. +

    + +

    +With the "-D" command line option, you can toggle whether m68k +exceptions will also invoke the debugger. Which exceptions cause +this, can be controlled with the "--debug-except" option. +

    + +

    +Giving "-D" option at Hatari startup is not advised because TOS HW +checks generate some exceptions at every TOS boot. It is better to +toggle exception catching later from the debugger with the "setopt -D" +command.

    -
    -xterm -T "Hatari debug window" -e hatari
    -
    +

    +Alternatively, you can give "--debug-except" option "autostart" flag +(e.g. "--debug-except all,autostart"). This will enable catching of +(specified) exceptions after TOS boot, when Atari program given on +Hatari command line is autostarted. +

    -

    General debugger use

    + +

    General debugger use

    At the debugger prompt, type "help" to get a list of all @@ -2925,15 +2530,18 @@ Generic commands: cd ( ) : change directory evaluate ( e) : evaluate an expression help ( h) : print help - history (hi) : show last CPU & DSP PC values & executed instructions + history (hi) : show last CPU/DSP PC values & executed instructions info ( i) : show machine/OS information lock ( ) : specify information to show on entering the debugger logfile ( f) : open or close log file parse ( p) : get debugger commands from file + rename ( ) : rename given file + reset ( ) : reset emulation setopt ( o) : set Hatari command line and debugger options stateload ( ) : restore emulation state statesave ( ) : save emulation state trace ( t) : select Hatari tracing settings + variables ( v) : List builtin symbols / variables quit ( q) : quit emulator CPU commands: @@ -2945,8 +2553,10 @@ CPU commands: memdump ( m) : dump memory memwrite ( w) : write bytes to memory loadbin ( l) : load a file into memory - savebin ( s) : save memory to a file + savebin ( ) : save memory to a file symbols ( ) : load CPU symbols & their addresses + step ( s) : single-step CPU + next ( n) : step CPU through subroutine calls / to given instruction type cont ( c) : continue emulation / CPU single-stepping DSP commands: @@ -2957,11 +2567,13 @@ DSP commands: dspsymbols ( ) : load DSP symbols & their addresses dspprofile (dp) : profile DSP code dspreg (dr) : read/write DSP registers + dspstep (ds) : single-step DSP + dspnext (dn) : step DSP through subroutine calls / to given instruction type dspcont (dc) : continue emulation / DSP single-stepping

    - -

    Entering arguments to debugger commands

    + +

    Entering arguments to debugger commands

    After writing (with TAB completion) one of the above command names, @@ -2972,7 +2584,7 @@ pressing TAB will (for most commands) sh If you want to give numbers in other number bases than the default/selected one, they need to be prefixed with a character indicating this. For decimals this prefix is "#" (#15), -for hexadecimals "$" ($F), and for binary values it's "%" (%1111). +for hexadecimals "$" ($F), and for binary values it is "%" (%1111).

    @@ -2991,14 +2603,14 @@ conditional breakpoints can be unexpecte

    Instead of a number, you can also use an arithmetic expression, by surrounding it with quotes (""). An expression can contain -calculations with CPU and DSP register, symbol and Hatari variable -values in addition to numbers. For example to give a sum of A0 and -D0 register values to a command, use "a0+d0". +calculations with CPU and DSP registers, symbols and Hatari variables +in addition to numbers. For example to give a sum of A0 and D0 +register values to a command, use "a0+d0".

    -Within arithmetic expressions parenthesis are used both to change -the order of precendence and to indicate indirect addressing. +Also within arithmetic expressions, parenthesis are used to indicate +indirect addressing, not to change the order of precedence. Unlike with conditional breakpoint expressions (explained below), you cannot give size for the indirect addressing, a long value is always read from the RAM address given within parenthesis. For example to @@ -3008,7 +2620,7 @@ get a long value pointed by stack pointe

    Values of arithmetic expressions are always evaluated before being given to a command. Except for "evaluate" and "address" commands, -they always need to be marked with quotes (""). Besides arithmetics, +they always need to be marked with quotes (""). Besides arithmetic, this can be used also to give symbol/register/variable values to commands that don't otherwise interpret them. If command complains that it didn't recognize e.g. a register name, just put it to quotes @@ -3016,13 +2628,36 @@ and it will be "evaluated" before being

    -With command argument completion (see build +Virtual V0-V7 "registers" can be used to store intermediate results +for calculations. For example, to get a sum of "_counter" symbol +address contents one could use following in suitable breakpoint: +

    +
    +# store counter sum to V0 virtual register
    +r v0=(_counter)
    +# store count of how many values are added
    +r v1="v1+1"
    +
    +

    And then later on, calculate the average:

    +
    +# round the counter sum (add half count to sum)
    +r v2="v0 + v1/2"
    +# and calculate the rounded average (rounded sum / count)
    +e v2/v1
    +
    +

    (Another virtual register was used for rounding here, in case one +wants to continue summing the _counter values with the original +value.) +

    + +

    +With command argument completion (see build notes), result from the last "evaluate" command can be inserted by typing '$' and pressing TAB.

    -

    Inspecting emulation state

    +

    Inspecting emulation state

    In the beginning, probably the most interesting commands are "m" and "d" @@ -3032,8 +2667,11 @@ commands to do the same for the DSP.

     > help memdump
     'memdump' or 'm' - dump memory
    -Usage:  m [start address-[end address]]
    -        dump memory at address or continue dump from previous address.
    +Usage:  m [b|w|l] [start address-[end address| count]]
    +	dump memory at address or continue dump from previous address.
    +	By default memory output is done as bytes, with 'w' or 'l'
    +	option, it will be done as words/longs instead.  Output amount
    +	can be given either as a count or an address range.
     
     > help disasm
    @@ -3056,7 +2694,12 @@ Both commands accept in addition to nume
     and symbol names, like in above example.  If you don't specify an
     address, the commands continue showing from an address that comes
     after the previously shown data.  "disasm" command default address
    -will be reseted to PC address everytime you re-enter the debugger.
    +will be reset to PC address every time you re-enter the debugger.
    +

    + +

    +Use "setopt --disasm help" if you want to set options controlling +the disassembly output.

    @@ -3096,18 +2739,105 @@ Without arguments "lock" command will sh

    -

    Debug symbols

    +

    Debug symbols

    -You can load symbol name/address information from a file to the -debugger with the "symbols" command (and with "dspsymbols" for DSP). -These symbolic names can be used in arithmetic expressions and -conditional breakpoint expressions. They also show up in the "disasm" -command output and you can trace calls to them with "trace cpu_symbols" -(and DSP symbols with "trace dsp_symbols"). +You can load debugging symbols to the debugger with the "symbols" +command (and with "dspsymbols" for DSP). These symbolic names can be +used in arithmetic expressions and conditional breakpoint expressions. +They also show up in the "disasm" command output and you can trace +calls to them with "trace cpu_symbols" (and DSP symbols with "trace +dsp_symbols").

    -

    The symbols file format is following:

    + +

    For a program under GEMDOS HD emulation

    + +

    +If currently running program contains debug symbol table, +and it is started from GEMDOS HD emulated drive, its symbol names / +addresses are automatically loaded when debugger is entered, and +removed when program terminates.

    + +

    +Above happens only if there are no symbols loaded when the program +starts. If there are, you can load program symbol data manually with +the following command, after program has been loaded to the memory by +TOS (see setting breakpoint at program +startup): +

    +
    +symbols prg
    +
    + +

    +The options you need to add suitable symbol table to your programs, +depend on which toolchain you use to build it: +

    +
    +
    Devpac:
    +
    "OPT D+,X+"
    +
    AHCC:
    +
    "-g" and "-l" options for linking
    +
    GCC:
    +
    "-g" for compilation, and no strip option for linking +(with older Hatari versions that didn't support a.out format, +also "-Wl,--traditional-format" option was needed for linking)
    +
    VBCC:
    +
    "-g" (can only be used at linking phase), when VBCC + configuration file uses "-bataritos" option for + the linker
    +
    + +

    You can view the generated symbols (and convert them to debugger +ASCII format) with tool installed with Hatari:

    +
    +$ gst2ascii -l -o program.tos > program.sym
    +
    +(Options -l and -o are used to exclude useless symbols from the output.) + + +

    For a program on a (disk) image

    + +

    +If the program isn't run from a GEMDOS HD emulated drive, but from +a cartridge, floppy or HD image, you need to have the corresponding +program also as a normal host file which location you can give to +the debugger: +

    +
    +symbols /path/to/the/program.tos
    +
    + + +

    ASCII debug symbol files

    + +

    +If Hatari complains that your program doesn't have debug symbol table, +or its symbols are in some unsupported format, and you cannot re-compile +it to include a.out or GST/DRI symbols, you have two options: +

    + + +

    NOTE: nm output for GCC generated +a.out binaries includes labels also for loops, +not just functions. While loop labels are fine for debugging, they should +be removed before profiling. Besides causing misleading profile +results, loop labels can seriously slow down profiling +(call graph tracking is automatically enabled for profiling when debug +symbols are loaded, and operations done on each matched symbol address +cause huge overhead if that match is for something happening every few +instructions). +

    + + +

    ASCII symbols file format is following:

     e01034 T random
     e01076 T kbdvbase
    @@ -3121,28 +2851,23 @@ starting with '#' (comments) are ignored
     

    -AHCC C-compiler can provide a symbol file suitable for this with its -"-n" 'nm' list option (not enabled by default). If you're reverse -engineering some code, you could just create your own symbols file to -help in debugging it later. -

    - -

    -If you're debugging normal TOS/GEM programs instead of code loaded -into a fixed address (like e.g. EmuTOS is), after the program has been -loaded, load the symbols with the program text segment address offset: +Debugger will automatically "relocate" the symbol addresses when it +loads them from a program binary, but with ASCII symbol files you need +to give the relocation offset(s) separately, unless the symbol names +are for fixed addresses (like is the case e.g. with EmuTOS):

    -symbols calc.sym "TEXT"
    +symbols program.sym TEXT DATA BSS
     

    -(The value of the above virtual "TEXT" debugger variable comes from a -program basepage, it's set after the program is loaded by TOS, see -"info basepage" output.) +If you're interested only about code symbols, you can leave DATA and +BSS offsets out (the values of the above virtual debugger variables +like TEXT come from the currently loaded program's basepage, they're +set after the program is loaded by TOS, see "info basepage" output).

    -

    Breakpoints

    +

    Breakpoints

    There are two ways to specify breakpoints for Hatari. First, there are @@ -3164,7 +2889,7 @@ breakpoints so you need to use "b" comma Then there are the conditional breakpoints which can handle much more complex break condition expressions; they can track changes to register and memory values with bitmasks, include multiple conditions -for triggering a breakpoint and so on. Use "b" (or "db" for the DSP) +for triggering a breakpoint and so on. Use "b" (or "db" for the DSP) to manage them.

    @@ -3194,13 +2919,13 @@ conditions need to be true for a breakpo

    -

    Breakpoint options

    +

    Breakpoint options

    Normally when a breakpoint is triggered, emulation is stopped and you get to the debugger. Breakpoint options can be used to affect what happens when a breakpoint is triggered. These options are given after -the conditions and are prefixed with ':'. +the conditions and are prefixed with ':'.

    @@ -3214,7 +2939,7 @@ a $1234 :2
    once
    -Delete the breakpoint when it's hit i.e. trigger it only once. It may +Delete the breakpoint when it is hit, i.e. trigger it only once. It may be useful if you just want to get a specific address. Or if you're on an instruction that jumps back to a start of the loop and you want to finish the loop, you could use: @@ -3236,7 +2961,7 @@ changes (explained below).
    Show the same information on breakpoint hit as you see when entering the debugger (see the "lock" command in -Inspecting emulation state +Inspecting emulation state above). This enables also trace option as you would anyway see this information if debugger would be entered.
    @@ -3247,10 +2972,21 @@ Execute debugger commands from given < is hit. With this you have complete control over what information is show when the debugger is hit, you can even chain breakpoints (as explained in -Chaining breakpoints later on) +Chaining breakpoints later on) etc. Use this if "lock" option isn't enough or you want different information show on breakpoints and when entering the debugger. + +
    noinit
    +
    +Hitting breakpoint doesn't re-initialize debugger which would e.g. +cause profiling data to be reset. This implies trace option as +entering debugger would also re-initialize debugger state. This option +is mainly intended for breakpoints that use :file option to show +backtraces with "profile stack" command during +profiling. See +Usage examples section for an example. +

    @@ -3260,7 +2996,7 @@ for address breakpoints you can give onl

    -

    Breakpoint conditions

    +

    Breakpoint conditions

    "b help" explains very briefly the breakpoint condition syntax: @@ -3291,7 +3027,7 @@ If the value is in parenthesis like in ' used value will be read from the memory address pointed by it. Note that this conditional breakpoint expression value is checked at run-time whereas quoted arithmetic expressions (mentioned in -Entering arguments +Entering arguments to debugger commands above) are evaluated already when adding a breakpoint. For example, to break when a value in an address (later) pointed by A0 matches the value currently in D0, one @@ -3304,9 +3040,9 @@ b (a0) = "d0"

    If you're interested only on certain bits in the value, you can use '&' and a numeric mask on either side of comparison operator to -mask the coresponding value, like this: +mask the corresponding value, like this:

    -b ($ff820).w & 3 = (a0)  &&  (a1) = d0 & %1100
    +b ($ff820).w & 3 = (a0)  &&  (a1) = d0 & %1100
     

    @@ -3317,9 +3053,12 @@ which indicates inequality ("is not") co b d0 > $20 && d0 < $40 && d0 ! $30

    + +
    Tracking breakpoint conditions
    +

    As a convenience, if the both sides of the comparison are exactly the -same (i.e. condition is redundant as it's always either true or +same (i.e. condition is redundant as it is always either true or false), the right side of the comparison is replaced with its current value. This way you can give something like this:

    @@ -3342,35 +3081,82 @@ like this: b ($ffff9202).w ! ($ffff9202).w :trace

    -Typically with this one would use the breakpoint "trace" option like -above. +Because tracking breakpoint conditions will print the evaluated +value when it changes, they're typically used with the trace option +to track changes e.g. to some I/O register.

    -

    Breakpoint variables

    +
    Breakpoint condition notes
    + + + + +

    Breakpoint variables

    In addition to loaded symbols, the debugger supports also setting conditional breakpoints on values of some "virtual" variables listed -by "b help". For example: +by "variables" (v) command. For example:

    Hint: "info" command "aes", "bios", "gemdos", "vdi" and "xbios" -subcommands for can be used to list the corresponding OS-call opcodes. +subcommands can be used to list the corresponding OS-call opcodes. For example, to see the GEMDOS opcodes, use:

     info gemdos 1
     
    - -

    Chaining breakpoints and other actions

    +

    Chaining breakpoints and other actions

    As the file pointed by the breakpoint ":file" option (see -Breakpoint options) can contain any +Breakpoint options) can contain any debugger commands, it can also be used to do automatic "chaining" of debugger and breakpoint actions so that after one breakpoint is hit, another one is set. @@ -3417,19 +3194,30 @@ another one is set.

    For example if you have these input files:

    -And then start Hatari with the first debugger input file and a GEMDOS -harddisk directory containing "desktop.inf" file: +And then start Hatari with the first debugger input file:

    -hatari --parse break.ini -d testdir
    +hatari --parse pexec.ini /path/to/your/program.tos
     
      -
    1. "break.ini" input file will break when TOS opens - the "desktop.inf" file (it's the first Fopen() i.e. GEMDOS call - 0x3D done by TOS at boot) and the breakpoint will run - the debugger commands from the "trace.ini" file -
    2. "trace.ini" input file sets Hatari to trace several things - (see Tracing section below) in the - emulated system for few VBLs until breakpoint runs commands - from the "disable.ini" file +
    3. "pexec.ini" sets a breakpoint to parse debugger commands from + "program.ini" when TOS starts loading the given program + (it is first Pexec(0) after boot) +
    4. "program.ini" sets a breakpoint to parse debugger commands from + "trace.ini" when program code begins executing. These two steps + are needed because TEXT variable isn't valid until TOS has booted +
    5. "trace.ini" input file loads symbols for the run program, sets Hatari + to trace several things (see Tracing section + below) in the emulated system for few VBLs until breakpoint runs + commands from the "disable.ini" file
    6. "disable.ini" input file will disable tracing and remove all (remaining) breakpoints
    -

    -Note: because debugger input files cannot "continue" +

    Note:

    +

    -Hint: It's better to test each input file separate before testing the -whole chain. Besides the ":file" breakpoint option, these debugger -input files can be also read with the debugger "file" command, "lock" -command "file" option and with the Hatari "--parse" command line -option. +Hint: It is better to test each input file separately before testing +the whole chain. Besides the ":file" breakpoint option, you can test +these debugger input files also with the debugger "file" command, +"file" option for the "lock" command, and with the Hatari "--parse" +command line option.

    - -

    Tracing

    +

    Stepping through code

    After analyzing the emulation state and/or setting new breakpoints, @@ -3483,9 +3276,50 @@ triggers) if you omit the instruction co

    -If you want to continue with real-time disassembling, you can enable -it with "trace cpu_disasm" (or "trace dsp_disasm" for DSP) at the -debugger prompt before continuing. +If you want to continue just to the next instruction, use "s" (step) +command to continue for exactly one instruction, or "n" (next), if you +want to skip subroutine + exception calls and DBCC branching backwards +(i.e. loops). "ds" and "dn" commands do the same for DSP (except that +"dn" doesn't skip loops). +

    + +

    +You can also continue with the "n" until instruction of certain +type is encountered, by giving it the instruction type: +

    + +

    +For example: "n branch", or "dn branch". +

    + +

    +(Note: CHK, CHK2, FBCC, FDBCC, & FTRAPCC exception / branch CPU +instructions aren't supported currently.) +

    + + +

    Tracing

    + +

    +If you want e.g. to continue with real-time disassembling, you can +enable it with "trace cpu_disasm" (or "trace dsp_disasm" for DSP) at +the debugger prompt before continuing.

    Disable tracing with "trace none" when you enter the debugger again. @@ -3493,46 +3327,49 @@ Disable tracing with "trace none" when y traceable things, from HW events to OS functions.

    -Because Hatari normally emulates things at the hardware level, tracing -certain Atari OS Traps requires setting additional Hatari options -which tell it to intercept this higher level functionality: +Notes: +

    -

    -Unlike with AES and VDI tracing, BIOS, GEMDOS and XBIOS traces show -arguments for most of the calls. -

    -

    -Tracing options can be set even from a program within the emulation +

  • +AES, BIOS, GEMDOS and XBIOS traces show arguments for (most of) the +calls, VDI trace shows only function calls (parsing the arguments +would be too complicated). +
  • +
  • +Tracing options can be set even from a program within the emulation, if you enable the Hatari "--bios-intercept" option and call XBios 255 -from the program with a suitable Hatari command line string. Bios -interception will also show the (Bios level) CON: output on the host -console. -

    -

    +from the program with a suitable trace options string. +

  • +
  • Note that the trace output file can be set only when Hatari starts, it cannot be changed from within the debugger (or emulation). -

    +
  • +

    -If tracing isn't possible for the things you'd like to track, you can -use the OS call opcode breakpoints explained above with the ":trace" -breakpoint option. +If there isn't a trace option for something you would like to track, +you may be able to use tracing breakpoints, explained above. +For example, following tracks Line-A calls:

    +
    +b  LineAOpcode ! LineAOpcode  &&  LineAOpcode < 0xffff  :trace
    +
    -

    Profiling

    +

    Profiling

    Profiling tells where the emulated code spends most of its (emulated) time. It can be used to find out where a program is (apparently) -stuck or what are the largest performance bottlenecks for a program. +stuck, or what are the largest performance bottlenecks for a program.

    +

    Collecting the profile data

    +

    Profiling is used by first enabling the profiler (use "dp" for DSP):

    @@ -3546,78 +3383,703 @@ And profiling will start once you contin
     > c
     Returning to emulation...
    -Allocated CPU profile buffer (18 MB).
    +Allocated CPU profile buffer (27 MB).
     

    When you get back to the debugger, the collected profiling information -is processed and a summary of in which parts of the RAM the execution -happened is shown: +is processed and a summary of in which parts of memory the execution +happened, and how long it took, is shown:

    -Allocated CPU profile address buffer (4 KB).
    -Normal RAM (0-0x400000):
    -- no activity
    -Cartridge ROM (0xFA0000-0xFC0000):
    -- no activity
    +Allocated CPU profile address buffer (57 KB).
     ROM TOS (0xE00000-0xE80000):
     - active address range:
    -  0xe0014c-0xe23f02
    +  0xe00030-0xe611a4
     - active instruction addresses:
    -  707 (100.00% of all)
    +  14240 (100.00% of all)
     - executed instructions:
    -  629144 (100.00% of all)
    +  4589668 (100.00% of all)
     - used cycles:
    -  9408503 (100.00% of all)
    -- address with most cycles:
    -  0xe0dcca, 402628 cycles (4.28% of all in area)
    -- address with most hits:
    -  0xe004a4, 4900 hits (0.78% of all in area)
    +  56898472 (100.00% of all)
    +  = 7.09347s
    +Cartridge ROM (0xFA0000-0xFC0000):
    +  - no activity
    +
    += 7.09347s
     

    (DSP RAM will be shown only as single area in profile information.)

    + +

    Investigating the profile data

    +

    -After this you can request more detailed profiling information: +When you are back in debugger, you can inspect the collected profile data:

    -> profile
    +> h profile
     'profile' - profile CPU code
    -Usage:  profile <on|off|counts|cycles|symbols|stats> [show count]
    -	on & off enable and disable profiling.  Data is collected
    -	until debugger is entered again after which you can view
    -	statistics about the data or view PC addresses that took
    -	most cycles or functions/symbols called most often.
    -	You can specify how many items are shown at most.
    +Usage:  profile <subcommand> [parameter]
    +
    +	Subcommands:
    +		- on
    +		- off
    +		- counts [count]
    +		- cycles [count]
    +		- i-misses [count]
    +		- d-hits [count]
    +		- symbols [count]
    +		- addresses [address]
    +		- callers
    +		- caches
    +		- stack
    +		- stats
    +		- save <file>
    +		- loops <file> [CPU limit] [DSP limit]
    +
    +	'on' ¨ 'off' enable and disable profiling.  Data is collected
    +	until debugger is entered again at which point you get profiling
    +	statistics ('stats') summary.
    +
    +	Then you can ask for list of the PC addresses, sorted either by
    +	execution 'counts', used 'cycles', i-cache misses or d-cache hits.
    +	First can be limited just to named addresses with 'symbols'.
    +	Optional count will limit how many items will be shown.
    +
    +	'caches' shows histogram of CPU cache usage.
    +
    +	'addresses' lists the profiled addresses in order, with the
    +	instructions (currently) residing at them.  By default this
    +	starts from the first executed instruction, or you can
    +	specify the starting address.
    +
    +	'callers' shows (raw) caller information for addresses which
    +	had symbol(s) associated with them.  'stack' shows the current
    +	profile stack (this is useful only with :noinit breakpoints).
    +
    +	Profile address and callers information can be saved with
    +	'save' command.
    +
    +	Detailed (spin) looping information can be collected by
    +	specifying to which file it should be saved, with optional
    +	limit(s) on how many bytes first and last instruction
    +	address of the loop can differ (0 = no limit).
     
    -

    For example:

    +

    For example, to see which memory addresses were executed most +and what instructions those have at the end of profiling, use:

     > profile counts 8
     addr:           count:
    -0xe004a4        0.78%   4900
    -0xe004b6        0.78%   4896
    -0xe0dcbc        0.55%   3448
    -0xe0dcc6        0.55%   3448
    -0xe0f59e        0.55%   3446
    -0xe0dcce        0.55%   3445
    -0xe0dcd6        0.55%   3445
    +0xe06f10        12.11%  555724  move.l    $4ba,d1
    +0xe06f16        12.11%  555724  cmp.l     d1,d0
    +0xe06f18        12.11%  555724  bgt.s     $e06f06
    +0xe06f06        12.11%  555708  move.b    $fffffa01.w,d1
    +0xe06f0a        12.11%  555708  btst      #5,d1
    +0xe06f0e        12.11%  555708  beq.s     $e06f1e
    +0xe00ed8         1.66%  76001   subq.l    #1,d0
    +0xe00eda         1.66%  76001   bpl.s     $e00ed8
     8 CPU addresses listed.
     
    + +

    +Then, to see what the executed code and its costs look like +around top addresses: +

    +> profile addresses 0xe06f04
    +# disassembly with profile data:
    +# <instructions percentage>% (<sum of instructions>, <sum of cycles>, <sum of i-cache misses>, <sum of d-cache hits>)
    +
    +$e06f04 :             bra.s     $e06f10                    0.00% (48, 576, 0, 0)
    +$e06f06 :             move.b    $fffffa01.w,d1            12.11% (555708, 8902068, 0, 0)
    +$e06f0a :             btst      #5,d1                     12.11% (555708, 6685268, 0, 0)
    +$e06f0e :             beq.s     $e06f1e                   12.11% (555708, 4457312, 0, 0)
    +$e06f10 :             move.l    $4ba,d1                   12.11% (555724, 11125668, 0, 0)
    +$e06f16 :             cmp.l     d1,d0                     12.11% (555724, 4461708, 0, 0)
    +$e06f18 :             bgt.s     $e06f06                   12.11% (555724, 4455040, 0, 0)
    +$e06f1a :             moveq     #1,d0                      0.00% (16, 64, 0, 0)
    +Disassembled 8 (of active 14240) CPU addresses.
    +
    +

    +Unlike normal disassembly, "profile addresses" command shows only +memory addresses which instructions were executed during profiling. +You get instruction cache misses only when using cycle-accurate 030 +emulation with a Hatari version configured to use WinUAE CPU core. +

    +If you have loaded symbol information, symbol names are shown above +the corresponding addresses. With the "profile symbols" command you +get a list of how many times the code execution passed through the +defined symbol addresses. +

    + + +

    Profile data accuracy

    + +

    Profile data accuracy depends on Hatari emulation accuracy. +Profile data accuracy from most to least accurate when Hatari's +default emulation options are used is following:

    + + + +

    Caller information

    + +

    +If you have loaded symbols (see Debug symbols) +before continuing emulation/profiling, additional caller information +will be collected for all the code symbol addresses which are called +as subroutines. This information includes callstack, call counts, +calling instruction type (subroutine call, branch, return etc), and +costs for those calls, both including costs for further subroutine +calls and without them. +

    + +

    When debugger is re-entered, current callstack is output before +profiling information:

    +
    +> a _P_LineAttack
    +CPU condition breakpoint 1 with 1 condition(s) added:
    +        pc = $30f44
    +$030f44 : 48e7 3820                            movem.l   d2-d4/a2,-(sp)
    +> c
    +...
    +CPU breakpoint condition(s) matched 1 times.
    +        pc = $30f44
    +Finalizing costs for 12 non-returned functions:
    +- 0x32a3c: _P_GunShot (return = 0x32b7e)
    +- 0x32b18: _A_FireShotgun (return = 0x3229a)
    +- 0x3223a: _P_SetPsprite (return = 0x32e86)
    +- 0x32e4e: _P_MovePsprites (return = 0x38070)
    +- 0x37f44: _P_PlayerThink (return = 0x36ea0)
    +- 0x36e44: _P_Ticker (return = 0x260e0)
    +- 0x25dcc: _G_Ticker (return = 0x1e4c6)
    +- 0x1e29e: _TryRunTics (return = 0x239fa)
    +- 0x238e8: _D_DoomLoop (return = 0x2556a)
    +- 0x24d7a: _D_DoomMain (return = 0x44346)
    +...
    +
    + +

    ("profile stack" command can be used in breakpoints with :noinit +option to show backtraces during caller profiling.)

    + +

    Note: rest of this subsection is about caller information format +which is mainly of interest for people writing profiling +post-processing tools. Come back here if you think there's +some problem with callgraphs produced by those tools.

    + +

    Other information collected during profiling is shown with +following command:

    +
    +> profile callers
    +# <callee>: <caller1> = <calls> <types>[ <inclusive/totals>[ <exclusive/totals>]], <caller2> ..., <callee name>
    +# types: s = subroutine call, r = return from subroutine, e = exception, x = return from exception,
    +#        b = branch/jump, n = PC moved to next instruction, u = unknown PC change
    +# totals: calls/instructions/cycles/misses
    +0xe00030: 0xffffff = 1 e, _main
    +0xe000fe: 0xe00a0c = 1 b, memdone
    +0xe0010a: 0xe04e34 = 1 s 1/5/72 1/5/72, _run_cartridge_applications
    +0xe00144: 0xe04dbe = 1 s 4/118/1512 1/27/444, _init_acia_vecs
    +0xe001ea: 0xe00ec6 = 1 b, _int_acia
    +0xe0038c: 0xe04c28 = 1 s 1/191/2052 1/191/2052, _init_exc_vec
    +0xe003a6: 0xe04c2e = 1 s 1/388/4656 1/388/4656, _init_user_vec
    +...
    +
    + +

    +For example, if you don't know all the places from which a certain +function is called, or in what context a certain interrupt handler can +be called during the period you are profiling, profile caller +information will tell you: +

    +
    +callee: caller: calls: calltype:
    +  |       |       |   /
    +0x379:  0x155 = 144 r, 0x283 = 112 b, 0x2ef = 112 b, 0x378 = 72 s
    +583236/359708265/1631189180 72/4419020/19123430, dsp_interrupt
    +           |                       |                 |
    +    inclusive costs         exclusive costs     callee name
    +  (of calls from 0x378)
    +
    +Calltypes:
    +- b: jump/branch
    +- n: PC  just moved to next address
    +- r: subroutine return
    +- s: subroutine call
    +

    -If you have loaded symbol information for code addresses, with the -"profile symbols" command you get a list of how many times the code -execution passed through the defined symbol addresses. +(Most "calls" to "dsp_interrupt" were subroutine call returns (=r) +to it from address 0x155.)

    -After the profiling information has been post-processed, it will -also be shown in the disassembly output. +With the execution counts in normal profiling data, caller information +can actually be used to have complete picture of what exactly the code +did during profiling. Main/overview work for this analysis is best done +automatically, by the profiler data post-processor (documented below).

    -

    Usage examples

    +

    Caller data accuracy

    + +

    Everything about profile data accuracy applies also to caller costs, +but there are additional things to take into account, mainly because +profiler cannot determine when exceptions are being handled:

    + + + +

    Saving profile data to a file

    + +

    It is useful to save the profile data to a file:

    +
    +> profile save program-profile.txt
    +
    + +

    With the saved profile disassembly (and optional caller information) +you can more easily investigate what your program did during +profiling, search symbols & addresses in it, and compare the +results to profiles you have saved from earlier versions of your code.

    + +

    You may even create your own post-processing tools for +investigating the profiling data more closely, e.g. to +find +CPU/DSP communication bottlenecks.

    + + +

    Profile data post-processing

    + +

    Saved profile data can be post-processed with (Python) script +installed by Hatari, to:

    + + + +

    Providing symbols for the post-processor

    + +

    When the data is post-processed, you should always provide +the post-processor symbols for the profile code! Relying just on the +symbol in the profile data can cause costs to be assigned to wrong +symbol, if symbol's code wasn't called through symbol's own address, +but by jumping inside its code.

    + +

    If your code is in fixed location, you should tell +post-processor to handle symbol addresses as absolute (-a):

    +
    +$ hatari_profile.py -a etos512k.sym emutos-profile.txt
    +
    + +

    Normal programs are relocated and you should instead give +the symbols as TEXT (code) section relative ones (-r):

    +
    +$ hatari_profile.py -r program.sym program-profile.txt
    +
    + +

    If symbols are included to your binary, first they need to be +extracted to the ASCII format +understood by the post-processor:

    +
    +$ gst2ascii -a -l -o program.prg > program.sym
    +
    + +

    If there are some extra symbols that you don't want to see +separately in profiles, because they aren't real functions, +but e.g. loop labels, you can either remove them manually +from the ASCII *.sym file, or filter them out with grep: +

    +
    +$ gst2ascii -a -l -o program.prg | grep -v -e useless1 -e useless2 > program.sym
    +
    + + +

    Post-processor provided statistics

    + +

    Above post-processor examples just parse + verify the given data +and produce output like this:

    +
    +Hatari profile data processor
    +
    +Parsing TEXT relative symbol address information from program.sym...
    +[...]
    +3237 lines with 1550 code symbols/addresses parsed, 0 unknown.
    +
    +Parsing profile information from program-profile.txt...
    +[...]
    +9575 lines processed with 368 functions.
    +
    +CPU profile information from 'program-profile.txt':
    +- Hatari v1.6.2+ (May  4 2013), WinUAE CPU core
    +
    + +

    To get statistics (-s) and list of top (-t) CPU users in profile, +add "-st" option:

    +
    +$ hatari_profile.py -st -r program.sym program-profile.txt
    +[...]
    +CPU profile information from 'program-profile.txt':
    +- Hatari v1.6.2+ (May  4 2013), WinUAE CPU core
    +
    +Time spent in profile = 34.49539s.
    +
    +Calls:
    +- max = 187738, in __toupper at 0x52b88, on line 8286
    +- 1585901 in total
    +Executed instructions:
    +- max = 1900544, in flat_remap_mips+14 at 0x47654, on line 7020
    +- 64499351 in total
    +Used cycles:
    +- max = 15224620, in flat_remap_mips+18 at 0x47658, on line 7022
    +- 553392132 in total
    +Instruction cache misses:
    +- max = 184308, in _BM_T_GetTicks at 0x43b90, on line 4772
    +- 4941307 in total
    +
    +Calls:
    +  11.84%      187698  __toupper
    +  11.48%      182105  _BM_T_GetTicks
    +  11.48%      182019  _I_GetTime
    +[...]
    +Executed instructions:
    +  34.83%    22462729  flat_generate_mips
    +  14.08%     9080215  flat_remap_mips
    +   8.55%     5515945  render_patch_direct
    +   5.09%     3283328  _TryRunTics
    +[...]
    +Used cycles:
    +  23.62%   130702768  flat_generate_mips
    +  12.42%    68735832  flat_remap_mips
    +   9.77%    54041148  _TryRunTics
    +   5.80%    32111536  correct_element
    +[...]
    +Instruction cache misses:
    +  37.03%     1829764  _TryRunTics
    +  11.20%      553314  _BM_T_GetTicks
    +   9.44%      466319  _NetUpdate
    +   9.27%      457899  _HGetPacket
    +[...]
    +
    + +

    If you want to see also symbol addresses and what is per call +cost, add -i option:

    +
    +$ hatari_profile.py -st -i -r program.sym program-profile.txt
    +[...]
    +Executed instructions:
    +  34.83%    22462729  flat_generate_mips   (0x04778a, 774576 / call)
    +  14.08%     9080215  flat_remap_mips      (0x047646, 313110 / call)
    +   8.55%     5515945  render_patch_direct  (0x047382, 29977 / call)
    +   5.09%     3283328  _TryRunTics          (0x042356, 19660 / call)
    +[...]
    +Used cycles:
    +  23.62%   8.14728s  130702768  flat_generate_mips  (0x04778a, 0.28094s / call)
    +  12.42%   4.28461s   68735832  flat_remap_mips     (0x047646, 0.14775s / call)
    +   9.77%   3.36863s   54041148  _TryRunTics         (0x042356, 0.02017s / call)
    +   5.80%   2.00165s   32111536  correct_element     (0x04a658, 0.00001s / call)
    +[...]
    +Instruction cache misses:
    +  37.03%     1829764  _TryRunTics          (0x042356, 10956 / call)
    +  11.20%      553314  _BM_T_GetTicks       (0x043b90, 3 / call)
    +   9.44%      466319  _NetUpdate           (0x041bcc, 5 / call)
    +   9.27%      457899  _HGetPacket          (0x041754, 5 / call)
    +[...]
    +
    + +

    (For cycles the "per call" information is in seconds, not as +a cost count.)

    + +

    If your profile file contains caller information, you should +add -p option to see it, as that will also help in detecting symbol +issues (see Interpreting +the numbers):

    +
    +$ hatari_profile.py -st -p -r program.sym program-profile.txt
    +[...]
    +9575 lines processed with 368 functions.
    +[...]
    +Of all 1570498 switches, ignored 581 for type(s) ['r', 'u', 'x'].
    +
    +CPU profile information from 'badmood-level-load-CPU.txt':
    +- Hatari v1.6.2+ (May  4 2013), WinUAE CPU core
    +[...]
    +Calls:
    +  11.84%  11.84%      187698    187698  __toupper
    +  11.48%  11.48%      182105    182105  _BM_T_GetTicks
    +  11.48%  22.95%      182019    364038  _I_GetTime
    +[...]
    +Executed instructions:
    +  34.83%  34.86%  34.86%    22462729  22484024  22484024  flat_generate_mips
    +  14.08%  14.10%  14.10%     9080215   9091270   9091676  flat_remap_mips
    +   8.55%                     5515945                      render_patch_direct
    +   5.09%   5.11%  94.96%     3283328   3294022  61247717  _TryRunTics
    +[...]
    +Used cycles:
    +  23.62%  23.69%  23.69%   130702768 131100604 131100604  flat_generate_mips
    +  12.42%  12.46%  12.46%    68735832  68928816  68930904  flat_remap_mips
    +   9.77%   9.80%  95.66%    54041148  54238744 529368824  _TryRunTics
    +   5.80%   5.82%   5.82%    32111536  32193664  32193664  correct_element
    +[...]
    +Instruction cache misses:
    +  37.03%  37.14%  98.57%     1829764   1835261   4870573  _TryRunTics
    +  11.20%  11.24%  11.24%      553314    555191    555191  _BM_T_GetTicks
    +   9.44%   9.49%  29.13%      466319    468782   1439340  _NetUpdate
    +   9.27%   9.29%   9.37%      457899    459197    463217  _HGetPacket
    +[...]
    +
    + +

    Now there's a message telling that some of the calls were ignored +because according to their "call type", they were actually returns from +exceptions, not real calls (this is mainly important for callgraph +generation, discussed below).

    + + +

    Interpreting the results

    + +

    In addition to accuracy issues mentioned in previous Profiling +sections, function/symbol level costs have gotchas of their own.

    + +

    The first cost percentage and count columns are sums for all +the instructions that were in profile data file between +the indicated symbol's address and the address of the next symbol +(= "between-symbols" cost).

    + +

    NOTE: If your symbol file doesn't contain addresses +for all the relevant symbols, results from this can be misleading because +instructions costs get assigned to whatever symbol's address +happened to precede those instructions. And you don't see which +caller is causing it from caller info or callgraph either, as entry +point for that time sink lacking a symbol means profiler hadn't +tracked calls to it...

    + +

    The next two cost percentage and count columns are for subroutine +calls costs, first one for exclusive and latter for inclusive cost +i.e. including costs for further subroutine calls. Values are based on +caller information documented above.

    + +

    Reasons why between-symbol costs, and subroutine call costs can +differ, are following:

    + + +

    In the first case, you should check the profile data to find out +whether there are missing symbols for executed function entry points. +You can notice function entry points as address gap and/or code +retrieving arguments from stack. Exit points can be seen from RTS +instructions.

    + +

    Second case can also be seen from the profile data. Call count +is same as count for how many times first instruction is executed +(worst case: large loop on subroutine's first instruction).

    + +

    While subroutine costs should be more accurate and relevant, due to +code optimizations many of the functions are not called as subroutines +(on m68k, using JSR/BSR), but just jumped or branched to. Because of +this, it is useful to compare both subroutine and between-symbols +costs. One should be able to see from the profile disassembly which +of the above cases is cause for the discrepancy in the values.

    + +

    NOTE: Before starting to do any serious source +level optimizations, you should always verify from profile +data (disassembly) where exactly the costs are in a function, to make +sure your optimization efforts can actually help the performance.

    + + +

    Generating and viewing callgraphs

    + +

    Callgraphs require that saved profile data contains caller +function address information, i.e. symbols for the code should +be loaded before starting profiling it (see +loading symbol data).

    + +

    Separate callgraphs will be created for each of the costs +(0=calls, 1=instructions, 2=cycles) with the -g option:

    +
    +$ hatari_profile.py -p -g -r program.sym program-profile.txt
    +[...]
    +Generating 'program-profile-0.dot' DOT callgraph file...
    +
    +Generating 'program-profile-1.dot' DOT callgraph file...
    +
    +Generating 'program-profile-2.dot' DOT callgraph file...
    +[...]
    +
    + +

    Callgraphs are saved in GraphViz +"dot" format. Dot files can be viewed:

    + + +

    Produced callgraph will look like this:

    +
    + + Part of callgraph + +
    + +

    Interpreting the callgraph:

    + + + +

    Making large callgraphs readable

    + +

    +If profile is for larger and more varied amount of code (e.g. program startup), +the resulting callgraph can be so huge that it not really readable anymore. +

    + +

    If your code has interrupt handlers, they can get called +at any point, which can show in callgraph as "explicit" calls +from the interrupted functions. To get rid of such incorrect +calls, give interrupt handler names to --ignore-to option:

    +
    +$ hatari_profile.py -p -g --ignore-to handler1,handler2 -r program.sym program-profile.txt
    +
    + +

    In large callgraph most of the functions aren't really interesting, +because their contribution to the cost is insignificant. You can +remove large number of them with --no-leafs and --no-intermediate +options, those options act only on nodes which costs are below +given threshold. Leaf nodes are ones which don't have any parents +and/or children. Intermediate ones have only single parent and +children (node calling itself is not taken into account). + +

    Threshold for this is given with the --limit (-l) option. With +that it typically makes also sense to change the node emphasis +threshold with --emph-limit (-e) option:

    +
    +$ hatari_profile.py -p -g -l 0.5 -e 2.0 -r program.sym program-profile.txt
    +
    + +

    If you are not interested in from how many different addresses +a given function calls another function, use --compact option. If you +still see multiple calls between two nodes with it, the reason is that +they happened through different call paths which were removed from +the callgraph after --compact option was applied:

    +
    +$ hatari_profile.py -p -g -l 1.0 -e 2.0 --no-leafs --no-intermediate --compact -r program.sym program-profile.txt
    +
    + +

    If even this doesn't help, you can remove all nodes below +the given cost threshold limit with --no-limited option, but this +often doesn't leave much of a call hierarchy. Instead you may +consider removing all nodes except for subroutine call ones, with the +--only-subroutines option.

    + +

    If you have trouble locating nodes you are specially interested +about, you can either color them differently with the --mark option, +or exclude everything else from the callgraph except those nodes and +their immediate callers & callees, with the --only option:

    +
    +$ hatari_profile.py -p -g --only func1,func2 -r program.sym program-profile.txt
    +
    + +

    Last option for reading the callgraph is using -k option to +export the data for use in (Linux) Kcachegrind UI. Kcachegrind generates +callgraphs on the fly, and just for the area around the function +you selected, so navigating in callgraph may be easier. It also +shows the related profile disassembly, which can make verifying +matters easier:

    +
    +$ hatari_profile.py -p -k -r program.sym program-profile.txt
    +[...]
    +Generating callgrind file 'program-profile.cg'...
    +[...]
    +$ kcachegrind program-profile.cg
    +
    +
    + Kcachegrind screenshot +
    + + +

    Usage examples

    Here's a list of some common debugging tasks and how to do them @@ -3626,13 +4088,13 @@ with the Hatari debugger:

    Stopping on program startup and examining its data
    -
    Please see Breakpoint variables -and Inspecting emulation state +
    Please see Breakpoint variables +and Inspecting emulation state sections.
    Tracing specific things in the system
    -
    To trace e.g. all GEMDOS calls and IO operations, use: +
    To trace e.g. all GEMDOS calls and I/O operations, use:
     trace  gemdos,io_all
     
    @@ -3648,6 +4110,27 @@ a $12345 :6
    +
    Stopping when specific exception happens
    +
    If one wants a specific breakpoint to trigger on a specific +exception, one can check when its handler address is called by the +CPU. At the start of memory is the CPU exception table for exception +vectors. So, to stop e.g. at bus error with some extra information, +one can use following: +
    +history  on
    +b  pc=($8)
    +
    +After bus error invokes debugger, 'history' command can then be used +to see (executed memory addresses with their current) instructions +leading to the error. The most interesting vector addresses are: +$8 (Bus error), $C (Address error), $10 (Illegal instruction), +$14 (Division by zero).
    +NOTE: Normally, to invoke debugger for larger set of exceptions, one +would use Hatari's "--debug-except" option to specify on which +exceptions debugger is invoked, and "setopt -D" to enable that on +run-time. +
    +
    Stopping when register has a specific value
    To stop when e.g. D1 register contains value 5, set a breakpoint on:
    @@ -3662,6 +4145,14 @@ b  d1 ! d1
     
    +
    Stopping when part of register value changes
    +
    To stop when e.g. D1 register lowest byte changes, set a +breakpoint on masked lowest 8 bits: +
    +b  d1 & 0xff ! d1 & 0xff
    +
    +
    +
    Stopping when register value is within some range
    To stop when e.g. D1 register value is within range of 10-30, set a breakpoint on: @@ -3672,7 +4163,7 @@ b d1 > 9 && d1 < 31
    Stopping when memory location has a specific value
    To stop when e.g. bit 1 of the Video Shifter Sync Mode byte at -IO address $ff820a is set i.e. video frequency is 60Hz, set +I/O address $ff820a is set i.e. video frequency is 60Hz, set a breakpoint on:
     b  ($ff820a).b & 2 = 2
    @@ -3688,13 +4179,24 @@ b  ($ff820a).b & 2 ! ($ff820a).b & 2
     
    Tracing all changes in specific memory location
    -
    To see the new values and continue without stopping, use +
    To see the new values and continue without stopping, add the ":trace" breakpoint option:
     b  ($ff820a).b & 2 ! ($ff820a).b & 2  :trace
     
    +
    Viewing OS structure and IO register values
    +
    To see e.g. basepage for currently running program: +
    +info basepage
    +
    +To see e.g. all Falcon Videl register values, use: +
    +info videl
    +
    +
    +
    Stopping at specific screen position
    To stop e.g. when VBL is 100, HBL is 40 and line cycles is 5, use the corresponding debugger variables: @@ -3710,37 +4212,56 @@ b d0 = "d0 + 10"
    +
    Examining specific system call return value
    +
    To check e.g. what's the Fopen() GEMDOS call return value, +check with "info gemdos 1" its opcode, set a breakpoint for that +and step to next (n) instruction from the trap call when breakpoint +is hit. GEMDOS call return value is then in register D0: +
    +> trace  gemdos
    +> b  GemdosOpcode = $3D
    +> c
    +[...continue until breakpoint...]
    +1. CPU breakpoint condition(s) matched 1 times.
    +        GemdosOpcode = $3D
    +> n
    +GEMDOS 0x3D Fopen("TEST.TXT", read-only)
    +> e  d0
    += %1000000 (bin), #64 (dec), $40 (hex)
    +
    +
    +
    Seeing code leading to a breakpoint
    -
    To see the instructions executed before debugger was entered, -you need to enabled history tracking beforehand and then whenever the -debugger is entered, you can request given number (here 16) of past -instructions to be shown: +
    To see CPU instructions executed before debugger was entered, +you need to enable history tracking before it. Whenever +debugger is entered, you can then request given number (here 16) of +past instructions to be shown:
    -history on
    +history  cpu
     c
     [breakpoint is hit and debugger entered]
    -history 16
    +history  16
     
    Getting instruction execution history for every breakpoint
    -To see last 16 instructions whenever (a normal or tracing) breakpoint -is hit: +To see last 16 instructions for both CPU and DSP whenever +(a normal or tracing) breakpoint is hit:
    -history on
    -lock history 16
    +history  on
    +lock  history 16
     c
     
    -
    Single step so that new register values are shown after each step
    +
    Single stepping so that new register values are shown after each step
    -lock registers
    -c 1
    +lock  registers
    +s
     [new register values]
    -c 1
    +s
     [new register values]
     ...
     
    @@ -3760,10 +4281,23 @@ you enter debugger manually etc, write t
     lock  file stack.ini
     
    -Please see also Chaining breakpoints +Please see also Chaining breakpoints section for more examples on what you can do with the debugger input files.
    +
    Adding cycle information to disassembly
    +
    Profiling collects cycle usage information for all executed instructions: +
    +profile  on
    +c
    +[after a while, use AltGr+Pause to get back to debugger]
    +d
    +[or if you want to see just the executed instructions]
    +profile addresses
    +
    +Please see Profiling section for more info. +
    +
    Finding where a program or the OS is stuck
    Profiling tells from which addresses CPU is executing the instructions:
    @@ -3772,18 +4306,46 @@ c
     [after a while, use AltGr+Pause to get back to debugger]
     profile  counts
     
    +Please see Profiling section for more info. +
    + +
    Seeing program callstack when breakpoint is hit
    +
    Profiler caller data includes +callstack information (with some limitations). +
    + +
    Seeing call backtraces whenever given function is called
    +
    Enable profiling, load symbols for the program and set breakpoint +for the function you are interested about, in the following way: +
    +profile on
    +symbols prg
    +b  pc = _my_function  :quiet :noinit :file showstack.ini
    +
    +I.e. whenever 'my_function' address is called, quietly trigger a +breakpoint without resetting profiling (callstack) information and run +debugger command(s) from the 'showstack.ini' debugger script file, +which contains following command: +
    +profile stack
    +
    +
    + +
    Seeing how program functions/symbols call each other
    +
    Profile data +post-processing can provide execution callgraphs.

    Hint: for most of the above commands, one just needs to prefix them with -"d" (or "dsp" if using full command names) to do similar operation on +"d" (or "dsp" when using full command names) to do similar operation on the DSP.

    -

    Build notes

    +

    Build notes

    Lastly, the debugger is much nicer to use with the command line @@ -3791,7 +4353,7 @@ history, editing and especially the comp command, command argument and symbol names.

    -If you're building Hatari yourself, please make sure that you have the +If you are building Hatari yourself, please make sure that you have the GNU readline development files installed (on Debian / Ubuntu these come from the libreadline5-dev package). Otherwise the name completion and other features don't get enabled when you configure Hatari. @@ -3802,7 +4364,7 @@ By default it should be enabled.

    -

    Performance

    +

    Performance

    Hatari performance varies between Atari programs, depending on what features Hatari needs to emulate for them. Less accurate Atari @@ -3812,55 +4374,92 @@ 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. +Rasberry Pi). +

    + -

    Improving Hatari performance

    +

    Operating system components performance

    -Hatari currently runs best in 16 or 32 bits per pixel color depth -mode, so try to avoid 24 bits per pixel display modes if possible. -16-bit mode is fastest. +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

    + +

    +Linux: Some HW platforms don't have properly HW accelerated +3D driver and SDL implementation. On these platforms it's better to +build Hatari with SDL v1.x than SDL 2.x, as latter can cause CPU +based 3D driver to be used for scaling Hatari graphics.

    -On OSX, frame skipping, zooming and drive LED options (listed below) -seem to have a large effect on performance in the windowed mode. -This is apparently due to issues in the SDL OSX backend and how OSX -itself composites non-fullscreen window contents. OSX uses always -32-bit mode. +MacOS: With SDL v1.x, frame skipping, zooming and drive LED +options (listed below) seem to have a large effect on performance in +the windowed mode. This is apparently due to issues in the SDL macOS +backend and how macOS itself composites non-fullscreen window +contents. These shouldn't be an issue with the SDL2 build of Hatari.

    -Unless you've 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 (demos) that use very -heavily interrupts. +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.

    -However, Hatari can be sped up considerably by giving up some -emulation or emulator accuracy. Except for DSP, these options -should be needed only on very slow devices like handhelds. See below. +CPU emulation: Hatari can be built with two different CPU +core implementations. The newer WinUAE CPU core has more accurate CPU +emulation and supports all of the higher end 680x0 CPU features. This +accuracy causes it to be clearly slower, than the OldAUE CPU core +implementation. If run-time options (acceptable to you) don't give +enough performance, give the OldUAE CPU core also a try.

    -If nothing else helps, try an earlier Hatari version. More accurate -emulation or emulator output in newer Hatari versions means that they -can be slower despite optimizations. +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 options not affecting emulation accuracy

    + +

    +Hatari currently runs best in 16 or 32 bits per pixel color depth +mode, so try to avoid 24 bits per pixel display modes if possible. +16-bit mode is faster with SDL1. MacOS uses always 32-bit mode. +

    -

    Emulation options

    + +

    Run-time emulation options

    -Emulation options have the largest impact on performance. -These options can be changed from the Hatari GUI System dialog and -the emulation needs to be rebooted for any of these changes to take -an effect! +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
    +

    DSP (Falcon)

    +

    Emulating the Falcon DSP is performance-wise several times more demanding than emulating the m68k; DSP runs at higher frequency, executes many @@ -3871,43 +4470,60 @@ that do use DSP, many use it only for ba fine without the real DSP emulation.

    -
    Timer-D
    +

    CPU: cycle exact (030/TT/Falcon)

    +

    -The single largest factor contributing to general Hatari emulation -performance is the handling of interrupts. Enabling Timer-D patching -option (about) doubles 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. +WinUAE 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, application and games +normally don't.

    -
    Compatible CPU
    +

    Timer-D

    -After the DSP and interrupts, m68k emulation takes most time. -Disabling the "Slower but more compatible CPU" option will speed up -the emulation a lot, but it won't anymore be cycle accurate. This can -be fine for many games and other programs, but won't work e.g. for demos -using overscan or rasters. +With ST/STe, the single largest factor contributing to general Hatari +emulation performance is the handling of interrupts. Enabling Timer-D +patching option (about) doubles Hatari ST/STE emulation performance +with OldUAE CPU core 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

    -Roughly speaking, for DSP emulation, one needs at least 2Ghz machine. -For normal (unpatched) Timer-D frequency on some specific cases (like -demos with overscan 512 color animations) one may need over 1GHz -machine, but some rare ST/STE demos may require over 1GHz machine even -with Timer-D patching. For "Compatible CPU" one needs at least 1/2Ghz -machine. +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

    -NOTE: Above options may cause some programs not to work correctly. +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 in correctly. The Hatari Software Compatibility List -lists programs known to need real real Falcon DSP emulation or Timer-D -frequency. Disabling "Compatible CPU" option is recommended only as -a last resort. +lists programs known to need real Falcon DSP emulation, Timer-D +frequency or accurate FDC timings.

    -

    Emulator options

    +

    Emulator options

    Emulator options don't usually have as large effect on performance as @@ -3916,7 +4532,8 @@ just the quality of the emulation "outpu be toggled at run-time without rebooting the emulation.

    -
    Sound
    +

    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 @@ -3927,24 +4544,37 @@ in Hatari as this can significantly redu interrupts.

    -
    Frame skipping
    +

    +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 (like OSX one?), 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. +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
    +

    Zooming

    If you are not using frame skip, disabling zooming can have noticeable improvement on performance. You can do this by specifying @@ -3955,7 +4585,7 @@ mode-lines (e.g. "320x200") to your xorg to use zooming, disabling borders may help a bit.

    -
    Spec512 color handling
    +

    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 @@ -3965,7 +4595,7 @@ completely by zeroing the threshold for --spec512 0 option.

    -
    Statusbar and drive LED
    +

    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 @@ -3973,7 +4603,7 @@ impact on performance too. Normally the

    -

    Measuring the performance

    +

    Measuring the performance

    There are a couple of ways to monitor and measure Hatari performance. @@ -3987,14 +4617,16 @@ is completely busy, it will increase to

    Hatari has also a facility to measure FPS i.e. Frames Per Second. -Just enable the --fast-forward option -on command line (or use the corresponding keyboard shortcut), and -after a while, press the "Pause" key. Whenever Hatari emulation is -paused, Hatari will output on console how many VBLs it could show per -second along with some other numbers. +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's best to +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 @@ -4007,7 +4639,7 @@ call, only the time spent by the Hatari 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's best to +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. @@ -4017,13 +4649,13 @@ Note that these numbers can fluctuate qu 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're making the measurements. +at the same time you are making the measurements.

    -

    Appendix

    +

    Appendix

    -

    Copying

    +

    Copying

    This program is free software; you can redistribute it and/or modify @@ -4045,15 +4677,13 @@ Inc., 51 Franklin Street, Fifth Floor, B Foundation | The GNU General Public License

    -

    Introduction to Emulation

    +

    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 niveau. +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 notice. -A good emulator will run most of the software intended for the emulated -platform without trouble. +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 @@ -4077,24 +4707,11 @@ error-free using such a simple loop syst

    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 is much trickier. +emulation of the various custom chips and hardware parts of the +emulated system, and their proper synchronization, is much trickier.

    -
    +
    -
    - - - - - - - -
    Valid HTML 4.01! - June 2012 -