Annotation of hatari/doc/manual.html, revision 1.1.1.21

1.1.1.17  root        1: <!DOCTYPE html>
1.1.1.20  root        2: <html lang="en">
1.1       root        3: <head>
                      4:   <title>Hatari User's Manual</title>
1.1.1.3   root        5:   <meta name="description"
1.1.1.17  root        6:         content="User's manual for the Atari ST emulator Hatari" />
                      7:   <meta name="author" content="Hatari development team" />
                      8:   <meta name="keywords" content="hatari, documentation, manual, linux" />
                      9:   <meta name="viewport" content="width=device-width; initial-scale=1.0;" />
1.1.1.18  root       10:   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1.1       root       11:   <style type="text/css">
                     12:   <!--
1.1.1.11  root       13:        body {  background:#FFFFFF;
1.1.1.2   root       14:                color:#000000;
1.1.1.7   root       15:                margin-left:10px;
1.1.1.2   root       16:                margin-right:10px;
1.1.1.8   root       17:                font-family:Verdana,Arial,Helvetica,sans-serif;
1.1.1.2   root       18:                }
1.1       root       19: 
1.1.1.8   root       20:        h2 { border-bottom:solid thin black;}
                     21:        h4.gui { clear:right }
1.1.1.10  root       22:        h5 { margin-bottom:2px; margin-left:1em; }
1.1.1.17  root       23:        hr { width: 100%; height: 2px; margin-top:4ex; margin-bottom: 2ex; }
1.1.1.10  root       24: 
                     25:        pre {   color: black;
1.1.1.11  root       26:                background:#eeeeee;
1.1.1.10  root       27:                margin: 0px 20px 8px 20px;
                     28:                padding: 2px 8px 1px 8px;
                     29:                border: solid thin #ccaa88;
                     30:                }
1.1       root       31: 
1.1.1.17  root       32:        th { text-align:center; }
1.1.1.8   root       33:        td { font-family:Verdana,Arial,Helvetica,sans-serif; }
1.1       root       34: 
1.1.1.11  root       35:        a:link { color:#000099; background:#ffffff; text-decoration:none; }
                     36:        a:visited { color:#cc0000; background:#ffffff; text-decoration:none;}
                     37:        a:hover { color:#0000ff; background:#ffffff; text-decoration:none; }
                     38:        a:active { color:#993399; background:#ffffff; text-decoration:none; }
                     39: 
1.1.1.12  root       40:        .pageheader { text-align:center; }
1.1.1.11  root       41:        .commandline { font-family:Courier,monospace; font-size:90% }
                     42:        .file { color: #000088;}
                     43:        .button { color:#000000; background:#c0c0c0; border:outset thin gray; font-family:Courier,monospace; padding-left:1em; padding-right:1em;}
                     44:        .key { color:#550000; font-family:Courier,monospace; font-size:90% }
                     45:        .backdropped { background:#ffffee; }
                     46:        .image {margin-left: 5px; margin-right: 5px; border-width:2px; border-style:solid; border-color:#eeeeff; padding:1cm; text-align:center; }
1.1.1.20  root       47:        .floatimage { clear:right; float:right; margin-left:1.5ex; border-width:2px; border-style:solid; border-color:#eeeeff; padding:1.5ex; }
1.1.1.17  root       48:        .clearboth { clear:both; }
1.1       root       49: 
1.1.1.17  root       50:        table.keytable { border:1px solid; }
                     51:        table.keytable tbody { text-align:center; }
                     52:        table.keytable th { border:1px solid; padding:3px; }
                     53:        table.keytable td { border:1px solid; padding:3px; }
                     54: 
                     55:        p.parameter { margin: 1px 1em 1px 11%; font-weight:bold; }
                     56:        p.paramdesc { margin: 1px 1em 1px 22%; }
1.1       root       57:   -->
                     58:   </style>
1.1.1.17  root       59:   <script type="text/javascript" src="toc.js"></script>
1.1       root       60: </head>
1.1.1.5   root       61: 
                     62: <body>
                     63: 
1.1.1.12  root       64: <h1 class="pageheader">Hatari User's Manual</h1>
1.1.1.5   root       65: 
1.1.1.12  root       66: <p class="pageheader">
1.1.1.21! root       67: Version 2.1.0, February 2018
1.1.1.3   root       68: </p>
1.1.1.12  root       69: <p class="pageheader">
1.1.1.8   root       70: Manual written by: <strong>Thomas Huth</strong>, <strong>Matthias Arndt</strong>
1.1.1.10  root       71:  &amp; <strong>Eero Tamminen</strong>
1.1.1.2   root       72: </p>
1.1.1.12  root       73: <p class="pageheader">
1.1.1.17  root       74: Hatari on the WWW:
                     75: <strong>
                     76: <a href="http://hatari.tuxfamily.org/">http://hatari.tuxfamily.org/</a>
                     77: </strong>
1.1.1.2   root       78: </p>
1.1       root       79: 
1.1.1.17  root       80: <h2 class="no-TOC">Index</h2>
1.1.1.5   root       81: 
1.1.1.17  root       82: <div id="generated-toc">
                     83: <!-- The TOC is generated automatically via JavaScript -->
                     84: </div>
1.1.1.5   root       85: 
1.1.1.17  root       86: <h2>Introduction</h2>
1.1       root       87: 
1.1.1.17  root       88: <h3>General description</h3>
1.1       root       89: <p>
1.1.1.21! root       90: Hatari is an Atari ST, STE, TT and Falcon emulator for Linux, *BSD, macOS,
1.1.1.13  root       91: Windows and other Systems which are supported by the SDL library.
1.1.1.4   root       92: The emulator is open source software and is distributed under the terms of the
1.1.1.7   root       93: <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General
                     94: Public License (GPL)</a>.
1.1.1.4   root       95: </p>
                     96: <p>
1.1.1.3   root       97: The Atari ST was a 16/32 bit computer system which was first released by Atari
1.1.1.4   root       98: in 1985. Using the Motorola 68000 CPU, it was a very popular computer having
                     99: quite a lot of CPU power at that time. See Appendix B for details on emulation
                    100: in general.
1.1.1.3   root      101: </p>
                    102: <p>
1.1.1.4   root      103: Unlike many other Atari ST emulators which try to give you a good
                    104: environment for running GEM applications, Hatari tries to emulate the hardware
                    105: of a ST as close as possible so that it is able to run most of the old ST games
                    106: and demos. Of course you can run normal GEM applications with Hatari, too.
1.1       root      107: </p>
                    108: 
1.1.1.17  root      109: <h3>Features</h3>
1.1       root      110: <ul>
1.1.1.16  root      111:   <li>68000 - 68040 emulation via the UAE CPU core
1.1.1.21! root      112:       (additional 68060 and MMU emulation only with the WinUAE CPU core)</li>
1.1.1.7   root      113:   <li>ST RAM size variable (from 512kiB up to 14MiB are possible)</li>
1.1.1.19  root      114:   <li>TT RAM size variable (from 0 up to 256MiB are possible)</li>
1.1.1.3   root      115:   <li>optional cartridge images for the ST ROM port</li>
1.1.1.2   root      116:   <li>most of the ST specific hardware</li>
1.1       root      117:   <li>ST Shifter with ST-High, ST-Medium and ST-Low resolutions,
1.1.1.7   root      118:     overscan effects for all borders in color resolutions</li>
1.1.1.6   root      119:   <li>512 color ST palette</li>
1.1.1.13  root      120:   <li>Spec512 mode support for low and medium resolutions</li>
1.1.1.7   root      121:   <li>many raster effects </li>
1.1.1.8   root      122:   <li>scaling of low resolutions by factor two</li>
1.1.1.7   root      123:   <li>interleaved lines rendering of ST-medium and (scaled) ST-low
                    124:     resolutions for the TV "monitor type"</li>
1.1.1.8   root      125:   <li>Blitter chip emulation</li>
1.1.1.2   root      126:   <li>PSG YM2149 emulation (soundchip) including STFM samples</li>
1.1.1.8   root      127:   <li>Printer port emulation on hardware level (print to file)</li>
1.1.1.10  root      128:   <li>RS232 emulation</li>
                    129:   <li>MIDI input/output/through emulation</li>
1.1.1.21! root      130:   <li>Mega ST(E) real time clock (for Mega-ST and Mega-STE mode)</li>
1.1.1.3   root      131:   <li>IKBD emulation (keyboard, mouse and joystick) with custom
1.1.1.7   root      132:     keyboard mapping</li>
1.1       root      133:   <li>joystick emulation via cursor keys and joystick emulation via a
1.1.1.7   root      134:     connected PC joystick</li>
1.1.1.18  root      135:   <li>FDC (floppy disk controller) emulation using floppy disk images
                    136:     in standard formats (*.ST, *.MSA, *.DIM and *.STX)</li>
                    137:   <li>FDC emulation via the IPF support library for using
                    138:     *.IPF, *.RAW and *.CTR images</li>
1.1.1.5   root      139:   <li>support for packed disk images (PkZip and Gzip)</li>
1.1.1.12  root      140:   <li>optional write-protection for floppy disk images</li>
1.1.1.18  root      141:   <li>ACSI emulation for hard drive support (with basic support for extended
                    142:     host adapter protocol to access disks &gt; 1 GB)</li>
                    143:   <li>GEMDOS interface driver to mount directories as hard drives
1.1.1.12  root      144:     with optional write-protection</li>
1.1.1.7   root      145:   <li>support for memory snapshots (save whole system state)</li>
1.1.1.2   root      146:   <li>driver for extended VDI resolutions</li>
                    147:   <li>recording of sound as .WAV and .YM files</li>
1.1.1.8   root      148:   <li>screenshots in PNG or BMP format</li>
1.1.1.12  root      149:   <li>AVI animation capturing with sound</li>
1.1.1.8   root      150:   <li>TOS versions 1.00, 1.02, 1.04 and 2.06 (and EmuTOS) can be used in ST mode.</li>
1.1       root      151: </ul>
1.1.1.5   root      152: 
1.1.1.7   root      153: <h4>STE hardware emulation</h4>
1.1.1.13  root      154: <p>There is support for following additional STE features:</p>
1.1.1.5   root      155: <ul>
                    156:   <li>horizontal and vertical hardware fine scrolling</li>
                    157:   <li>split screen techniques / in-screen video address manipulations</li>
1.1.1.8   root      158:   <li>(STE specific) left border opening</li>
1.1.1.5   root      159:   <li>4096 colors STE palette</li>
1.1.1.12  root      160:   <li>Stereo DMA sample sound</li>
1.1.1.17  root      161:   <li>Microwire/LMC1992 emulation</li>
1.1.1.7   root      162:   <li>STE joypads</li>
1.1.1.8   root      163:   <li>TOS versions 1.06, 1.62, 2.05 and 2.06 (and EmuTOS) can be used in STE mode.</li>
1.1.1.5   root      164: </ul>
1.1.1.21! root      165: <p>
        !           166: Hatari can also emulate a Mega-STE, which had slightly different hardware
        !           167: compared to a normal STE (like a built-in real time clock chip).
        !           168: </p>
1.1.1.5   root      169: 
1.1.1.12  root      170: <h4>Experimental TT hardware emulation</h4>
1.1.1.13  root      171: <p>There is support for following additional TT features:</p>
1.1.1.7   root      172: <ul>
                    173:   <li>TT low/med/high resolution support</li>
                    174:   <li>ST/TT palette switching and video shifter</li>
1.1.1.19  root      175:   <li>RAM up to 14MiB (ST-RAM) and up to 256 MiB (TT-RAM)</li>
1.1.1.8   root      176:   <li>Only TOS version 3.06 (and EmuTOS) can be used in TT mode.</li>
1.1.1.7   root      177: </ul>
1.1.1.21! root      178: <p>
        !           179: Note that TT emulation is incomplete &ndash; additional hardware like the
        !           180: second MFP and the SCC UARTs is not emulated yet.
        !           181: </p>
1.1.1.7   root      182: 
1.1.1.12  root      183: <h4>Falcon hardware emulation</h4>
1.1.1.13  root      184: <p>There is support for following additional Falcon features:</p>
1.1.1.7   root      185: <ul>
1.1.1.16  root      186:   <li>Partial Videl and Videl borders emulation for all Falcon screen modes</li>
1.1.1.12  root      187:   <li>Aspect correction and scaling of small resolutions by an integer factor</li>
1.1.1.7   root      188:   <li>STE/Falcon palette switching and shifter</li>
                    189:   <li>Mono/RGB/VGA/TV monitor types</li>
1.1.1.12  root      190:   <li>DSP co-processor emulation</li>
1.1.1.19  root      191:   <li>RAM up to 14MiB (ST-RAM) and up to 256 MiB (TT-RAM)</li>
1.1.1.12  root      192:   <li>Experimental microphone (jack) emulation</li>
1.1.1.19  root      193:   <li>Experimental Crossbar sound matrix (ADC (mic &amp; PSG), DAC, DMA, DSP)
1.1.1.12  root      194:       interconnect emulation + support for the additional DMA sound
                    195:       sample rates</li>
1.1.1.18  root      196:   <li>Experimental IDE master and slave emulation for hard drive support</li>
1.1.1.8   root      197:   <li>TOS versions 4.00, 4.02, 4.04 and 4.92 (and EmuTOS) can be used in Falcon mode.</li>
1.1.1.7   root      198: </ul>
                    199: 
1.1.1.12  root      200: <p>See the developers' <span class="file">doc/todo.txt</span> file
                    201: (included with Hatari sources) for the details on the few remaining
                    202: emulation gaps and the <a href="compatibility.html">Hatari Atari
                    203: Software Compatibility List</a> for which Atari programs are known
                    204: to be affected by them.</p>
1.1.1.5   root      205: 
                    206: 
1.1.1.17  root      207: <h3>System requirements</h3>
1.1.1.5   root      208: 
                    209: <p>
1.1.1.21! root      210: Hatari needs a fast machine (1 GHz or more for ST/STE emulation, &gt; 2 GHz
        !           211: for Falcon emulation) which is running a POSIX compatible operating system
        !           212: (preferably GNU/Linux) that supports the SDL library.
        !           213: There are also some ports to other operating systems like macOS or Windows,
        !           214: but they are not used by the developers, so such builds are normally not very
        !           215: well tested.
1.1.1.5   root      216: </p>
                    217: 
1.1.1.17  root      218: <h2>Compiling and running</h2>
1.1.1.5   root      219: 
1.1.1.17  root      220: <h3>Compiling Hatari</h3>
1.1.1.5   root      221: 
1.1.1.13  root      222: <p>Required:</p>
                    223: <ul>
                    224: <li>A C compiler. Preferably GCC, but others have worked too.</li>
                    225: <li>A working CMake installation. See
                    226: <a href="http://www.cmake.org/">http://www.cmake.org/</a> for details.
                    227: <li>The SDL library v1.2.10 or newer. You can get it from
                    228: <a href="http://www.libsdl.org/">http://www.libsdl.org/</a>.
                    229: </li>
                    230: <li>The zLib compression library. You can get it from
                    231: <a href="http://www.gzip.org/zlib/">http://www.gzip.org/zlib/</a>.
                    232: </li>
                    233: </ul>
                    234: 
                    235: <p>Optional:</p>
                    236: <ul>
                    237: <li>The PNG image library for PNG format screenshots and to
                    238: decrease AVI video recording file sizes. You can get it from
                    239: <a href="http://www.libpng.org/">http://www.libpng.org/</a>.</li>
                    240: <li>The GNU Readline library for Hatari debugger command line editing.</li>
                    241: <li>The Xlib library to support Hatari Python UI window embedding
                    242: on systems with the X window system (Linux and other unixes).</li>
                    243: <li>The portaudio library for Falcon microphone recording support</li>
                    244: </ul>
                    245: <p>
                    246: The versions available in your Linux distribution will be sufficient
                    247: in most cases, but make sure you have also the header files installed
                    248: for the libraries as well! Typically they're in a corresponding -dev
                    249: package.
1.1.1.3   root      250: </p>
1.1.1.13  root      251: 
                    252: <p>
                    253: After you've verified that you have the required libraries and their
                    254: development files, change to the <span class="file">hatari/</span>
                    255: directory.  Create a <span class="file">build/</span> directory under
                    256: it and configure the build system for your environment:
1.1.1.10  root      257: <pre>
1.1.1.13  root      258: mkdir -p build
                    259: cd build
                    260: cmake ..
1.1.1.10  root      261: </pre>
1.1.1.3   root      262: <p>
                    263: Then compile Hatari by typing <span class="commandline">make</span>.
1.1.1.13  root      264: If all works fine, you'll get the executable <span class="commandline">hatari</span>
1.1.1.3   root      265: in the src/ subdirectory.
1.1.1.2   root      266: </p>
1.1.1.13  root      267: <p>
                    268: Note: Instead of calling CMake directly, you can also use the supplied
                    269: configure script to run CMake and to give the arguments (like install
                    270: prefix) in a format familiar from GNU Autotools using programs.  Type
                    271: "<span class="commandline">./configure --help</span>"
                    272: to see all the options supported by this script.
                    273: </p>
1.1.1.5   root      274: 
1.1.1.17  root      275: <h3>Installation of a TOS ROM</h3>
1.1.1.5   root      276: 
1.1.1.6   root      277: <p>
                    278: Before you can start Hatari, you have to copy a TOS ROM image to the data
1.1.1.13  root      279: directory (<span class="file">&lt;prefix&gt;/share/hatari/</span>, by
                    280: default <span class="file">/usr/local/share/hatari/</span>) and
1.1.1.3   root      281: rename it to <span class="commandline">tos.img</span>, or use the
                    282: <span class="commandline">--tos</span> command line option to tell
                    283: Hatari where to find a TOS ROM.
1.1       root      284: Hatari needs a TOS ROM image because this contains the operating system
1.1.1.6   root      285: of the emulated Atari.
                    286: </p>
                    287: <p>
                    288: Unfortunately it is not possible to ship an original ROM
1.1.1.5   root      289: image with the Hatari package since these images are still copyrighted.
                    290: But you can easily create an image with a real ST and one of those various
1.1.1.12  root      291: ROM-image programs for the ST (search for "TOSDUMP" with your
1.1.1.5   root      292: favourite internet search engine). If your old ST does not work anymore, you
                    293: can also try to search the internet directly for corresponding TOS ROM image,
                    294: but don't ask the Hatari team where to get one. </p>
                    295: <p> Another solution is EmuTOS, which is also shipped with the official
                    296: release versions of Hatari. EmuTOS is an open-source TOS clone. You can find
                    297: it at:
                    298: <a href="http://emutos.sourceforge.net/">http://emutos.sourceforge.net/</a>.
                    299: It is not the best solution for playing games or running other old software
1.1.1.8   root      300: due to compatibility issues (see <span class="file">emutos.txt</span> for
                    301: more details), but it's free and compatible with Hatari.</p>
1.1.1.20  root      302: <p>If you do not specify a TOS image on the commandline and Hatari
                    303: cannot find a suitable TOS image in the default dir, you'll get the
                    304: chance to select a TOS image file from the GUI. </p>
1.1.1.5   root      305: 
1.1.1.17  root      306: <h3>Installation of the binary</h3>
1.1.1.5   root      307: 
1.1.1.13  root      308: <p> Type <span class="commandline">make install</span> as "root" user to
                    309: do a systemwide installation.</p>
                    310: <p>Assuming you didn't change the default installation prefix and that
                    311: <span class="file">/usr/local/bin/</span> is in your PATH, you should
                    312: be now able to start the Hatari executable from anywhere.</p>
1.1       root      313: <p> When you finally have got a TOS image, try starting Hatari with the
1.1.1.3   root      314: option <span class="commandline">--help</span> to find out more about
                    315: its command line parameters. </p>
1.1.1.5   root      316: 
1.1.1.17  root      317: <h3>Running Hatari for the first time</h3>
1.1.1.5   root      318: 
1.1.1.3   root      319: <p> Now type <span class="commandline">hatari</span> to run the
                    320: emulator for the first time. If all goes
                    321: well, you should now be presented with a window showing you the
                    322: familiar
                    323: little green desktop of the Atari ST. Press <span class="key">F12</span>
                    324: to turn on the GUI to
                    325: configure Hatari to suit your needs, press <span class="key">F11</span>
                    326: to toggle windowed and fullscreen mode. </p>
1.1.1.5   root      327: 
1.1.1.17  root      328: <h3>Configuration options precedence</h3>
                    329: 
                    330: <p>Hatari settings can come from several sources, with later ones
                    331: overriding the earlier given ones:
                    332: <ul>
                    333: <li>Builtin Hatari default options (which are different for old UAE and WinUAE
                    334:     CPU core builds, former defaults to ST, latter to Falcon)</li>
                    335: <li>Global <span class="commandline">/etc/hatari.cfg</span>
                    336:     (or <span class="commandline">/usr/local/etc/hatari.cfg</span>)
                    337:     configuration file</li>
                    338: <li>User specific <span class="commandline">~/.hatari/hatari.cfg</span>
                    339:     configuration file</li>
                    340: <li>Command line arguments
                    341: <li>Option changes done at run-time in Hatari options GUI, with debugger "setopt"
                    342:     command or through the (optionally enabled) Hatari control socket.
                    343: </ul>
                    344: 
1.1.1.19  root      345: <p>Some of the run-time changes require emulation to be reset for them
1.1.1.17  root      346: to take effect.</p>
                    347: 
                    348: 
                    349: <h2>Command line options and arguments</h2>
1.1.1.5   root      350: 
1.1.1.7   root      351: <p>Usage:</p>
                    352: <pre>
1.1.1.13  root      353:  hatari [options] [disk image | directory | Atari program ]
1.1.1.7   root      354: </pre>
                    355: 
1.1.1.13  root      356: <p>As an argument one can give either a name of:</p>
                    357: <ul>
                    358: <li>A floppy disk image,
1.1.1.18  root      359: <li>A directory that should be emulated as a virtual GEMDOS HD, or</li>
1.1.1.13  root      360: <li>An Atari program that should be autostarted.  In this case
                    361:     the program's directory will be used as the C: drive from
                    362:     where this program will be started.
1.1.1.21! root      363: </li>
1.1.1.13  root      364: </ul>
1.1.1.21! root      365: (These arguments are shortcuts for "--disk-a", "--harddisk" and "--auto"
        !           366: options listed below.)
1.1.1.13  root      367: 
                    368: <p>Booting will be done from the disk image or directory that's given
                    369: last on the command line as an option or the argument (and which
                    370: corresponds to A: or C:).</p>
                    371: 
1.1.1.8   root      372: <p>Hatari command line options are split into several categories:</p>
1.1.1.7   root      373: 
1.1.1.8   root      374: <!--
                    375: Generated from hatari.1 options section by changing subheaders to h3
                    376: and removing extra paragraphs:
1.1.1.18  root      377:   groff -man -Thtml hatari.1 | sed -e 's/&minus;/-/g' | tidy | awk '
1.1.1.17  root      378:   /h2.OPTIONS/ { out = 1; next }
1.1.1.8   root      379:   /COMMANDS/ { out = 0; next }
1.1.1.17  root      380:   { if(out) print }' \
                    381:   | sed -e 's/h2/h3/g' -e 's/<b>//' -e 's/<\/b>//' \
                    382:         -e 's/style="margin-left:11%;[^"]*"/class="parameter"/g' \
                    383:         -e 's/style="margin-left:22%;"/class="paramdesc"/g'
1.1.1.8   root      384: -->
                    385: 
                    386: <h3>General options</h3>
1.1.1.18  root      387: <p class="parameter">-h,
                    388: --help</p>
1.1.1.17  root      389: <p class="paramdesc">Print command line options and
                    390: terminate</p>
1.1.1.18  root      391: <p class="parameter">-v,
                    392: --version</p>
1.1.1.17  root      393: <p class="paramdesc">Print version information and
                    394: terminate</p>
1.1.1.18  root      395: <p class="parameter">--confirm-quit
1.1.1.17  root      396: &lt;bool&gt;</p>
                    397: <p class="paramdesc">Whether Hatari confirms quitting</p>
1.1.1.18  root      398: <p class="parameter">-c, --configfile
1.1.1.17  root      399: &lt;filename&gt;</p>
                    400: <p class="paramdesc">Read additional configuration values from
                    401: &lt;file&gt;, these override values read from the global and
                    402: user configuration files
                    403: </p>
1.1.1.18  root      404: <p class="parameter">-k, --keymap
1.1.1.17  root      405: &lt;file&gt;</p>
                    406: <p class="paramdesc">load keyboard mapping from
                    407: &lt;file&gt;</p>
1.1.1.18  root      408: <p class="parameter">--fast-forward
1.1.1.17  root      409: &lt;bool&gt;</p>
                    410: <p class="paramdesc">On fast machine helps skipping (fast
                    411: forwarding) Hatari output</p>
1.1.1.21! root      412: <p class="parameter">--auto &lt;program&gt;</p>
        !           413: <p class="paramdesc">Autostarts given program, if TOS finds it.
        !           414: Program needs to be given with full path it will have under
        !           415: emulation, for example "C:\DIR\PROGRAM.PRG"</p>
1.1.1.13  root      416: 
                    417: <h3>Common display options</h3>
1.1.1.18  root      418: <p class="parameter">-m,
                    419: --mono</p>
1.1.1.17  root      420: <p class="paramdesc">Start in monochrome mode instead of
                    421: color</p>
1.1.1.18  root      422: <p class="parameter">--monitor
1.1.1.17  root      423: &lt;x&gt;</p>
                    424: <p class="paramdesc">Select monitor type (x =
                    425: mono/rgb/vga/tv)</p>
1.1.1.21! root      426: <p class="parameter">--tos-res &lt;x&gt;</p>
        !           427: <p class="paramdesc">Select TOS resolution for color monitors
        !           428: (x = low/med/high/ttlow/ttmed)</p>
1.1.1.18  root      429: <p class="parameter">-f,
                    430: --fullscreen</p>
1.1.1.17  root      431: <p class="paramdesc">Start the emulator in fullscreen
                    432: mode</p>
1.1.1.18  root      433: <p class="parameter">-w, --window</p>
                    434: <p class="paramdesc">Start the emulator in windowed mode</p>
                    435: <p class="parameter">--grab</p>
                    436: <p class="paramdesc">Grab mouse (also) in windowed mode</p>
1.1.1.21! root      437: <p class="parameter">--resizable &lt;bool&gt;</p>
        !           438: <p class="paramdesc">Allow window resizing</p>
        !           439: <p class="paramdesc">NOTE: this is supported only by Hatari SDL2 build</p>
1.1.1.18  root      440: <p class="parameter">--borders &lt;bool&gt;</p>
                    441: <p class="paramdesc">Show ST/STE/Falcon screen borders
                    442: (for low/med resolution overscan demos)</p>
                    443: <p class="parameter">--frameskips
1.1.1.17  root      444: &lt;x&gt;</p>
                    445: <p class="paramdesc">Skip &lt;x&gt; frames after each
                    446: displayed frame to accelerate emulation (0=disabled, &gt;4 uses
                    447: automatic frameskip with given value as maximum)</p>
1.1.1.18  root      448: <p class="parameter">--slowdown &lt;x&gt;</p>
                    449: <p class="paramdesc">Slow down emulation by factor of x
                    450: (used as multiplier for VBL wait time)</p>
                    451: <p class="parameter">--statusbar
1.1.1.17  root      452: &lt;bool&gt;</p>
                    453: <p class="paramdesc">Show statusbar (with floppy leds etc
                    454: etc)</p>
1.1.1.18  root      455: <p class="parameter">--drive-led
1.1.1.17  root      456: &lt;bool&gt;</p>
                    457: <p class="paramdesc">Show overlay drive led when statusbar
                    458: isn&rsquo;t shown</p>
1.1.1.18  root      459: <p class="parameter">--max-width
                    460: &lt;x&gt;</p>
                    461: <p class="paramdesc">Preferred / maximum window width
                    462: for borders / zooming</p>
                    463: <p class="parameter">--max-height
                    464: &lt;x&gt;</p>
                    465: <p class="paramdesc">Preferred / maximum window height
                    466: for borders / zooming</p>
                    467: <p class="parameter">--bpp
1.1.1.17  root      468: &lt;bool&gt;</p>
                    469: <p class="paramdesc">Force internal bitdepth (x =
                    470: 8/15/16/32, 0=disable)</p>
1.1.1.21! root      471: <p class="parameter">--disable-video
        !           472: &lt;bool&gt;</p>
        !           473: <p class="paramdesc">Run emulation without displaying video (audio only)</p>
1.1.1.13  root      474: 
                    475: <h3>ST/STE specific display options</h3>
1.1.1.18  root      476: <p class="parameter">--desktop-st
1.1.1.17  root      477: &lt;bool&gt;</p>
1.1.1.20  root      478: <p class="paramdesc">
                    479: NOTE: this has effect only for SDL1 Hatari build.  In SDL2 build,
                    480: <i>--desktop</i> option controls also ST/STe mode.</p>
                    481: <p class="paramdesc">Whether to use desktop resolution on fullscreen
                    482: to avoid issues related to resolution switching (messing multi-screen
                    483: setups, several seconds delay needed for resolution switching by some
                    484: LCD monitors and the resulting sound break). Otherwise fullscreen will
                    485: use a resolution that is closest to the Hatari window size.</p>
                    486: <p class="paramdesc">As Hatari ST/STe display code doesn't support
                    487: zooming (except low-rez doubling), it doesn't get scaled (by Hatari or
                    488: monitor) when this is enabled, and you may get large black borders
                    489: around ST/STe screen. Therefore this is mainly useful only if you
                    490: suffer from the described effects, but still want to grab mouse and
                    491: remove other distractions from the screen just by toggling fullscreen
                    492: mode. (disabled by default)</p>
1.1.1.18  root      493: <p class="parameter">--spec512
1.1.1.17  root      494: &lt;x&gt;</p>
                    495: <p class="paramdesc">Hatari uses this threshold to decide
                    496: when to render a screen with the slower but more accurate
                    497: Spectrum512 screen conversion functions (0 &lt;= x &lt;= 512,
                    498: 0=disable)</p>
1.1.1.18  root      499: <p class="parameter">-z, --zoom
1.1.1.17  root      500: &lt;x&gt;</p>
                    501: <p class="paramdesc">Zoom (double) low resolution (1=no,
                    502: 2=yes)</p>
1.1.1.20  root      503: <p class="parameter">--video-timing
                    504: &lt;x&gt;</p>
                    505: <p class="paramdesc">Wakeup State for MMU/GLUE (x=ws1/ws2/ws3/ws4/random,
                    506: default ws3). When powering on, the STF will randomly choose one of these
                    507: wake up states. The state will then affect the timings where border removals
                    508: and other video tricks should be made, which can give different results on
                    509: screen. For example, WS3 is known to be compatible with many demos, while WS1 can show
                    510: more problems.</p>
1.1.1.13  root      511: 
1.1.1.18  root      512: <h3>TT/Falcon specific display options</h3>
                    513: <p>
                    514: Zooming to sizes specified below is internally done using integer scaling
                    515: factors. This means that different Atari resolutions may show up with
                    516: different sizes, but they are never blurry.
                    517: <p class="parameter">--desktop &lt;bool&gt;</p>
1.1.1.17  root      518: <p class="paramdesc">Whether to use desktop resolution on
                    519: fullscreen to avoid issues related to resolution switching.
                    520: Otherwise fullscreen will use a resolution that is closest to the
                    521: Hatari window size. (enabled by default)</p>
1.1.1.18  root      522: <p class="parameter">--force-max
1.1.1.17  root      523: &lt;bool&gt;</p>
                    524: <p class="paramdesc">Hatari window size is forced to
                    525: specified maximum size and black borders used when Atari resolution
                    526: doesn&rsquo;t scale evenly to it. This is most useful when
                    527: recording videos of Falcon demos that change their resolution.
                    528: (disabled by default)</p>
1.1.1.18  root      529: <p class="parameter">--aspect
1.1.1.17  root      530: &lt;bool&gt;</p>
                    531: <p class="paramdesc">Whether to do monitor aspect ratio
                    532: correction (enabled by default)</p>
1.1.1.13  root      533: 
1.1.1.8   root      534: <h3>VDI options</h3>
1.1.1.18  root      535: <p class="parameter">--vdi
1.1.1.17  root      536: &lt;bool&gt;</p>
                    537: <p class="paramdesc">Whether to use VDI screen mode</p>
1.1.1.18  root      538: <p class="parameter">--vdi-planes
1.1.1.17  root      539: &lt;x&gt;</p>
                    540: <p class="paramdesc">Use extended VDI resolution with bit
                    541: depth &lt;x&gt; (x = 1, 2 or 4)</p>
1.1.1.18  root      542: <p class="parameter">--vdi-width
1.1.1.17  root      543: &lt;w&gt;</p>
                    544: <p class="paramdesc">Use extended VDI resolution with width
                    545: &lt;w&gt; (320 &lt; w &lt;= 1280)</p>
1.1.1.18  root      546: <p class="parameter">--vdi-height
1.1.1.17  root      547: &lt;h&gt;</p>
                    548: <p class="paramdesc">Use extended VDI resolution with height
                    549: &lt;h&gt; (200 &lt; h &lt;= 960)</p>
1.1.1.13  root      550: 
                    551: <h3>Screen capture options</h3>
1.1.1.18  root      552: <p class="parameter">--crop
1.1.1.17  root      553: &lt;bool&gt;</p>
                    554: <p class="paramdesc">Remove statusbar from the screen
                    555: captures</p>
1.1.1.18  root      556: <p class="parameter">--avirecord</p>
1.1.1.19  root      557: <p class="paramdesc">Start AVI recording. Note: recording will
                    558: automatically stop when emulation resolution changes.</p>
                    559: <p class="parameter">--avi-vcodec &lt;x&gt;</p>
                    560: <p class="paramdesc">Select AVI video codec (x = bmp/png).
                    561: PNG compression can be <em>much</em> slower than using the uncompressed BMP
                    562: format, but uncompressed video content takes huge amount of space.</p>
                    563: <p class="parameter">--png-level &lt;x&gt;</p>
                    564: <p class="paramdesc">Select PNG compression level for AVI video (x = 0-9).
                    565: Both compression efficiency and speed depend on the compressed
                    566: screen content. Highest compression level (9) can be <em>really</em>
                    567: slow with some content. Levels 3-6 should compress nearly as well
                    568: with clearly smaller CPU overhead.</p>
                    569: <p class="parameter">--avi-fps &lt;x&gt;</p>
                    570: <p class="paramdesc">Force AVI frame rate (x = 50/60/71/...)</p>
                    571: <p class="parameter">--avi-file &lt;file&gt;</p>
                    572: <p class="paramdesc">Use &lt;file&gt; to record AVI</p>
1.1.1.13  root      573: 
1.1.1.8   root      574: <h3>Devices options</h3>
1.1.1.18  root      575: <p class="parameter">-j,
                    576: --joystick &lt;port&gt;</p>
1.1.1.17  root      577: <p class="paramdesc">Emulate joystick with cursor keys in
                    578: given port (0-5)</p>
1.1.1.18  root      579: <p class="parameter">--joy&lt;port&gt;
1.1.1.17  root      580: &lt;type&gt;</p>
                    581: <p class="paramdesc">Set joystick type (none/keys/real) for
                    582: given port</p>
1.1.1.18  root      583: <p class="parameter">--printer
1.1.1.17  root      584: &lt;file&gt;</p>
                    585: <p class="paramdesc">Enable printer support and write data
                    586: to &lt;file&gt;</p>
1.1.1.21! root      587: <p class="parameter">--midi &lt;bool&gt;</p>
        !           588: <p class="paramdesc">Enable MIDI support (PortMidi only)</p>
1.1.1.18  root      589: <p class="parameter">--midi-in
1.1.1.17  root      590: &lt;filename&gt;</p>
                    591: <p class="paramdesc">Enable MIDI support and write MIDI data
1.1.1.21! root      592: to &lt;file&gt; (Linux only)</p>
1.1.1.18  root      593: <p class="parameter">--midi-out
1.1.1.17  root      594: &lt;filename&gt;</p>
                    595: <p class="paramdesc">Enable MIDI support and read MIDI data
1.1.1.21! root      596: from &lt;file&gt; (Linux only)</p>
1.1.1.18  root      597: <p class="parameter">--rs232-in
1.1.1.17  root      598: &lt;filename&gt;</p>
                    599: <p class="paramdesc">Enable serial port support and use
                    600: &lt;file&gt; as the input device</p>
1.1.1.18  root      601: <p class="parameter">--rs232-out
1.1.1.17  root      602: &lt;filename&gt;</p>
                    603: <p class="paramdesc">Enable serial port support and use
                    604: &lt;file&gt; as the output device</p>
1.1.1.13  root      605: 
1.1.1.21! root      606: <h3>Floppy drive options</h3>
1.1.1.18  root      607: <p class="parameter">--drive-a
                    608: &lt;bool&gt;</p>
                    609: <p class="paramdesc">Enable/disable drive A (default is on)</p>
                    610: <p class="parameter">--drive-b
                    611: &lt;bool&gt;</p>
                    612: <p class="paramdesc">Enable/disable drive B (default is on)</p>
                    613: <p class="parameter">--drive-a-heads
                    614: &lt;x&gt;</p>
                    615: <p class="paramdesc">Set number of heads for drive A (1=single sided, 2=double sided)</p>
                    616: <p class="parameter">--drive-b-heads
                    617: &lt;x&gt;</p>
                    618: <p class="paramdesc">Set number of heads for drive B (1=single sided, 2=double sided)</p>
                    619: <p class="parameter">--disk-a
1.1.1.17  root      620: &lt;file&gt;</p>
                    621: <p class="paramdesc">Set disk image for floppy drive A</p>
1.1.1.18  root      622: <p class="parameter">--disk-b
1.1.1.17  root      623: &lt;file&gt;</p>
                    624: <p class="paramdesc">Set disk image for floppy drive B</p>
1.1.1.18  root      625: <p class="parameter">--protect-floppy
1.1.1.17  root      626: &lt;x&gt;</p>
                    627: <p class="paramdesc">Write protect floppy image contents
                    628: (on/off/auto). With "auto" option write protection is according to
1.1.1.18  root      629: the disk image file attributes</p>
1.1.1.21! root      630: 
        !           631: <h3>Hard drive options</h3>
        !           632: <p class="parameter">-d, --harddrive
        !           633: &lt;dir&gt;</p>
        !           634: <p class="paramdesc">GEMDOS HD emulation. Emulate hard disk partition(s)
        !           635: with &lt;dir&gt; contents. If directory contains only single letter
        !           636: (C-Z) subdirectories, each of these subdirectories will be treated
        !           637: as a separate partition, otherwise the given directory itself will
        !           638: be assigned to drive "C:". In the multiple partition case, the
        !           639: letters used as the subdirectory names will determine to which
        !           640: drives/partitions they&rsquo;re assigned. If &lt;dir&gt; is
        !           641: an empty string, then harddrive's emulation is disabled</p>
1.1.1.18  root      642: <p class="parameter">--protect-hd
1.1.1.17  root      643: &lt;x&gt;</p>
1.1.1.18  root      644: <p class="paramdesc">Write protect hard drive &lt;dir&gt;
1.1.1.17  root      645: contents (on/off/auto). With "auto" option the protection can be
                    646: controlled by setting individual files attributes as it disables
1.1.1.18  root      647: the file attribute modifications for the GEMDOS HD
                    648: emulation</p>
                    649: <p class="parameter">--gemdos-case &lt;x&gt;</p>
1.1.1.17  root      650: <p class="paramdesc">Specify whether new dir/filenames are forced to be
1.1.1.20  root      651: in upper or lower case with GEMDOS HD emulation. Off/upper/lower, off by default
1.1.1.17  root      652: </p>
1.1.1.21! root      653: <p class="parameter">--gemdos-time &lt;x&gt;</p>
        !           654: <p class="paramdesc">Specify what file modification timestamps should be used,
        !           655: emulation internal (atari) ones, or ones from the machine (host) on which
        !           656: the machine is running. While Atari emulation and host clocks are in sync
        !           657: at Hatari startup, they will diverge while emulation is running, especially
        !           658: if you use fast forward.  Default is "atari".  If you modify files accessed
        !           659: by the Atari side, directly from the host side while Hatari is already
        !           660: running, you may want to use "host" option</p>
        !           661: <p class="parameter">--gemdos-conv &lt;bool&gt;</p>
        !           662: <p class="paramdesc">Whether GEMDOS file names with 8-bit (non-ASCII) characters
        !           663: are converted between Atari and host character sets. On Linux, host file
        !           664: name character set is assumed to be UTF-8. This option is disabled by
        !           665: default, in case you've transferred files from Atari machine without
        !           666: proper file name conversion (e.g. by zipping them on Atari and
        !           667: unzipping on PC)</p>
        !           668: <p class="parameter">--gemdos-drive &lt;drive&gt;</p>
        !           669: <p class="paramdesc">Assign (seprately specified) GEMDOS HD to given
        !           670: drive letter (C-Z) instead of default C:, or use "skip" to specify
        !           671: that Hatari should add GEMDOS HD after IDE and ACSI drives (assumes
        !           672: Hatari and native HD driver parse same number of partitions from
        !           673: HD images partition tables)</p>
1.1.1.18  root      674: <p class="parameter">--acsi
1.1.1.17  root      675: &lt;file&gt;</p>
1.1.1.18  root      676: <p class="paramdesc">Emulate an ACSI hard drive with an image
1.1.1.17  root      677: &lt;file&gt;</p>
1.1.1.18  root      678: <p class="parameter">--ide-master
1.1.1.17  root      679: &lt;file&gt;</p>
1.1.1.18  root      680: <p class="paramdesc">Emulate an IDE master hard drive with an
1.1.1.17  root      681: image &lt;file&gt;</p>
1.1.1.18  root      682: <p class="parameter">--ide-slave
1.1.1.17  root      683: &lt;file&gt;</p>
1.1.1.18  root      684: <p class="paramdesc">Emulate an IDE slave hard drive with an
1.1.1.17  root      685: image &lt;file&gt;</p>
1.1.1.18  root      686: <p class="parameter">--fastfdc
1.1.1.17  root      687: &lt;bool&gt;</p>
1.1.1.18  root      688: <p class="paramdesc">Speed up FDC emulation (can cause
1.1.1.17  root      689: incompatibilities)</p>
1.1.1.13  root      690: 
1.1.1.8   root      691: <h3>Memory options</h3>
1.1.1.17  root      692: <p class="parameter">
1.1.1.18  root      693: --memstate &lt;file&gt;</p>
1.1.1.17  root      694: <p class="paramdesc">Load memory snap-shot &lt;file&gt;</p>
1.1.1.18  root      695: <p class="parameter">-s, --memsize
1.1.1.17  root      696: &lt;x&gt;</p>
                    697: <p class="paramdesc">Set amount of emulated RAM, x = 1 to 14
1.1.1.21! root      698: MiB, or 0 for 512 KiB. Other values are considered as a size in KiB</p>
1.1.1.14  root      699: 
                    700: <h3>ROM options</h3>
1.1.1.18  root      701: <p class="parameter">-t,
                    702: --tos &lt;imagefile&gt;</p>
1.1.1.17  root      703: <p class="paramdesc">Specify TOS ROM image to use</p>
1.1.1.18  root      704: <p class="parameter">--patch-tos
1.1.1.17  root      705: &lt;bool&gt;</p>
                    706: <p class="paramdesc">Use this option to enable/disable TOS
                    707: ROM patching. Experts only! Leave this enabled unless you know what
                    708: you are doing!</p>
1.1.1.18  root      709: <p class="parameter">--cartridge
1.1.1.17  root      710: &lt;imagefile&gt;</p>
                    711: <p class="paramdesc">Use ROM cartridge image &lt;file&gt;
                    712: (only works if GEMDOS HD emulation and extended VDI resolution are
                    713: disabled)</p>
1.1.1.13  root      714: 
1.1.1.20  root      715: <h3>Common CPU options</h3>
1.1.1.17  root      716: <p class="parameter">
1.1.1.18  root      717: --cpulevel &lt;x&gt;</p>
1.1.1.17  root      718: <p class="paramdesc">Specify CPU (680x0) to use (use x &gt;=
                    719: 1 with EmuTOS or TOS &gt;= 2.06 only!)</p>
1.1.1.18  root      720: <p class="parameter">--cpuclock
1.1.1.17  root      721: &lt;x&gt;</p>
1.1.1.20  root      722: <p class="paramdesc">Set the CPU clock (8, 16 or 32 MHz)</p>
1.1.1.18  root      723: <p class="parameter">--compatible
1.1.1.17  root      724: &lt;bool&gt;</p>
                    725: <p class="paramdesc">Use a more compatible, but slower 68000
                    726: CPU mode with better prefetch accuracy and cycle counting</p>
1.1.1.13  root      727: 
1.1.1.20  root      728: <h3>WinUAE CPU core options</h3>
                    729: <p class="parameter">--cpu-exact &lt;bool&gt;</p>
                    730: <p class="paramdesc">Use cycle exact CPU emulation (cache emulation)</p>
                    731: <p class="parameter">--addr24 &lt;bool&gt;</p>
                    732: <p class="paramdesc">Use 24-bit instead of 32-bit addressing mode (24-bit is enabled by default)</p>
                    733: <p class="parameter">--fpu &lt;x&gt;</p>
                    734: <p class="paramdesc">FPU type (x=none/68881/68882/internal)</p>
                    735: <p class="parameter">--mmu &lt;bool&gt;</p>
                    736: <p class="paramdesc">Use MMU emulation</p>
                    737: 
1.1.1.8   root      738: <h3>Misc system options</h3>
1.1.1.17  root      739: <p class="parameter">
1.1.1.18  root      740: --machine &lt;x&gt;</p>
1.1.1.21! root      741: <p class="paramdesc">Select machine type (x = st, megast, ste,
        !           742: megaste, tt or falcon)</p>
1.1.1.18  root      743: <p class="parameter">--blitter
1.1.1.17  root      744: &lt;bool&gt;</p>
                    745: <p class="paramdesc">Enable blitter emulation (ST only)</p>
1.1.1.18  root      746: <p class="parameter">--dsp &lt;x&gt;</p>
1.1.1.17  root      747: <p class="paramdesc">Falcon DSP emulation (x = none, dummy
                    748: or emu, Falcon only)</p>
1.1.1.18  root      749: <p class="parameter">--timer-d
1.1.1.17  root      750: &lt;bool&gt;</p>
                    751: <p class="paramdesc">Patch redundantly high Timer-D
                    752: frequency set by TOS. This about doubles Hatari speed (for ST/e
                    753: emulation) as the original Timer-D frequency causes most of the
                    754: interrupts.</p>
1.1.1.18  root      755: <p class="parameter">--fast-boot
1.1.1.17  root      756: &lt;bool&gt;</p>
                    757: <p class="paramdesc">Patch TOS and initialize the so-called
                    758: "memvalid" system variables to by-pass the memory test of TOS, so
                    759: that the system boots faster.</p>
1.1.1.14  root      760: 
                    761: <h3>Sound options</h3>
1.1.1.18  root      762: <p class="parameter">--mic
1.1.1.17  root      763: &lt;bool&gt;</p>
                    764: <p class="paramdesc">Enable/disable (Falcon only)
                    765: microphone</p>
1.1.1.18  root      766: <p class="parameter">--sound
1.1.1.17  root      767: &lt;x&gt;</p>
                    768: <p class="paramdesc">Sound frequency: 6000-50066. "off"
                    769: disables the sound and speeds up the emulation. To prevent extra
                    770: sound artifacts, the frequency should be selected so that it either
                    771: matches evenly with the STE/TT/Falcon sound DMA (6258, 12517,
                    772: 250033, 50066 Hz) or your sound card frequencies (11025, 22050,
                    773: 44100 or 6000...48000 Hz). Check what your sound card supports.</p>
1.1.1.18  root      774: <p class="parameter">--sound-buffer-size
1.1.1.17  root      775: &lt;x&gt;</p>
                    776: <p class="paramdesc">SDL&rsquo;s sound buffer size: 10-100,
                    777: or 0 to use default buffer size. By default Hatari uses an SDL
1.1.1.20  root      778: buffer size of 1024 samples, which gives approximately 20-30 ms
1.1.1.17  root      779: of sound depending on the chosen sound frequency. Under some OS or
                    780: with not fully supported sound card, this default setting can cause
                    781: a bigger delay at lower frequency (nearly 0.5 sec). In that case,
                    782: you can use this option to force the size of the sound buffer to a
                    783: fixed number of milliseconds of sound (using 20 is often a good
                    784: choice if you have such problems). Most users will not need this
                    785: option.</p>
1.1.1.18  root      786: <p class="parameter">--sound-sync
1.1.1.17  root      787: &lt;bool&gt;</p>
                    788: <p class="paramdesc">The emulation rate is nudged by +100 or
                    789: 0 or -100 micro-seconds on occasion. This prevents the sound buffer
                    790: from overflowing (long latency and lost samples) or underflowing
                    791: (short latency and repeated samples). The emulation rate smoothly
                    792: deviates by a maximum of 0.58% until synchronized, while the
                    793: emulator continuously generates every sound sample and the crystal
                    794: controlled sound system consumes every sample.<br />
                    795: (on|off, off=default)</p>
1.1.1.18  root      796: <p class="parameter">--ym-mixing
1.1.1.17  root      797: &lt;x&gt;</p>
                    798: <p class="paramdesc">Select a method for mixing the three
                    799: YM2149 voice volumes together. "model" uses a mathematical model of
                    800: the YM voices, "table" uses a lookup table of audio output voltage
                    801: values measured on STF and "linear" just averages the 3 YM
                    802: voices.</p>
1.1.1.13  root      803: 
1.1.1.8   root      804: <h3>Debug options</h3>
1.1.1.19  root      805: <p class="parameter">-W, --wincon</p>
                    806: <p class="paramdesc">Open console window (Windows only)</p>
1.1.1.18  root      807: <p class="parameter">-D,
                    808: --debug</p>
1.1.1.17  root      809: <p class="paramdesc">Toggle whether CPU exceptions invoke
                    810: the debugger</p>
1.1.1.18  root      811: <p class="parameter">--debug-except &lt;flags&gt;</p>
                    812: <p class="paramdesc">Specify which exceptions invoke debugger, see
                    813: "--debug-except help" for available (comma separated) exception
                    814: flags.</p>
                    815: <p class="parameter">--bios-intercept</p>
                    816: <p class="paramdesc">
                    817: Toggle XBios command parsing. Allows Atari programs to use all Hatari
1.1.1.20  root      818: functionality and change Hatari state through Hatari specific
1.1.1.18  root      819: XBios(255) calls. XBios(20) printscreen calls produce also Hatari
                    820: screenshots.</p>
                    821: <p class="parameter">--conout &lt;device&gt;</p>
1.1.1.17  root      822: <p class="paramdesc">Enable console (xconout vector functions) output
                    823: redirection for given &lt;device&gt; to host terminal.  Device 2 is for
                    824: the (CON:) VT52 console, which vector function catches also EmuTOS panic
                    825: messages and MiNT console output, not just normal BIOS console output.</p>
1.1.1.18  root      826: <p class="parameter">--disasm &lt;x&gt;</p>
1.1.1.17  root      827: <p class="paramdesc">Set disassembly options.  'uae' and 'ext' select
                    828: the dissasembly engine to use, bitmask sets output options for the
                    829: external disassembly engine and 'help' lists them.</p>
1.1.1.18  root      830: <p class="parameter">--natfeats &lt;bool&gt;</p>
1.1.1.17  root      831: <p class="paramdesc">Enable/disable (basic) Native Features support.
                    832: E.g. EmuTOS uses it for debug output.</p>
1.1.1.18  root      833: <p class="parameter">--trace
                    834: &lt;flags&gt;</p>
1.1.1.17  root      835: <p class="paramdesc">Activate debug traces, see
1.1.1.18  root      836: "--trace help" for available tracing flags</p>
                    837: <p class="parameter">--trace-file
1.1.1.17  root      838: &lt;file&gt;</p>
                    839: <p class="paramdesc">Save trace output to &lt;file&gt;
                    840: (default=stderr)</p>
1.1.1.18  root      841: <p class="parameter">--parse
1.1.1.17  root      842: &lt;file&gt;</p>
                    843: <p class="paramdesc">Parse/execute debugger commands from
                    844: &lt;file&gt;</p>
1.1.1.18  root      845: <p class="parameter">--saveconfig</p>
1.1.1.17  root      846: <p class="paramdesc">Save Hatari configuration and exit.
                    847: Hatari UI needs Hatari configuration file to start, this can be
                    848: used to create it automatically.</p>
1.1.1.18  root      849: <p class="parameter">--no-parachute</p>
1.1.1.17  root      850: <p class="paramdesc">Disable SDL parachute to get Hatari
                    851: core dumps. SDL parachute is enabled by default to restore video
                    852: mode in case Hatari terminates abnormally while using non-standard
                    853: screen resolution.</p>
1.1.1.18  root      854: <p class="parameter">--control-socket
1.1.1.17  root      855: &lt;file&gt;</p>
                    856: <p class="paramdesc">Hatari reads options from given socket
                    857: at run-time</p>
1.1.1.18  root      858: <p class="parameter">--log-file
1.1.1.17  root      859: &lt;file&gt;</p>
                    860: <p class="paramdesc">Save log output to &lt;file&gt;
                    861: (default=stderr)</p>
1.1.1.18  root      862: <p class="parameter">--log-level
1.1.1.17  root      863: &lt;x&gt;</p>
                    864: <p class="paramdesc">Log output level
                    865: (x=debug/todo/info/warn/error/fatal)</p>
1.1.1.18  root      866: <p class="parameter">--alert-level
1.1.1.17  root      867: &lt;x&gt;</p>
                    868: <p class="paramdesc">Show dialog for log messages above
                    869: given level</p>
1.1.1.18  root      870: <p class="parameter">--run-vbls
1.1.1.17  root      871: &lt;x&gt;</p>
                    872: <p class="paramdesc">Exit after X VBLs</p>
1.1.1.21! root      873: <p class="parameter">--benchmark</p>
        !           874: <p class="paramdesc">Start in benchmark mode (use with --run-vbls).
        !           875: This allows to measure the speed of the emulation in frames per second
        !           876: by running at maximum speed (don't wait for VBL). Disable audio/video
        !           877: output to have as little OS overhead as possible</p>
1.1.1.5   root      878: 
1.1.1.7   root      879: <p>Type <span class="commandline">hatari --help</span> to list all
                    880: the command line options supported by a given version of Hatari.</p>
                    881: 
1.1.1.17  root      882: 
                    883: <h2>Using the emulated system</h2>
1.1.1.5   root      884: 
1.1.1.18  root      885: <p> Once you've started Hatari successfully, you can use the emulator as
1.1.1.10  root      886: an almost complete Atari ST computer system. </p>
1.1.1.5   root      887: 
1.1.1.17  root      888: <h3>The GUI</h3>
1.1.1.5   root      889: 
1.1.1.3   root      890: <p>Press <span class="key">F12</span> to enter the GUI. Navigate it
                    891: with the mouse.
1.1       root      892: The GUI is rather self explanatory.</p>
1.1.1.5   root      893: 
1.1.1.17  root      894: <h4 class="gui">The Main Menu</h4>
1.1.1.5   root      895: 
                    896: <div class="floatimage">
1.1.1.17  root      897:   <img src="images/main.png" width="500" height="304"
                    898:        alt="Hatari's GUI - the main menu" />
1.1.1.5   root      899: </div>
                    900: 
1.1.1.12  root      901: <p>
                    902: You can reach the other setup dialogs from the main menu by clicking on
                    903: the appropriate buttons.
                    904: </p>
                    905: <p>
                    906: You can load the current settings from a configuration file by clicking
1.1.1.20  root      907: on the <span class="button">Load&nbsp;config</span> button, and save
1.1.1.12  root      908: the current settings to a configuration file by clicking on
1.1.1.20  root      909: the <span class="button">Save&nbsp;config</span> button.
1.1.1.12  root      910: </p>
                    911: <p>
                    912: Click <span class="button">OK</span> to go back and continue the emulation.
                    913: All changed options will be applied.
                    914: </p>
                    915: <p>
1.1.1.20  root      916: Select the <em>&quot;Reset machine&quot;</em> option if you
1.1.1.12  root      917: want the emulated machine to perform a cold reset. This is equal to
                    918: switching the power off and on again on a real Atari machine.
                    919: </p>
                    920: <p>
                    921: Click <span class="button">Quit</span> to terminate Hatari
                    922: and return to the host OS.
                    923: </p>
                    924: <p>
                    925: Click <span class="button">Cancel</span> to abandon any
                    926: changes that you have made.
                    927: </p>
1.1.1.5   root      928: 
1.1.1.10  root      929: 
1.1.1.17  root      930: <h4 class="gui">The File Selector Dialog</h4>
1.1.1.10  root      931: 
                    932: <div class="floatimage">
1.1.1.18  root      933:   <img src="images/fileselector.png" width="640" height="400"
1.1.1.17  root      934:        alt="Hatari's GUI - the fileselector" />
1.1.1.10  root      935: </div>
                    936: 
                    937: <p>
                    938:  The file selector dialog appears whenever you are prompted to choose a file
                    939:  or folder.
                    940: </p>
                    941: <p>
1.1.1.17  root      942:  To enter a folder or choose a file, simply click on the entry in the
                    943:  main box of the dialog. To navigate in the file list, you can use the
                    944:  scrollbar on the right with mouse, or use keyboard up + down arrow,
                    945:  page up + down, Home and End keys.
1.1.1.10  root      946: </p>
                    947: <p>
                    948:  You can use the three buttons in the upper right corner for additional folder
1.1.1.17  root      949:  navigation. Click the <span class="button">..</span> button to go up one level
1.1.1.20  root      950:  in the directory tree. The <span class="button">CWD</span> button takes you
                    951:  to the current working directory (i.e. the folder that was current when
                    952:  Hatari has been started). Click the <span class="button">~</span> button to
                    953:  return to your home directory. The <span class="button">/</span> button can
                    954:  be clicked to go to the root directory of the file system.
                    955: </p>
                    956: <p>
                    957:  When you tick the <em>&quot;Show hidden files&quot;</em> setting, Hatari will
                    958:  also show files that start with a dot in the file selection dialog.
1.1.1.10  root      959: </p>
                    960: 
1.1.1.17  root      961: <h4 class="gui">The System Dialog</h4>
1.1.1.5   root      962: 
                    963: <div class="floatimage">
1.1.1.20  root      964:   <img src="images/system.png" width="500" height="288"
1.1.1.17  root      965:        alt="Hatari's GUI - the system dialog" />
1.1.1.5   root      966: </div>
                    967: 
1.1.1.7   root      968: <p>
1.1.1.18  root      969:  The system dialog can be used to define the basic hardware attributes of
                    970:  the machine that should be emulated.
1.1.1.7   root      971: </p>
                    972: <p>
1.1.1.18  root      973:  The machine type option is used to select the type of Atari computer to
1.1.1.20  root      974:  be emulated:
1.1.1.18  root      975: </p>
                    976: <ul>
                    977:  <li>
1.1.1.20  root      978:   The <strong>ST</strong> was the very first 16/32-bit computer from Atari.
                    979:   Most older games and demos require an ST. TOS 1.00, 1.02, 1.04 or 2.06
                    980:   is required for running in ST mode.</li>
1.1.1.18  root      981:  <li>
1.1.1.20  root      982:   The <strong>Mega-ST</strong> was an slightly improved version which also
                    983:   provided the so-called blitter chip (for accelerating certain graphic
                    984:   operations) and a Real Time Clock (RTC) chip.
1.1.1.18  root      985:  </li>
                    986:  <li>
1.1.1.20  root      987:   The <strong>STE</strong> was introduced some years later and had some more
                    988:   advanced hardware features, like the blitter chip, hardware scrolling and
                    989:   DMA sample sound (but no Real Time Clock). There are not that many demos or
                    990:   games that really require an STE but since most normal ST games/demos also
                    991:   work with an STE, it's normally safe to always work in STE mode.
                    992:   Also make sure to use TOS version 1.06, 1.62 or 2.0x with this machine type.
1.1.1.18  root      993:  </li>
                    994:  <li>
1.1.1.20  root      995:   The <strong>Mega-STE</strong> was an improved version of the STE, with
                    996:   16 MHz (instead of 8 MHz) CPU frequency and a built-in Real Time Clock chip.
1.1.1.18  root      997:  </li>
                    998:  <li>
1.1.1.20  root      999:    The <strong>TT</strong> was the advanced workstation from Atari. It
                   1000:    featured a 32MHz 68030 CPU, a very high monochrome resolution, and a
                   1001:    lot of interfaces. However, compatibility was not as high as with the
                   1002:    other machines. For TT emulation you need TOS 3.0x.
1.1.1.18  root     1003:  </li>
                   1004:  <li>
1.1.1.20  root     1005:   The <strong>Falcon</strong> was Atari's last computer, using a 16 MHz 68030
                   1006:   CPU and some more interesting new hardware feature, like the Videl graphic
                   1007:   chip and DSP 56001 for sound. You need TOS 4.0x for running in Falcon mode.
                   1008:  </li> 
1.1.1.18  root     1009: </ul>
1.1.1.20  root     1010: <p>
                   1011:  <em>Note:</em> Falcon and especially TT emulation are still considered as
                   1012:  experimental and incomplete, so quite a bunch of programs do not work very
                   1013:  well yet.
                   1014:  Also a lot of old games and demos do not work with these machine types
                   1015:  anymore since the hardware is quite a bit different. There were only very
                   1016:  few programs that were made for the TT exclusively, while there were some
                   1017:  interesting games and demos specially made for the Falcon.
                   1018: </p>
1.1.1.18  root     1019: 
                   1020: <p>
1.1.1.20  root     1021:  The video timings (&quot;wakestate&quot;) settings influence the internal
                   1022:  timings of the ST video chip emulation. You normally do not have to change
                   1023:  these unless you know what you are doing, only some very few demos require
                   1024:  a special setting here.
1.1.1.7   root     1025: </p>
1.1.1.20  root     1026: 
1.1.1.10  root     1027: <p>
1.1.1.18  root     1028:  For Falcon mode, you can choose whether you want to disable DSP emulation,
                   1029:  fake it or enable full emulation. Most Falcon programs only play sound or work
1.1.1.10  root     1030:  correctly when you enable the DSP emulation, but it needs a lot of host CPU
1.1.1.18  root     1031:  power (more than 2 GHz) for full emulation. So if you have a slow host CPU,
                   1032:  you can try if your Falcon program also runs with DSP disabled or in
                   1033:  the &quot;dummy&quot; fake mode.
1.1.1.20  root     1034:  Note that you cannot change this option while the DSP based program already
1.1.1.10  root     1035:  runs.
                   1036: </p>
1.1.1.18  root     1037: <p>
                   1038:  The check boxes in the &quot;CPU and system parameters&quot; section can
                   1039:  be used to fine-tune the machine and CPU types.
                   1040: </p>
                   1041: <p>
1.1.1.20  root     1042:  The Blitter option can be set to enable Blitter emulation in plain ST mode.
1.1.1.18  root     1043:  The Blitter is a custom chip that accelerates some graphical operations.
1.1.1.20  root     1044:  Note that in Mega-ST, STE and Falcon mode, the Blitter is always enabled
                   1045:  (since these machines have always been sold with a Blitter chip). The TT
                   1046:  was always shipped without the Blitter chip.
1.1.1.18  root     1047: </p>
                   1048: <p>
                   1049:  The &quot;Patch Timer-D&quot; option changes the Timer-D initialization from
                   1050:  TOS. TOS uses the MFP timer D as a baudrate generator for RS232. However, the
                   1051:  TOS default value slows down the emulation. The patch gives you a better
                   1052:  performance.  It is normally safe to enable the patch, but if you encounter a
                   1053:  program that does not work, you can try to disable the patch to see if it
                   1054:  works better.
                   1055: </p>
                   1056: <p>
                   1057:  With the &quot;Boot faster&quot; option, Hatari patches the TOS ROM and some
                   1058:  system variables, to speed up the boot process of the emulated system, e.g.
                   1059:  by simulating a warm reset. This is a convenient option, but some very few old
                   1060:  programs rely on an unmodified boot process, so in rare cases this option has
                   1061:  to be switched off to get those programs running.
                   1062: </p>
                   1063: <p>
1.1.1.20  root     1064:  <em>NOTE:</em> The emulated Atari system is very very sensitive to all of
                   1065:  these options and it is strongly recommended to reset the emulation after
                   1066:  changing them (for most things that's done automatically).
                   1067:  Most settings are also selected automatically when one uses the
                   1068:  <span class="commandline">--machine</span> command line option.
                   1069: </p>
                   1070: 
                   1071: 
                   1072: <h4 class="gui">The CPU Dialog</h4>
                   1073: 
                   1074: <div class="floatimage">
                   1075:   <img src="images/cpu.png" width="460" height="368"
                   1076:        alt="Hatari's GUI - the CPU dialog" />
                   1077: </div>
                   1078: 
                   1079: <p>
                   1080:  The CPU type option can be used to select the level of the central processing
                   1081:  unit. If you are not sure what to use, simply select 68000 for ST and STE
                   1082:  machines and 68030 for TT and Falcon emulation, since this were the original
                   1083:  configurations used in the Atari computers. In case you want to vary
                   1084:  the CPU type, you have got to be aware of some constraints:
                   1085: </p>
                   1086: <ul>
                   1087:  <li>
                   1088:   Atari ST and STE have only been shipped with a 68000 CPU, so for best
                   1089:   compatibility with old programs, you should choose this CPU type.
                   1090:  </li>
                   1091:  <li>
                   1092:   If you are going to use TOS 1.0x, you also have to select the 68000 CPU,
                   1093:   since these TOS versions are not aware of the higher CPU levels yet.
                   1094:   If you want to use a higher CPU level with the ST or STE machine type,
                   1095:   you've got to use TOS 2.0x instead.
                   1096:  </li>
                   1097:  <li>
                   1098:   Atari TT and Falcon computers were using the 68030 CPU, so you should select
                   1099:   the 68030 CPU type for these machines.
                   1100:  </li>
                   1101:  <li>
                   1102:   TOS 3.0x and 4.0x also only work with a CPU &gt;= 68020.
                   1103:  </li>
                   1104:  <li>
                   1105:   68010 and 68040, 68060 have never been used in official Atari computers,
                   1106:   so don't use these CPU types unless you've got some good reasons.
                   1107:  </li>
                   1108:  <li>
                   1109:   The 68060 option is only available in the &quot;WinUAE&quot; builds of
                   1110:   Hatari, and is currently also considered as experimental, so do not use
                   1111:   this option unless you know what you are doing.
                   1112:  </li>
                   1113: </ul>
                   1114: 
                   1115: <p>
                   1116:  The CPU clock option can be used to select the frequency that is used
                   1117:  to clock the CPU. 8 MHz is the standard for ST and STE and the most
                   1118:  compatible frequency for old software.
                   1119:  Use 16 MHz for Mega STE and Falcon emulation.
                   1120:  The CPU in the TT was clocked with 32 MHz.
                   1121: </p>
                   1122: 
                   1123: <p>
1.1.1.18  root     1124:  The &quot;Prefetch mode&quot; option is used to enable the emulation of 68k
                   1125:  address errors and the so-called CPU prefetch buffer. This is needed for best
                   1126:  compatibility, but it slows down emulation a little bit so you can disable it
                   1127:  if you don't need it and if you have a slow host system.
                   1128: </p>
                   1129: <p>
                   1130:  The &quot;Cycle exact&quot;, the &quot;MMU emulation&quot; and
                   1131:  &quot;24-bit addressing&quot; option are only available in the
                   1132:  &quot;WinUAE&quot; builds
1.1.1.20  root     1133:  of Hatari. They are considered as experimental and should only be changed
                   1134:  if you know what you are doing.
1.1.1.18  root     1135: </p>
                   1136: <p>
                   1137:  The FPU settings are also only available with the &quot;WinUAE&quot; builds
                   1138:  of Hatari. They can be used to select the type of floating point unit of CPUs
1.1.1.20  root     1139:  &gt;= 68020. In the non-WinUAE builds of Hatari, the FPU is always enabled for
1.1.1.18  root     1140:  68030 and 68040 CPUs.
                   1141: </p>
1.1.1.5   root     1142: 
                   1143: 
1.1.1.17  root     1144: <h4 class="gui">The Floppy Disks Dialog</h4>
1.1.1.5   root     1145: 
1.1.1.10  root     1146: <div class="floatimage">
1.1.1.17  root     1147:   <img src="images/floppydisks.png" width="640" height="320"
                   1148:        alt="Hatari's GUI - the floppy disks dialog" />
1.1.1.5   root     1149: </div>
                   1150: 
1.1.1.10  root     1151: <p>
                   1152:  This dialog can be used to choose which floppy disks should be emulated
                   1153:  in the disk drives. You can use most standard Atari ST disk image files.
                   1154:  You may select and browse also zipped disk images. See the chapter
1.1.1.17  root     1155:  <a href="#Floppy_disk_images">"Floppy disk images"</a> for details.
1.1.1.10  root     1156: </p>
                   1157: <p>
1.1.1.18  root     1158:  Each drive can be enabled or disabled (as if it was not connected or turned
                   1159:  off). You can also choose to emulate a single sided drive instead of a double
                   1160:  sided one (some games or demos will have a different behaviour in single sided
                   1161:  mode).
                   1162: </p>
                   1163: <p>
1.1.1.10  root     1164:  Click on the button <span class="button">Browse</span> next to the
                   1165:  A: and B: option to go to the fileselector to choose a disk image for the
                   1166:  corresponding drive.
                   1167: </p>
1.1.1.3   root     1168: <p>Click on <span class="button">Eject</span> to eject a disk image
                   1169: from the emulated drive. The emulated ST will act as if had no floppy
                   1170: disk in its drive.</p>
                   1171: <p>You can specify a default directory where Hatari will start to
                   1172: browse the filesystem.</p>
1.1.1.2   root     1173: <p>
1.1.1.6   root     1174: Check the "Auto insert B" option if you want Hatari to be smart and
                   1175: insert the second disk of a two disk game automatically.
                   1176: Some games then use the second drive automatically.
                   1177: In the case that a game is not able to find the disk in the second drive,
                   1178: you have to insert the second disk in drive A: manually when prompted.
1.1.1.17  root     1179: <br />
1.1.1.6   root     1180: <em>NOTE:</em> This option only works properly if the file name of the
                   1181: first disks ends with an 'a' before the extension and the second disk name
                   1182: ends with a 'b'.
1.1.1.2   root     1183: </p>
1.1.1.10  root     1184: <p>
1.1.1.14  root     1185:  Select if you want to use fast FDC (Floppy Disk Controller) emulation.
1.1.1.18  root     1186: 
                   1187:  "Fast floppy access" option will speed up disk accesses, but this can
                   1188:  cause incompatibilities with programs that expect correct delays
                   1189:  (some games/demos don't expect data to be read too fast from the
                   1190:  disk). For example, when using STX images, most protections will fail
                   1191:  if fast floppy access is enabled.
1.1.1.10  root     1192: </p>
                   1193: <p>
1.1.1.18  root     1194:  If you want, you can set Hatari to write-protect your disks. Atari ST
1.1.1.20  root     1195:  viruses can spread on disk images, so that can be a good idea. However,
1.1.1.18  root     1196:  note that some programs won't work correctly (or at all) with write
                   1197:  protected disks, and things like saving highscores in games will fail.
1.1.1.10  root     1198: </p>
                   1199: 
                   1200: <div class="floatimage">
1.1.1.17  root     1201:   <img src="images/newfloppy.png" width="290" height="224"
                   1202:        alt="Hatari's GUI - the new floppy dialog" />
1.1.1.10  root     1203: </div>
                   1204: 
                   1205: <p>
                   1206:  If you need to create a new blank disk image, click on
                   1207:  <span class="button">Create&nbsp;blank&nbsp;image</span>.
1.1.1.18  root     1208:  Parameters for the new image can be set in the following dialog. HD
                   1209:  and ED disk sector counts are for larger, non-Atari disk sizes, they
                   1210:  can be useful with programs that don't work from hard drive, or with
                   1211:  with GEMDOS HD emulation.
1.1.1.10  root     1212:  Click on <span class="button">Create</span> to save the new image or on
                   1213:  <span class="button">Back</span> to return to the disk dialog.
                   1214: </p>
                   1215: <p>
                   1216:  After clicking <span class="button">Create</span>, a fileselector
                   1217:  appears. You can browse the filesystem now. Select the target directory,
1.1.1.12  root     1218:  click beside "File:" and type in a name for the new disk image.
1.1.1.10  root     1219:  The name should terminate with .st or .msa.
                   1220: </p>
                   1221: <p>
                   1222:  Hatari can currently create plain .ST and .MSA disk images exclusively.
1.1.1.12  root     1223:  <span class="commandline">hmsa</span> command line utility can be used
                   1224:  to convert disk images between .ST and .MSA formats.
1.1.1.10  root     1225: </p>
                   1226: 
                   1227: 
1.1.1.17  root     1228: <h4 class="gui">The Hard Disks Dialog</h4>
1.1.1.10  root     1229: 
                   1230: <div class="floatimage">
1.1.1.17  root     1231:   <img src="images/harddisks.png" width="640" height="304"
                   1232:        alt="Hatari's GUI - the hard disks dialog" />
1.1.1.10  root     1233: </div>
                   1234: 
                   1235: <p>
1.1.1.18  root     1236:  This dialog can be used to change the hard disk settings.
1.1.1.10  root     1237: </p>
                   1238: <p>
1.1.1.18  root     1239:  Here you can select a hard disk image file for ACSI, IDE master or
                   1240:  slave hard drive emulation, or you can select a host directory to be
                   1241:  emulated as the Atari hard drive.
1.1.1.10  root     1242: </p>
                   1243: <p>
1.1.1.20  root     1244:  Check "Boot from HD" to set given hard disk image / directory as TOS
                   1245:  boot device (if ACSI or IDE is enabled, it's C:, otherwise it's the
                   1246:  first specified GEMDOS HD drive).  With command line options, the value
                   1247:  of this setting depends on whether you specify floppy image or harddisk
                   1248:  later on the command line (later one takes precedence).
1.1.1.12  root     1249: </p>
                   1250: <p>
                   1251:  Removing the check from the "Allow GEMDOS drive modification" option
1.1.1.18  root     1252:  will prevent Atari programs from modifying the files in GEMDOS HD
1.1.1.12  root     1253:  emulation directory or creating new files under it.
1.1.1.10  root     1254: </p>
                   1255: <p>
1.1.1.19  root     1256:  Note that you need TOS version &gt;= 2.05 to boot from IDE hard drive.
1.1.1.18  root     1257:  And ACSI hard drive emulation does not work with TOS 4.0x in Falcon mode.
1.1.1.10  root     1258: </p>
                   1259: 
1.1.1.5   root     1260: 
1.1.1.17  root     1261: <h4 class="gui">The Memory Dialog</h4>
1.1.1.5   root     1262: 
1.1.1.8   root     1263: <div class="floatimage">
1.1.1.17  root     1264:   <img src="images/memory.png" width="398" height="349"
                   1265:        alt="Hatari's GUI - the memory dialog" />
1.1.1.5   root     1266: </div>
                   1267: 
1.1.1.3   root     1268: <p>You can select the amount of RAM for the emulated ST here. Only
                   1269: amounts that were valid on a real unmodified STFM can be selected.</p>
                   1270: <p><em>Note:</em> This option is critical and you are strongly advised
                   1271: to reset the emulated ST
1.1       root     1272: when changing this option.</p>
1.1.1.2   root     1273: <p>Here you will find the options to save memory snapshots as well.</p>
1.1.1.3   root     1274: <p>Click on <span class="button">Save</span> to save a memory snapshot
                   1275: to file. You can select a new filename here.</p>
                   1276: <p>Click on <span class="button">Restore</span> to restore a memory
                   1277: snapshot from a file. Use the fileselector to select the snapshot to be
                   1278: restored.</p>
                   1279: <p><em>NOTE:</em> Memory snapshots are not interchangeable between
1.1.1.20  root     1280: different versions of Hatari. e.g. if you compile a newer Hatari, you
1.1.1.3   root     1281: cannot load your old memory snapshots back.</p>
                   1282: 
1.1.1.5   root     1283: 
1.1.1.17  root     1284: <h4 class="gui">The ROM Dialog</h4>
1.1.1.8   root     1285: 
                   1286: <div class="floatimage">
1.1.1.17  root     1287:   <img src="images/tos.png" width="519" height="367"
                   1288:        alt="Hatari's GUI - the ROM dialog" />
1.1.1.5   root     1289: </div>
                   1290: 
1.1.1.3   root     1291: <p>Here you can select the TOS image to use. Click on <span
1.1.1.5   root     1292:  class="button">Browse</span> to select it via the fileselector.
1.1.1.3   root     1293: You can also select an optional cartridge image to use. Click on <span
1.1.1.4   root     1294:  class="button">Browse</span> to select one via the fileselector. Click on <span
1.1.1.5   root     1295:  class="button">Eject</span> to disconnect the custom cartridge image.
                   1296: </p>
1.1.1.7   root     1297: <p>
                   1298: For ST mode, use TOS 1.00, 1.02, 1.04 or 2.06.
                   1299: For STE mode, use TOS 1.06, 1.62, 2.05 or 2.06.
                   1300: If you want to use the TT mode, you must specify a TOS 3.06 image here.
                   1301: And in Falcon mode, you have to use either TOS 4.00, 4.02, 4.04 or 4.92.
                   1302: However, you should always use TOS 4.04 for Falcon mode, it's the most common one.
1.1.1.20  root     1303: Also note that TOS 4.92 cannot be booted from a boot disk (like it's done on a
1.1.1.7   root     1304: real Falcon), you have to specify it directly in the TOS ROM setup dialog here.
                   1305: </p>
                   1306: <p>
                   1307: Keep in mind that any custom cartridge image will not work together with
1.1.1.18  root     1308: GEMDOS HD emulation or the VDI extended resolution emulation
1.1.1.3   root     1309: since some additional driver code will be used in the cartridge memory
1.1.1.7   root     1310: space for these emulations.
                   1311: </p>
                   1312: <p>
                   1313: <em>Note:</em> These options are critical and you are strongly
1.1.1.3   root     1314: advised to reset the emulated ST
1.1.1.7   root     1315: when changing one of these option.
                   1316: </p>
1.1.1.5   root     1317: 
1.1.1.8   root     1318: 
1.1.1.17  root     1319: <h4 class="gui">The Joystick Dialog</h4>
1.1.1.5   root     1320: 
                   1321: <div class="floatimage">
1.1.1.17  root     1322:   <img src="images/joystick.png" width="320" height="288"
                   1323:        alt="Hatari's GUI - the joystick dialog" />
1.1.1.5   root     1324: </div>
                   1325: 
                   1326: <p>In this dialog, you can configure the emulated joysticks.
                   1327: With the upper two arrows, you can choose the joystick which you want to
                   1328: configure.</p>
1.1.1.3   root     1329: <p>Joystick 1 is the normal ST joystick port and 99.9% of all ST games
1.1.1.5   root     1330: use this port.
                   1331: Joystick 0 emulates a joystick plugged into the ST mouse port
                   1332: and is often used in games for two players.</p>
                   1333: <p>With STE joypad A and B, you can enable the emulation of Jaguar joypads
                   1334: which are plugged in the enhanced joystick ports of the Atari STE.
                   1335: Only very few STE games support these joypads, so you often won't need this.</p>
                   1336: <p>Finally, Hatari also emulates joysticks which were plugged on the parallel
                   1337: port with a special adapter on a real ST. These were used in some few
1.1.1.12  root     1338: multi-player games like "Gauntlet 2".</p>
1.1.1.5   root     1339: <p>For each ST joystick, choose whether you want to disable it,
                   1340: use the keyboard for emulation or use a real PC joystick.</p>
                   1341: <p>For keyboard emulation, you can select the keys by pressing the
1.1.1.10  root     1342: <span class="button">Define&nbsp;keys</span> button. You will be prompted to press
1.1.1.5   root     1343: the keys for up, down, left, right and fire.</p>
                   1344: <p>If you want to use a real PC joystick for the emulation, you should connect
                   1345: it to your PC before you start Hatari. Then you can choose the joystick with
                   1346: the two lower arrows.</p>
1.1.1.12  root     1347: <p>Check the "Enable autofire" option if you are too lazy to pound
1.1.1.5   root     1348: on the fire button in shoot'em-up games. However, this option only works with
                   1349: certain games. In some other games, it gets worse if you enable this option.</p>
                   1350: <p>See also the chapter "Emulated Joystick" for details.</p>
                   1351: 
1.1.1.8   root     1352: 
1.1.1.17  root     1353: <h4 class="gui">The Atari Monitor Dialog</h4>
1.1.1.5   root     1354: 
1.1.1.7   root     1355: <div class="floatimage">
1.1.1.17  root     1356:   <img src="images/monitor.png" width="340" height="304"
                   1357:        alt="Hatari's GUI - the Atari monitor dialog" />
1.1.1.5   root     1358: </div>
1.1       root     1359: 
1.1.1.7   root     1360: <p>
                   1361:  Here you control the video output of the emulated Atari.
                   1362: </p>
                   1363: <p>
1.1.1.12  root     1364:  You can select which sort of monitor to use. This option depends on
                   1365:  the machine type which you have selected in the "System options"
                   1366:  dialog. In ST and STE mode, you can choose between monochrome mode
                   1367:  (select "Mono") and color mode (select one of the other monitor types).
                   1368:  Note that when you select "TV" and use zoomed low resolution or
                   1369:  switch to ST medium resolution, you will get a TV-like screen rendering
                   1370:  which is a little bit faster but darker compared to the normal "RGB"
                   1371:  monitor mode. Switching between mono and a color monitor acts like a monitor
1.1.1.17  root     1372:  switch on a real ST - so beware, this will reboot your emulated system!<br />
1.1.1.12  root     1373:  In TT mode, you can only choose between TT-high resolution ("Mono")
                   1374:  and normal modes (select one of the other monitor types).
                   1375:  Finally the Falcon mode supports all four types of monitors. Note that most
1.1.1.19  root     1376:  Falcon demos/games require a RGB or TV mode, and do not work with
                   1377:  VGA, although there are also few VGA-only games and demos.
1.1.1.7   root     1378: </p>
                   1379: <p>
1.1.1.12  root     1380:  "Show ST/STE borders" toggles the displaying of the borders around the ST /
1.1.1.19  root     1381:  STE. Some demos and games use the screen borders for displaying
1.1.1.12  root     1382:  additional graphics. As enabling this option increases CPU computing time,
                   1383:  don't enable it if you have a very slow computer.
1.1.1.19  root     1384:  Borders are shown also in Falcon emulation, but Videl emulation doesn't
                   1385:  yet support palette effects.
                   1386:  This option doesn't affect TT screen mode or extended VDI resolutions.
                   1387: </p>
                   1388: <p>
                   1389: Extended VDI resolutions will emulate a sort of extended graphics card
                   1390: in the emulated machine, which gives you larger (2-16 color)
                   1391: resolutions for GEM. Select a resolution and color depth. Check to
                   1392: activate. This mode isn't affect by the other video options mentioned
                   1393: above. Uncheck to get back to a normal ST behaviour.<br />
1.1.1.7   root     1394: </p>
1.1.1.20  root     1395: <p><em>Note that there are several gotchas with extended VDI
1.1.1.19  root     1396: resolutions:</em></p>
                   1397: <ul>
                   1398: <li>Only GEM conformant applications work with them, 99% of all games
                   1399: and demos don't.</li>
                   1400: <li>Several GEM programs accessing screen directly (like NVDI) crash
                   1401: with large enough screen sizes.</li>
                   1402: <li>Memory reserved for (larger) extended resolutions breaks TOS v3 memory
                   1403: detection, so you need to interrupt boot up memory detection.</li>
                   1404: <li>TOS v4 isn't compatible with them. In Falcon emulation you need to
                   1405: use EmuTOS with extended resolutions.</li>
                   1406: </ul>
1.1.1.7   root     1407: <p>
1.1.1.19  root     1408: Because TT and Falcon support natively larger resolutions,
                   1409: VDI mode is most useful with ST / STE emulation.
1.1.1.7   root     1410: </p>
1.1.1.12  root     1411: 
                   1412: 
1.1.1.17  root     1413: <h4 class="gui">The Hatari Screen Dialog</h4>
1.1.1.12  root     1414: 
                   1415: <div class="floatimage">
1.1.1.17  root     1416:   <img src="images/screen.png" width="520" height="320"
                   1417:        alt="Hatari's GUI - the Hatari screen dialog" />
1.1.1.12  root     1418: </div>
                   1419: 
1.1.1.7   root     1420: <p>
1.1.1.12  root     1421: Here you control how the video output of the emulated Atari appears
                   1422: on your screen.
                   1423: </p>
                   1424: 
                   1425: <p>
                   1426:  Check "Fullscreen" to run Hatari in fullscreen.  By default Hatari
                   1427:  runs in windowed mode.
1.1.1.7   root     1428: </p>
                   1429: <p>
1.1.1.12  root     1430:  The "Frame Skip" option can be used to speed up the emulator
1.1.1.8   root     1431:  if it is running too slow on your system. Disable frame-skip if you have
                   1432:  a fast computer. When selecting 1, 2 or 4, drawing of corresponding number
                   1433:  of frames will be skipped after each frame actually shown by Hatari.
1.1.1.12  root     1434:  Select "Auto" to let the emulator to decide whether, and
1.1.1.17  root     1435:  how many frames will be skipped.<br />
1.1.1.8   root     1436:  <em>Note:</em> The frameskip option also affects the frame rate of the
                   1437:  screen animation recording!
1.1.1.7   root     1438: </p>
                   1439: <p>
1.1.1.13  root     1440: Indicators that you can have on the Hatari window:
1.1.1.7   root     1441: </p>
1.1.1.13  root     1442: <ul>
                   1443: <li>"Statusbar" at the bottom of the screen.
                   1444: The statusbar shows the floppy drive LEDs, the current frameskip value,
                   1445: the machine type including TOS version and memory size, and whether
                   1446: recording is currently active.</li>
                   1447: <li>"Drive led" is a colored rectangle shown on top of the Hatari window
1.1.1.18  root     1448: contents. It will show any disk (floppy or hard drive) activity.</li>
1.1.1.13  root     1449: <li>"None" turns both of above options off.</li>
                   1450: </ul>
                   1451: <p>
                   1452: "Keep desktop resolution" option will use your desktop resolution
                   1453: for fullscreen to avoid issues related to resolution switching,
                   1454: especially on LCD monitors (they're slow).  If this isn't enabled,
                   1455: values from the "Max zoomed win" option are used in selecting
                   1456: a suitable resolution.
1.1.1.7   root     1457: <p>
1.1.1.13  root     1458: "Max zoomed win" option controls up to which size Hatari tries to scale
1.1.1.12  root     1459: the Atari resolutions and how much of the borders (enabled in Atari
1.1.1.13  root     1460: Monitor dialog) will be shown.  Note that there are several limitations
                   1461: in this and the "Keep desktop resolution" option, partly because Hatari
                   1462: has different implementations for different video modes:
1.1.1.7   root     1463: </p>
1.1.1.12  root     1464: <ul>
                   1465: <li>VDI resolutions (selectable in Atari Monitor dialog) aren't scaled.</li>
                   1466: <li>ST and STE video emulation supports only doubling of the ST-low
                   1467:     resolution.</li>
                   1468: <li>Hatari doesn't support downscaling. If the original Atari resolution
1.1.1.13  root     1469:     is larger than the specified size (e.g. TT-high), the Hatari screen
                   1470:     size will also be larger than requested.  Hatari Falcon/TT window size
                   1471:     will be limited to the Desktop size though.</li>
1.1.1.12  root     1472: <li>TT and Falcon resolutions support only <em>integer</em> scaling ratios.
                   1473:     If the scaling ratio cannot match the requested size exactly, Hatari
                   1474:     will use a ratio that will produce smaller size closest to the
                   1475:     requested one.</li>
                   1476: </ul>
                   1477: <p>
                   1478: You should set these values to a size that suits best your monitor
                   1479: resolution. It's intended to help in getting Hatari to best use your
                   1480: monitor space on a windowed mode and in fullscreen avoiding "fuzzy"
1.1.1.13  root     1481: scaling done by your LCD monitor.
1.1.1.12  root     1482: </p>
                   1483: <p>
                   1484: Giving "-z 2" option on command line will reset max zoomed size to
                   1485: default values and "-z 1" will disable all zooming.
                   1486: Note that zooming takes additional CPU computing time and should
                   1487: not be enabled on very slow computers.
                   1488: </p>
                   1489: <p>Click the <span class="button">Screenshot</span> button to create
                   1490: a screenshot in PNG (or BMP) format to the current working directory
                   1491: or click the <span class="button">Record&nbsp;AVI</span> button to
1.1.1.13  root     1492: record an AVI format video of Hatari screen (and audio) output.
                   1493: </p>
                   1494: <p>
                   1495: Selecting "Crop statusbar" option will leave statusbar out from
                   1496: the screenshots and recorded videos.
1.1       root     1497: </p>
1.1.1.8   root     1498: 
1.1.1.17  root     1499: <h4 class="gui">The Keyboard Dialog</h4>
1.1.1.5   root     1500: 
                   1501: <div class="floatimage">
1.1.1.20  root     1502:   <img src="images/keyboard.png" width="460" height="384"
1.1.1.17  root     1503:        alt="Hatari's GUI - the keyboard dialog" />
1.1.1.5   root     1504: </div>
                   1505: 
                   1506: <p>Here you can select the keyboard mapping to use. Two different mappings
1.1.1.12  root     1507:  called "Symbolic" and "Scancode" are predefined.</p>
                   1508: <p>"Symbolic" tries to map the symbolic values of your PC keys
1.1.1.5   root     1509:  to the ST keys. It should be working pretty good on all systems as long
1.1.1.20  root     1510:  as your keyboard layout looks close to the standard English keyboard
1.1.1.5   root     1511:  layout. However, you might experience some problems with special keys like
                   1512:  brackets etc.</p>
1.1.1.21! root     1513: <p>"Scancode" uses the scancode values of your PC keys for keyboard mapping.
        !          1514:  This only works on certain architectures like Linux where the scancodes are
        !          1515:  similar to the ST scancodes (e.g. it does not work on macOS with SDL1.2).
1.1.1.5   root     1516:  If it works on your system, this often gives better results than the symbolic
                   1517:  mapping. Note that you also need a TOS version with the right language
                   1518:  (e.g. use a French TOS if you are using a French keyboard).</p>
                   1519: <p>You can also load a custom keyboard mapping file here if you wish. Please
1.1.1.12  root     1520:  note that the custom keyboard mapping will use the "symbolic"
1.1.1.6   root     1521:  mapping for all keys that are not defined by your map file. Have a look
                   1522:  at the supplied example mapfile (keymap-sample.txt) to see how to create
                   1523:  your own keyboard mapping.</p>
1.1.1.8   root     1524: <p>
1.1.1.20  root     1525:  The "Shortcuts" section can be used to configure the keyboard shortcuts
                   1526:  that can be activated while the emulation is running. Hatari supports
                   1527:  two sets of keyboard shortcuts: The first type is activated by pressing a
1.1.1.21! root     1528:  modifier key (AltGr / right Alt by default, Cmd key on macOS) together with
        !          1529:  the key, and the second type is directly activated by pressing a single key,
        !          1530:  without additional modifier key.
1.1.1.20  root     1531:  Use the arrow buttons to select the shortcut that you want to change,
                   1532:  then press one of the <span class="button">Define</span> buttons to
                   1533:  change the key for the shortcut. You'll be prompted to press the key
                   1534:  that should be used.
                   1535:  If you reconsider and don't want to change the key, you can press the
                   1536:  left mouse button instead. By pressing the right mouse button during
                   1537:  the prompt, you can also erase the current shortcut setting.
                   1538: </p>
                   1539: <p>
                   1540:  The last setting in this dialog can be used to disable the key repetition
                   1541:  in fast forward mode. When the emulator runs in fast forward mode, and you
                   1542:  want to type text, it can be annoying that the emulated system detects
                   1543:  multiple key events due to the key repetition of the emulated system.
                   1544:  So this can be avoided by enabling this option.
1.1.1.8   root     1545: </p>
1.1.1.5   root     1546: 
                   1547: 
1.1.1.17  root     1548: <h4 class="gui">The Sound Dialog</h4>
1.1.1.8   root     1549: 
                   1550: <div class="floatimage">
1.1.1.17  root     1551:   <img src="images/sound.png" width="400" height="400"
                   1552:        alt="Hatari's GUI - the sound dialog" />
1.1.1.5   root     1553: </div>
                   1554: 
1.1.1.2   root     1555: <p>Here you can control the sound subsystem.</p>
1.1.1.16  root     1556: <p>Check "Enabled" if you want emulated sound at all. Emulation is faster if
1.1.1.3   root     1557: sound emulation is turned off.</p>
1.1.1.16  root     1558: <p>If you experiment latency issues with your OS audio's output, you
                   1559: can check the "Synchronize" option to adjust Hatari's video emulation to match
                   1560: your OS audio.</p>
1.1.1.10  root     1561: <p>
                   1562:  Nine frequencies from low to high quality are available. Experiment a
                   1563:  little bit to find out which fits best for your setup.
                   1564:  For most modern computers, 44100 Hz or 48000 Hz should be fine.
                   1565:  For older or slower host systems, you should use a lower frequency.
                   1566:  12517, 250033 and 50066 Hz are frequencies supported by
                   1567:  the STE/TT/Falcon sound DMA.
                   1568: </p>
                   1569: <p>
1.1.1.16  root     1570: YM voices volume mixing "ST table" method uses a lookup table of audio output
                   1571: voltage values measured on STF, "Math model" uses a complex model to mix the
                   1572: 3 YM voices and "Linear" just averages the 3 YM voices. Use "ST table" or "Math model"
                   1573: for accurate sound's emulation.
1.1.1.13  root     1574: </p>
                   1575: <p>
1.1.1.10  root     1576:  You can select to record a piece of sound here.
                   1577:  Use the <span class="button">Browse</span> button to choose a file.
                   1578:  The file name extension that you use (.WAV or .YM) determines in which format
                   1579:  the sound is recorded in. The <span class="button">Record&nbsp;sound</span> button
                   1580:  is a toggle so you will need to return to the GUI to switch sound recording off
                   1581:  again (or to use the keyboard shortcut for that).
                   1582: </p>
1.1.1.5   root     1583: 
                   1584: 
1.1.1.17  root     1585: <h4 class="gui">The Devices Dialog</h4>
1.1.1.5   root     1586: 
1.1.1.8   root     1587: <div class="floatimage">
1.1.1.17  root     1588:   <img src="images/devices.png" width="520" height="383"
                   1589:        alt="Hatari's GUI - the device dialog" />
1.1.1.5   root     1590: </div>
                   1591: 
1.1.1.17  root     1592: <p>Check the first checkmark to enable printer support.
                   1593: See the <a href="#Emulated_printer">Emulated printer</a> section for
1.1.1.10  root     1594: details.</p>
1.1.1.8   root     1595: 
1.1.1.3   root     1596: <p>As Hatari currently only supports printing to file, click on <span
1.1.1.10  root     1597:  class="button">Browse</span> to select the file to print to. You can
1.1.1.3   root     1598: enter a new filename as well.</p>
1.1.1.17  root     1599: <p>Check the second checkmark to enable RS232 support.
1.1.1.10  root     1600: The RS232 device is configured according to the settings of
1.1.1.3   root     1601: the emulated RS232 of the Atari ST. This means Hatari will
                   1602: automatically use baudrate and handshaking as configured for the
                   1603: emulated ST.</p>
1.1.1.10  root     1604: <p>Click on <span class="button">Browse</span> to select suitable
                   1605: device files for serial input and output.  On Linux a good choice is
                   1606: /dev/ttyS0 or /dev/ttyS1.
                   1607: </p>
1.1.1.17  root     1608: <p>Check the third checkmark to enable MIDI support.
1.1.1.10  root     1609: Click on <span class="button">Browse</span> to select a suitable
                   1610: MIDI device files for MIDI input and output.</p>
                   1611: <p><span class="file">midi-linux.txt</span> file explains how to
1.1.1.12  root     1612: select the correct MIDI device file, how to set up software sound
1.1.1.20  root     1613: synthesizing on Linux (using Alsa) if your sound card/driver doesn't
1.1.1.12  root     1614: support MIDI, and how to set up MIDI networking e.g. between multiple
1.1.1.10  root     1615: Hatari instances.
1.1.1.2   root     1616: </p>
1.1.1.5   root     1617: 
1.1.1.8   root     1618: 
1.1.1.19  root     1619: <h3 class="clearboth">Keyboard shortcuts for the SDL GUI</h3>
                   1620: 
                   1621: <p>There are multiple ways to interact with the SDL GUI.</p>
                   1622: 
                   1623: <p>TAB and cursor keys change focus between UI elements.  Additionally
                   1624: Home key moves focus to first item, End key to last one.  Initially
                   1625: focus is on default UI element, but focus changes are remembered
                   1626: between dialog invocations. Enter and Space invoke focused item. UI
                   1627: elements with underlined characters can be invoked directly with Alt +
                   1628: key with that character.  Alt + arrow keys will act on arrow
                   1629: buttons.</p>
                   1630: 
                   1631: <p>Most importantly:</p>
                   1632: <ul>
                   1633: <li><em>Options GUI main view</em>: Enter accepts configuration, ESC
                   1634: cancels it.</li>
                   1635: <li><em>Options GUI dialogs</em>: Enter (or End+Enter if focus was moved)
                   1636: returns back to main view.</li>
                   1637: <li><em>Fileselector</em>: Page up and down keys scroll the file list.
                   1638: Enter on focused file name selects it.  Enter on OK button accepts
                   1639: the selected file. ESC cancels the dialog/selection.</li>
                   1640: <li><em>Alert dialogs</em>: Enter accepts and ESC cancels the dialog.</li>
                   1641: </ul>
                   1642: 
                   1643: 
                   1644: <h3>Keyboard shortcuts during emulation</h3>
1.1.1.5   root     1645: 
1.1       root     1646: <p> While the emulator is running, you can activate or toggle various
1.1.1.20  root     1647: features via Hatari keyboard shortcuts. Most of them require the
                   1648: <a href="http://en.wikipedia.org/wiki/AltGr_key">AltGr</a> (right Alt)
1.1.1.21! root     1649: modifier key. On Mac macOS, the Cmd key &#8984; is used instead.
1.1.1.20  root     1650: Below are listed the default shortcut key bindings:</p>
1.1.1.18  root     1651: <table class="keytable">
1.1.1.17  root     1652:   <thead>
1.1       root     1653:     <tr class="backdropped">
1.1.1.17  root     1654:       <th>Shortcut</th>
                   1655:       <th>Purpose</th>
1.1       root     1656:     </tr>
1.1.1.17  root     1657:   </thead>
                   1658:   <tbody>
1.1       root     1659:     <tr>
1.1.1.20  root     1660:       <td><span class="key">AltGr+a</span></td>
1.1.1.17  root     1661:       <td>record animation</td>
1.1.1.2   root     1662:     </tr>
                   1663:     <tr>
1.1.1.20  root     1664:       <td><span class="key">AltGr+g</span></td>
1.1.1.17  root     1665:       <td>grab a screenshot</td>
1.1       root     1666:     </tr>
                   1667:     <tr>
1.1.1.20  root     1668:       <td><span class="key">AltGr+i</span></td>
1.1.1.17  root     1669:       <td>boss key: leave full screen mode, pause Hatari
                   1670:           and iconify its window</td>
1.1.1.2   root     1671:     </tr>
                   1672:     <tr>
1.1.1.20  root     1673:       <td><span class="key">AltGr+m</span></td>
1.1.1.17  root     1674:       <td>(un-)lock the mouse into the window</td>
1.1       root     1675:     </tr>
                   1676:     <tr>
1.1.1.20  root     1677:       <td><span class="key">AltGr+r</span></td>
1.1.1.17  root     1678:       <td>(warm) reset the ST</td>
1.1       root     1679:     </tr>
                   1680:     <tr>
1.1.1.20  root     1681:       <td><span class="key">AltGr+c</span></td>
1.1.1.21! root     1682:       <td>cold reset the ST (same as the original power switch)</td>
1.1       root     1683:     </tr>
                   1684:     <tr>
1.1.1.20  root     1685:       <td><span class="key">AltGr+d</span></td>
1.1.1.17  root     1686:       <td>open dialog to select/change disk A</td>
1.1.1.8   root     1687:     </tr>
                   1688:     <tr>
1.1.1.20  root     1689:       <td><span class="key">AltGr+s</span></td>
1.1.1.17  root     1690:       <td>enable/disable sound</td>
1.1.1.2   root     1691:     </tr>
                   1692:     <tr>
1.1.1.20  root     1693:       <td><span class="key">AltGr+q</span></td>
1.1.1.17  root     1694:       <td>quit the emulator</td>
1.1       root     1695:     </tr>
                   1696:     <tr>
1.1.1.20  root     1697:       <td><span class="key">AltGr+x</span></td>
1.1.1.17  root     1698:       <td>toggle normal speed/fast forward</td>
1.1.1.2   root     1699:     </tr>
                   1700:     <tr>
1.1.1.20  root     1701:       <td><span class="key">AltGr+y</span></td>
1.1.1.17  root     1702:       <td>enable/disable sound recording</td>
1.1.1.2   root     1703:     </tr>
                   1704:     <tr>
1.1.1.20  root     1705:       <td><span class="key">AltGr+k</span></td>
1.1.1.17  root     1706:       <td>save memory snapshot</td>
1.1.1.7   root     1707:     </tr>
                   1708:     <tr>
1.1.1.20  root     1709:       <td><span class="key">AltGr+l</span></td>
1.1.1.17  root     1710:       <td>load memory snapshot</td>
1.1.1.7   root     1711:     </tr>
                   1712:     <tr>
1.1.1.20  root     1713:       <td><span class="key">AltGr+j</span></td>
1.1.1.19  root     1714:       <td>toggle joystick emulation via cursor keys
                   1715:           on/off between ports 0 and 1</td>
                   1716:     </tr>
                   1717:     <tr>
1.1.1.20  root     1718:       <td><span class="key">AltGr+F1</span></td>
1.1.1.19  root     1719:       <td>switch joystick type on joy port 0</td>
                   1720:     </tr>
                   1721:     <tr>
1.1.1.20  root     1722:       <td><span class="key">AltGr+F2</span></td>
1.1.1.19  root     1723:       <td>switch joystick type on joy port 1</td>
                   1724:     </tr>
                   1725:     <tr>
1.1.1.20  root     1726:       <td><span class="key">AltGr+F3</span></td>
1.1.1.19  root     1727:       <td>switch joystick type for joypad A</td>
                   1728:     </tr>
                   1729:     <tr>
1.1.1.20  root     1730:       <td><span class="key">AltGr+F4</span></td>
1.1.1.19  root     1731:       <td>switch joystick type for joypad B</td>
                   1732:     </tr>
                   1733:     <tr>
1.1.1.21! root     1734:       <td><span class="key">AltGr+b</span></td>
        !          1735:       <td>toggle borders on/off</td>
        !          1736:     </tr>
        !          1737:     <tr>
1.1.1.20  root     1738:       <td><span class="key">AltGr+f or F11</span></td>
1.1.1.17  root     1739:       <td>toggle between fullscreen and windowed mode</td>
1.1       root     1740:     </tr>
                   1741:     <tr>
1.1.1.20  root     1742:       <td><span class="key">AltGr+o or F12</span></td>
1.1.1.17  root     1743:       <td>activate the options GUI</td>
1.1       root     1744:     </tr>
                   1745:     <tr>
1.1.1.20  root     1746:       <td><span class="key">Pause</span></td>
1.1.1.17  root     1747:       <td>pause emulation</td>
1.1.1.10  root     1748:     </tr>
                   1749:     <tr>
1.1.1.20  root     1750:       <td><span class="key">AltGr+Pause</span></td>
1.1.1.17  root     1751:       <td>invoke the internal Hatari debugger</td>
1.1       root     1752:     </tr>
                   1753:   </tbody>
                   1754: </table>
1.1.1.5   root     1755: 
1.1.1.6   root     1756: <p>You can change the key bindings from the Hatari configuration file.
1.1.1.19  root     1757: See keymap-sample.txt file for instructions.</p>
1.1.1.6   root     1758: 
                   1759: 
1.1.1.17  root     1760: <h3>Emulated Atari ST keyboard</h3>
1.1.1.5   root     1761: 
1.1       root     1762: <p> All other keys on the keyboard act as the normal Atari ST keys so
                   1763: pressing SPACE on your PC will result in an emulated press of the SPACE
                   1764: key on the ST. The following keys have special meanings: </p>
1.1.1.17  root     1765: 
                   1766: <table class="keytable">
                   1767:   <thead>
1.1       root     1768:     <tr class="backdropped">
1.1.1.17  root     1769:       <th>Key</th>
                   1770:       <th>Meaning</th>
1.1       root     1771:     </tr>
1.1.1.17  root     1772:   </thead>
                   1773:   <tbody>
1.1       root     1774:     <tr>
1.1.1.17  root     1775:       <td><span class="key">Alt</span></td>
                   1776:       <td>will act as the ST's ALTERNATE key</td>
1.1       root     1777:     </tr>
                   1778:     <tr>
1.1.1.17  root     1779:       <td><span class="key">left CTRL</span></td>
                   1780:       <td>will act as the ST's CONTROL key</td>
1.1       root     1781:     </tr>
                   1782:     <tr>
1.1.1.17  root     1783:       <td><span class="key">Print Screen</span></td>
                   1784:       <td>will emulate the ST's HELP key</td>
1.1       root     1785:     </tr>
                   1786:     <tr>
1.1.1.17  root     1787:       <td><span class="key">Scroll Lock</span></td>
                   1788:       <td>will emulate the ST's UNDO key</td>
1.1       root     1789:     </tr>
1.1.1.2   root     1790:     <tr>
1.1.1.17  root     1791:       <td><span class="key">Page Up</span></td>
                   1792:       <td>will emulate the ST's ( key in the keypad</td>
1.1.1.2   root     1793:     </tr>
                   1794:     <tr>
1.1.1.17  root     1795:       <td><span class="key">Page Down</span></td>
                   1796:       <td>will emulate the ST's ) in the keypad</td>
1.1.1.2   root     1797:     </tr>
1.1       root     1798:   </tbody>
                   1799: </table>
1.1.1.5   root     1800: 
1.1.1.8   root     1801: <p>If joystick emulation via keyboard is enabled, by default cursor keys
                   1802: are used for the directions and <span class="key">right CTRL</span> key
                   1803: as the fire button. Otherwise they act as corresponding keys of the emulated
                   1804: Atari ST.</p>
                   1805: 
1.1.1.20  root     1806: <p>NOTE: Problems with simultaneous keypresses most likely aren't an
1.1.1.12  root     1807: issue in Hatari as many modern keyboards report/support only three
1.1.1.20  root     1808: simultaneous key presses (or even just two depending on which keys
1.1.1.12  root     1809: are in question).  Expensive gaming keyboards support more.</p>
                   1810: 
1.1.1.5   root     1811: 
1.1.1.17  root     1812: <h3>Emulated mouse</h3>
1.1.1.5   root     1813: 
1.1       root     1814: <p>For obvious reasons your PC mouse will act as the emulated Atari ST
                   1815: mouse. In fullscreen mode it will act as expected, directly controlling
                   1816: the ST mouse pointer. </p>
1.1.1.17  root     1817: <p>However it is a little bit different in windowed mode as
                   1818: mouse cursor positions between host and emulated Atari can get
                   1819: out of sync. This can be worked around by constraining the mouse
1.1.1.20  root     1820: to the Hatari window. Pressing the <span class="key">AltGr+m</span>
1.1.1.10  root     1821: hotkey combination or starting Hatari with the
1.1.1.17  root     1822: <span class="commandline">--grab</span> command line option
                   1823: grabs the mouse i.e. locks its movements to the Hatari window.
1.1.1.10  root     1824: Press the shortcut key (again) to go back to normal mouse behaviour
1.1.1.20  root     1825: which allows you to move mouse outside the Hatari window while
1.1.1.10  root     1826: Hatari is up and running. Note: pausing the emulation will also
                   1827: (temporarily) release the mouse grab.</p>
1.1.1.19  root     1828: <p>Middle button click emulates double click, which is very useful
                   1829: in Fast Forward mode (where normal double clicking is nearly
                   1830: impossible).</p>
1.1.1.6   root     1831: <p>Mouse scrollwheel will act as cursor up and down keys. </p>
1.1.1.5   root     1832: 
1.1.1.17  root     1833: <h3>Emulated joystick</h3>
1.1.1.5   root     1834: 
1.1.1.20  root     1835: <p>The Atari ST joysticks are emulated of course allowing you to play
1.1       root     1836: your favourite games with Hatari. </p>
                   1837: <p>The default mode is to use a connected PC joystick. You can use any
1.1.1.19  root     1838: joystick that is supported by your kernel / SDL library. If your joystick works
                   1839: with other applications, it will likely work with Hatari as well. Make sure
1.1       root     1840: it is calibrated and then off you go. Move the stick to point into the
                   1841: desired direction. Please note that Hatari will not detect analogue
                   1842: movement as the Atari ST only had digital joysticks. The first
1.1.1.3   root     1843: firebutton will act as the normal firebutton on the Atari ST while the
                   1844: second
                   1845: firebutton will emulate a keypress of the <span class="key">SPACE</span>
                   1846: key on the ST as many ST
1.1.1.8   root     1847: games utilize the SPACE bar for secondary game functions. (Xenon for
1.1.1.3   root     1848: example)</p>
1.1       root     1849: <p>If you do not have a PC joystick or joypad, then you do not need to
                   1850: desperate. You can emulate one of the two Atari ST joysticks via the
                   1851: cursor keys. Just activate it in the GUI. Then the cursor keys will act
                   1852: as the joystick directions, the right CTRL key will act as the
                   1853: firebutton. You can still use the cursor keys as the ST's
1.1.1.3   root     1854: cursorkeys in this mode as long as you press <span class="key">SHIFT</span>
1.1.1.8   root     1855: along with the cursorkeys.  You can also configure these keys from the
                   1856: joystick options.</p>
1.1.1.5   root     1857: 
1.1.1.17  root     1858: <h3>Emulated video</h3>
1.1.1.5   root     1859: 
1.1.1.8   root     1860: <p>Hatari emulates all screen modes of the original machine.</p>
                   1861: <p>
                   1862: ST/STE shifter overscan effects are emulated, but due to the fact
                   1863: that these effects are achieved by using quirks and glitches in the
                   1864: original chips to do things beyond their specification, emulation is
                   1865: a bit tricky for these effects. As a result, some demos using these
                   1866: techniques might not be displayed correctly in Hatari, known ones are
                   1867: listed in the <span class="file">compatibility.html</span> file.
1.1.1.3   root     1868: </p>
                   1869: <p>Beside that you can setup extended VDI modes. These only work with
                   1870: GEM-compliant applications and they are equal to fitting a videocard
                   1871: into your Mega ST.</p>
                   1872: <p>Make sure to disable extended VDI modes for playing games as 99% of
                   1873: all ST games will not be able to make use of higher resolutions.</p>
1.1.1.5   root     1874: 
1.1.1.17  root     1875: <h3 id="Emulated_printer">Emulated printer</h3>
1.1.1.5   root     1876: 
1.1.1.17  root     1877: <p>Due to the fact that printer handling is different on Atari and
                   1878: current machines, emulation of the printer is achieved by writing all
                   1879: printer output to a file.</p>
1.1.1.3   root     1880: <p>The file will contain a sequence of data, the same that would appear
                   1881: on the data pins of the Atari ST printer port.
                   1882: That would include control characters and commands for graphic
                   1883: printing. Clicking "Print desktop" on the GEM desktop would result
1.1.1.2   root     1884: in a messy data dump in the printer output.</p>
1.1.1.3   root     1885: <p>Printer emulation works best for plain text files or programs that
                   1886: do not format the output for a specific printer.
                   1887: The file contents can be used with your favourite text editor for
                   1888: further processing and printing to a real printer.</p>
1.1.1.17  root     1889: <p>To get real direct printing out of Hatari you may set up a suitable
                   1890: (e.g. PostScript) GDOS or NVDI printer driver on the emulated Atari and
                   1891: set your printer device file as Hatari's printer output.<br />
                   1892: <em>NOTE:</em> If the driver doesn't match or there's some other problem,
                   1893: this can cause your printer to print out hundreds of pages of garbage.</p>
1.1.1.5   root     1894: 
1.1.1.17  root     1895: <h3>Emulated RS232</h3>
1.1.1.5   root     1896: 
1.1.1.3   root     1897: <p>Serial communications in Hatari is designed to directly use a serial
                   1898: port on your PC.</p>
                   1899: <p>Communications parameters are set automatically upon the settings of
                   1900: the emulated ST. This means all you do is to set
                   1901: the communication parameters like baudrate from your ST communications
                   1902: software. Hatari will do the rest and handle
1.1.1.2   root     1903: the serial input and output for you.</p>
1.1.1.5   root     1904: 
1.1.1.17  root     1905: <h2 id="Floppy_disk_images">Floppy disk images</h2>
1.1.1.5   root     1906: 
1.1       root     1907: <p>Hatari does not use floppy disks directly but disk images due to
                   1908: differences between the floppy disk controllers of the ST and the PC.
1.1.1.18  root     1909: Several types of disk images are currently supported :
                   1910: </p>
                   1911: 
                   1912: <ul>
                   1913: <li>
                   1914: the raw "ST" type
                   1915: </li>
                   1916: <li>
                   1917: the similar "DIM" type (not widely used)
                   1918: </li>
                   1919: <li>
                   1920: the compressed "MSA" (Magic-Shadow-Archiver) type
                   1921: </li>
                   1922: <li>
                   1923: the "STX" type that can store low level disk layout. This format is mainly
                   1924: used to dump original games with their protection. Those images are created
                   1925: on a real ST using pasti.prg
                   1926: </li>
                   1927: <li>
                   1928: the "IPF", "RAW" and "CTR" types require the caps library. Similar to STX, they
                   1929: record disk layout, but at a much precise level by storing MFM data. Most of
                   1930: these dumps are made with the Kryoflux board
                   1931: </li>
                   1932: </ul>
                   1933: 
1.1       root     1934: <p> The raw type (file suffix should be "*.st") is simply a sector by
                   1935: sector image of a real floppy disk. You can easily create such an image
1.1.1.3   root     1936: with the <span class="commandline">dd</span> program which should
                   1937: normally be pre-installed on every
                   1938: Unix-like system. Simply type something like <span class="commandline">dd
                   1939: if=/dev/fd0 of=myimage.st</span> to create a disk image. Of course you
                   1940: need access to
1.1       root     1941: /dev/fd0, and depending on your system and the type of floppy disk you
                   1942: might have to use another device name here (for example I use
1.1.1.3   root     1943: /dev/fd0u720 for 720kB disks). However, if the disk is copy-protected
                   1944: or
1.1       root     1945: doesn't use a MSDOS compatible file system, this might fail. So be very
1.1.1.10  root     1946: careful if you are not sure about the disk format. </p>
1.1.1.3   root     1947: <p> The other possibility is to image the disk on a real Atari ST.
1.1.1.18  root     1948: For non-protected disk, there
1.1       root     1949: are programs like the Magic Shadow Archiver for this task. Hatari
1.1.1.3   root     1950: supports this slightly compressed MSA disk images, too. Note that
                   1951: Hatari
                   1952: only supports the "old" MSA format, there are some Magic Shadow
                   1953: Archiver
1.1       root     1954: clones (like Jay-MSA) that create better compressed but
1.1.1.2   root     1955: Hatari-incompatible disk images. However, if you have got such a MSA
1.1.1.3   root     1956: disk and want to use it with Hatari, you can still run the
                   1957: corresponding
1.1.1.2   root     1958: MSA program within Hatari to extract the incompatible disk image to a
1.1.1.18  root     1959: normal floppy disk image.
                   1960: <p>
                   1961: For protected disk, the most widely used method is to run pasti.prg on
                   1962: a real Atari ST and get a .STX image.
                   1963: <br>
                   1964: For more complex protections or altered disk, one can use *.IPF or *.CTR
                   1965: which include tools to check MFM data and possible problems when dumping a disk.
                   1966: </p>
                   1967: <p> While *.ST, *.MSA and *.STX are more or less the "standard" types of Atari
1.1.1.2   root     1968: disk images, you might sometimes also find STT or ADF images on the
1.1.1.3   root     1969: internet. These currently do not work with Hatari. </p>
                   1970: <p>Hatari can now also utilize *.DIM images just as *.ST ones without
                   1971: any problems.
1.1.1.2   root     1972: Note that DIM images are nearly the same as the raw ST images
1.1.1.3   root     1973: (they only have an additional 32 bytes header), so you can easily
                   1974: transform
1.1.1.2   root     1975: the DIM images into ST images by stripping the header from the files.
                   1976: For example try something like:
                   1977: <span class="commandline">dd if=input.dim of=output.st bs=32 skip=1</span>
                   1978: </p>
1.1       root     1979: <p> If you've got a disk image that has been created with the old ST
                   1980: emulator PaCifiST (for DOS) or with early versions of the program
                   1981: Makedisk, and the disk image does not work with Hatari, then the disk
1.1.1.3   root     1982: probably suffers from the "PaCifiST bootsector bug" (Hatari will
                   1983: display a
1.1       root     1984: warning message then). In this case, the bootsector of the disk
                   1985: contains some illegal data, so that the disk even does not work on a
                   1986: real ST any more. However, if it is a .ST and not a .MSA disk, you can
1.1.1.3   root     1987: easily fix it by using a hex-editor to change the byte at offset $D
                   1988: (13)
1.1       root     1989: from 0 to 1 (don't forget to backup your disk image first, since you
                   1990: can also easily destroy your disk image when changing a wrong byte
                   1991: there). If the disk contains a bootsector program, you probably have to
                   1992: adjust the boot sector check sum, too (it can be found at offset $1FE +
                   1993: $1FF). </p>
1.1.1.2   root     1994: <p>Hatari supports disk images that are compressed with (Pk-)ZIP
                   1995: (file suffix must be ".zip") or GZip (file suffix must be ".st.gz" or
1.1.1.3   root     1996: ".msa.gz"), so you can archive your disk images into zip archives.
1.1.1.2   root     1997: You can also directly run the zip archives you may download from the
                   1998: net as long as the archive contains a disk image in .ST or .MSA format.</p>
1.1.1.3   root     1999: <p><em>Note:</em> Hatari does not save disk images back to *.ZIP files
                   2000: so
1.1.1.2   root     2001: your highscores and savegames are lost if you load the game from such
                   2002: a zipped disk image.</p>
1.1.1.5   root     2003: 
1.1.1.10  root     2004: 
1.1.1.17  root     2005: <h2>Hard disk support</h2>
1.1.1.5   root     2006: 
1.1.1.8   root     2007: <p>
1.1.1.18  root     2008: Hatari supports three ways of emulating Atari hard drives: The
                   2009: low-level ACSI and IDE hard drive emulation and a GEMDOS based HD
                   2010: emulation. In most cases the GEMDOS HD emulation is best as it allows
1.1.1.10  root     2011: exchanging files easily between the emulated and the host environment.
                   2012: </p>
                   2013: <p>
                   2014: Please note that changing the HD-image or the GEMDOS HD-folder will reset
1.1.1.18  root     2015: the emulated Atari since it is not possible to switch the hard drive
1.1.1.8   root     2016: while the emulator is running.
                   2017: </p>
1.1.1.12  root     2018: <p>
                   2019: On a 32-bit host system, the size of a hard disk image is limited to 2 GB.
1.1.1.14  root     2020: On 64-bit host systems, bigger images might be possible but the support
1.1.1.18  root     2021: for bigger images is not tested very well yet.
                   2022: </p>
                   2023: <p>
                   2024: The maximum size of partitions inside the hard disk (images) depends on the
                   2025: TOS version. TOS 1.00 and 1.02 support up to 256 MB, TOS 1.04 to 3.06 up to
1.1.1.19  root     2026: 512 MB and TOS 4.0x supports up to 1 GB partitions.
                   2027: </p>
                   2028: <p>
                   2029: NOTE: you need to be careful when mounting device files.  Depending on
                   2030: the system setup (e.g. udev settings) partitions on memory cards etc.
                   2031: can be mounted automatically. When Hatari is started and uses a device
                   2032: file with partitions that are already mounted, data can be destroyed
                   2033: (when several programs independently write to the same device).
                   2034: Disable your desktop automount, or remember to manually unmount
                   2035: devices before giving them to Hatari.
1.1.1.12  root     2036: </p>
1.1.1.6   root     2037: 
1.1.1.19  root     2038: 
1.1.1.18  root     2039: <h3>GEMDOS based hard drive emulation</h3>
1.1.1.12  root     2040: <p>
1.1.1.20  root     2041: With GEMDOS HD emulation, you can easily "mount" a folder from the
1.1.1.18  root     2042: host file system to a drive of the emulated Atari.
1.1.1.12  root     2043: </p>
                   2044: <p>
1.1.1.17  root     2045: If you provide Hatari a directory containing only single letter (C-Z)
                   2046: subdirectories, each of these subdirectories will be treated as a
                   2047: separate partition, otherwise the given directory itself will be
                   2048: assigned to drive "C:". In the multiple partition case, the letters
                   2049: used as the subdirectory names will determine to which
1.1.1.19  root     2050: drives/partitions they're assigned.  For example following
                   2051: directory setup:
                   2052: </p>
                   2053: <pre>
                   2054: partitions/
                   2055:   + C/
                   2056:   + D/
                   2057: </pre>
                   2058: <p>
                   2059: That is given to Hatari as "hatari -d partitions", will give you
                   2060: GEMDOS HD emulated C: and D: drives.
1.1.1.12  root     2061: </p>
                   2062: <p>
1.1.1.18  root     2063: GEMDOS HD emulation is an easy way to share files between the
1.1.1.12  root     2064: host system and the emulated Atari, but there are also some known
1.1.1.20  root     2065: limitations which are due to the way GEMDOS HD emulation is
1.1.1.12  root     2066: implemented:
                   2067: </p>
                   2068: <ul>
1.1.1.20  root     2069: <li>Fforce() file handle redirection works <em>only</em> for standard
                   2070: handles used with GEMDOS <em>file</em> functions, like Fwrite() to standard
                   2071: output that is redirected to a file.  File redirection is NOT supported
                   2072: e.g. for GEMDOS Ccon* console functions.
1.1.1.17  root     2073: <li>Directory entries are returned in a (case-insensitively) sorted
                   2074: order, for consistency.  E.g. moving files to a different directory and
                   2075: back (without changing their names) like AUTOSORT does, doesn't change
                   2076: that order. You need to rename the files.</li>
                   2077: <li>Names which aren't valid TOS directory or file names, are converted
                   2078: to a valid format.  If there are multiple files which converted
                   2079: names are identical in TOS-format, you see only one of those.</li>
1.1.1.12  root     2080: <li>It is not possible to use a cartridge image at the same time
1.1.1.20  root     2081: with GEMDOS HD emulation (Hatari has its own cartridge code
1.1.1.18  root     2082: that is used for GEMDOS HD emulation).</li>
1.1.1.17  root     2083: <li>Anything that installs its own GEMDOS handler, like MiNT, doesn't work
1.1.1.20  root     2084: with GEMDOS HD emulation.  Such things need to be run from a real
1.1.1.17  root     2085: hard disk image.</li>
1.1.1.19  root     2086: <li>GEMDOS HD C: drive conflicts with the ACSI and IDE hard drives.
1.1.1.18  root     2087: If you want to use GEMDOS HD directory and ACSI/IDE disk images together,
1.1.1.19  root     2088: either use the GEMDOS HD option for skipping ACSI & IDE partitions, or
1.1.1.18  root     2089: use a multiple partition GEMDOS HD emulation setup and select the partition
1.1.1.19  root     2090: subdirectories (see above) so that they don't conflict with the ACSI/IDE
                   2091: partitions (drive letters).  With HD Driver you have also another option,
1.1.1.17  root     2092: see <a href="#Using_HD_Driver_with_GEMDOS_partitions">Using HD Driver
1.1.1.18  root     2093: with GEMDOS HD partitions</a>.</li>
                   2094: <li><em>The GEMDOS HD emulation does not work (very well) with TOS
                   2095: 1.00 and 1.02</em>.  Use at least TOS 1.04 if you want the GEMDOS HD
1.1.1.12  root     2096: emulation to work properly.</li>
                   2097: </ul>
                   2098: <p>
1.1.1.19  root     2099: If your programs complain that they could not find/read/write
                   2100: files on the GEMDOS emulated drive, you can copy and use them
                   2101: from a floppy disk image or a real hard disk image instead.
1.1.1.6   root     2102: </p>
1.1.1.8   root     2103: 
1.1.1.19  root     2104: 
                   2105: <h3>ACSI &amp; IDE hard drive emulation with EmuTOS</h3>
                   2106: 
                   2107: <p>
                   2108: Accessing HD image files is easiest with EmuTOS.  It supports both
                   2109: ASCI and IDE interfaces, regardless of emulated machine type, and
                   2110: understands DOS partition tables without additional drivers.
                   2111: <span class="commandline">atari-hd-image.sh</span> script coming
                   2112: with Hatari can be used to create such image files and to copy
                   2113: initial data to them.
                   2114: </p>
                   2115: <p>
                   2116: If you have an hard drive (image) with Atari format partition table,
                   2117: that should already have hard disk driver on it and work fine.
                   2118: Partitioning/formatting them is the problem.  Creating such images
                   2119: from scratch is described in following sections.
                   2120: </p>
                   2121: 
                   2122: 
1.1.1.18  root     2123: <h3 id="ACSI_hard_drive_emulation">ACSI hard drive emulation</h3>
1.1.1.10  root     2124: <p>
1.1.1.18  root     2125: To use the ACSI hard drive emulation, you need a hard disk image file
1.1.1.12  root     2126: with a pre-installed HD driver in it. You can try to get an image of
                   2127: your old ST hard disk or grab one from the internet (e.g. from the
                   2128: Hatari website).
1.1.1.18  root     2129: Please note that the size of ACSI hard drive is normally limited to 1 GB
                   2130: due to some addressing constraints of the ACSI bus. Bigger disks were only
                   2131: possible with certain host adapters &ndash; this behaviour is emulated by
                   2132: Hatari, too, but you need a hard disk driver that supports these extensions.
1.1.1.12  root     2133: </p>
                   2134: <p>
                   2135: To create a <em>new</em> ACSI hard disk image, you can start with an empty
                   2136: image that you have created for example with the following command:
                   2137: <span class="commandline">dd if=/dev/zero of=hd.img bs=512 count=xxx</span>
                   2138: (where 'xxx' is size in 512 byte blocks).  Copy the complete AHDI 5.0
                   2139: package to a floppy disk image, then boot Hatari with this floppy disk
                   2140: image and the fresh hard disk image like this:
                   2141: <span class="commandline">--acsi hd.img ahdi.st</span>.
                   2142: Then start HDX.PRG from the floppy disk and format + partition the hard
                   2143: disk image with it.
                   2144: </p>
                   2145: <p>
                   2146: Formatting and partitioning works currently only with AHDI 5, but you
                   2147: can install the AHDI 6 driver to the hard disk after it's formatted.
                   2148: Restart the emulated system, run AHDI.PRG from the floppy disk to access
                   2149: the hard disk image from the emulated Atari and then run HINSTALL.PRG.
                   2150: After installing the hard disk driver to the fresh HD image with
                   2151: HINSTALL.PRG, you can boot directly from the hard disk image.
1.1.1.10  root     2152: </p>
1.1.1.19  root     2153: <p>
                   2154: HD Driver (v9) partitioning is also compatible with Hatari ACSI
                   2155: emulation. CBHD and ICDPro AdSCSI drivers work on images which have
                   2156: been partitioned elsewhere.
                   2157: </p>
                   2158: 
1.1.1.10  root     2159: 
1.1.1.18  root     2160: <h3>IDE hard drive emulation</h3>
1.1.1.10  root     2161: <p>
1.1.1.12  root     2162: <p>
                   2163: As the IDE disk format (little endian) differs from the ACSI disk format
                   2164: (big endian), you need separate disk images for them.  Hatari doesn't
1.1.1.19  root     2165: currently support partitioning IDE disks with AHDI, but you can do it with
1.1.1.12  root     2166: <em>Cecile</em>.
                   2167: </p>
                   2168: <p>
                   2169: First create an empty image file with the size of your choice with:
1.1.1.10  root     2170: <span class="commandline">dd if=/dev/zero of=hd.img bs=1k count=xxx</span>.
                   2171: Then get the Cecile hard disk driver from
                   2172: <a href="http://centek.free.fr/atari/softs/s_cecile.htm">http://centek.free.fr/atari/softs/s_cecile.htm</a>
1.1.1.12  root     2173: and put it on a floppy disk image (e.g. to one named "cecile.st" using:
                   2174: <span class="commandline">zip2st.sh cecile.zip</span>).
1.1.1.10  root     2175: </p>
                   2176: <p>
                   2177: Run Hatari with
1.1.1.12  root     2178: <span class="commandline">hatari --machine falcon --tos tos404.rom
                   2179: --ide-master hd.img cecile.st</span>, switch to larger color resolution
                   2180: and warm up your French language skills. Then start the Cecile hard
                   2181: disk driver CECILE.PRG and run CC_TOOLS.APP to partition your hard
                   2182: disk image. Click the "Partition" button, select "Hatari IDE disk" and set
                   2183: suitable partition size with the arrows (below type field). Then click
                   2184: "Valider".
1.1.1.10  root     2185: </p>
                   2186: <p>
                   2187: If you only want to use your HD image in Falcon mode, you can install
                   2188: the Cecile hard disk driver to the image from the Cecile CC_TOOLS.APP:
1.1.1.12  root     2189: Click the "Installer" button and save the Cecile driver to the
1.1.1.10  root     2190: 1st partition on "Hatari IDE disk". If you want to also use your HD
1.1.1.19  root     2191: image in ST/STE mode, you need to get and install either HD Driver or
                   2192: AHDI 6 driver on it instead (see <a href="#ACSI_hard_drive_emulation">ASCI
                   2193: hard drive emulation</a> section).
1.1.1.10  root     2194: </p>
                   2195: <p>
                   2196: Then you can boot from your hard disk image by simply specifying it
1.1.1.12  root     2197: with the <span class="commandline">--ide-master</span> parameter.
1.1.1.10  root     2198: </p>
                   2199: 
                   2200: 
1.1.1.17  root     2201: <h2>Moving files to/from hard disk images</h2>
1.1.1.12  root     2202: 
                   2203: <p>Moving files to and from Atari hard disk images can be done
1.1.1.18  root     2204: either through GEMDOS HD partitions (host directories mounted inside
1.1.1.12  root     2205: Hatari emulation) or accessing the images directly on the host
                   2206: (outside the emulation).  Both have their own limitations.</p>
                   2207: 
1.1.1.19  root     2208: <p>If it's fine for the IDE/ACSI partitions to be first, you can
                   2209: either use ACSI/IDE partition skip option, or a multipartition GEMDOS
                   2210: HD setup as described in above sections.
                   2211: </p>
                   2212: 
                   2213: <p>If you want to boot from a GEMDOS HD partition i.e. such to be
                   2214: before hard disk image partitions, and still to be able to access all
                   2215: the IDE/ACSI partitions, you need to use HD Driver.  Note: this is the
                   2216: preferred method with EmuTOS (v0.9.x), because it doesn't run/use
                   2217: driver installed to the IDE/ACSI image directly although its own
                   2218: partition table/type support is very limited.</p>
1.1.1.12  root     2219: 
1.1.1.17  root     2220: <h3 id="Using_HD_Driver_with_GEMDOS_partitions">Using HD Driver with GEMDOS partitions</h3>
1.1.1.12  root     2221: 
                   2222: <p>Uwe Seimet's <a href="http://www.seimet.de/atari/en/hddriver.html">HD
1.1.1.18  root     2223: Driver</a> works fine with both the Hatari GEMDOS HD partitions and normal
1.1.1.19  root     2224: hard disk images.
1.1.1.12  root     2225: </p>
                   2226: 
1.1.1.18  root     2227: <p>First copy the HDDRIVER.PRG binary into your GEMDOS HD emulation
1.1.1.12  root     2228: directory AUTO folder. Then start the HDDRUTIL.APP configuration utility,
                   2229: locate HDDRIVER.PRG, open the
                   2230: <a href="http://www.seimet.de/atari/en/hddriverscreenshots.html">"Devices
                   2231: and Partitions" dialog</a> and select the "Preserve Existing Partitions"
                   2232: option.  Then you can just start Hatari with your hard disk image and
1.1.1.18  root     2233: this GEMDOS HD directory, for example like this:
                   2234: "<span class="commandline">hatari --harddrive gemdos-hd/ --ide-master
1.1.1.12  root     2235: ide-hd.image</span>".</p>
                   2236: 
1.1.1.19  root     2237: <p>If you're using
                   2238: the <a href="http://hddriver.seimet.de/en/downloads.html">demo version
                   2239: of HD Driver</a>, you can write files only to the C: partition, i.e. in
                   2240: above case only copy files from the hard disk image partition to the
1.1.1.20  root     2241: GEMDOS HD partition (with some write slowdowns included into the demo
1.1.1.19  root     2242: version). If you want to copy files to the hard disk image with
                   2243: the <em>demo</em> version of the HD Driver, you need to set the hard disk
                   2244: image as drive C:.</p>
1.1.1.12  root     2245: 
1.1.1.18  root     2246: <p>To accomplish this, set the GEMDOS HD partitions to be from D: forward,
1.1.1.12  root     2247: i.e. have a directory which contains only single letter subdirectories,
                   2248: starting from "D" like in "<span class="commandline">mkdir gemdos-hd;
                   2249: mkdir gemdos-hd/D</span>". Then give Hatari (as the last parameter)
                   2250: a boot floppy image containing the demo version of HDDRIVER.PRG in
                   2251: its AUTO folder, like this: "<span class="commandline">hatari
1.1.1.18  root     2252: --ide-master ide-hd.image --harddrive gemdos-hd/ hd-driver-floppy.st</span>".
1.1.1.19  root     2253: You can convert HD Driver ZIP package to floppy image with the
                   2254: <span class="commandline">zip2st</span> utility.</p>
1.1.1.12  root     2255: 
                   2256: 
1.1.1.17  root     2257: <h3>Accessing HDD image partitions outside of Hatari</h3>
1.1.1.12  root     2258: 
1.1.1.10  root     2259: <p>
1.1.1.18  root     2260: If you want to access the hard disk image partitions also outside
1.1.1.12  root     2261: the emulation, the disk image needs to have a DOS partition table.
                   2262: The <span class="commandline">atari-hd-image</span> script included
1.1.1.10  root     2263: with Hatari can be used to create such an image.
                   2264: </p>
                   2265: <p>
                   2266: Inside the Hatari emulator, EmuTOS can access partition(s) on these
                   2267: kind of images directly without any driver software.  Of the Atari HD
1.1.1.12  root     2268: drivers mentioned above, Centek's Cecile and Uwe Seimet's HD Driver
                   2269: (demo) work fine with these partitions. E.g. AHDI and CBHD don't.
1.1.1.19  root     2270: Cecile works only with TT or Falcon.
1.1.1.10  root     2271: </p>
                   2272: <p>
1.1.1.19  root     2273: To summarise; if EmuTOS is enough, use that. Otherwise, if you want to
                   2274: use TT or Falcon emulation, use Cecile (or full HD Driver version if
                   2275: you have it), otherwise use HD Driver (demo).
1.1.1.10  root     2276: </p>
                   2277: <p>
                   2278: To access the content of the partitions on Linux host, there are two
                   2279: possibilities:
                   2280: 
                   2281: <h4>Using Mtools</h4>
                   2282: <p>
                   2283: For this you need to add an entry for the hard disk
                   2284: image to your <span class="commandline">~/.mtoolsrc</span> and
                   2285: specify which partition you want to access from the image. For
                   2286: an image created with the above mentioned script, the line in
                   2287: the configuration file should look something like this:
                   2288: </p>
                   2289: <pre>
                   2290: MTOOLS_NO_VFAT=1
                   2291: drive c: file="/home/user/hatari/hd.img" partition=1
                   2292: </pre>
                   2293: <p>
                   2294: Note that Mtools is instructed to use FAT compatibility mode because
                   2295: EmuTOS cannot deal properly with VFAT file information.  If you don't
                   2296: want this setting for all your Mtools drives, you can set it also via
1.1.1.12  root     2297: the environment like this ("::" refers to the drive image given with
                   2298: the "-i" option):
1.1.1.10  root     2299: </p>
                   2300: <pre>
1.1.1.12  root     2301: MTOOLS_NO_VFAT=1 mcopy -spmv -i hd.img files/* ::
1.1.1.10  root     2302: </pre>
                   2303: 
                   2304: <h4>Using a loopback device</h4>
                   2305: <p>
                   2306: This is recommended even by Mtools documentation, but it's less
                   2307: convenient as it requires root rights. First you need to "loop"
                   2308: mount the image:
                   2309: </p>
                   2310: <pre>
                   2311: $ su
                   2312: # image="hd.img"; mountdir="hd"
                   2313: # start=$(parted $image unit s print | awk '/ 1 /{print $2}' | tr -d s)
                   2314: # losetup -f $image -o $((512*$start))
                   2315: # loop=$(losetup -a | tail -1 | cut -d: -f1)
                   2316: # mkdir -p $mountdir
                   2317: # mount -t msdos $loop $mountdir
                   2318: </pre>
                   2319: <p>
                   2320: This uses <span class="commandline">parted</span> to find out the first
                   2321: partition offset in sectors and then tells <span class="commandline">losetup</span>
                   2322: to bind the first free loop device to a corresponding offset from
                   2323: the <span class="commandline">hd.img</span> image.
                   2324: <span class="commandline">mount</span> is then used to mount the file system
                   2325: from the loop device on top of the "hd" directory.
                   2326: </p>
                   2327: <p>
                   2328: After you've copied the relevant files to the "hd" directory, you need
1.1.1.20  root     2329: to unmount the file system and remove the loop device binding before
                   2330: using the disk image from Hatari:
1.1.1.10  root     2331: </p>
                   2332: <pre>
                   2333: # umount $mountdir
                   2334: # losetup -d $loop
                   2335: </pre>
                   2336: 
1.1.1.17  root     2337: 
                   2338: <h2 id="The_debugger">The debugger</h2>
1.1.1.10  root     2339: 
                   2340: <p>
                   2341: Hatari has a built-in debugging interface which can be used for
1.1.1.18  root     2342: analyzing code that runs in the emulated system.
1.1.1.12  root     2343: </p>
1.1.1.10  root     2344: 
                   2345: <p>
1.1.1.21! root     2346: On Unix (Linux / macOS) debugger uses Hatari's parent console window, so
1.1.1.19  root     2347: make sure you run Hatari from the command line when you want to use
                   2348: the debugger.  On Windows you need to use "-W" option to get console
                   2349: window.  You can add an icon to your desktop that does it.  On Linux
                   2350: it should do something like this (replace "xterm" with your favorite
                   2351: terminal program):
1.1.1.10  root     2352: </p>
1.1.1.18  root     2353: <pre>
                   2354: xterm -T "Hatari debug window" -e hatari
                   2355: </pre>
1.1.1.10  root     2356: 
                   2357: <p>
1.1.1.21! root     2358: To run debugger commands from a file at Hatari startup, one can use
        !          2359: the "--parse &lt;file&gt;" command line option.  This is useful e.g.
        !          2360: for debugging TOS or some demo startup code, or if you always want to
        !          2361: use some specific debugger setup (breakpoints etc).
        !          2362: </p>
        !          2363: 
        !          2364: <p>
        !          2365: Note that when debugger scripts are run, current directory is set to
        !          2366: the currently running script's directory i.e. all file operations are
        !          2367: relative to it.  After script finishes, earlier current directory is
        !          2368: restored.  To set current directory from a setup script, e.g. for
        !          2369: scripts run at breakpoints, you need to give '-f' option for the
        !          2370: 'cd' command.
1.1.1.13  root     2371: </p>
                   2372: 
1.1.1.18  root     2373: 
                   2374: <h3>Invoking the debugger</h3>
                   2375: 
1.1.1.13  root     2376: <p>
1.1.1.18  root     2377: You can invoke the debugger manually by pressing the
                   2378: <span class="key">AltGr + Pause</span> key combination.
                   2379: </p>
                   2380: 
                   2381: <p>
                   2382: With the "-D" command line option, you can toggle whether m68k
                   2383: exceptions will also invoke the debugger.  Which exceptions cause
                   2384: this, can be controlled with the "--debug-except" option.  
                   2385: </p>
                   2386: 
                   2387: <p>
                   2388: Giving "-D" option at Hatari startup is not advised because TOS HW
                   2389: checks generate some exceptions at every TOS boot.  It's better to
                   2390: toggle exception catching later from the debugger with the "setopt -D"
                   2391: command. 
                   2392: </p>
                   2393: 
                   2394: <p>
                   2395: Alternatively, you can give "--debug-except" option "autostart" flag
                   2396: (e.g. "--debug-except all,autostart").  This will enable catching of
                   2397: (specified) exceptions after TOS boot, when Atari program given on
                   2398: Hatari command line is <em>autostarted</em>.
1.1.1.10  root     2399: </p>
                   2400: 
1.1.1.12  root     2401: 
1.1.1.17  root     2402: <h3>General debugger use</h3>
1.1.1.12  root     2403: 
1.1.1.10  root     2404: <p>
1.1.1.12  root     2405: At the debugger prompt, type "help" to get a list of all
1.1.1.10  root     2406: the available commands and their shortcuts:
                   2407: </p>
                   2408: <pre>
1.1.1.12  root     2409: Generic commands:
                   2410:            cd (  ) : change directory
                   2411:      evaluate ( e) : evaluate an expression
                   2412:          help ( h) : print help
1.1.1.21! root     2413:       history (hi) : show last CPU/DSP PC values & executed instructions
1.1.1.12  root     2414:          info ( i) : show machine/OS information
1.1.1.13  root     2415:          lock (  ) : specify information to show on entering the debugger
1.1.1.12  root     2416:       logfile ( f) : open or close log file
                   2417:         parse ( p) : get debugger commands from file
1.1.1.21! root     2418:        rename (  ) : rename given file
        !          2419:         reset (  ) : reset emulation
1.1.1.12  root     2420:        setopt ( o) : set Hatari command line and debugger options
                   2421:     stateload (  ) : restore emulation state
                   2422:     statesave (  ) : save emulation state
                   2423:         trace ( t) : select Hatari tracing settings
1.1.1.21! root     2424:     variables ( v) : List builtin symbols / variables
1.1.1.12  root     2425:          quit ( q) : quit emulator
                   2426: 
                   2427: CPU commands:
                   2428:       address ( a) : set CPU PC address breakpoints
                   2429:    breakpoint ( b) : set/remove/list conditional CPU breakpoints
1.1.1.10  root     2430:        disasm ( d) : disassemble from PC, or given address
1.1.1.13  root     2431:       profile (  ) : profile CPU code
1.1.1.10  root     2432:        cpureg ( r) : dump register values or set register to value
                   2433:       memdump ( m) : dump memory
                   2434:      memwrite ( w) : write bytes to memory
                   2435:       loadbin ( l) : load a file into memory
1.1.1.17  root     2436:       savebin (  ) : save memory to a file
1.1.1.12  root     2437:       symbols (  ) : load CPU symbols & their addresses
1.1.1.17  root     2438:          step ( s) : single-step CPU
1.1.1.21! root     2439:          next ( n) : step CPU through subroutine calls / to given instruction type
1.1.1.10  root     2440:          cont ( c) : continue emulation / CPU single-stepping
1.1.1.12  root     2441: 
                   2442: DSP commands:
                   2443:    dspaddress (da) : set DSP PC address breakpoints
                   2444:      dspbreak (db) : set/remove/list conditional DSP breakpoints
                   2445:     dspdisasm (dd) : disassemble DSP code
                   2446:    dspmemdump (dm) : dump DSP memory
                   2447:    dspsymbols (  ) : load DSP symbols & their addresses
1.1.1.13  root     2448:    dspprofile (dp) : profile DSP code
1.1.1.12  root     2449:        dspreg (dr) : read/write DSP registers
1.1.1.17  root     2450:       dspstep (ds) : single-step DSP
1.1.1.21! root     2451:       dspnext (dn) : step DSP through subroutine calls / to given instruction type
1.1.1.12  root     2452:       dspcont (dc) : continue emulation / DSP single-stepping
1.1.1.10  root     2453: </pre>
                   2454: 
1.1.1.17  root     2455: 
                   2456: <h4 id="Entering_arguments_to_debugger_commands">Entering arguments to debugger commands</h4>
1.1.1.13  root     2457: 
                   2458: <p>
                   2459: After writing (with TAB completion) one of the above command names,
                   2460: pressing TAB will (for most commands) show all the available subcommands.
                   2461: </p>
                   2462: 
1.1.1.10  root     2463: <p>
1.1.1.13  root     2464: If you want to give numbers in other number bases
1.1.1.12  root     2465: than the default/selected one, they need to be prefixed with a
                   2466: character indicating this.  For decimals this prefix is "#" (#15),
                   2467: for hexadecimals "$" ($F), and for binary values it's "%" (%1111).
1.1.1.13  root     2468: </p>
                   2469: 
                   2470: <p>
                   2471: By default debugger expects all numbers without a prefix to be
1.1.1.12  root     2472: decimals, but you can change the default number base with the "setopt"
                   2473: command, just give it the desired default number base (bin/dec/hex).
1.1.1.13  root     2474: <em>When using the hexadecimal number base, remember still to prefix
                   2475: hexadecimal numbers with '$' if they could be confused with register
                   2476: names (a0-7, d0-7)!</em>  Otherwise results from expressions and
                   2477: conditional breakpoints can be unexpected.
1.1.1.12  root     2478: </p>
                   2479: 
1.1.1.13  root     2480: 
                   2481: <h4>Calculations and immediate evaluation</h4>
                   2482: 
1.1.1.12  root     2483: <p>
1.1.1.13  root     2484: Instead of a number, you can also use an arithmetic expression, by
                   2485: surrounding it with quotes ("").  An expression can contain
                   2486: calculations with CPU and DSP register, symbol and Hatari variable
                   2487: values in addition to numbers. For example to give a sum of A0 and
                   2488: D0 register values to a command, use "a0+d0".
1.1.1.12  root     2489: </p>
                   2490: 
                   2491: <p>
1.1.1.13  root     2492: Within arithmetic expressions parenthesis are used both to change
1.1.1.20  root     2493: the order of precedence <em>and</em> to indicate indirect addressing.
1.1.1.13  root     2494: Unlike with conditional breakpoint expressions (explained below), you
                   2495: cannot give size for the indirect addressing, a long value is always
                   2496: read from the RAM address given within parenthesis.  For example to
                   2497: get a long value pointed by stack pointer + 2, use "(a7+2)".
1.1.1.12  root     2498: </p>
                   2499: 
                   2500: <p>
1.1.1.13  root     2501: Values of arithmetic expressions are always evaluated before being
                   2502: given to a command.  Except for "evaluate" and "address" commands,
1.1.1.20  root     2503: they always need to be marked with quotes (""). Besides arithmetic,
1.1.1.13  root     2504: this can be used also to give symbol/register/variable values to
                   2505: commands that don't otherwise interpret them.  If command complains
                   2506: that it didn't recognize e.g. a register name, just put it to quotes
                   2507: and it will be "evaluated" before being given to the command.
1.1.1.12  root     2508: </p>
                   2509: 
                   2510: <p>
1.1.1.17  root     2511: With command argument completion (see <a href="#Build_notes">build
1.1.1.13  root     2512: notes</a>), result from the last "evaluate" command can be inserted
                   2513: by typing '$' and pressing TAB.
1.1.1.12  root     2514: </p>
                   2515: 
                   2516: 
1.1.1.17  root     2517: <h3 id="Inspecting_emulation_state">Inspecting emulation state</h3>
1.1.1.12  root     2518: 
                   2519: <p>
                   2520: In the beginning, probably the most interesting commands are "m" and "d"
                   2521: for dumping and disassembling memory regions.  You can use "dm" and "dd"
                   2522: commands to do the same for the DSP.
1.1.1.10  root     2523: </p>
                   2524: <pre>
                   2525: &gt; help memdump
                   2526: 'memdump' or 'm' - dump memory
1.1.1.12  root     2527: Usage:  m [start address-[end address]]
1.1.1.10  root     2528:         dump memory at address or continue dump from previous address.
                   2529: </pre>
                   2530: <pre>
                   2531: &gt; help disasm
                   2532: 'disasm' or 'd' - disassemble from PC, or given address
1.1.1.12  root     2533: Usage:  d [start address-[end address]]
1.1.1.10  root     2534:         If no address is given, this command disassembles from the last
1.1.1.12  root     2535:         position or from current PC if no last position is available.
1.1.1.10  root     2536: </pre>
                   2537: <pre>
1.1.1.13  root     2538: &gt; disasm pc
                   2539: $00aa6e : 2f08                                 move.l    a0,-(sp)
                   2540: $00aa70 : 0241 0fff                            andi.w    #$fff,d1
                   2541: $00aa74 : 207c 00fe 78c0                       movea.l   #$fe78c0,a0
                   2542: $00aa7a : 2070 1000                            movea.l   (a0,d1.w),a0
                   2543: $00aa7e : 4ed0                                 jmp       (a0)
1.1.1.10  root     2544: </pre>
                   2545: 
                   2546: <p>
1.1.1.13  root     2547: Both commands accept in addition to numeric addresses also register
                   2548: and symbol names, like in above example.  If you don't specify an
                   2549: address, the commands continue showing from an address that comes
                   2550: after the previously shown data.  "disasm" command default address
1.1.1.19  root     2551: will be reset to PC address every time you re-enter the debugger.
1.1.1.13  root     2552: </p>
                   2553: 
                   2554: <p>
1.1.1.17  root     2555: Use "setopt --disasm help" if you want to set options controlling
                   2556: the disassembly output.
                   2557: </p>
                   2558: 
                   2559: <p>
1.1.1.12  root     2560: You can use the "info" command to see state of specific sets of HW
1.1.1.13  root     2561: registers (e.g. "info videl") and Atari OS structures (e.g. "info gemdos").
                   2562: </p>
                   2563: 
                   2564: 
                   2565: <h4>Selecting what information is shown on entering the debugger</h4>
                   2566: 
                   2567: <p>
                   2568: By using the "lock" command, you can ask Hatari to show specific
                   2569: information whenever you enter the debugger / hit a breakpoint. For
                   2570: example to see disassembly from current PC address, use "lock disasm".
                   2571: </p>
                   2572: 
                   2573: <p>
                   2574: With the "regaddr" subcommand, you see disassembly or memory
                   2575: dump of an address pointed by a given register ("lock regaddr disasm
                   2576: a0"). Of the DSP registers, only Rx ones are valid for this
                   2577: subcommand.
                   2578: </p>
                   2579: 
                   2580: <p>
                   2581: "file" subcommand can be used to get (arbitrary number of) commands
                   2582: parsed and executed from a given debugger input file whenever debugger
                   2583: is entered.  With this you can output any information you need:
1.1.1.12  root     2584: </p>
1.1.1.13  root     2585: <pre>
                   2586: lock file debugger.ini
                   2587: </pre>
1.1.1.12  root     2588: 
                   2589: <p>
1.1.1.13  root     2590: To disable showing of this extra information, use "lock default".
                   2591: Without arguments "lock" command will show the available options
                   2592: (like the "info" command does).
1.1.1.12  root     2593: </p>
                   2594: 
1.1.1.13  root     2595: 
1.1.1.17  root     2596: <h3>Debug symbols</h3>
                   2597: 
                   2598: <p>
                   2599: You can load debugging symbols to the debugger with the "symbols"
                   2600: command (and with "dspsymbols" for DSP). These symbolic names can be
                   2601: used in arithmetic expressions and conditional breakpoint expressions.
                   2602: They also show up in the "disasm" command output and you can trace
                   2603: calls to them with "trace cpu_symbols" (and DSP symbols with "trace
                   2604: dsp_symbols").
                   2605: </p>
                   2606: 
                   2607: 
                   2608: <h4>For a program under GEMDOS HD emulation</h4>
                   2609: 
                   2610: <p>
1.1.1.19  root     2611: If currently running program contains symbol table in DRI/GST format,
                   2612: and it's started from GEMDOS HD emulated drive, its symbol names /
                   2613: addresses are automatically loaded when debugger is entered, and
                   2614: removed when program terminates.</p>
                   2615: 
                   2616: <p>
                   2617: Above happens only if there are no symbols loaded when the program
                   2618: starts. If there are, you can load program symbol data manually with
                   2619: the following command, after program has been loaded to the memory by
                   2620: TOS (see <a href="#Breakpoint_variables">setting breakpoint at program
                   2621: startup</a>):
1.1.1.17  root     2622: </p>
                   2623: <pre>
                   2624: symbols prg
                   2625: </pre>
                   2626: <p>
                   2627: 
                   2628: <p>
                   2629: The options you need to add suitable symbol table to your programs,
                   2630: depend on which toolchain you use to build it:
                   2631: </p>
                   2632: <dl>
                   2633: <dt><em>Devpac</em>:</dt>
                   2634: <dd>"OPT D+,X+"</dd>
                   2635: <dt><em>AHCC</em>:</dt>
                   2636: <dd>"-g", and "-l" option for local symbols, both for linking</dd>
                   2637: <dt><em>GCC</em>:</dt>
                   2638: <dd>"-Wl,--traditional-format" option for linking,
                   2639:     and "-g" for compilation to get local symbols</dd>
                   2640: <dt><em>VBCC</em>:</dt>
                   2641: <dd>"-g" (can only be used at linking phase), <em>when VBCC
                   2642:     configuration file uses "-bataritos" option for
                   2643:     the linker</em></dd>
                   2644: </dl>
                   2645: 
                   2646: <p>You can view the generated symbols (and convert them to debugger
                   2647: ASCII format) with tool installed with Hatari:</p>
                   2648: <pre>
                   2649: $ gst2ascii -l -o program.tos &gt; program.sym
                   2650: </pre>
                   2651: (Options -l and -o are used to exclude useless symbols from the output.)
                   2652: 
                   2653: 
                   2654: <h4>For a program on a (disk) image</h4>
                   2655: 
                   2656: <p>
                   2657: If the program isn't run from a GEMDOS HD emulated drive, but from a
                   2658: cartridge, floppy or HD image, you need to have the corresponding
                   2659: program also as normal host file which location you can give to the
                   2660: debugger:
                   2661: </p>
                   2662: <pre>
                   2663: symbols /path/to/the/program.tos
                   2664: </pre>
                   2665: 
                   2666: 
                   2667: <h4>ASCII debug symbol files</h4>
1.1.1.12  root     2668: 
                   2669: <p>
1.1.1.17  root     2670: If Hatari complains that your program doesn't have DRI/GST format
                   2671: symbol table, or its symbols are in some other format, and you
                   2672: cannot re-compile it to have them, you have two options:
1.1.1.12  root     2673: </p>
1.1.1.17  root     2674: <ul>
                   2675: <li>Convert the symbols to ASCII format understood by the Hatari debugger.
                   2676:     Writing converters for other ASCII formats is easy, and Hatari already
1.1.1.20  root     2677:     contains converters for DSP LOD files, <span class="commandline">nm</span>
1.1.1.17  root     2678:     output for MiNT/a.out binaries and AHCC map files.
1.1.1.19  root     2679: <li>Create the ASCII symbols file by hand while you're debugging a program.
1.1.1.17  root     2680: </ul>
1.1.1.12  root     2681: 
1.1.1.20  root     2682: <p><b>NOTE:</b> <span class="commandline">nm</span> output for GCC generated
                   2683: <span class="commandline">a.out</span> binaries includes labels also for loops,
                   2684: not just functions. While loop labels are fine for debugging, <em>they should
                   2685: be removed before profiling</em>.  Besides causing misleading profile
                   2686: results, loop labels can <em>seriously</em> slow down profiling
                   2687: (call graph tracking is automatically enabled for profiling when debug
                   2688: symbols are loaded, and operations done on each matched symbol address
                   2689: cause huge overhead if that match is for something happening every few
                   2690: instructions).
                   2691: </p>
                   2692: 
                   2693: 
1.1.1.17  root     2694: <p>ASCII symbols file format is following:</p>
1.1.1.12  root     2695: <pre>
                   2696: e01034 T random
                   2697: e01076 T kbdvbase
                   2698: e0107e T supexec
                   2699: </pre>
                   2700: <p>
1.1.1.13  root     2701: Where 'T' means text (code), 'D' means data and 'B' means BSS section
                   2702: type of address.  The hexadecimal address, address type letter and the
                   2703: symbol name are separated by white space.  Empty lines and lines
                   2704: starting with '#' (comments) are ignored.
1.1.1.12  root     2705: </p>
                   2706: 
                   2707: <p>
1.1.1.17  root     2708: Debugger will automatically "relocate" the symbol addresses when it
                   2709: loads them from a program binary, but with ASCII symbol files you need
                   2710: to give the relocation offset(s) separately, unless the symbol names
1.1.1.20  root     2711: are for fixed addresses (like is the case e.g. with EmuTOS):
1.1.1.13  root     2712: </p>
                   2713: <pre>
1.1.1.17  root     2714: symbols program.sym TEXT DATA BSS
1.1.1.12  root     2715: </pre>
1.1.1.13  root     2716: <p>
1.1.1.17  root     2717: If you're interested only about code symbols, you can leave DATA and
                   2718: BSS offsets out (the values of the above virtual debugger variables
                   2719: like TEXT come from the currently loaded program's basepage, they're
                   2720: set after the program is loaded by TOS, see "info basepage" output).
1.1.1.13  root     2721: </p>
                   2722: 
1.1.1.12  root     2723: 
1.1.1.17  root     2724: <h3>Breakpoints</h3>
1.1.1.12  root     2725: 
                   2726: <p>
                   2727: There are two ways to specify breakpoints for Hatari. First, there are
                   2728: the simple address breakpoints which trigger when the CPU (or DSP)
                   2729: program counter hits a given address. Use "a" (or "da" for the DSP)
                   2730: to create them, for example:
                   2731: </p>
                   2732: <pre>
1.1.1.13  root     2733: a $e01034
                   2734: a some_symbol
1.1.1.12  root     2735: </pre>
                   2736: 
                   2737: <p>
1.1.1.13  root     2738: Note that address breakpoints are just wrappers for conditional
                   2739: breakpoints so you need to use "b" command to remove or list them.
1.1.1.12  root     2740: </p>
                   2741: 
                   2742: <p>
                   2743: Then there are the conditional breakpoints which can handle much more
1.1.1.13  root     2744: complex break condition expressions; they can track changes to
                   2745: register and memory values with bitmasks, include multiple conditions
                   2746: for triggering a breakpoint and so on.  Use "b" (or "db" for the DSP) 
                   2747: to manage them.
1.1.1.10  root     2748: </p>
                   2749: 
1.1.1.13  root     2750: <p>Help explains the general syntax:</p>
1.1.1.10  root     2751: <pre>
1.1.1.13  root     2752: &gt; help b
                   2753: 'breakpoint' or 'b' - set/remove/list conditional CPU breakpoints
                   2754: Usage:  b &lt;condition&gt; [&amp;&amp; &lt;condition&gt; ...] [:&lt;option&gt;] | &lt;index&gt; | help | all
                   2755: 
                   2756: Set breakpoint with given &lt;conditions&gt;, remove breakpoint with
                   2757: given &lt;index&gt;, remove all breakpoints with 'all' or output
                   2758: breakpoint condition syntax with 'help'.  Without arguments,
                   2759: lists currently active breakpoints.
                   2760: </pre>
                   2761: 
                   2762: <p>
                   2763: Unless you give breakpoint one of the pre-defined subcommands ('all',
                   2764: 'help'), index for a breakpoint to remove or no arguments (to list
                   2765: breakpoints), the arguments are interpreted as a new breakpoint
                   2766: definition.
                   2767: </p>
                   2768: 
                   2769: <p>
                   2770: Each conditional breakpoint can have (currently up to 4) conditions
                   2771: which are separated by "&amp;&amp;".  All of the breakpoint's
                   2772: conditions need to be true for a breakpoint to trigger.
                   2773: </p>
                   2774: 
                   2775: 
1.1.1.17  root     2776: <h4 id="Breakpoint_options">Breakpoint options</h4>
1.1.1.13  root     2777: 
                   2778: <p>
                   2779: Normally when a breakpoint is triggered, emulation is stopped and you
                   2780: get to the debugger. Breakpoint options can be used to affect what
                   2781: happens when a breakpoint is triggered.  These options are given after
                   2782: the conditions and are prefixed with ':'. 
                   2783: </p>
                   2784: 
                   2785: <dl>
                   2786: <dt><em>&lt;count&gt;</em></dt>
                   2787: <dd>Break only on every &lt;count&gt; hit. For example, to stop
                   2788: on every other time PC is at given address, use:
                   2789: <pre>
                   2790: a $1234 :2
                   2791: </pre>
                   2792: </dd>
                   2793: 
                   2794: <dt><em>once</em></dt>
                   2795: <dd>
                   2796: Delete the breakpoint when it's hit i.e. trigger it only once. It may
                   2797: be useful if you just want to get a specific address. Or if you're on
                   2798: an instruction that jumps back to a start of the loop and you want to
1.1.1.16  root     2799: finish the loop, you could use:
1.1.1.13  root     2800: <pre>
                   2801: b pc &gt; "pc" :once
                   2802: continue
                   2803: </pre>
                   2804: </dd>
                   2805: 
                   2806: <dt><em>trace</em></dt>
                   2807: <dd>
                   2808: Continue emulation without stopping after printing the value that
                   2809: triggered the breakpoint and doing other possible option actions.
                   2810: This is most useful when investigating memory or register value
                   2811: changes (explained below).
                   2812: </dd>
                   2813: 
                   2814: <dt><em>lock</em></dt>
                   2815: <dd>
                   2816: Show the same information on breakpoint hit as you see when entering
                   2817: the debugger (see the "lock" command in
1.1.1.17  root     2818: <a href="#Inspecting_emulation_state">Inspecting emulation state</a>
1.1.1.13  root     2819: above).  This enables also trace option as you would anyway see this
                   2820: information if debugger would be entered.
                   2821: </dd>
                   2822: 
                   2823: <dt><em>file &lt;file&gt;</em></dt>
                   2824: <dd>
                   2825: Execute debugger commands from given &lt;file&gt; when this breakpoint
                   2826: is hit.  With this you have complete control over what information is
                   2827: show when the debugger is hit, you can even chain breakpoints (as
                   2828: explained in
1.1.1.17  root     2829: <a href="#Chaining_breakpoints">Chaining breakpoints</a> later on)
1.1.1.13  root     2830: etc.  Use this if "lock" option isn't enough or you want different
                   2831: information show on breakpoints and when entering the debugger.
                   2832: </dd>
1.1.1.17  root     2833: 
                   2834: <dt><em>noinit</em></dt>
                   2835: <dd>
                   2836: Hitting breakpoint doesn't re-initialize debugger which would e.g.
                   2837: cause profiling data to be reset.  This implies trace option as
                   2838: entering debugger would also re-initialize debugger state. This option
                   2839: is mainly intended for breakpoints that use :file option to show
                   2840: backtraces with "profile stack" command during
                   2841: <a href="#Profiling">profiling</a>.  See
                   2842: <a href="#Usage_examples">Usage examples</a> section for an example.
                   2843: </dd>
1.1.1.13  root     2844: </dl>
                   2845: 
                   2846: <p>
                   2847: Note: you can give multiple options for conditional breakpoints, but
                   2848: for address breakpoints you can give only one these options.  And
                   2849: "file" option is supported only for conditional breakpoints.
                   2850: </p>
                   2851: 
                   2852: 
1.1.1.17  root     2853: <h4>Breakpoint conditions</h4>
1.1.1.13  root     2854: 
                   2855: <p>
                   2856: "b help" explains very briefly the breakpoint condition syntax:
                   2857: </p>
                   2858: <pre>
                   2859: &gt; b help
                   2860: condition = &lt;value&gt;[.mode] [&amp; &lt;mask&gt;] &lt;comparison&gt; &lt;value&gt;[.mode]
1.1.1.10  root     2861: 
                   2862: where:
1.1.1.12  root     2863:         value = [(] &lt;register/symbol/variable name | number&gt; [)]
1.1.1.13  root     2864:         number/mask = [#|$|%]&lt;digits&gt;
1.1.1.12  root     2865:         comparison = '&lt;' | '&gt;' | '=' | '!'
                   2866:         addressing mode (width) = 'b' | 'w' | 'l'
                   2867:         addressing mode (space) = 'p' | 'x' | 'y'
1.1.1.13  root     2868: </pre>
                   2869: 
                   2870: <p>
                   2871: For CPU breakpoints, mode is the address width; it can be byte ("b"),
                   2872: word ("w") or long ("l", default).  For DSP breakpoints, mode specifies
                   2873: the address space: "P", "X" or "Y". Note that on DSP only R0-R7
                   2874: registers can be used for memory addressing.  For example;
                   2875: <pre>
                   2876: db (r0).x = 1 &amp;&amp; (r0).y = 2
1.1.1.10  root     2877: </pre>
                   2878: 
                   2879: <p>
                   2880: If the value is in parenthesis like in '($ff820)' or '(a0)', then the
1.1.1.12  root     2881: used value will be read from the memory address pointed by it.  Note
1.1.1.13  root     2882: that this conditional breakpoint expression value is checked at
                   2883: run-time whereas quoted arithmetic expressions (mentioned in
1.1.1.17  root     2884: <a href="#Entering_arguments_to_debugger_commands">Entering arguments
1.1.1.13  root     2885: to debugger commands</a> above) are evaluated already when
                   2886: adding a breakpoint.  For example, to break when a value in an address
                   2887: (later) pointed by A0 matches the value <em>currently</em> in D0, one
                   2888: would use:
1.1.1.10  root     2889: </p>
1.1.1.12  root     2890: <pre>
1.1.1.13  root     2891: b (a0) = "d0"
1.1.1.12  root     2892: </pre>
                   2893: 
1.1.1.10  root     2894: <p>
1.1.1.13  root     2895: If you're interested only on certain bits in the value, you can use
                   2896: '&amp;' and a numeric mask on either side of comparison operator to
1.1.1.20  root     2897: mask the corresponding value, like this:
1.1.1.13  root     2898: <pre>
1.1.1.17  root     2899: b ($ff820).w &amp; 3 = (a0)  &amp;&amp;  (a1) = d0 &amp; %1100
1.1.1.13  root     2900: </pre>
1.1.1.10  root     2901: 
1.1.1.13  root     2902: <p>
                   2903: Comparison operators should be familiar and obvious, except for '!'
                   2904: which indicates inequality ("is not") comparison.  For example:
                   2905: </p>
1.1.1.10  root     2906: <pre>
1.1.1.13  root     2907: b d0 &gt; $20  &amp;&amp;  d0 &lt; $40  &amp;&amp;  d0 ! $30
1.1.1.12  root     2908: </pre>
1.1.1.10  root     2909: 
1.1.1.17  root     2910: 
                   2911: <h5>Tracking breakpoint conditions</h5>
                   2912: 
1.1.1.10  root     2913: <p>
1.1.1.13  root     2914: As a convenience, if the both sides of the comparison are exactly the
                   2915: same (i.e. condition is redundant as it's always either true or
                   2916: false), the <em>right side</em> of the comparison is replaced with
                   2917: its current value.  This way you can give something like this:
1.1.1.12  root     2918: </p>
1.1.1.13  root     2919: <pre>
                   2920: b pc &gt; "pc"
                   2921: </pre>
                   2922: <p>As:</p>
                   2923: <pre>
                   2924: b pc &gt; pc
                   2925: </pre>
1.1.1.12  root     2926: 
                   2927: <p>
1.1.1.13  root     2928: That in itself isn't so useful, but for inequality ('!') comparison,
                   2929: conditional breakpoint will additionally track and output all further
                   2930: changes for the given address/register expression. This can be used
                   2931: for example to find out all value changes in a given memory address,
                   2932: like this:
                   2933: </p>
                   2934: <pre>
                   2935: b ($ffff9202).w ! ($ffff9202).w :trace
                   2936: </pre>
                   2937: <p>
1.1.1.17  root     2938: Because tracking breakpoint conditions will print the evaluated
                   2939: value when it changes, they're typically used with the trace option
1.1.1.20  root     2940: to track changes e.g. to some I/O register.
1.1.1.12  root     2941: </p>
1.1.1.10  root     2942: 
1.1.1.13  root     2943: 
1.1.1.17  root     2944: <h5>Breakpoint condition notes</h5>
                   2945: 
                   2946: <ul>
                   2947: <li>
                   2948: Any '!' condition should be given as the first condition. Because
                   2949: breakpoint evaluation is stopped ("short-circuited") when any of the
                   2950: conditions fails, the tracked value would not be updated correctly
                   2951: unless tracking condition is given as the first one.
                   2952: </li>
                   2953: 
                   2954: <li>
                   2955: Hatari will internally update some register values without immediately
1.1.1.20  root     2956: updating the corresponding I/O address range memory addresses.  For
1.1.1.17  root     2957: example the Busy bit for the internal Blitter control register is
1.1.1.20  root     2958: (internally) cleared when Blitter activity stops, but the actual I/O
1.1.1.17  root     2959: address for that control register gets updated only when something
1.1.1.20  root     2960: actually writes or reads that I/O address.  Many HW registers behave
1.1.1.18  root     2961: like this (status registers in FDC, ACIA, MFP, Blitter...).
1.1.1.17  root     2962: <br>
1.1.1.20  root     2963: For breakpoints that track just a single I/O register memory address, or
1.1.1.17  root     2964: multiple ones of which <strong>none</strong> are modified by Hatari,
                   2965: only by emulated code, this is not a problem, they get triggered as
                   2966: expected.
                   2967: <br>
1.1.1.20  root     2968: However, if you have a breakpoint that tracks multiple I/O registers
1.1.1.17  root     2969: where some of them are updated by Hatari, for example to check that
                   2970: other Blitter registers aren't updated while control register
                   2971: indicates Blitter to be active (busy), things don't work as expected!
                   2972: </li>
                   2973: </ul>
                   2974: 
                   2975: 
                   2976: <h4>Breakpoint variables</h4>
1.1.1.13  root     2977: 
1.1.1.10  root     2978: <p>
1.1.1.13  root     2979: In addition to loaded symbols, the debugger supports also setting
                   2980: conditional breakpoints on values of some "virtual" variables listed
1.1.1.21! root     2981: by "variables" (v) command. For example:
1.1.1.12  root     2982: </p>
1.1.1.13  root     2983: <ul>
                   2984: <li>If you want the emulation to stop on the first instruction of
                   2985:     next program; after TOS desktop is up, set a breakpoint on
                   2986:     the TEXT segment address given in a program basepage:
                   2987: <pre>
                   2988: b  pc = TEXT :once
                   2989: </pre>
                   2990: Note1: It's better to trigger it only once because if you'd leave it on,
                   2991: during reboot you would get a warning for every instruction until TOS sets
                   2992: a valid basepage.
1.1.1.17  root     2993: <br />
                   2994: Note2: you cannot use an address breakpoint for this because value of
                   2995: a variable given to address breakpoint is evaluated when it's set, not
                   2996: at run-time, so it cannot get the new value that the TEXT variable
                   2997: gets when you start a program.
1.1.1.13  root     2998: </li>
1.1.1.18  root     2999: <li>To view current program DATA and BSS segment contents,
1.1.1.13  root     3000:     use the corresponding variables:
                   3001: <pre>
1.1.1.14  root     3002: m  DATA
                   3003: m  BSS
1.1.1.13  root     3004: </pre>
                   3005: </li>
                   3006: <li>If you want to stop at a specific cycle within a frame (that is,
                   3007:     PC relative to the current VBL/HBL in cycles), set breakpoints to
                   3008:     specific "HBL" and "FrameCycles" variable values.  If you for
                   3009:     example want to break after 20 HBLs, use:
1.1.1.12  root     3010: <pre>
1.1.1.13  root     3011: b  HBL = "HBL+20"
1.1.1.12  root     3012: </pre>
1.1.1.13  root     3013: </li>
                   3014: <li>Aes/Bios/Gemdos/LineA/LineF/Vdi/XbiosOpcode variables can be used
                   3015:     to catch AES, BIOS, GEMDOS, Line-A, Line-F, VDI and XBIOS OS-calls.
1.1.1.17  root     3016:     By default they contain the 0xffff value, so to trace e.g. all AES
                   3017:     calls, instead of a specific one, one needs to use something like this:
1.1.1.13  root     3018: <pre>
1.1.1.17  root     3019: b  AesOpcode ! AesOpcode  &amp;&amp;  AesOpcode &lt; 0xffff  :trace
1.1.1.13  root     3020: </pre>
                   3021: </li>
                   3022: </ul>
1.1.1.12  root     3023: 
                   3024: <p>
1.1.1.16  root     3025: Hint: "info" command "aes", "bios", "gemdos", "vdi" and "xbios"
1.1.1.20  root     3026: subcommands can be used to list the corresponding OS-call opcodes.
1.1.1.16  root     3027: For example, to see the GEMDOS opcodes, use:</p>
1.1.1.13  root     3028: <pre>
                   3029: info gemdos 1
                   3030: </pre>
                   3031: 
                   3032: 
1.1.1.17  root     3033: <h4 id="Chaining_breakpoints">Chaining breakpoints and other actions</h4>
1.1.1.13  root     3034: 
                   3035: <p>
                   3036: As the file pointed by the breakpoint ":file" option (see
1.1.1.17  root     3037: <a href="#Breakpoint_options">Breakpoint options</a>) can contain any
1.1.1.13  root     3038: debugger commands, it can also be used to do automatic "chaining" of
                   3039: debugger and breakpoint actions so that after one breakpoint is hit,
                   3040: another one is set.
1.1.1.12  root     3041: </p>
1.1.1.13  root     3042: 
                   3043: <p>For example if you have these input files:</p>
                   3044: <ul>
                   3045: <li>"break.ini":
                   3046: <pre>
1.1.1.18  root     3047: b GemdosOpcode = 0x3D :trace :once :file program.ini
1.1.1.17  root     3048: </pre>
                   3049: </li>
                   3050: <li>"program.ini":
                   3051: <pre>
1.1.1.18  root     3052: b pc = TEXT :trace :once :file trace.ini
1.1.1.13  root     3053: </pre>
                   3054: </li>
                   3055: <li>"trace.ini":
                   3056: <pre>
1.1.1.17  root     3057: symbols prg
                   3058: trace gemdos,cpu_symbols
1.1.1.18  root     3059: b VBL = "VBL+4" :trace :once :file disable.ini
1.1.1.13  root     3060: </pre>
                   3061: </li>
                   3062: <li>"disable.ini":
1.1.1.12  root     3063: <pre>
1.1.1.13  root     3064: trace none
                   3065: b all
1.1.1.12  root     3066: </pre>
1.1.1.13  root     3067: </li>
                   3068: </ul>
1.1.1.12  root     3069: 
                   3070: <p>
1.1.1.13  root     3071: And then start Hatari with the first debugger input file and a GEMDOS
1.1.1.18  root     3072: HD directory containing "desktop.inf" file:
1.1.1.13  root     3073: </p>
                   3074: <pre>
1.1.1.17  root     3075: hatari --parse break.ini /path/to/your/program.tos
1.1.1.13  root     3076: </pre>
                   3077: 
                   3078: <ol>
                   3079: <li>"break.ini" input file will break when TOS opens
                   3080:     the "desktop.inf" file (it's the first Fopen() i.e. GEMDOS call
                   3081:     0x3D done by TOS at boot) and the breakpoint will run
1.1.1.17  root     3082:     the debugger commands from the "symbols.ini" file
                   3083: <li>"program.ini" will setup breakpoint to program startup
                   3084:     (because TEXT variable cannot be used before TOS has booted)
                   3085: <li>"trace.ini" input file loads symbols for the run program, sets Hatari
                   3086:     to trace several things (see <a href="#Tracing">Tracing</a> section
                   3087:     below) in the emulated system for few VBLs until breakpoint runs
                   3088:     commands from the "disable.ini" file
1.1.1.13  root     3089: <li>"disable.ini" input file will disable tracing and remove
                   3090:     all (remaining) breakpoints
                   3091: </ol>
                   3092: 
1.1.1.18  root     3093: <p><em>Note:</em></p>
                   3094: <ul>
                   3095: <li>Because debugger input files cannot "continue"
1.1.1.13  root     3096: emulation, ":trace" option needs to be used for the breakpoint(s)
1.1.1.18  root     3097: if you want emulation to continue after the breakpoint action(s).</li>
                   3098: <li>In simpler breakpoint chain (like above), new breakpoint just
                   3099: replaces the previous one, ":once" option tells that breakpoint
                   3100: isn't needed after it's hit.
                   3101: </li>
                   3102: </ul>
1.1.1.12  root     3103: 
                   3104: <p>
1.1.1.13  root     3105: Hint: It's better to test each input file separate before testing the
                   3106: whole chain.  Besides the ":file" breakpoint option, these debugger
                   3107: input files can be also read with the debugger "file" command, "lock"
                   3108: command "file" option and with the Hatari "--parse" command line
                   3109: option.
1.1.1.10  root     3110: </p>
                   3111: 
1.1.1.18  root     3112: <h3>Stepping through code</h3>
1.1.1.12  root     3113: 
1.1.1.10  root     3114: <p>
1.1.1.13  root     3115: After analyzing the emulation state and/or setting new breakpoints,
                   3116: you can continue the emulation with the "c" command. You can continue
                   3117: for a given number of CPU instructions (or DSP instructions when "dc"
                   3118: is used), or you can continue forever (until a non-tracing breakpoint
                   3119: triggers) if you omit the instruction count.
                   3120: </p>
                   3121: 
                   3122: <p>
1.1.1.17  root     3123: If you want to continue just to the next instruction, use "s" (step)
                   3124: command to continue for exactly one instruction, or "n" (next), if you
1.1.1.21! root     3125: want to skip subroutine + exception calls and DBCC branching backwards
        !          3126: (i.e. loops).  "ds" and "dn" commands do the same for DSP (except that
        !          3127: "dn" doesn't skip loops).
1.1.1.17  root     3128: </p>
                   3129: 
                   3130: <p>
1.1.1.18  root     3131: You can also continue with the "n" until instruction of certain
                   3132: type is encountered, by giving it the instruction type:
                   3133: <ul>
1.1.1.21! root     3134: <li>"branch" matches branch instructions:<br>
        !          3135:     CPU: BCC, BRA, DBCC, JMP<br>
        !          3136:     DSP: DO/ENDO JCC, JCLR, JMP, JSET, REP</li>
        !          3137: <li>"subcall" matches subroutine calls:<br>
        !          3138:     CPU: BSR, JSR<br>
        !          3139:     DSP: JSCC, JSCLR, JSSET, JSR</li>
        !          3140: <li>"subreturn" matches return from subroutine:<br>
        !          3141:     CPU: RTD, RTR, RTS<br>
        !          3142:     DSP: RTS</li>
        !          3143: <li>"exception" matches exceptions:<br>
        !          3144:     CPU: BKPT, ILLG, STOP, TRAP, TRAPV</li>
        !          3145: <li>"exreturn" matches return from exception:<br>
        !          3146:     CPU: RTE<br>
        !          3147:     DSP: RTI</li>
1.1.1.18  root     3148: <li>"return" matches both subroutine and exception returns</li>
                   3149: </ul>
                   3150: 
                   3151: <p>
                   3152: For example: "n branch", or "dn branch".
                   3153: </p>
                   3154: 
                   3155: <p>
                   3156: (Note: CHK, CHK2, FBCC, FDBCC, &amp; FTRAPCC exception / branch CPU
                   3157: instructions aren't supported currently.)
                   3158: </p>
                   3159: 
                   3160: 
                   3161: <h3>Tracing</h3>
                   3162: 
                   3163: <p>
                   3164: If you want e.g. to continue with real-time disassembling, you can
                   3165: enable it with "trace cpu_disasm" (or "trace dsp_disasm" for DSP) at
                   3166: the debugger prompt before continuing.
1.1.1.12  root     3167: </p>
                   3168: <p>
                   3169: Disable tracing with "trace none" when you enter the debugger again.
1.1.1.16  root     3170: "trace help" (or TAB) can be used to list all the (over 40) supported
1.1.1.13  root     3171: traceable things, from HW events to OS functions.
1.1.1.12  root     3172: </p>
                   3173: <p>
1.1.1.18  root     3174: Notes:
                   3175: </p>
1.1.1.12  root     3176: <ul>
1.1.1.18  root     3177: <li>
                   3178: If GEMDOS HD emulation isn't enabled, GEMDOS call tracing needs to be
                   3179: enabled at Hatari command line, it's not possible to enable it after
                   3180: TOS has initialized GEMDOS.
1.1.1.13  root     3181: </li>
1.1.1.18  root     3182: <li>
                   3183: AES, BIOS, GEMDOS and XBIOS traces show arguments for (most of) the
                   3184: calls, VDI trace shows only function calls (parsing the arguments
                   3185: would be too complicated).
                   3186: </li>
                   3187: <li>
1.1.1.17  root     3188: Tracing options can be set even from a program within the emulation,
1.1.1.13  root     3189: if you enable the Hatari "--bios-intercept" option and call XBios 255
1.1.1.18  root     3190: from the program with a suitable trace options string.
                   3191: </li>
                   3192: <li>
1.1.1.12  root     3193: Note that the trace output file can be set only when Hatari starts,
                   3194: it cannot be changed from within the debugger (or emulation).
1.1.1.18  root     3195: </li>
                   3196: </ul>
1.1.1.16  root     3197: <p>
1.1.1.18  root     3198: If there isn't a trace option for something you'd like to track,
                   3199: you may be able to use tracing breakpoints, explained above.
                   3200: For example, following tracks Line-A calls:
1.1.1.16  root     3201: </p>
1.1.1.18  root     3202: <pre>
                   3203: b  LineAOpcode ! LineAOpcode  &amp;&amp;  LineAOpcode &lt; 0xffff  :trace
                   3204: </pre>
1.1.1.10  root     3205: 
1.1.1.13  root     3206: 
1.1.1.17  root     3207: <h3>Profiling</h3>
1.1.1.13  root     3208: 
                   3209: <p>
                   3210: Profiling tells where the emulated code spends most of its (emulated)
                   3211: time.  It can be used to find out where a program is (apparently)
1.1.1.17  root     3212: stuck, or what are the largest performance bottlenecks for a program.
1.1.1.13  root     3213: </p>
                   3214: 
1.1.1.17  root     3215: <h4>Collecting the profile data</h4>
                   3216: 
1.1.1.13  root     3217: <p>
                   3218: Profiling is used by first enabling the profiler (use "dp" for DSP):
                   3219: </p>
                   3220: <pre>
                   3221: &gt; profile on
                   3222: Profiling enabled.
                   3223: </pre>
                   3224: <p>
                   3225: And profiling will start once you continue the emulation:
                   3226: </p>
                   3227: <pre>
                   3228: &gt; c
                   3229: Returning to emulation...
1.1.1.17  root     3230: Allocated CPU profile buffer (27 MB).
1.1.1.13  root     3231: </pre>
                   3232: 
                   3233: <p>
                   3234: When you get back to the debugger, the collected profiling information
1.1.1.17  root     3235: is processed and a summary of in which parts of memory the execution
                   3236: happened, and how long it took, is shown:
1.1.1.13  root     3237: </p>
                   3238: <pre>
1.1.1.17  root     3239: Allocated CPU profile address buffer (57 KB).
1.1.1.13  root     3240: ROM TOS (0xE00000-0xE80000):
                   3241: - active address range:
1.1.1.17  root     3242:   0xe00030-0xe611a4
1.1.1.13  root     3243: - active instruction addresses:
1.1.1.17  root     3244:   14240 (100.00% of all)
1.1.1.13  root     3245: - executed instructions:
1.1.1.17  root     3246:   4589668 (100.00% of all)
1.1.1.13  root     3247: - used cycles:
1.1.1.17  root     3248:   56898472 (100.00% of all)
                   3249:   = 7.09347s
                   3250: Cartridge ROM (0xFA0000-0xFC0000):
                   3251:   - no activity
                   3252: 
                   3253: = 7.09347s
1.1.1.13  root     3254: </pre>
                   3255: <p>
                   3256: (DSP RAM will be shown only as single area in profile information.)
                   3257: </p>
                   3258: 
1.1.1.17  root     3259: 
                   3260: <h4>Investigating the profile data</h4>
                   3261: 
1.1.1.13  root     3262: <p>
1.1.1.17  root     3263: When you're back in debugger, you can inspect the collected profile data:
1.1.1.13  root     3264: </p>
                   3265: <pre>
1.1.1.17  root     3266: &gt; h profile
1.1.1.13  root     3267: 'profile' - profile CPU code
1.1.1.18  root     3268: Usage:  profile &lt;subcommand&gt; [parameter]
                   3269: 
1.1.1.21! root     3270:        Subcommands:
        !          3271:                - on
1.1.1.18  root     3272:                - off
                   3273:                - counts [count]
                   3274:                - cycles [count]
1.1.1.21! root     3275:                - i-misses [count]
        !          3276:                - d-hits [count]
1.1.1.18  root     3277:                - symbols [count]
                   3278:                - addresses [address]
                   3279:                - callers
1.1.1.21! root     3280:                - caches
1.1.1.18  root     3281:                - stack
                   3282:                - stats
                   3283:                - save &lt;file&gt;
                   3284:                - loops &lt;file&gt; [CPU limit] [DSP limit]
                   3285: 
1.1.1.21! root     3286:        'on' &uml; 'off' enable and disable profiling.  Data is collected
1.1.1.17  root     3287:        until debugger is entered again at which point you get profiling
1.1.1.18  root     3288:        statistics ('stats') summary.
1.1.1.17  root     3289: 
                   3290:        Then you can ask for list of the PC addresses, sorted either by
1.1.1.21! root     3291:        execution 'counts', used 'cycles', i-cache misses or d-cache hits.
        !          3292:        First can be limited just to named addresses with 'symbols'.
        !          3293:        Optional count will limit how many items will be shown.
        !          3294: 
        !          3295:        'caches' shows histogram of CPU cache usage.
1.1.1.17  root     3296: 
                   3297:        'addresses' lists the profiled addresses in order, with the
1.1.1.18  root     3298:        instructions (currently) residing at them.  By default this
1.1.1.17  root     3299:        starts from the first executed instruction, or you can
                   3300:        specify the starting address.
                   3301: 
1.1.1.18  root     3302:        'callers' shows (raw) caller information for addresses which
                   3303:        had symbol(s) associated with them.  'stack' shows the current
                   3304:        profile stack (this is useful only with :noinit breakpoints).
                   3305: 
                   3306:        Profile address and callers information can be saved with
                   3307:        'save' command.
                   3308: 
                   3309:        Detailed (spin) looping information can be collected by
                   3310:        specifying to which file it should be saved, with optional
                   3311:        limit(s) on how many bytes first and last instruction
                   3312:        address of the loop can differ (0 = no limit).
1.1.1.13  root     3313: </pre>
                   3314: 
1.1.1.17  root     3315: <p>For example, to see which memory addresses were executed most
                   3316: and what instructions those have at the end of profiling, use:</p>
1.1.1.13  root     3317: <pre>
                   3318: &gt; profile counts 8
                   3319: addr:           count:
1.1.1.17  root     3320: 0xe06f10        12.11%  555724  move.l    $4ba,d1
                   3321: 0xe06f16        12.11%  555724  cmp.l     d1,d0
                   3322: 0xe06f18        12.11%  555724  bgt.s     $e06f06
                   3323: 0xe06f06        12.11%  555708  move.b    $fffffa01.w,d1
                   3324: 0xe06f0a        12.11%  555708  btst      #5,d1
                   3325: 0xe06f0e        12.11%  555708  beq.s     $e06f1e
                   3326: 0xe00ed8         1.66%  76001   subq.l    #1,d0
                   3327: 0xe00eda         1.66%  76001   bpl.s     $e00ed8
1.1.1.13  root     3328: 8 CPU addresses listed.
                   3329: </pre>
1.1.1.17  root     3330: 
1.1.1.13  root     3331: <p>
1.1.1.17  root     3332: Then, to see what the executed code and its costs look like
                   3333: around top addresses:
                   3334: <pre>
                   3335: &gt; profile addresses 0xe06f04
                   3336: # disassembly with profile data:
1.1.1.21! root     3337: # &lt;instructions percentage&gt;% (&lt;sum of instructions&gt;, &lt;sum of cycles&gt;, &lt;sum of i-cache misses&gt;, &lt;sum of d-cache hits&gt;)
        !          3338: 
        !          3339: $e06f04 :             bra.s     $e06f10                    0.00% (48, 576, 0, 0)
        !          3340: $e06f06 :             move.b    $fffffa01.w,d1            12.11% (555708, 8902068, 0, 0)
        !          3341: $e06f0a :             btst      #5,d1                     12.11% (555708, 6685268, 0, 0)
        !          3342: $e06f0e :             beq.s     $e06f1e                   12.11% (555708, 4457312, 0, 0)
        !          3343: $e06f10 :             move.l    $4ba,d1                   12.11% (555724, 11125668, 0, 0)
        !          3344: $e06f16 :             cmp.l     d1,d0                     12.11% (555724, 4461708, 0, 0)
        !          3345: $e06f18 :             bgt.s     $e06f06                   12.11% (555724, 4455040, 0, 0)
        !          3346: $e06f1a :             moveq     #1,d0                      0.00% (16, 64, 0, 0)
1.1.1.17  root     3347: Disassembled 8 (of active 14240) CPU addresses.
                   3348: </pre>
                   3349: <p>
                   3350: Unlike normal disassembly, "profile addresses" command shows only
                   3351: memory addresses which instructions were executed during profiling.
                   3352: You get instruction cache misses only when using cycle-accurate 030
                   3353: emulation with a Hatari version configured to use WinUAE CPU core.
                   3354: <p>
                   3355: If you have loaded symbol information, symbol names are shown above
                   3356: the corresponding addresses.  With the "profile symbols" command you
                   3357: get a list of how many times the code execution passed through the
                   3358: defined symbol addresses.
1.1.1.13  root     3359: </p>
                   3360: 
1.1.1.17  root     3361: 
                   3362: <h4>Profile data accuracy</h4>
                   3363: 
                   3364: <p>Profile data accuracy depends on Hatari emulation accuracy.
                   3365: Profile data accuracy from most to least accurate when Hatari's
                   3366: default emulation options are used is following:</p>
                   3367: <ul>
                   3368: <li>Executed CPU and DSP instruction counts are accurate.</li>
1.1.1.20  root     3369: <li>68000 cycle counts have been tested to be accurate to within 1%.</li>
                   3370: <li>DSP cycle counts (and the variance information) should be accurate.</li>
                   3371: <li>030 CPU instruction cache hit/miss counts (provided by WinUAE CPU core)
                   3372:     are assumed to be accurate.</li>
                   3373: <li>As to 680x0 cycles... Cycles used by a given CPU instruction depend
                   3374:     on what instruction(s) is executed, where it was executed (ST or
                   3375:     TT-RAM) and what data was processed before it (was it cached).
                   3376:     E.g. 030 cycle counts can be off by tens of percents.</li>
                   3377: <li>FPU instruction cycles can be off by 2x.</li>
1.1.1.17  root     3378: </ul>
                   3379: 
                   3380: 
                   3381: <h4>Caller information</h4>
                   3382: 
1.1.1.13  root     3383: <p>
1.1.1.17  root     3384: If you have loaded symbols (see <a href="#Debug_symbols">Debug symbols</a>)
                   3385: before continuing emulation/profiling, additional caller information
                   3386: will be collected for all the code symbol addresses which are called
                   3387: as subroutines.  This information includes callstack, call counts,
                   3388: calling instruction type (subroutine call, branch, return etc), and
                   3389: costs for those calls, both including costs for further subroutine
                   3390: calls and without them.
1.1.1.13  root     3391: </p>
                   3392: 
1.1.1.17  root     3393: <p>When debugger is re-entered, current callstack is output before
                   3394: profiling information:</p>
                   3395: <pre>
                   3396: &gt; a <em>_P_LineAttack</em>
                   3397: CPU condition breakpoint 1 with 1 condition(s) added:
                   3398:         pc = $30f44
                   3399: $030f44 : 48e7 3820                            movem.l   d2-d4/a2,-(sp)
                   3400: &gt; c
                   3401: ...
                   3402: CPU breakpoint condition(s) matched 1 times.
                   3403:         pc = $30f44
                   3404: Finalizing costs for 12 non-returned functions:
                   3405: - 0x32a3c: _P_GunShot (return = 0x32b7e)
                   3406: - 0x32b18: _A_FireShotgun (return = 0x3229a)
                   3407: - 0x3223a: _P_SetPsprite (return = 0x32e86)
                   3408: - 0x32e4e: _P_MovePsprites (return = 0x38070)
                   3409: - 0x37f44: _P_PlayerThink (return = 0x36ea0)
                   3410: - 0x36e44: _P_Ticker (return = 0x260e0)
                   3411: - 0x25dcc: _G_Ticker (return = 0x1e4c6)
                   3412: - 0x1e29e: _TryRunTics (return = 0x239fa)
                   3413: - 0x238e8: _D_DoomLoop (return = 0x2556a)
                   3414: - 0x24d7a: _D_DoomMain (return = 0x44346)
                   3415: ...
                   3416: </pre>
                   3417: 
                   3418: <p>("profile stack" command can be used in breakpoints with :noinit
                   3419: option to show backtraces during caller profiling.)</p>
                   3420: 
1.1.1.21! root     3421: <p>Note: rest of this subsection is about caller information format
        !          3422: which is mainly of interest for people writing profiling
        !          3423: post-processing tools.  Come back here if you think there's
        !          3424: some problem with callgraphs produced by those tools.</p>
        !          3425: 
1.1.1.17  root     3426: <p>Other information collected during profiling is shown with
                   3427: following command:</p>
                   3428: <pre>
                   3429: &gt; profile callers
                   3430: # &lt;callee&gt;: &lt;caller1&gt; = &lt;calls&gt; &lt;types&gt;[ &lt;inclusive/totals&gt;[ &lt;exclusive/totals&gt;]], &lt;caller2&gt; ..., &lt;callee name&gt;
                   3431: # types: s = subroutine call, r = return from subroutine, e = exception, x = return from exception,
                   3432: #        b = branch/jump, n = PC moved to next instruction, u = unknown PC change
                   3433: # totals: calls/instructions/cycles/misses
                   3434: 0xe00030: 0xffffff = 1 e, _main
                   3435: 0xe000fe: 0xe00a0c = 1 b, memdone
                   3436: 0xe0010a: 0xe04e34 = 1 s 1/5/72 1/5/72, _run_cartridge_applications
                   3437: 0xe00144: 0xe04dbe = 1 s 4/118/1512 1/27/444, _init_acia_vecs
                   3438: 0xe001ea: 0xe00ec6 = 1 b, _int_acia
                   3439: 0xe0038c: 0xe04c28 = 1 s 1/191/2052 1/191/2052, _init_exc_vec
                   3440: 0xe003a6: 0xe04c2e = 1 s 1/388/4656 1/388/4656, _init_user_vec
                   3441: ...
                   3442: </pre>
                   3443: 
                   3444: <p>
                   3445: For example, if you don't know all the places from which a certain
                   3446: function is called, or in what context a certain interrupt handler can
                   3447: be called during the period you're profiling, profile caller
                   3448: information will tell you:
                   3449: </p>
                   3450: <pre>
                   3451: callee: caller: calls: calltype:
                   3452:   |       |       |   /
                   3453: 0x379:  0x155 = 144 r, 0x283 = 112 b, 0x2ef = 112 b, 0x378 = 72 s
                   3454: 583236/359708265/1631189180 72/4419020/19123430, dsp_interrupt
                   3455:            |                       |                 |
                   3456:     inclusive costs         exclusive costs     callee name
                   3457:   (of calls from 0x378)
1.1.1.13  root     3458: 
1.1.1.17  root     3459: Calltypes:
                   3460: - b: jump/branch
                   3461: - n: PC  just moved to next address
                   3462: - r: subroutine return
                   3463: - s: subroutine call
                   3464: </pre>
                   3465: <p>
                   3466: (Most "calls" to "dsp_interrupt" were subroutine call returns (=r)
                   3467: to it from address 0x155.)
                   3468: </p>
                   3469: 
                   3470: <p>
                   3471: With the execution counts in normal profiling data, caller information
                   3472: can actually be used to have complete picture of what exactly the code
                   3473: did during profiling.  Main/overview work for this analysis is best done
                   3474: automatically, by the profiler data post-processor (documented below).
                   3475: </p>
                   3476: 
                   3477: 
                   3478: <h4>Caller data accuracy</h4>
                   3479: 
                   3480: <p>Everything about profile data accuracy applies also to caller costs,
                   3481: but there are additional things to take into account, mainly because
1.1.1.18  root     3482: profiler cannot determine when exceptions are being handled:</p>
1.1.1.17  root     3483: <ul>
                   3484: <li>If there are exception(s) during a subroutine call, costs for
                   3485:     the exception handling will also be accounted for that subroutine.
                   3486:     This shouldn't be a problem unless those costs are very large,
                   3487:     i.e. check how much CPU your exception handlers take.</li>
                   3488: <li>Indicated exception handler call type can be incorrect.</li>
                   3489: <li>Profiled code doing return address related stack manipulations
                   3490:     confuses call tracking and produces incorrect results (profiler
                   3491:     has special code to handle EmuTOS AES switcher because of this).
                   3492:     Typically this produces large list of functions that are finalized
                   3493:     at profile end, so it should be easy to detect.</li>
1.1.1.20  root     3494: <li>Complicated recursive calls seem to sometimes cause inclusive
1.1.1.17  root     3495:     costs (ones including costs of further subroutine calls) to be
                   3496:     incorrect.  Sometimes this can be noticed by them being even
                   3497:     &gt;100%.</li>
                   3498: <li>On DSP, profiler heuristics assume (for speed reasons) that
                   3499:     <em>conditional</em> subroutine calls never call the very next
                   3500:     instruction (as that would be very bad/inefficient code).</li>
                   3501: </ul>
                   3502: 
                   3503: 
                   3504: <h4>Saving profile data to a file</h4>
                   3505: 
                   3506: <p>It's useful to save the profile data to a file:
                   3507: <pre>
                   3508: &gt; profile save program-profile.txt
                   3509: </pre>
                   3510: 
                   3511: <p>With the saved profile disassembly (and optional caller information)
                   3512: you can more easily investigate what your program did during
                   3513: profiling, search symbols &amp; addresses in it, and compare the
                   3514: results to profiles you've saved from earlier versions of your code.</p>
                   3515: 
                   3516: <p>You may even create your own post-processing tools for
                   3517: investigating the profiling data more closely, e.g. to
                   3518: <a href="http://www.atari-forum.com/viewtopic.php?f=68&amp;t=24561&amp;start=75#p226505">find
                   3519: CPU/DSP communication bottlenecks</a>.</p>
                   3520: 
                   3521: 
                   3522: <h3>Profile data post-processing</h3>
                   3523: 
                   3524: <p>Saved profile data can be post-processed with (Python) script
                   3525: installed by Hatari, to:</p>
                   3526: <ul>
                   3527: <li>Get lists of functions/symbols with highest costs.</li>
                   3528: <li>Get callgraphs of what functions/symbols cause those
1.1.1.18  root     3529:     costs and what kind of call hierarchy the profiled code
1.1.1.17  root     3530:     has.</li>
                   3531: <li>Export profile data in Valgrind's
                   3532:     <a href="http://valgrind.org/docs/manual/cl-format.html">Callgrind format</a>
                   3533:     for viewing it in
                   3534:     <a href="http://kcachegrind.sourceforge.net/">Kcachegrind</a>
                   3535:     GUI.</li>
                   3536: </ul>
                   3537: 
                   3538: 
                   3539: <h4>Providing symbols for the post-processor</h4>
                   3540: 
                   3541: <p>When the data is post-processed, you should always provide
                   3542: the post-processor symbols for the profile code!  Relying just on the
1.1.1.20  root     3543: symbol in the profile data can cause costs to be assigned to wrong
1.1.1.17  root     3544: symbol, if symbol's code wasn't called through symbol's own address,
                   3545: but by jumping inside its code.</p>
                   3546: 
                   3547: <p>If your code is in fixed location, you should tell
                   3548: post-processor to handle symbol addresses as absolute (-a):</p>
                   3549: <pre>
                   3550: $ hatari_profile.py <b>-a</b> etos512k.sym emutos-profile.txt
                   3551: </pre>
                   3552: 
                   3553: <p>Normal programs are relocated and you should instead give
                   3554: the symbols as TEXT (code) section relative ones (-r):</p>
                   3555: <pre>
                   3556: $ hatari_profile.py <b>-r</b> program.sym program-profile.txt
                   3557: </pre>
                   3558: 
                   3559: <p>If symbols are included to your binary in DRI/GST format, first they
                   3560: need to be extracted to <a href="#Debug_symbols">the ASCII format</a>
                   3561: understood by the post-processor:</p>
                   3562: <pre>
                   3563: $ gst2ascii -l -o program.prg &gt; program.sym
                   3564: </pre>
                   3565: 
                   3566: <p>If there are some extra symbols that you don't want to see
                   3567: separately in profiles, because they aren't real functions,
                   3568: but e.g. loop labels, you can either remove them manually
                   3569: from the ASCII *.sym file, or filter them out with grep:
                   3570: </p>
                   3571: <pre>
1.1.1.18  root     3572: $ gst2ascii -l -o program.prg | grep -v -e useless1 -e useless2 &gt; program.sym
1.1.1.17  root     3573: </pre>
                   3574: 
1.1.1.18  root     3575: 
                   3576: <h4>Post-processor provided statistics</h4>
                   3577: 
1.1.1.17  root     3578: <p>Above post-processor examples just parse + verify the given data
                   3579: and produce output like this:</p>
                   3580: <pre>
                   3581: Hatari profile data processor
                   3582: 
                   3583: Parsing TEXT relative symbol address information from program.sym...
                   3584: [...]
                   3585: 3237 lines with 1550 code symbols/addresses parsed, 0 unknown.
                   3586: 
                   3587: Parsing profile information from program-profile.txt...
                   3588: [...]
                   3589: 9575 lines processed with 368 functions.
                   3590: 
                   3591: CPU profile information from 'program-profile.txt':
                   3592: - Hatari v1.6.2+ (May  4 2013), WinUAE CPU core
                   3593: </pre>
                   3594: 
                   3595: <p>To get statistics (-s) and list of top (-t) CPU users in profile,
                   3596: add "-st" option:</p>
                   3597: <pre>
                   3598: $ hatari_profile.py <b>-st</b> -r program.sym program-profile.txt
                   3599: [...]
                   3600: CPU profile information from 'program-profile.txt':
                   3601: - Hatari v1.6.2+ (May  4 2013), WinUAE CPU core
                   3602: 
                   3603: Time spent in profile = 34.49539s.
                   3604: 
                   3605: Calls:
                   3606: - max = 187738, in __toupper at 0x52b88, on line 8286
                   3607: - 1585901 in total
                   3608: Executed instructions:
                   3609: - max = 1900544, in flat_remap_mips+14 at 0x47654, on line 7020
                   3610: - 64499351 in total
                   3611: Used cycles:
                   3612: - max = 15224620, in flat_remap_mips+18 at 0x47658, on line 7022
                   3613: - 553392132 in total
                   3614: Instruction cache misses:
                   3615: - max = 184308, in _BM_T_GetTicks at 0x43b90, on line 4772
                   3616: - 4941307 in total
                   3617: 
                   3618: Calls:
                   3619:   11.84%      187698  __toupper
                   3620:   11.48%      182105  _BM_T_GetTicks
                   3621:   11.48%      182019  _I_GetTime
                   3622: [...]
                   3623: Executed instructions:
                   3624:   34.83%    22462729  flat_generate_mips
                   3625:   14.08%     9080215  flat_remap_mips
                   3626:    8.55%     5515945  render_patch_direct
                   3627:    5.09%     3283328  _TryRunTics
                   3628: [...]
                   3629: Used cycles:
                   3630:   23.62%   130702768  flat_generate_mips
                   3631:   12.42%    68735832  flat_remap_mips
                   3632:    9.77%    54041148  _TryRunTics
                   3633:    5.80%    32111536  correct_element
                   3634: [...]
                   3635: Instruction cache misses:
                   3636:   37.03%     1829764  _TryRunTics
                   3637:   11.20%      553314  _BM_T_GetTicks
                   3638:    9.44%      466319  _NetUpdate
                   3639:    9.27%      457899  _HGetPacket
                   3640: [...]
                   3641: </pre>
                   3642: 
                   3643: <p>If you want to see also symbol addresses and what is per call
                   3644: cost, add -i option:<p>
                   3645: <pre>
                   3646: $ hatari_profile.py -st <b>-i</b> -r program.sym program-profile.txt
                   3647: [...]
                   3648: Executed instructions:
                   3649:   34.83%    22462729  flat_generate_mips   (0x04778a, 774576 / call)
                   3650:   14.08%     9080215  flat_remap_mips      (0x047646, 313110 / call)
                   3651:    8.55%     5515945  render_patch_direct  (0x047382, 29977 / call)
                   3652:    5.09%     3283328  _TryRunTics          (0x042356, 19660 / call)
                   3653: [...]
                   3654: Used cycles:
                   3655:   23.62%   8.14728s  130702768  flat_generate_mips  (0x04778a, 0.28094s / call)
                   3656:   12.42%   4.28461s   68735832  flat_remap_mips     (0x047646, 0.14775s / call)
                   3657:    9.77%   3.36863s   54041148  _TryRunTics         (0x042356, 0.02017s / call)
                   3658:    5.80%   2.00165s   32111536  correct_element     (0x04a658, 0.00001s / call)
                   3659: [...]
                   3660: Instruction cache misses:
                   3661:   37.03%     1829764  _TryRunTics          (0x042356, 10956 / call)
                   3662:   11.20%      553314  _BM_T_GetTicks       (0x043b90, 3 / call)
                   3663:    9.44%      466319  _NetUpdate           (0x041bcc, 5 / call)
                   3664:    9.27%      457899  _HGetPacket          (0x041754, 5 / call)
                   3665: [...]
                   3666: </pre>
                   3667: 
                   3668: <p>(For cycles the "per call" information is in seconds, not as
                   3669: a cost count.)</p>
                   3670: 
                   3671: <p>If your profile file contains caller information, you should
                   3672: add -p option to see it, as that will also help in detecting symbol
                   3673: issues (see <a href="#Interpreting_the_numbers">Interpreting
                   3674: the numbers</a>):<p>
                   3675: <pre>
                   3676: $ hatari_profile.py -st <b>-p</b> -r program.sym program-profile.txt
                   3677: [...]
                   3678: 9575 lines processed with 368 functions.
                   3679: [...]
                   3680: Of all 1570498 switches, ignored 581 for type(s) ['r', 'u', 'x'].
                   3681: 
                   3682: CPU profile information from 'badmood-level-load-CPU.txt':
                   3683: - Hatari v1.6.2+ (May  4 2013), WinUAE CPU core
                   3684: [...]
                   3685: Calls:
                   3686:   11.84%  11.84%      187698    187698  __toupper
                   3687:   11.48%  11.48%      182105    182105  _BM_T_GetTicks
                   3688:   11.48%  22.95%      182019    364038  _I_GetTime
                   3689: [...]
                   3690: Executed instructions:
                   3691:   34.83%  34.86%  34.86%    22462729  22484024  22484024  flat_generate_mips
                   3692:   14.08%  14.10%  14.10%     9080215   9091270   9091676  flat_remap_mips
                   3693:    8.55%                     5515945                      render_patch_direct
                   3694:    5.09%   5.11%  94.96%     3283328   3294022  61247717  _TryRunTics
                   3695: [...]
                   3696: Used cycles:
                   3697:   23.62%  23.69%  23.69%   130702768 131100604 131100604  flat_generate_mips
                   3698:   12.42%  12.46%  12.46%    68735832  68928816  68930904  flat_remap_mips
                   3699:    9.77%   9.80%  95.66%    54041148  54238744 529368824  _TryRunTics
                   3700:    5.80%   5.82%   5.82%    32111536  32193664  32193664  correct_element
                   3701: [...]
                   3702: Instruction cache misses:
                   3703:   37.03%  37.14%  98.57%     1829764   1835261   4870573  _TryRunTics
                   3704:   11.20%  11.24%  11.24%      553314    555191    555191  _BM_T_GetTicks
                   3705:    9.44%   9.49%  29.13%      466319    468782   1439340  _NetUpdate
                   3706:    9.27%   9.29%   9.37%      457899    459197    463217  _HGetPacket
                   3707: [...]
                   3708: </pre>
                   3709: 
1.1.1.18  root     3710: <p>Now there's a message telling that some of the calls were ignored
                   3711: because according to their "call type", they were actually returns from
1.1.1.17  root     3712: exceptions, not real calls (this is mainly important for callgraph
                   3713: generation, discussed below).</p>
                   3714: 
                   3715: 
                   3716: <h4>Interpreting the results</h4>
                   3717: 
                   3718: <p>In addition to accuracy issues mentioned in previous Profiling
                   3719: sections, function/symbol level costs have gotchas of their own.</p>
                   3720: 
                   3721: <p>The first cost percentage and count columns are <em>sums for all
                   3722: the instructions</em> that were in profile data file <em>between
                   3723: the indicated symbol's address and the address of the next symbol</em>
                   3724: (= "between-symbols" cost).</p>
                   3725: 
                   3726: <p><strong>NOTE:</strong> If your symbol file doesn't contain addresses
                   3727: for all the relevant symbols, results from this can be misleading because
                   3728: instructions costs get assigned to <em>whatever</em> symbol's address
1.1.1.18  root     3729: happened to precede those instructions.  And you don't see which
1.1.1.17  root     3730: caller is causing it from caller info or callgraph either, as entry
                   3731: point for that time sink lacking a symbol means profiler hadn't
                   3732: tracked calls to it...</p>
                   3733: 
                   3734: <p>The next two cost percentage and count columns are for <em>subroutine
                   3735: calls costs</em>, first one for exclusive and latter for inclusive cost
                   3736: i.e. including costs for further subroutine calls.  Values are based on
                   3737: caller information documented above.</p>
                   3738: 
                   3739: <p>Reasons why between-symbol costs, and subroutine call costs can
1.1.1.18  root     3740: differ, are following:</p>
1.1.1.17  root     3741: <ul>
                   3742: <li>Subroutine terminates before next symbol address: exclusive
                   3743:     cost is smaller than in-between cost <em>because of missing
                   3744:     symbol information</em>
                   3745:     (these are indicated with '*' in statistics).</li>
                   3746: <li>Subroutine is called more through jumps/branches than through
                   3747:     subroutine calls: inclusive call count may be smaller than
                   3748:     in-between call count which includes branches/jumps.</li>
                   3749: <li>Subroutine jumps/branches to another function instead of
                   3750:     using subroutine call, or function contains additional
                   3751:     (non-function) labels: exclusive cost is larger than
                   3752:     in-between cost.</li>
                   3753: <li>Exception happening during subroutine call: exclusive cost is
                   3754:     (slightly) larger than in-between cost.</li>
                   3755: </ul>
                   3756: 
                   3757: <p>In the first case, you should check the profile data to find out
                   3758: whether there are missing symbols for executed function entry points.
                   3759: You can notice function entry points as address gap and/or code
1.1.1.18  root     3760: retrieving arguments from stack. Exit points can be seen from RTS
                   3761: instructions.</p>
1.1.1.17  root     3762: 
                   3763: <p>Second case can also be seen from the profile data.  Call count
                   3764: is same as count for how many times first instruction is executed
                   3765: (worst case: large loop on subroutine's first instruction).</p>
                   3766: 
                   3767: <p>While subroutine costs should be more accurate and relevant, due to
                   3768: code optimizations many of the functions are not called as subroutines
1.1.1.20  root     3769: (on m68k, using JSR/BSR), but just jumped or branched to.  Because of
1.1.1.17  root     3770: this, it's useful to compare both subroutine and between-symbols
                   3771: costs.  One should be able to see from the profile disassembly which
                   3772: of the above cases is cause for the discrepancy in the values.</p>
                   3773: 
                   3774: <p><strong>NOTE:</strong> Before starting to do any serious source
                   3775: level optimizations, you should <em>always</em> verify from profile
                   3776: data (disassembly) where exactly the costs are in a function, to make
                   3777: sure your optimization efforts can actually help the performance.</p>
                   3778: 
                   3779: 
                   3780: <h4>Generating and viewing callgraphs</h4>
                   3781: 
1.1.1.19  root     3782: <p>Callgraphs require that saved profile data contains caller
                   3783: function address information, i.e. symbols for the code should
                   3784: be loaded before starting profiling it (see
                   3785: <a href="#Debug_symbols">loading symbol data</a>).</p>
1.1.1.17  root     3786: 
                   3787: <p>Separate callgraphs will be created for each of the costs
                   3788: (0=calls, 1=instructions, 2=cycles) with the -g option:</p>
                   3789: <pre>
                   3790: $ hatari_profile.py <b>-p -g</b> -r program.sym program-profile.txt
                   3791: [...]
                   3792: Generating 'program-profile-0.dot' DOT callgraph file...
                   3793: 
                   3794: Generating 'program-profile-1.dot' DOT callgraph file...
                   3795: 
                   3796: Generating 'program-profile-2.dot' DOT callgraph file...
                   3797: [...]
                   3798: </pre>
                   3799: 
                   3800: <p>Callgraphs are saved in <a href="http://www.graphviz.org/">GraphViz</a>
                   3801: "dot" format.  Dot files can be viewed:</p>
                   3802: <ul>
                   3803: <li>With "dotty" program included with GraphViz</li>
                   3804: <li>With <a href="http://code.google.com/p/jrfonseca/wiki/XDot">XDot</a>
                   3805:     Python GUI (best option on Linux), or some platform specific viewer</li>
                   3806: <li>By converting dot file to PostScript or SVG format before
                   3807:     viewing it with viewers for those:
                   3808: <pre>
                   3809: $ dot -Tsvg program-profile-1.dot &gt; program-profile-1.svg
                   3810: </pre>
                   3811:     (problem with most PS/PDF and SVG viewers is that either they
                   3812:     don't allow zooming large callgraphs enough or they use huge
                   3813:     amounts of memory and get very slow)
                   3814:     </li>
                   3815: </ul>
                   3816: 
                   3817: <p>Produced callgraph will look like this:</p>
                   3818: <div style="text-align:center">
                   3819:   <a href="images/callgraph.svg">
                   3820:     <img src="images/callgraph.png" width="953" height="589"
                   3821:          alt="Part of callgraph" />
                   3822:   </a>
                   3823: </div>
                   3824: 
                   3825: <p>Interpreting the callgraph:</p>
                   3826: <ul>
                   3827: <li>Diamond shaped nodes are symbols called as subroutines.
                   3828:     Values listed in them are subroutine call costs; inclusive
                   3829:     (total) cost with exclusive (own) cost in parenthesis,
                   3830:     followed by inclusive cost count.  Exclusive cost is
                   3831:     shown only if it differs from inclusive one.</li>
                   3832: <li>Ellipse shaped nodes are for other symbols (functions
                   3833:     called using jumps/branches, loop labels etc).  Values
                   3834:     listed in them are between-symbols costs, i.e. normally
                   3835:     they're included to inclusive (total) costs shown in
                   3836:     subroutine call node somewhere higher in call hierarchy.</li>
                   3837: <li>Nodes which exclusive (own) or between-symbols costs
                   3838:     exceed default or explicitly given threshold value,
                   3839:     have gray background.</li>
1.1.1.18  root     3840: <li>Both nodes, which inclusive or between-symbols cost exceeds
                   3841:     the threshold value, and the arrows to &amp; from them,
1.1.1.17  root     3842:     are marked red.
                   3843: <li>Arrow types indicate call types; normal arrows subroutine
                   3844:     calls, circles branches/jumps, backarrows returns.
                   3845:     Exception calls and returns are indicated with dashed lines,
                   3846:     unknown calls with dotted lines.</li>
1.1.1.18  root     3847: <li>Arrow text tells from which address (within the caller)
                   3848:     the call originated.  If symbol had multiple callers, text
                   3849:     includes count of calls from that particular address, and its
                   3850:     percentage is of all calls done to that symbol.</li>
1.1.1.17  root     3851: </ul>
                   3852: 
                   3853: 
                   3854: <h4>Making large callgraphs readable</h4>
                   3855: 
                   3856: <p>If profile is for larger and more varied amount of code
                   3857: (e.g. program startup), the resulting callgraph can be so
                   3858: huge it's unreadable.</p>
                   3859: 
                   3860: <p>If your code has interrupt handlers, they can get called
                   3861: at any point, which can show in callgraph as "explicit" calls
                   3862: from the interrupted functions.  To get rid of such incorrect
                   3863: calls, give interrupt handler names to --ignore-to option:</p>
                   3864: <pre>
                   3865: $ hatari_profile.py -p -g <b>--ignore-to handler1,handler2</b> -r program.sym program-profile.txt
                   3866: </pre>
                   3867: 
                   3868: <p>In large callgraph most of the functions aren't really interesting,
                   3869: because their contribution to the cost is insignificant. You can
                   3870: remove large number of them with --no-leafs and --no-intermediate
1.1.1.20  root     3871: options, those options act <em>only</em> on nodes which costs are below
1.1.1.17  root     3872: given threshold.  Leaf nodes are ones which don't have any parents
1.1.1.18  root     3873: and/or children. Intermediate ones have only single parent and
                   3874: children (node calling itself is not taken into account).
1.1.1.17  root     3875: 
                   3876: <p>Threshold for this is given with the --limit (-l) option.  With
                   3877: that it typically makes also sense to change the node emphasis
                   3878: threshold with --emph-limit (-e) option:</p>
                   3879: <pre>
                   3880: $ hatari_profile.py -p -g <b>-l 0.5 -e 2.0</b> -r program.sym program-profile.txt
                   3881: </pre>
                   3882: 
                   3883: <p>If you're not interested in from how many different addresses
                   3884: a given function calls another function, use --compact option.  If you
                   3885: still see multiple calls between two nodes with it, the reason is that
                   3886: they happened through different call paths which were removed from
                   3887: the callgraph after --compact option was applied:</p>
                   3888: <pre>
                   3889: $ hatari_profile.py -p -g -l 1.0 -e 2.0 <b>--no-leafs --no-intermediate --compact</b> -r program.sym program-profile.txt
                   3890: </pre>
                   3891: 
                   3892: <p>If even this doesn't help, you can remove all nodes below
                   3893: the given cost threshold limit with --no-limited option, but this
1.1.1.18  root     3894: often doesn't leave much of a call hierarchy.  Instead you may
                   3895: consider removing all nodes except for subroutine call ones, with the
1.1.1.17  root     3896: --only-subroutines option.</p>
                   3897: 
                   3898: <p>If you have trouble locating nodes you're specially interested
                   3899: about, you can either color them differently with the --mark option,
                   3900: or exclude everything else from the callgraph except those nodes and
                   3901: their immediate callers &amp; callees, with the --only option:</p>
                   3902: <pre>
                   3903: $ hatari_profile.py -p -g <b>--only func1,func2</b> -r program.sym program-profile.txt
                   3904: </pre>
                   3905: 
                   3906: <p>Last option for reading the callgraph is using -k option to
1.1.1.18  root     3907: export the data for use in (Linux) Kcachegrind UI. Kcachegrind generates
1.1.1.17  root     3908: callgraphs on the fly, and just for the area around the function
                   3909: you selected, so navigating in callgraph may be easier.  It also
                   3910: shows the related profile disassembly, which can make verifying
                   3911: matters easier:</p>
                   3912: <pre>
                   3913: $ hatari_profile.py <b>-p -k</b> -r program.sym program-profile.txt
                   3914: [...]
                   3915: Generating callgrind file 'program-profile.cg'...
                   3916: [...]
                   3917: $ kcachegrind program-profile.cg
                   3918: </pre>
                   3919: <div style="text-align:center">
                   3920:   <img src="images/kcachegrind.png" width="887" height="442"
                   3921:        alt="Kcachegrind screenshot" />
                   3922: </div>
                   3923: 
                   3924: 
                   3925: <h3>Usage examples</h3>
1.1.1.13  root     3926: 
                   3927: <p>
                   3928: Here's a list of some common debugging tasks and how to do them
                   3929: with the Hatari debugger:
                   3930: </p>
                   3931: 
                   3932: <dl>
                   3933: <dt><em>Stopping on program startup and examining its data</em></dt>
1.1.1.17  root     3934: <dd>Please see <a href="#Breakpoint_variables">Breakpoint variables</a>
                   3935: and <a href="#Inspecting_emulation_state">Inspecting emulation state</a>
1.1.1.13  root     3936: sections.
                   3937: </dd>
                   3938: 
                   3939: <dt><em>Tracing specific things in the system</em></dt>
1.1.1.20  root     3940: <dd>To trace e.g. all GEMDOS calls and I/O operations, use:
1.1.1.13  root     3941: <pre>
                   3942: trace  gemdos,io_all
                   3943: </pre>
                   3944: Please see <a href="#Tracing">Tracing</a> section for more information
1.1.1.14  root     3945: on tracing, what's possible with it and what are its limitations.
1.1.1.13  root     3946: </dd>
                   3947: 
                   3948: <dt><em>Stopping when certain PC address is passed Nth time</em></dt>
                   3949: <dd>To stop e.g. after function/subroutine at $12345 is called for
                   3950: the 6th time:
                   3951: <pre>
                   3952: a  $12345 :6
                   3953: </pre>
                   3954: </dd>
                   3955: 
1.1.1.17  root     3956: <dt><em>Stopping when specific exception happens</em></dt>
                   3957: <dd>Hatari's -D option doesn't invoke debugger on all exceptions and
                   3958: doesn't allow invoking debugger just for specific exceptions.  To
                   3959: stop at specific exception, one can check when it's called.
                   3960: At the start of memory is the CPU exception table for exception
                   3961: handler addresses, so to stop e.g. at bus error with some extra
                   3962: information, one can use following:
                   3963: <pre>
                   3964: history  on
                   3965: b  pc=($8)
                   3966: </pre>
                   3967: After bus error invokes debugger, 'history' command can then be used
                   3968: to see (executed memory addresses with their current) instructions
                   3969: leading to the error.  The most interesting vector addresses are:
                   3970: $8 (Bus error), $C (Address error), $10 (Illegal instruction),
1.1.1.19  root     3971: $14 (Division by zero).  See also --debug-except option.
1.1.1.17  root     3972: </dd>
                   3973: 
1.1.1.13  root     3974: <dt><em>Stopping when register has a specific value</em></dt>
                   3975: <dd>To stop when e.g. D1 register contains value 5, set a breakpoint on:
                   3976: <pre>
                   3977: b  d1 = 5
                   3978: </pre>
                   3979: </dd>
                   3980: 
                   3981: <dt><em>Stopping when a register value changes</em></dt>
                   3982: <dd>To stop when e.g. D1 register value changes, set a breakpoint on:
                   3983: <pre>
                   3984: b  d1 ! d1
                   3985: </pre>
                   3986: </dd>
                   3987: 
                   3988: <dt><em>Stopping when register value is within some range</em></dt>
                   3989: <dd>To stop when e.g. D1 register value is within range of 10-30,
                   3990: set a breakpoint on:
                   3991: <pre>
                   3992: b  d1 &gt; 9  &amp;&amp;  d1 &lt; 31
                   3993: </pre>
                   3994: </dd>
                   3995: 
                   3996: <dt><em>Stopping when memory location has a specific value</em></dt>
                   3997: <dd>To stop when e.g. bit 1 of the Video Shifter Sync Mode byte at
1.1.1.20  root     3998: I/O address $ff820a is set i.e. video frequency is 60Hz, set
1.1.1.13  root     3999: a breakpoint on:
                   4000: <pre>
                   4001: b  ($ff820a).b & 2 = 2
                   4002: </pre>
                   4003: </dd>
                   4004: 
                   4005: <dt><em>Stopping when a memory value changes</em></dt>
                   4006: <dd>To stop when above bit changes, set a breakpoint on its value
                   4007: being different from the current value ('!' compares for inequality):
                   4008: <pre>
                   4009: b  ($ff820a).b & 2 ! ($ff820a).b & 2
                   4010: </pre>
                   4011: </dd>
                   4012: 
                   4013: <dt><em>Tracing all changes in specific memory location</em></dt>
1.1.1.17  root     4014: <dd>To see the new values and continue without stopping, add
1.1.1.13  root     4015: the ":trace" breakpoint option:
                   4016: <pre>
                   4017: b  ($ff820a).b & 2 ! ($ff820a).b & 2  :trace
                   4018: </pre>
                   4019: </dd>
                   4020: 
                   4021: <dt><em>Stopping at specific screen position</em></dt>
                   4022: <dd>To stop e.g. when VBL is 100, HBL is 40 and line cycles is 5,
                   4023: use the corresponding debugger variables:
                   4024: <pre>
                   4025: b  VBL = 100  &amp;&amp;  HBL = 40  &amp;&amp;  FrameCycles = 5
                   4026: </pre>
                   4027: </dd>
                   4028: 
                   4029: <dt><em>Stopping after value increases/decreases by certain amount</em></dt>
                   4030: <dd>To stop e.g. after D0 value has increased by 10, set breakpoint on:
                   4031: <pre>
                   4032: b  d0 = "d0 + 10"
                   4033: </pre>
                   4034: </dd>
                   4035: 
1.1.1.17  root     4036: <dt><em>Examining specific system call return value</em></dt>
                   4037: <dd>To check e.g. what's the Fopen() GEMDOS call return value,
                   4038: check with "info gemdos 1" its opcode, set a breakpoint for that
                   4039: and step to next (n) instruction from the trap call when breakpoint
                   4040: is hit. GEMDOS call return value is then in register D0:
                   4041: <pre>
                   4042: &gt; trace  gemdos
                   4043: &gt; b  GemdosOpcode = $3D
                   4044: &gt; c
                   4045: [...continue until breakpoint...]
                   4046: 1. CPU breakpoint condition(s) matched 1 times.
                   4047:         GemdosOpcode = $3D
                   4048: &gt; n
                   4049: GEMDOS 0x3D Fopen("TEST.TXT", read-only)
                   4050: &gt; e  d0
                   4051: = %1000000 (bin), #64 (dec), $40 (hex)
                   4052: </pre>
                   4053: </dd>
                   4054: 
1.1.1.14  root     4055: <dt><em>Seeing code leading to a breakpoint</em></dt>
1.1.1.17  root     4056: <dd>To see CPU instructions executed before debugger was entered,
1.1.1.20  root     4057: you need to enable history tracking <em>before</em> it. Whenever
1.1.1.17  root     4058: debugger is entered, you can then request given number (here 16) of
                   4059: past instructions to be shown:
1.1.1.14  root     4060: <pre>
1.1.1.17  root     4061: history  cpu
1.1.1.14  root     4062: c
                   4063: [breakpoint is hit and debugger entered]
1.1.1.17  root     4064: history  16
1.1.1.14  root     4065: </pre>
                   4066: </dd>
                   4067: 
                   4068: <dt><em>Getting instruction execution history for every breakpoint</em></dt>
                   4069: <dd>
1.1.1.17  root     4070: To see last 16 instructions for both CPU and DSP whenever
                   4071: (a normal or tracing) breakpoint is hit:
1.1.1.14  root     4072: <pre>
1.1.1.17  root     4073: history  on
                   4074: lock  history 16
1.1.1.14  root     4075: c
                   4076: </pre>
                   4077: </dd>
                   4078: 
1.1.1.17  root     4079: <dt><em>Single stepping so that new register values are shown after each step</em></dt>
1.1.1.13  root     4080: <dd>
                   4081: <pre>
1.1.1.17  root     4082: lock  registers
                   4083: s
1.1.1.13  root     4084: [new register values]
1.1.1.17  root     4085: s
1.1.1.13  root     4086: [new register values]
                   4087: ...
                   4088: </pre>
                   4089: </dd>
                   4090: 
                   4091: <dt><em>Showing current stack contents</em></dt>
                   4092: <dd>To see first 64 bytes on top of the stack, use:
                   4093: <pre>
                   4094: m  "a7-64"-a7
                   4095: </pre>
                   4096: </dd>
                   4097: 
                   4098: <dt><em>Seeing specific information each time debugger is entered</em></dt>
                   4099: <dd>To see above information whenever some breakpoint is hit,
                   4100: you enter debugger manually etc, write that command to e.g.
                   4101: <span class="file">stack.ini</span> file and then use:
                   4102: <pre>
                   4103: lock  file stack.ini
                   4104: </pre>
1.1.1.17  root     4105: Please see also <a href="#Chaining_breakpoints">Chaining breakpoints</a>
1.1.1.13  root     4106: section for more examples on what you can do with the debugger input files.
                   4107: </dd>
                   4108: 
1.1.1.21! root     4109: <dt><em>Adding cycle information to disassembly</em></dt>
        !          4110: <dd>Profiling collects cycle usage information for all executed instructions:
        !          4111: <pre>
        !          4112: profile  on
        !          4113: c
        !          4114: [after a while, use AltGr+Pause to get back to debugger]
        !          4115: d
        !          4116: [if you want to see just the executed instructions]
        !          4117: profile addresses
        !          4118: </pre>
        !          4119: Please see <a href="#Profiling">Profiling</a> section for more info.
        !          4120: </dd>
        !          4121: 
1.1.1.16  root     4122: <dt><em>Finding where a program or the OS is stuck</em></dt>
                   4123: <dd>Profiling tells from which addresses CPU is executing the instructions:
1.1.1.13  root     4124: <pre>
                   4125: profile  on
                   4126: c
                   4127: [after a while, use AltGr+Pause to get back to debugger]
                   4128: profile  counts
                   4129: </pre>
1.1.1.17  root     4130: Please see <a href="#Profiling">Profiling</a> section for more info.
                   4131: </dd>
                   4132: 
                   4133: <dt><em>Seeing program callstack when breakpoint is hit</em></dt>
                   4134: <dd><a href="#Caller_information">Profiler caller data</a> includes
                   4135: callstack information (with some limitations).
                   4136: </dd>
                   4137: 
                   4138: <dt><em>Seeing call backtraces whenever given function is called</em></dt>
                   4139: <dd>Enable profiling, load symbols for the program and set breakpoint
                   4140: for the function you're interested about, in the following way:
                   4141: <pre>
                   4142: profile on
                   4143: symbols prg
                   4144: b  pc = _my_function  :quiet :noinit :file showstack.ini
                   4145: </pre>
                   4146: I.e. whenever 'my_function' address is called, quietly trigger a
1.1.1.20  root     4147: breakpoint without resetting profiling (callstack) information and run
1.1.1.17  root     4148: debugger command(s) from the 'showstack.ini' debugger script file,
                   4149: which contains following command:
                   4150: <pre>
                   4151: profile stack
                   4152: </pre>
                   4153: </dd>
                   4154: 
                   4155: <dt><em>Seeing how program functions/symbols call each other</em></dt>
                   4156: <dd><a href="#Profile_data_post-processing">Profile data
                   4157: post-processing</a> can provide execution callgraphs.
1.1.1.13  root     4158: </dd>
                   4159: 
                   4160: </dl>
                   4161: 
                   4162: <p>
1.1.1.16  root     4163: Hint: for most of the above commands, one just needs to prefix them with
1.1.1.17  root     4164: "d" (or "dsp" when using full command names) to do similar operation on
1.1.1.16  root     4165: the DSP.
1.1.1.13  root     4166: </p>
                   4167: 
                   4168: 
1.1.1.17  root     4169: <h3 id="Build_notes">Build notes</h3>
1.1.1.12  root     4170: 
1.1.1.10  root     4171: <p>
                   4172: Lastly, the debugger is much nicer to use with the command line
1.1.1.16  root     4173: history, editing and especially the completion support for the
                   4174: command, command argument and symbol names.
                   4175: </p>
                   4176: <p>
                   4177: If you're building Hatari yourself, please make sure that you have the
                   4178: GNU readline development files installed (on Debian / Ubuntu these
                   4179: come from the libreadline5-dev package). Otherwise the name completion
                   4180: and other features don't get enabled when you configure Hatari.
1.1.1.12  root     4181: </p>
                   4182: <p>
                   4183: ENABLE_TRACING define needs to be set for tracing to work.
                   4184: By default it should be enabled.
1.1.1.10  root     4185: </p>
                   4186: 
                   4187: 
1.1.1.17  root     4188: <h2 id="Performance">Performance</h2>
1.1.1.12  root     4189: 
                   4190: <p>Hatari performance varies between Atari programs, depending on what
                   4191: features Hatari needs to emulate for them.  Less accurate Atari
                   4192: emulators may be faster as emulation accuracy has a performance
                   4193: overhead.</p>
                   4194: 
1.1.1.13  root     4195: <p>The operating system and libraries below Hatari can also sometimes
                   4196: have a noticeable effect on performance.</p>
                   4197: 
1.1.1.12  root     4198: 
1.1.1.17  root     4199: <h3>Improving Hatari performance</h3>
1.1.1.10  root     4200: 
                   4201: <p>
1.1.1.13  root     4202: Hatari currently runs best in 16 or 32 bits per pixel color depth
                   4203: mode, so try to avoid 24 bits per pixel display modes if possible.
                   4204: 16-bit mode is fastest.
                   4205: </p>
                   4206: 
                   4207: <p>
1.1.1.21! root     4208: <em>On macOS with SDL 1.2, frame skipping, zooming and drive LED options
        !          4209: (listed below) seem to have a large effect on performance in the windowed
        !          4210: mode</em>. This is apparently due to issues in the SDL macOS backend and how
        !          4211: macOS itself composites non-fullscreen window contents. MacOS uses always
1.1.1.13  root     4212: 32-bit mode.
                   4213: </p>
                   4214: 
                   4215: <p>
1.1.1.10  root     4216: Unless you've disabled compiler optimizations (like GCC's -O2 or -O3
                   4217: options) in the Hatari build, the extra optimization flags (like GCC's
                   4218: "-mtune=i686") don't seem to have very large effect on Hatari
1.1.1.12  root     4219: performance.  Using GCC -O3 option instead of -O2 can give minor
                   4220: (5-10%) performance improvements for things (demos) that use very
                   4221: heavily interrupts.
1.1.1.10  root     4222: </p>
1.1.1.13  root     4223: 
1.1.1.10  root     4224: <p>
                   4225: However, Hatari can be sped up considerably by giving up some
1.1.1.13  root     4226: emulation or emulator accuracy.  Except for DSP, these options
                   4227: should be needed only on very slow devices like handhelds. See below.
                   4228: </p>
                   4229: 
                   4230: <p>
                   4231: If nothing else helps, try an earlier Hatari version.  More accurate
                   4232: emulation or emulator output in newer Hatari versions means that they
                   4233: can be slower despite optimizations.
1.1.1.10  root     4234: </p>
                   4235: 
                   4236: 
1.1.1.17  root     4237: <h3>Emulation options</h3>
1.1.1.10  root     4238: 
                   4239: <p>
                   4240: Emulation options have the largest impact on performance.
                   4241: These options can be changed from the Hatari GUI System dialog and
                   4242: the emulation needs to be rebooted for any of these changes to take
1.1.1.17  root     4243: an effect!  They're enabled by default.
1.1.1.10  root     4244: </p>
                   4245: 
1.1.1.17  root     4246: <h4>DSP</h4>
1.1.1.10  root     4247: <p>
1.1.1.12  root     4248: Emulating the Falcon DSP is performance-wise several times more demanding
1.1.1.10  root     4249: than emulating the m68k; DSP runs at higher frequency, executes many
                   4250: instructions for each m68k instruction and emulation isn't as mature
1.1.1.16  root     4251: and optimized.  Unless some Falcon program needs DSP, <em>none</em> or
1.1.1.10  root     4252: <em>dummy</em> DSP emulation mode could be used.  Even of the programs
                   4253: that do use DSP, many use it only for background music and work
                   4254: fine without the real DSP emulation.
                   4255: </p>
1.1.1.12  root     4256: 
1.1.1.17  root     4257: <h4>Timer-D</h4>
1.1.1.10  root     4258: <p>
                   4259: The single largest factor contributing to general Hatari emulation
                   4260: performance is the handling of interrupts.  Enabling Timer-D patching
1.1.1.12  root     4261: option (about) doubles Hatari ST/STE emulation performance as it
                   4262: significantly reduces the number of interrupts generated by the emulated
                   4263: Atari machine. Using this has adverse effect only for very rare programs.
1.1.1.10  root     4264: </p>
1.1.1.12  root     4265: 
1.1.1.17  root     4266: <h4>FDC</h4>
                   4267: <p>
                   4268: While accurate FDC emulation doesn't take that much CPU, it slows down
                   4269: floppy image accesses (and Hatari startup) a lot.  Only <em>very</em>
                   4270: few demos and games require accurate FDC emulation for their copy protection,
                   4271: so enabling fast floppy access is fairly safe.
                   4272: </p>
                   4273: 
                   4274: <h4>Compatible CPU</h4>
1.1.1.10  root     4275: <p>
1.1.1.12  root     4276: After the DSP and  interrupts, m68k emulation takes most time.
1.1.1.10  root     4277: Disabling the "Slower but more compatible CPU" option will speed up
                   4278: the emulation a lot, but it won't anymore be cycle accurate.  This can
                   4279: be fine for many games and other programs, but won't work e.g. for demos
                   4280: using overscan or rasters.
                   4281: </p>
                   4282: 
                   4283: <p>
1.1.1.12  root     4284: Roughly speaking, for DSP emulation, one needs at least 2Ghz machine.
                   4285: For normal (unpatched) Timer-D frequency on some specific cases (like
1.1.1.10  root     4286: demos with overscan 512 color animations) one may need over 1GHz
1.1.1.12  root     4287: machine, but some rare ST/STE demos may require over 1GHz machine even
                   4288: with Timer-D patching.  For "Compatible CPU" one needs at least 1/2Ghz
                   4289: machine.
1.1.1.10  root     4290: </p>
1.1.1.12  root     4291: 
1.1.1.10  root     4292: <p>
1.1.1.17  root     4293: <strong>NOTE</strong>: Above options may cause some programs to work in correctly.
1.1.1.12  root     4294: The <a href="compatibility.html">Hatari Software Compatibility List</a>
1.1.1.20  root     4295: lists programs known to need real Falcon DSP emulation, Timer-D
1.1.1.17  root     4296: frequency or accurate FDC timings.  Disabling "Compatible CPU" option
                   4297: is recommended only as a last resort.
1.1.1.10  root     4298: </p>
                   4299: 
                   4300: 
1.1.1.17  root     4301: <h3>Emulator options</h3>
1.1.1.10  root     4302: 
                   4303: <p>
1.1.1.13  root     4304: Emulator options don't usually have as large effect on performance as
1.1.1.10  root     4305: emulation options, but they don't affect the emulated programs at all,
                   4306: just the quality of the emulation "output". These options can also
                   4307: be toggled at run-time without rebooting the emulation.
                   4308: </p>
                   4309: 
1.1.1.17  root     4310: <h4>Sound</h4>
1.1.1.10  root     4311: <p>
                   4312: Internal Hatari sound handling and the SDL_mixer sound thread
                   4313: libALSA sound processing can account up to 1/3 of the Hatari CPU usage
1.1.1.12  root     4314: in normal ST/STE emulation. Disabling sound will get rid of that.
                   4315: Using low sound frequency or one matching your sound card may also help.
                   4316: Best is if you disable also background music from the programs you run
                   4317: in Hatari as this can significantly reduce the number of generated
                   4318: interrupts.
1.1.1.10  root     4319: </p>
1.1.1.12  root     4320: 
1.1.1.17  root     4321: <h4>Frame skipping</h4>
1.1.1.10  root     4322: <p>
                   4323: Screen rendering can take noticeable amount of CPU time. The default
                   4324: Hatari "auto" frame skipping should be used unless there's a good
                   4325: reason not to.  It will skip converting and showing some of the frames
1.1.1.13  root     4326: if there's not enough time for them.
                   4327: </p>
                   4328: <p>
                   4329: Also, if your monitor refresh frequency is lower than the selected
                   4330: Hatari monitor frequency (e.g. LCD monitors usually use 60Hz whereas
                   4331: Atari monochrome monitor uses 71Hz), you should use frameskip of one.
                   4332: The reason is that if your SDL library uses VSync to synchronize the
1.1.1.21! root     4333: output to screen, with zero frame skip that forces the emulation to
        !          4334: run slower than a real Atari. If SDL doesn't use VSync, Hatari does
        !          4335: redundant work to convert frames you can't see.
1.1.1.10  root     4336: </p>
1.1.1.12  root     4337: 
1.1.1.17  root     4338: <h4>Zooming</h4>
1.1.1.10  root     4339: <p>
                   4340: If you are not using frame skip, disabling zooming can have
1.1.1.12  root     4341: noticeable improvement on performance.  You can do this by specifying
                   4342: suitably low "Max zoomed" resolution (<span class="commandline">--zoom
                   4343: 1</span> command line option sets it to 320x200).  If you still want to
                   4344: have a nice fullscreen mode, you should rather add the right resolution
                   4345: mode-lines (e.g. "320x200") to your xorg.conf file.  If you still want
                   4346: to use zooming, disabling borders may help a bit.
1.1.1.10  root     4347: </p>
1.1.1.12  root     4348: 
1.1.1.17  root     4349: <h4>Spec512 color handling</h4>
1.1.1.10  root     4350: <p>
                   4351: Handling Spec512 color modes which change the ST/e palette constantly
                   4352: takes some extra CPU.  If you have problems with CPU usage in such
                   4353: screens and you care more e.g. from the sound quality than visuals, you
1.1.1.16  root     4354: can either increase the threshold or disable the Spec512 mode handling
                   4355: completely by zeroing the threshold for that with the
                   4356: <span class="commandline">--spec512 0</span> option.
1.1.1.10  root     4357: </p>
1.1.1.12  root     4358: 
1.1.1.17  root     4359: <h4>Statusbar and drive LED</h4>
1.1.1.10  root     4360: <p>
1.1.1.16  root     4361: If your version of the SDL library uses VSync to synchronize the screen
                   4362: output, drawing of the statusbar or the drive LED may have some minor
                   4363: impact on performance too.  Normally they shouldn't.
1.1.1.10  root     4364: </p>
                   4365: 
                   4366: 
1.1.1.17  root     4367: <h3>Measuring the performance</h3>
1.1.1.10  root     4368: 
                   4369: <p>
                   4370: There are a couple of ways to monitor and measure Hatari performance.
                   4371: </p>
                   4372: <p>
                   4373: By default Hatari has Statusbar visible and automatic frameskip
                   4374: enabled. When Hatari has enough time that it can sleep a little each
                   4375: frame, the statusbar frame skip ("FS") value keeps at zero.  If Hatari
                   4376: is completely busy, it will increase to the maximum specified
                   4377: (automatic) frame skip value.
                   4378: </p>
                   4379: <p>
                   4380: Hatari has also a facility to measure FPS i.e. Frames Per Second.
                   4381: Just enable the <span class="commandline">--fast-forward</span> option
                   4382: on command line (or use the corresponding keyboard shortcut), and
                   4383: after a while, press the "Pause" key.  Whenever Hatari emulation is
1.1.1.12  root     4384: paused, Hatari will output on console how many VBLs it could show per
                   4385: second along with some other numbers.
1.1.1.10  root     4386: </p>
                   4387: <p>
                   4388: It depends on what you want to measure, but usually it's best to
                   4389: disable sound and set high frame skip like
                   4390: <span class="commandline">--sound off --frameskips 60</span> so that
                   4391: the associated external overheads are minimized.  E.g. video output
1.1.1.16  root     4392: can on some platforms do VSync and measurements would then show your
                   4393: monitor refresh frequency instead of the actual Hatari performance.
1.1.1.10  root     4394: </p>
                   4395: <p>
                   4396: On Unix systems with <span class="commandline">times()</span> function
                   4397: call, only the time spent by the Hatari process itself is measured.
1.1.1.16  root     4398: On other systems, much less accurate SDL "wall clock" timings are
1.1.1.10  root     4399: used.  To make latter more accurate you could use also
                   4400: <span class="commandline">--run-vbls</span> option to specify how many
1.1.1.12  root     4401: VBLs Hatari should run before it exits.  In this case it's best to
                   4402: either have the test-case run automatically from the AUTO-folder or
                   4403: given as memory snapshot to Hatari with the frame skip set equal to
                   4404: the VBL count.
1.1.1.10  root     4405: </p>
                   4406: <p>
1.1.1.16  root     4407: Note that these numbers can fluctuate quite a bit, <em>especially</em>
1.1.1.10  root     4408: when the SDL timings are used, so for (statistically) reliable numbers
                   4409: you may need to repeat the measurement several times.  You should of
                   4410: course make also sure that the system doesn't have any other activity
                   4411: at the same time you're making the measurements.
                   4412: </p>
                   4413: 
                   4414: 
1.1.1.17  root     4415: <h2>Appendix</h2>
1.1.1.5   root     4416: 
1.1.1.17  root     4417: <h3>Copying</h3>
1.1.1.4   root     4418: 
1.1       root     4419: <div class="backdropped">
                   4420: <p>This program is free software; you can redistribute it and/or modify
1.1.1.3   root     4421: it under the terms of the GNU General Public License as published by
                   4422: the
1.1       root     4423: Free Software Foundation; either version 2 of the License, or (at your
                   4424: option) any later version. </p>
                   4425: <p>This program is distributed in the hope that it will be useful, but <em>WITHOUT
                   4426: ANY WARRANTY</em>; without even the implied warranty of <em>MERCHANTABILITY</em>
1.1.1.3   root     4427: or <em>FITNESS FOR A PARTICULAR PURPOSE</em>. See the GNU General
1.1.1.4   root     4428: Public License for more details. </p>
                   4429: <p>
                   4430: You should have received a copy of the GNU General Public License
                   4431: along with this program; if not, write to the Free Software Foundation,
                   4432: Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                   4433: </p>
1.1       root     4434: </div>
1.1.1.3   root     4435: <p><a href="http://www.gnu.org/">The GNU Project and the Free Software
                   4436: Foundation</a> | <a href="http://www.fsf.org/licenses/gpl.html">The
                   4437: GNU General Public License</a></p>
1.1.1.4   root     4438: 
1.1.1.17  root     4439: <h3>Introduction to Emulation</h3>
1.1.1.5   root     4440: 
1.1       root     4441: <p>Emulation via software is an art and Hatari is an example of this.</p>
1.1.1.3   root     4442: <p>Emulation is to make a computer behave like a (probably) completely
1.1.1.20  root     4443: different machine on the lowest possible level.
1.1.1.3   root     4444: This includes CPU and custom chip emulation allowing software written
1.1.1.20  root     4445: for the emulated machine to be run without it noticing a difference.
1.1       root     4446: </p>
                   4447: <p>
1.1.1.3   root     4448: The key to emulation is to simply do those things with a software
                   4449: program, the emulator, that normally chips would perform.
                   4450: So you have an CPU emulator that basically consists of a large loop
                   4451: that does exactly what the real thing would do:
1.1       root     4452: </p>
                   4453: <ul>
1.1.1.3   root     4454:   <li>fetch an instruction from virtual memory</li>
                   4455:   <li>interpret this instruction</li>
                   4456:   <li>fetch operands from the emulated registers and memory</li>
                   4457:   <li>perform the operation like addition or changing the program
                   4458: counter on a jump instruction</li>
                   4459:   <li>writes results back into the intended registers or memory
                   4460: locations</li>
                   4461:   <li>increment of the program counter and loop</li>
1.1       root     4462: </ul>
                   4463: <p>
1.1.1.3   root     4464: The typical von-Neumann CPU can be emulated very fast, stable and
                   4465: error-free using such a simple loop system.
1.1       root     4466: </p>
                   4467: <p>
1.1.1.3   root     4468: But in most cases the CPU emulation is the simplest part. Correct
1.1.1.20  root     4469: emulation of the various custom chips and hardware parts of the
                   4470: emulated system, and their proper synchronization, is much trickier.
1.1       root     4471: </p>
                   4472: 
1.1.1.17  root     4473: <hr>
1.1.1.6   root     4474: 
1.1       root     4475: </body>
                   4476: </html>

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.