--- hatari/doc/manual.html 2019/04/09 08:58:26 1.1.1.21 +++ hatari/doc/manual.html 2019/04/09 08:59:42 1.1.1.22 @@ -8,7 +8,7 @@ - - +
@@ -64,7 +64,7 @@-Version 2.1.0, February 2018 +Version 2.2.0, January 2019
Manual written by: Thomas Huth, Matthias Arndt @@ -94,15 +94,15 @@ The emulator is open source software and Public License (GPL).
-The Atari ST was a 16/32 bit computer system which was first released by Atari +The Atari ST was a 16/32-bit computer system which was first released by Atari in 1985. Using the Motorola 68000 CPU, it was a very popular computer having quite a lot of CPU power at that time. See Appendix B for details on emulation in general.
-Unlike many other Atari ST emulators which try to give you a good +Unlike many other Atari emulators which try to give you a good environment for running GEM applications, Hatari tries to emulate the hardware -of a ST as close as possible so that it is able to run most of the old ST games +as close as possible so that it is able to run most of the old games and demos. Of course you can run normal GEM applications with Hatari, too.
@@ -111,7 +111,7 @@ and demos. Of course you can run normal-Note that TT emulation is incomplete – additional hardware like the -second MFP and the SCC UARTs is not emulated yet. +Note that TT emulation is incomplete – e.g. the second MFP is not +emulated yet.
+Both TT and Falcon emulation support NVRAM for persistent OS configuration +and RTC (real time clock). +
See the developers' doc/todo.txt file (included with Hatari sources) for the details on the few remaining @@ -240,7 +248,12 @@ decrease AVI video recording file sizes.
The versions available in your Linux distribution will be sufficient @@ -250,7 +263,7 @@ package.
-After you've verified that you have the required libraries and their +After you have verified that you have the required libraries and their development files, change to the hatari/ directory. Create a build/ directory under it and configure the build system for your environment: @@ -287,18 +300,18 @@ of the emulated Atari.
Unfortunately it is not possible to ship an original ROM image with the Hatari package since these images are still copyrighted. -But you can easily create an image with a real ST and one of those various -ROM-image programs for the ST (search for "TOSDUMP" with your -favourite internet search engine). If your old ST does not work anymore, you -can also try to search the internet directly for corresponding TOS ROM image, -but don't ask the Hatari team where to get one.
+But you can easily create an image with a real Atari machine and one of +those various ROM-image programs for them (search for "TOSDUMP" with your +favourite internet search engine).Another solution is EmuTOS, which is also shipped with the official release versions of Hatari. EmuTOS is an open-source TOS clone. You can find it at: http://emutos.sourceforge.net/. -It is not the best solution for playing games or running other old software -due to compatibility issues (see emutos.txt for -more details), but it's free and compatible with Hatari.
+It is not the best solution for Falcon emulation, playing old games +or running other old software due to compatibility issues (see +emutos.txt for more details), +but it is free, compatible with Hatari, doesn't require driver to +support harddisk images, and it boots much faster than original TOS.If you do not specify a TOS image on the commandline and Hatari cannot find a suitable TOS image in the default dir, you'll get the chance to select a TOS image file from the GUI.
@@ -338,8 +351,9 @@ overriding the earlier given ones:Some of the run-time changes require emulation to be reset for them @@ -542,11 +556,30 @@ depth <x> (x = 1, 2 or 4)
--vdi-width <w>
Use extended VDI resolution with width -<w> (320 < w <= 1280)
+<w> (320 < w <= 2048)--vdi-height <h>
Use extended VDI resolution with height -<h> (200 < h <= 960)
+<h> (200 < h <= 1280) ++TOS and popular GEM progams add extra restrictions for the VDI screen +size. In total screen can take at maximum 300kB, width needs to be +multiple of 128/planes, and height multiple of 16 pixels (or 8, +depending on system font height). That translates to following maximum +standard resolutions for the VDI mode: +
+monochrome
++FullHD (1920×1080), WUXGA (1920x1200) and QWXGA (2048x1152) +
+2 plane mode (4 colors)
++HD (1280x720), WXGA (1280x768) and XGA+ (1152x864) +
+4 plane mode (16-colors)
++qHD (960x540), DVGA (960x640) and WSVGA (1024x600) +
--crop @@ -596,12 +629,16 @@ to <file> (Linux only)
from <file> (Linux only)--rs232-in <filename>
-Enable serial port support and use +
Enable MFP serial port support and use <file> as the input device
--rs232-out <filename>
-Enable serial port support and use +
Enable MFP serial port support and use <file> as the output device
+--scc-b-out +<filename>
+Enable SCC channel B serial port support and use +<file> for the output (only for Mega-STE, TT and Falcon)
--drive-a @@ -622,6 +659,10 @@ from <file> (Linux only)
--disk-b <file>
Set disk image for floppy drive B
+--fastfdc +<bool>
+Speed up FDC emulation (can cause +incompatibilities)
--protect-floppy <x>
Write protect floppy image contents @@ -662,31 +703,35 @@ running, you may want to use "host" opti
Whether GEMDOS file names with 8-bit (non-ASCII) characters are converted between Atari and host character sets. On Linux, host file name character set is assumed to be UTF-8. This option is disabled by -default, in case you've transferred files from Atari machine without +default, in case you have transferred files from Atari machine without proper file name conversion (e.g. by zipping them on Atari and unzipping on PC)
--gemdos-drive <drive>
-Assign (seprately specified) GEMDOS HD to given +
Assign (separately specified) GEMDOS HD to given drive letter (C-Z) instead of default C:, or use "skip" to specify that Hatari should add GEMDOS HD after IDE and ACSI drives (assumes Hatari and native HD driver parse same number of partitions from -HD images partition tables)
---acsi -<file>
-Emulate an ACSI hard drive with an image -<file>
+the partition tables in HD images) +--acsi <id>=<file>
+Emulate an ACSI hard drive with given bus ID (0-7) +using image <file>. If just a filename is given, it is assigned to +bus ID 0
+--scsi <id>=<file>
+Emulate a SCSI hard drive with given bus ID (0-7) +using image <file>. If just a filename is given, it is assigned to +bus ID 0
--ide-master <file>
-Emulate an IDE master hard drive with an +
Emulate an IDE 0 (master) hard drive with an image <file>
--ide-slave <file>
-Emulate an IDE slave hard drive with an +
Emulate an IDE 1 (slave) hard drive with an image <file>
---fastfdc -<bool>
-Speed up FDC emulation (can cause -incompatibilities)
+--ide-swap <id>=<x>
+Set byte-swap option <x> (off/on/auto) for +given IDE <id> (0/1). If just option is given, it is applied to +IDE 0
@@ -696,6 +741,10 @@ incompatibilities)
<x>Set amount of emulated RAM, x = 1 to 14 MiB, or 0 for 512 KiB. Other values are considered as a size in KiB
+--ttram +<x>
+Set amount of emulated TT RAM (for Falcon and TT +mode), x = 0 to 512 MiB
-t, @@ -732,6 +781,8 @@ CPU mode with better prefetch accuracy a
Use 24-bit instead of 32-bit addressing mode (24-bit is enabled by default)
--fpu <x>
FPU type (x=none/68881/68882/internal)
+--fpu-softfloat <bool>
+Use full software FPU emulation (Softfloat library)
--mmu <bool>
Use MMU emulation
@@ -812,12 +863,13 @@ the debuggerSpecify which exceptions invoke debugger, see "--debug-except help" for available (comma separated) exception flags.
---bios-intercept
+--bios-intercept <bool>
-Toggle XBios command parsing. Allows Atari programs to use all Hatari +Enable/disable XBios command parsing. Allows Atari programs to use all Hatari functionality and change Hatari state through Hatari specific XBios(255) calls. XBios(20) printscreen calls produce also Hatari -screenshots.
+screenshots. XBios(11) Dbmsg call can be used to invoke the debugger. +--conout <device>
Enable console (xconout vector functions) output redirection for given <device> to host terminal. Device 2 is for @@ -851,10 +903,18 @@ used to create it automatically.
core dumps. SDL parachute is enabled by default to restore video mode in case Hatari terminates abnormally while using non-standard screen resolution. ---control-socket -<file>
-Hatari reads options from given socket -at run-time
+--control-socket <path>
++Hatari connects to given local socket file and reads commands from it. +Use when the control process life-time is longer than Hatari's, or +control process needs response from Hatari +
+--cmd-fifo <path>
++Hatari creates the indicated FIFO file and reads commands from it. +Commands can be echoed to FIFO file, and are same as with the control +socket. Hatari outputs help for unrecognized commands and subcommands +
--log-file <file>
Save log output to <file> @@ -882,7 +942,7 @@ the command line options supported by a
Once you've started Hatari successfully, you can use the emulator as +
Once you have started Hatari successfully, you can use the emulator as an almost complete Atari ST computer system.
Note: Falcon and especially TT emulation are still considered as @@ -1072,7 +1135,7 @@ changes that you have made.
- Here you can select a hard disk image file for ACSI, IDE master or - slave hard drive emulation, or you can select a host directory to be - emulated as the Atari hard drive. + Here you can select a hard disk image file for ACSI, SCSI or IDE hard drive + emulation, or you can select a host directory to be emulated as the Atari + hard drive. Use the arrow buttons to select the ID of the drive that you + want to set, then click on to choose + a file which should be used for providing the contents of the hard disk, + or click on to disable the current ID. +
++ IDE controllers are using a 16-bit interface, so depending on where the + contents of a real hard disk have initially been created (on an Atari + machine or on a PC), and depending on where the contents have been read + out from the disk, 16-bit values in the image might be byte-swapped. + Hatari can either try to detect this situation automatically (when + "Auto" is selected), or you can tell Hatari whether it should + always byte-swap the disk image contents or not. +
+
+ GEMDOS HD emulation can be used to provide a folder on your host
+ computer file system as hard drive(s) to the emulated Atari. Select
+ to choose a folder, or
+ to disable the drive(s) again.
+
+ The "Atari <-> host 8-bit filename conversion" setting
+ can be used to tell Hatari whether it should try to convert the character
+ set of the file names on the host to the Atari character set, since
+ modern operating systems use different character sets than Atari TOS.
+ File name conversion option is best-effort conversion between
+ the host OS and Atari character set for the non-ASCII file names
+ exposed by the GEMDOS HD emulation.
+
+ GEMDOS HD emulation can override partition(s) from HD images.
+ With "Add GEMDOS HD after ACSI/SCSI/IDE partitions" option Hatari
+ tries to assign it to a drive after the partitions on HD images,
+ instead of C: (whether that works correctly depends on whether
+ your emulated Atari hard disk interprets the HD images partition
+ tables similarly to Hatari, and whether it starts assigning them
+ from C: onwards). As a last resort, you can use "--gemdos-drive"
+ command line option to explicitly specify which drive should be
+ used for GEMDOS HD.
+
+ Finally, you can also choose whether you want to provide the files on
+ GEMDOS HD only as write-protected to the Atari environment or not,
+ or whether you want Hatari to select this status automatically depending
+ on the file attributes of the file in the host file system.
Check "Boot from HD" to set given hard disk image / directory as TOS - boot device (if ACSI or IDE is enabled, it's C:, otherwise it's the + boot device (if ACSI or IDE is enabled, it is C:, otherwise it is the first specified GEMDOS HD drive). With command line options, the value of this setting depends on whether you specify floppy image or harddisk later on the command line (later one takes precedence).
- Removing the check from the "Allow GEMDOS drive modification" option - will prevent Atari programs from modifying the files in GEMDOS HD - emulation directory or creating new files under it. -
-Note that you need TOS version >= 2.05 to boot from IDE hard drive. - And ACSI hard drive emulation does not work with TOS 4.0x in Falcon mode. + ACSI hard drive emulation does not work with TOS 4.0x in Falcon mode. + For SCSI emulation, you either need to run with TT or Falcon emulation. + Please also refer to the Hard disk support + chapter for more details about hard disk emulation.
You can select the amount of RAM for the emulated ST here. Only +
You can select the amount of RAM for the emulated machine here. Only amounts that were valid on a real unmodified STFM can be selected.
Note: This option is critical and you are strongly advised -to reset the emulated ST +to reset the emulated machine when changing this option.
+TT RAM size allows to emulate up to 512 MiB of 32-bit RAM. This is only +useful in Falcon or TT mode and require to disable "24 bit addressing" mode +in the CPU options
Here you will find the options to save memory snapshots as well.
Click on to save a memory snapshot to file. You can select a new filename here.
@@ -1295,12 +1406,14 @@ You can also select an optional cartridg class="button">Eject to disconnect the custom cartridge image.+Depending on the machine type that you want to emulate, you can either use +EmuTOS, or you must use a TOS version that supports the machine type. For ST mode, use TOS 1.00, 1.02, 1.04 or 2.06. For STE mode, use TOS 1.06, 1.62, 2.05 or 2.06. -If you want to use the TT mode, you must specify a TOS 3.06 image here. -And in Falcon mode, you have to use either TOS 4.00, 4.02, 4.04 or 4.92. -However, you should always use TOS 4.04 for Falcon mode, it's the most common one. -Also note that TOS 4.92 cannot be booted from a boot disk (like it's done on a +If you want to use the TT mode, you must specify a TOS 3.05 or 3.06 image here. +And in Falcon mode, you have to use either TOS 4.00, 4.02, 4.04 or 4.92. However, +you should always use TOS 4.04 for Falcon mode, it is the most common one. +Also note that TOS 4.92 cannot be booted from a boot disk (like it is done on a real Falcon), you have to specify it directly in the TOS ROM setup dialog here.
@@ -1476,7 +1589,7 @@ has different implementations for differ
You should set these values to a size that suits best your monitor -resolution. It's intended to help in getting Hatari to best use your +resolution. It is intended to help in getting Hatari to best use your monitor space on a windowed mode and in fullscreen avoiding "fuzzy" scaling done by your LCD monitor.
@@ -1598,9 +1711,9 @@ details. enter a new filename as well.Check the second checkmark to enable RS232 support. The RS232 device is configured according to the settings of -the emulated RS232 of the Atari ST. This means Hatari will +the emulated MFP RS232 of the Atari ST/STE/TT. This means Hatari will automatically use baudrate and handshaking as configured for the -emulated ST.
+emulated machine.Click on to select suitable device files for serial input and output. On Linux a good choice is /dev/ttyS0 or /dev/ttyS1. @@ -1897,10 +2010,14 @@ this can cause your printer to print out
Serial communications in Hatari is designed to directly use a serial port on your PC.
Communications parameters are set automatically upon the settings of -the emulated ST. This means all you do is to set -the communication parameters like baudrate from your ST communications -software. Hatari will do the rest and handle -the serial input and output for you.
+the emulated machine. This means all you do is to set the communication +parameters like baudrate from the emulated communications software. +Hatari will do the rest and handle the serial input and output for you. +Note that the “normal” RS232 port of Hatari is the one that +is connected to the MFP chip of the selected system. This port is only +wired on the ST, STE and TT machines, but not on the Falcon. To use serial +port emulation in Falcon mode, you have to use the “SCC channel B” +emulation instead.
If you've got a disk image that has been created with the old ST +
If you have got a disk image that has been created with the old ST emulator PaCifiST (for DOS) or with early versions of the program Makedisk, and the disk image does not work with Hatari, then the disk probably suffers from the "PaCifiST bootsector bug" (Hatari will @@ -2061,15 +2178,10 @@ GEMDOS HD emulated C: and D: drives.
GEMDOS HD emulation is an easy way to share files between the -host system and the emulated Atari, but there are also some known -limitations which are due to the way GEMDOS HD emulation is -implemented: +host system and the emulated Atari, but there are also several +limitations:
If your programs complain that they could not find/read/write @@ -2144,7 +2266,7 @@ disk image with it.
Formatting and partitioning works currently only with AHDI 5, but you -can install the AHDI 6 driver to the hard disk after it's formatted. +can install the AHDI 6 driver to the hard disk after it is formatted. Restart the emulated system, run AHDI.PRG from the floppy disk to access the hard disk image from the emulated Atari and then run HINSTALL.PRG. After installing the hard disk driver to the fresh HD image with @@ -2159,7 +2281,6 @@ been partitioned elsewhere.
-
As the IDE disk format (little endian) differs from the ACSI disk format (big endian), you need separate disk images for them. Hatari doesn't currently support partitioning IDE disks with AHDI, but you can do it with @@ -2205,7 +2326,7 @@ either through GEMDOS HD partitions (hos Hatari emulation) or accessing the images directly on the host (outside the emulation). Both have their own limitations.
-If it's fine for the IDE/ACSI partitions to be first, you can +
If it is fine for the IDE/ACSI partitions to be first, you can either use ACSI/IDE partition skip option, or a multipartition GEMDOS HD setup as described in above sections.
@@ -2303,9 +2424,8 @@ MTOOLS_NO_VFAT=1 mcopy -spmv -i hd.img f-This is recommended even by Mtools documentation, but it's less -convenient as it requires root rights. First you need to "loop" -mount the image: +This is recommended even by Mtools documentation, but it is less convenient +as it requires root rights. First you need to "loop" mount the image:
$ su
@@ -2325,7 +2445,7 @@ the hd.img
-After you've copied the relevant files to the "hd" directory, you need
+After you have copied the relevant files to the "hd" directory, you need
to unmount the file system and remove the loop device binding before
using the disk image from Hatari:
@@ -2381,14 +2501,14 @@ You can invoke the debugger manually by
With the "-D" command line option, you can toggle whether m68k
exceptions will also invoke the debugger. Which exceptions cause
-this, can be controlled with the "--debug-except" option.
+this, can be controlled with the "--debug-except" option.
Giving "-D" option at Hatari startup is not advised because TOS HW
-checks generate some exceptions at every TOS boot. It's better to
+checks generate some exceptions at every TOS boot. It is better to
toggle exception catching later from the debugger with the "setopt -D"
-command.
+command.
@@ -2464,7 +2584,7 @@ pressing TAB will (for most commands) sh
If you want to give numbers in other number bases
than the default/selected one, they need to be prefixed with a
character indicating this. For decimals this prefix is "#" (#15),
-for hexadecimals "$" ($F), and for binary values it's "%" (%1111).
+for hexadecimals "$" ($F), and for binary values it is "%" (%1111).
@@ -2483,14 +2603,14 @@ conditional breakpoints can be unexpecte
Instead of a number, you can also use an arithmetic expression, by
surrounding it with quotes (""). An expression can contain
-calculations with CPU and DSP register, symbol and Hatari variable
-values in addition to numbers. For example to give a sum of A0 and
-D0 register values to a command, use "a0+d0".
+calculations with CPU and DSP registers, symbols and Hatari variables
+in addition to numbers. For example to give a sum of A0 and D0
+register values to a command, use "a0+d0".
-Within arithmetic expressions parenthesis are used both to change
-the order of precedence and to indicate indirect addressing.
+Also within arithmetic expressions, parenthesis are used to indicate
+indirect addressing, not to change the order of precedence.
Unlike with conditional breakpoint expressions (explained below), you
cannot give size for the indirect addressing, a long value is always
read from the RAM address given within parenthesis. For example to
@@ -2508,6 +2628,29 @@ and it will be "evaluated" before being
+Virtual V0-V7 "registers" can be used to store intermediate results
+for calculations. For example, to get a sum of "_counter" symbol
+address contents one could use following in suitable breakpoint:
+
+
+# store counter sum to V0 virtual register
+r v0=(_counter)
+# store count of how many values are added
+r v1="v1+1"
+
+And then later on, calculate the average:
+
+# round the counter sum (add half count to sum)
+r v2="v0 + v1/2"
+# and calculate the rounded average (rounded sum / count)
+e v2/v1
+
+(Another virtual register was used for rounding here, in case one
+wants to continue summing the _counter values with the original
+value.)
+
+
+
With command argument completion (see build
notes), result from the last "evaluate" command can be inserted
by typing '$' and pressing TAB.
@@ -2524,8 +2667,11 @@ commands to do the same for the DSP.
> help memdump
'memdump' or 'm' - dump memory
-Usage: m [start address-[end address]]
- dump memory at address or continue dump from previous address.
+Usage: m [b|w|l] [start address-[end address| count]]
+ dump memory at address or continue dump from previous address.
+ By default memory output is done as bytes, with 'w' or 'l'
+ option, it will be done as words/longs instead. Output amount
+ can be given either as a count or an address range.
> help disasm
@@ -2608,8 +2754,8 @@ dsp_symbols").
For a program under GEMDOS HD emulation
-If currently running program contains symbol table in DRI/GST format,
-and it's started from GEMDOS HD emulated drive, its symbol names /
+If currently running program contains debug symbol table,
+and it is started from GEMDOS HD emulated drive, its symbol names /
addresses are automatically loaded when debugger is entered, and
removed when program terminates.
@@ -2623,7 +2769,6 @@ startup):
symbols prg
-
The options you need to add suitable symbol table to your programs,
@@ -2633,10 +2778,11 @@ depend on which toolchain you use to bui
Devpac:
"OPT D+,X+"
AHCC:
-"-g", and "-l" option for local symbols, both for linking
+"-g" and "-l" options for linking
GCC:
-"-Wl,--traditional-format" option for linking,
- and "-g" for compilation to get local symbols
+"-g" for compilation, and no strip option for linking
+(with older Hatari versions that didn't support a.out format,
+also "-Wl,--traditional-format" option was needed for linking)
VBCC:
"-g" (can only be used at linking phase), when VBCC
configuration file uses "-bataritos" option for
@@ -2654,10 +2800,10 @@ $ gst2ascii -l -o program.tos > progr
For a program on a (disk) image
-If the program isn't run from a GEMDOS HD emulated drive, but from a
-cartridge, floppy or HD image, you need to have the corresponding
-program also as normal host file which location you can give to the
-debugger:
+If the program isn't run from a GEMDOS HD emulated drive, but from
+a cartridge, floppy or HD image, you need to have the corresponding
+program also as a normal host file which location you can give to
+the debugger:
symbols /path/to/the/program.tos
@@ -2667,9 +2813,9 @@ symbols /path/to/the/program.tos
ASCII debug symbol files
-If Hatari complains that your program doesn't have DRI/GST format
-symbol table, or its symbols are in some other format, and you
-cannot re-compile it to have them, you have two options:
+If Hatari complains that your program doesn't have debug symbol table,
+or its symbols are in some unsupported format, and you cannot re-compile
+it to include a.out or GST/DRI symbols, you have two options:
- Convert the symbols to ASCII format understood by the Hatari debugger.
@@ -2743,7 +2889,7 @@ breakpoints so you need to use "b" comma
Then there are the conditional breakpoints which can handle much more
complex break condition expressions; they can track changes to
register and memory values with bitmasks, include multiple conditions
-for triggering a breakpoint and so on. Use "b" (or "db" for the DSP)
+for triggering a breakpoint and so on. Use "b" (or "db" for the DSP)
to manage them.
@@ -2779,7 +2925,7 @@ conditions need to be true for a breakpo
Normally when a breakpoint is triggered, emulation is stopped and you
get to the debugger. Breakpoint options can be used to affect what
happens when a breakpoint is triggered. These options are given after
-the conditions and are prefixed with ':'.
+the conditions and are prefixed with ':'.
@@ -2793,7 +2939,7 @@ a $1234 :2
- once
-
-Delete the breakpoint when it's hit i.e. trigger it only once. It may
+Delete the breakpoint when it is hit, i.e. trigger it only once. It may
be useful if you just want to get a specific address. Or if you're on
an instruction that jumps back to a start of the loop and you want to
finish the loop, you could use:
@@ -2912,7 +3058,7 @@ b d0 > $20 && d0 < $40
As a convenience, if the both sides of the comparison are exactly the
-same (i.e. condition is redundant as it's always either true or
+same (i.e. condition is redundant as it is always either true or
false), the right side of the comparison is replaced with
its current value. This way you can give something like this:
@@ -2981,20 +3127,34 @@ conditional breakpoints on values of som
by "variables" (v) command. For example:
-- If you want the emulation to stop on the first instruction of
- next program; after TOS desktop is up, set a breakpoint on
- the TEXT segment address given in a program basepage:
+
- Aes/Bios/Gemdos/LineA/LineF/Vdi/XbiosOpcode variables can be used
+ to catch AES, BIOS, GEMDOS, Line-A, Line-F, VDI and XBIOS OS-calls.
+ By default they contain the 0xffff value, so to trace e.g. all AES
+ calls (instead of a specific one) one needs to use something like this:
+
+b AesOpcode ! AesOpcode && AesOpcode < 0xffff :trace
+
+
+- To stop when TOS starts next program, set a breakpoint for
+ Pexec(0,...) OS call:
+
+b GemdosOpcode = 0x4B && OsCallParam = 0x0
+
+
+- Then, to stop emulation on the first instruction of that
+ program, set a breakpoint when program counter matches
+ the TEXT (i.e. code) segment address (taken from program
+ basepage):
b pc = TEXT :once
-Note1: It's better to trigger it only once because if you'd leave it on,
-during reboot you would get a warning for every instruction until TOS sets
-a valid basepage.
+Note1: It is better to trigger it only once, because if you would leave it
+on, during (re)boot you would get a warning for every instruction
+(until TOS sets a valid basepage).
-Note2: you cannot use an address breakpoint for this because value of
-a variable given to address breakpoint is evaluated when it's set, not
-at run-time, so it cannot get the new value that the TEXT variable
-gets when you start a program.
+Note2: you cannot use an address breakpoint for this because
+variable values are evaluated at run-time only for conditional
+breakpoints.
- To view current program DATA and BSS segment contents,
use the corresponding variables:
@@ -3005,20 +3165,12 @@ m BSS
- If you want to stop at a specific cycle within a frame (that is,
PC relative to the current VBL/HBL in cycles), set breakpoints to
- specific "HBL" and "FrameCycles" variable values. If you for
- example want to break after 20 HBLs, use:
+ specific "HBL" and "FrameCycles" variable values. If you want,
+ for example, to break after 20 HBLs, use:
b HBL = "HBL+20"
-- Aes/Bios/Gemdos/LineA/LineF/Vdi/XbiosOpcode variables can be used
- to catch AES, BIOS, GEMDOS, Line-A, Line-F, VDI and XBIOS OS-calls.
- By default they contain the 0xffff value, so to trace e.g. all AES
- calls, instead of a specific one, one needs to use something like this:
-
-b AesOpcode ! AesOpcode && AesOpcode < 0xffff :trace
-
-
@@ -3042,25 +3194,30 @@ another one is set.
For example if you have these input files:
-- "break.ini":
+
- "pexec.ini":
-b GemdosOpcode = 0x3D :trace :once :file program.ini
+# continue to "program.ini" on Pexec(0, ....)
+b GemdosOpcode = 0x4B && OsCallParam = 0x0 :trace :once :file program.ini
- "program.ini":
+# continue to "trace.ini" when program execution starts
b pc = TEXT :trace :once :file trace.ini
- "trace.ini":
+# load symbols, trace gemdos & program function calls
symbols prg
trace gemdos,cpu_symbols
+# continue to "disable.ini" after 4 VBLs
b VBL = "VBL+4" :trace :once :file disable.ini
- "disable.ini":
+# stop tracing and remove breakpoints
trace none
b all
@@ -3068,20 +3225,19 @@ b all
-And then start Hatari with the first debugger input file and a GEMDOS
-HD directory containing "desktop.inf" file:
+And then start Hatari with the first debugger input file:
-hatari --parse break.ini /path/to/your/program.tos
+hatari --parse pexec.ini /path/to/your/program.tos
-- "break.ini" input file will break when TOS opens
- the "desktop.inf" file (it's the first Fopen() i.e. GEMDOS call
- 0x3D done by TOS at boot) and the breakpoint will run
- the debugger commands from the "symbols.ini" file
-
- "program.ini" will setup breakpoint to program startup
- (because TEXT variable cannot be used before TOS has booted)
+
- "pexec.ini" sets a breakpoint to parse debugger commands from
+ "program.ini" when TOS starts loading the given program
+ (it is first Pexec(0) after boot)
+
- "program.ini" sets a breakpoint to parse debugger commands from
+ "trace.ini" when program code begins executing. These two steps
+ are needed because TEXT variable isn't valid until TOS has booted
- "trace.ini" input file loads symbols for the run program, sets Hatari
to trace several things (see Tracing section
below) in the emulated system for few VBLs until breakpoint runs
@@ -3095,18 +3251,18 @@ hatari --parse break.ini /path/to/your/p
- Because debugger input files cannot "continue"
emulation, ":trace" option needs to be used for the breakpoint(s)
if you want emulation to continue after the breakpoint action(s).
-- In simpler breakpoint chain (like above), new breakpoint just
-replaces the previous one, ":once" option tells that breakpoint
-isn't needed after it's hit.
+
- In simpler breakpoint chain (like above), where new breakpoint
+just replaces the previous one, ":once" option tells debugger that
+breakpoint isn't needed after it is hit.
-Hint: It's better to test each input file separate before testing the
-whole chain. Besides the ":file" breakpoint option, these debugger
-input files can be also read with the debugger "file" command, "lock"
-command "file" option and with the Hatari "--parse" command line
-option.
+Hint: It is better to test each input file separately before testing
+the whole chain. Besides the ":file" breakpoint option, you can test
+these debugger input files also with the debugger "file" command,
+"file" option for the "lock" command, and with the Hatari "--parse"
+command line option.
Stepping through code
@@ -3176,7 +3332,7 @@ Notes:
-
If GEMDOS HD emulation isn't enabled, GEMDOS call tracing needs to be
-enabled at Hatari command line, it's not possible to enable it after
+enabled at Hatari command line, it is not possible to enable it after
TOS has initialized GEMDOS.
-
@@ -3195,7 +3351,7 @@ it cannot be changed from within the deb
-If there isn't a trace option for something you'd like to track,
+If there isn't a trace option for something you would like to track,
you may be able to use tracing breakpoints, explained above.
For example, following tracks Line-A calls:
@@ -3260,7 +3416,7 @@ Cartridge ROM (0xFA0000-0xFC0000):
Investigating the profile data
-When you're back in debugger, you can inspect the collected profile data:
+When you are back in debugger, you can inspect the collected profile data:
> h profile
@@ -3444,7 +3600,7 @@ following command:
For example, if you don't know all the places from which a certain
function is called, or in what context a certain interrupt handler can
-be called during the period you're profiling, profile caller
+be called during the period you are profiling, profile caller
information will tell you:
@@ -3503,7 +3659,7 @@ profiler cannot determine when exception
Saving profile data to a file
-It's useful to save the profile data to a file:
+
It is useful to save the profile data to a file:
> profile save program-profile.txt
@@ -3511,7 +3667,7 @@ profiler cannot determine when exception
With the saved profile disassembly (and optional caller information)
you can more easily investigate what your program did during
profiling, search symbols & addresses in it, and compare the
-results to profiles you've saved from earlier versions of your code.
+results to profiles you have saved from earlier versions of your code.
You may even create your own post-processing tools for
investigating the profiling data more closely, e.g. to
@@ -3556,11 +3712,11 @@ the symbols as TEXT (code) section relat
$ hatari_profile.py -r program.sym program-profile.txt
-If symbols are included to your binary in DRI/GST format, first they
-need to be extracted to the ASCII format
+
If symbols are included to your binary, first they need to be
+extracted to the ASCII format
understood by the post-processor:
-$ gst2ascii -l -o program.prg > program.sym
+$ gst2ascii -a -l -o program.prg > program.sym
If there are some extra symbols that you don't want to see
@@ -3569,7 +3725,7 @@ but e.g. loop labels, you can either rem
from the ASCII *.sym file, or filter them out with grep:
-$ gst2ascii -l -o program.prg | grep -v -e useless1 -e useless2 > program.sym
+$ gst2ascii -a -l -o program.prg | grep -v -e useless1 -e useless2 > program.sym
@@ -3641,7 +3797,7 @@ Instruction cache misses:
If you want to see also symbol addresses and what is per call
-cost, add -i option:
+cost, add -i option:
$ hatari_profile.py -st -i -r program.sym program-profile.txt
[...]
@@ -3671,7 +3827,7 @@ a cost count.)
If your profile file contains caller information, you should
add -p option to see it, as that will also help in detecting symbol
issues (see Interpreting
-the numbers):
+the numbers):
$ hatari_profile.py -st -p -r program.sym program-profile.txt
[...]
@@ -3767,7 +3923,7 @@ is same as count for how many times firs
While subroutine costs should be more accurate and relevant, due to
code optimizations many of the functions are not called as subroutines
(on m68k, using JSR/BSR), but just jumped or branched to. Because of
-this, it's useful to compare both subroutine and between-symbols
+this, it is useful to compare both subroutine and between-symbols
costs. One should be able to see from the profile disassembly which
of the above cases is cause for the discrepancy in the values.
@@ -3832,7 +3988,7 @@ $ dot -Tsvg program-profile-1.dot > p
Ellipse shaped nodes are for other symbols (functions
called using jumps/branches, loop labels etc). Values
listed in them are between-symbols costs, i.e. normally
- they're included to inclusive (total) costs shown in
+ they are included to inclusive (total) costs shown in
subroutine call node somewhere higher in call hierarchy.
Nodes which exclusive (own) or between-symbols costs
exceed default or explicitly given threshold value,
@@ -3853,9 +4009,10 @@ $ dot -Tsvg program-profile-1.dot > p
Making large callgraphs readable
-If profile is for larger and more varied amount of code
-(e.g. program startup), the resulting callgraph can be so
-huge it's unreadable.
+
+If profile is for larger and more varied amount of code (e.g. program startup),
+the resulting callgraph can be so huge that it not really readable anymore.
+
If your code has interrupt handlers, they can get called
at any point, which can show in callgraph as "explicit" calls
@@ -3880,7 +4037,7 @@ threshold with --emph-limit (-e) option:
$ hatari_profile.py -p -g -l 0.5 -e 2.0 -r program.sym program-profile.txt
-If you're not interested in from how many different addresses +
If you are not interested in from how many different addresses a given function calls another function, use --compact option. If you still see multiple calls between two nodes with it, the reason is that they happened through different call paths which were removed from @@ -3895,7 +4052,7 @@ often doesn't leave much of a call hiera consider removing all nodes except for subroutine call ones, with the --only-subroutines option.
-If you have trouble locating nodes you're specially interested +
If you have trouble locating nodes you are specially interested about, you can either color them differently with the --mark option, or exclude everything else from the callgraph except those nodes and their immediate callers & callees, with the --only option:
@@ -3954,12 +4111,11 @@ a $12345 :6history on b pc=($8) @@ -3968,7 +4124,11 @@ After bus error invokes debugger, 'histo to see (executed memory addresses with their current) instructions leading to the error. The most interesting vector addresses are: $8 (Bus error), $C (Address error), $10 (Illegal instruction), -$14 (Division by zero). See also --debug-except option. +$14 (Division by zero).
+NOTE: Normally, to invoke debugger for larger set of exceptions, one +would use Hatari's "--debug-except" option to specify on which +exceptions debugger is invoked, and "setopt -D" to enable that on +run-time.
+b d1 & 0xff ! d1 & 0xff ++
+info basepage ++To see e.g. all Falcon Videl register values, use: +
+info videl ++
profile on symbols prg @@ -4174,7 +4353,7 @@ history, editing and especially the comp command, command argument and symbol names.-If you're building Hatari yourself, please make sure that you have the +If you are building Hatari yourself, please make sure that you have the GNU readline development files installed (on Debian / Ubuntu these come from the libreadline5-dev package). Otherwise the name completion and other features don't get enabled when you configure Hatari. @@ -4195,55 +4374,92 @@ overhead.
The operating system and libraries below Hatari can also sometimes have a noticeable effect on performance.
++Hatari can be sped up considerably by giving up some emulation or +emulator accuracy. With ST/STe emulation, these options should be +needed only on slow devices, typically ARM and/or mobile ones (e.g. +Rasberry Pi). +
+ -Improving Hatari performance
+Operating system components performance
-Hatari currently runs best in 16 or 32 bits per pixel color depth -mode, so try to avoid 24 bits per pixel display modes if possible. -16-bit mode is fastest. +Finding out whether there's a performance problem with the system +components (like SDL) in your setup, requires profiling Hatari and +rest of the system. How to do that is OS specific. On Linux that would +involve running "perf record -a" command (as root) on the background +for few minutes while Hatari is running, and then investigating +the results with "perf report" command. +
+ ++Some other process eating CPU cycles from Hatari one can see just with +the (Linux/Unix) "top" command.
+ +Build options impact on performance
+-On macOS with SDL 1.2, frame skipping, zooming and drive LED options -(listed below) seem to have a large effect on performance in the windowed -mode. This is apparently due to issues in the SDL macOS backend and how -macOS itself composites non-fullscreen window contents. MacOS uses always -32-bit mode. +Linux: Some HW platforms don't have properly HW accelerated +3D driver and SDL implementation. On these platforms it's better to +build Hatari with SDL v1.x than SDL 2.x, as latter can cause CPU +based 3D driver to be used for scaling Hatari graphics.
-Unless you've disabled compiler optimizations (like GCC's -O2 or -O3 -options) in the Hatari build, the extra optimization flags (like GCC's -"-mtune=i686") don't seem to have very large effect on Hatari -performance. Using GCC -O3 option instead of -O2 can give minor -(5-10%) performance improvements for things (demos) that use very -heavily interrupts. +MacOS: With SDL v1.x, frame skipping, zooming and drive LED +options (listed below) seem to have a large effect on performance in +the windowed mode. This is apparently due to issues in the SDL macOS +backend and how macOS itself composites non-fullscreen window +contents. These shouldn't be an issue with the SDL2 build of Hatari.
-However, Hatari can be sped up considerably by giving up some -emulation or emulator accuracy. Except for DSP, these options -should be needed only on very slow devices like handhelds. See below. +Compiler: Unless you have disabled compiler optimizations +(like GCC's -O2 or -O3 options) in the Hatari build, the extra +optimization flags (like GCC's "-mtune=i686") don't seem to have very +large effect on Hatari performance. Using GCC -O3 option instead of +-O2 can give minor (5-10%) performance improvements for things (mainly +demos) that use very heavily interrupts.
-If nothing else helps, try an earlier Hatari version. More accurate -emulation or emulator output in newer Hatari versions means that they -can be slower despite optimizations. +CPU emulation: Hatari can be built with two different CPU +core implementations. The newer WinUAE CPU core has more accurate CPU +emulation and supports all of the higher end 680x0 CPU features. This +accuracy causes it to be clearly slower, than the OldAUE CPU core +implementation. If run-time options (acceptable to you) don't give +enough performance, give the OldUAE CPU core also a try.
++Older versions: If nothing else helps, try (building) much +earlier Hatari version. More accurate emulation in newer Hatari +versions means that they can be slower despite optimizations. +
-Emulation options
+Run-time options not affecting emulation accuracy
-Emulation options have the largest impact on performance. -These options can be changed from the Hatari GUI System dialog and -the emulation needs to be rebooted for any of these changes to take -an effect! They're enabled by default. +Hatari currently runs best in 16 or 32 bits per pixel color depth +mode, so try to avoid 24 bits per pixel display modes if possible. +16-bit mode is faster with SDL1. MacOS uses always 32-bit mode.
-DSP
+ +Run-time emulation options
+ ++Emulation options have the largest impact on Hatari performance. These +options can be changed from the Hatari GUI System and CPU dialogs and +the emulation needs to be rebooted for any of these changes to take an +effect! They are enabled by default. +
+ +DSP (Falcon)
+Emulating the Falcon DSP is performance-wise several times more demanding than emulating the m68k; DSP runs at higher frequency, executes many @@ -4254,47 +4470,56 @@ that do use DSP, many use it only for ba fine without the real DSP emulation.
+CPU: cycle exact (030/TT/Falcon)
+ ++WinUAE CPU core supports 030 cache emulation for cycle accuracy. This +is very heavy. Unless program needs cycle accuracy to work correctly, +you can disable it. Many Falcon demos need it, application and games +normally don't. +
+Timer-D
-The single largest factor contributing to general Hatari emulation -performance is the handling of interrupts. Enabling Timer-D patching -option (about) doubles Hatari ST/STE emulation performance as it -significantly reduces the number of interrupts generated by the emulated -Atari machine. Using this has adverse effect only for very rare programs. +With ST/STe, the single largest factor contributing to general Hatari +emulation performance is the handling of interrupts. Enabling Timer-D +patching option (about) doubles Hatari ST/STE emulation performance +with OldUAE CPU core as it significantly reduces the number of +interrupts generated by the emulated Atari machine. Using this has +adverse effect only for very rare programs.
FDC
While accurate FDC emulation doesn't take that much CPU, it slows down floppy image accesses (and Hatari startup) a lot. Only very -few demos and games require accurate FDC emulation for their copy protection, -so enabling fast floppy access is fairly safe. +few demos and games require accurate FDC emulation for their copy +protection, so enabling fast floppy access is fairly safe.
-Compatible CPU
+CPU: prefetch
-After the DSP and interrupts, m68k emulation takes most time. -Disabling the "Slower but more compatible CPU" option will speed up -the emulation a lot, but it won't anymore be cycle accurate. This can -be fine for many games and other programs, but won't work e.g. for demos -using overscan or rasters. +After the DSP, cycle accuracy and interrupts, m68k emulation takes +most time. Disabling the "Prefetch" / "Compatible" option can speed up +the emulation noticeably, but it will be less accurate. This can be +fine for many games and other programs, but won't work e.g. for demos +using overscan or rasters. This is recommended only as a last resort.
-Roughly speaking, for DSP emulation, one needs at least 2Ghz machine. -For normal (unpatched) Timer-D frequency on some specific cases (like -demos with overscan 512 color animations) one may need over 1GHz -machine, but some rare ST/STE demos may require over 1GHz machine even -with Timer-D patching. For "Compatible CPU" one needs at least 1/2Ghz -machine. +Roughly speaking, for Falcon DSP emulation with cycle exact 030 cache +emulation, one needs at least 3Ghz machine. For normal (unpatched) +Timer-D frequency on some specific cases (like demos with overscan 512 +color animations) one may need over 1GHz machine for ST/STE emulation, +but some rare demos may require over 1GHz machine even with Timer-D +patching.
NOTE: Above options may cause some programs to work in correctly. The Hatari Software Compatibility List lists programs known to need real Falcon DSP emulation, Timer-D -frequency or accurate FDC timings. Disabling "Compatible CPU" option -is recommended only as a last resort. +frequency or accurate FDC timings.
@@ -4308,6 +4533,7 @@ be toggled at run-time without rebootingSound
+Internal Hatari sound handling and the SDL_mixer sound thread libALSA sound processing can account up to 1/3 of the Hatari CPU usage @@ -4318,13 +4544,26 @@ in Hatari as this can significantly redu interrupts.
++If program supports both ST and STE, use STE. Emulating DMA sound, is +more lightweight than interrupt heavy ST sound. +
+ ++If problem is occasional performance related audio glitches, increasing +the sound buffer size (with "--sound-buffer-size" option) may help, but +it increases sound latency. +
+Frame skipping
+Screen rendering can take noticeable amount of CPU time. The default Hatari "auto" frame skipping should be used unless there's a good reason not to. It will skip converting and showing some of the frames if there's not enough time for them.
+Also, if your monitor refresh frequency is lower than the selected Hatari monitor frequency (e.g. LCD monitors usually use 60Hz whereas @@ -4378,14 +4617,16 @@ is completely busy, it will increase to
Hatari has also a facility to measure FPS i.e. Frames Per Second. -Just enable the --fast-forward option -on command line (or use the corresponding keyboard shortcut), and -after a while, press the "Pause" key. Whenever Hatari emulation is -paused, Hatari will output on console how many VBLs it could show per -second along with some other numbers. +Enable frame skipping with +--fast-forward yes option +(or use the corresponding keyboard shortcut) and set +--log-level info. +Then after a while, press the "Pause" key. Whenever Hatari emulation +is paused, Hatari will output on console info on how many VBLs it +could show per second, along with some other numbers.
-It depends on what you want to measure, but usually it's best to +It depends on what you want to measure, but usually it is best to disable sound and set high frame skip like --sound off --frameskips 60 so that the associated external overheads are minimized. E.g. video output @@ -4398,7 +4639,7 @@ call, only the time spent by the Hatari On other systems, much less accurate SDL "wall clock" timings are used. To make latter more accurate you could use also --run-vbls option to specify how many -VBLs Hatari should run before it exits. In this case it's best to +VBLs Hatari should run before it exits. In this case it is best to either have the test-case run automatically from the AUTO-folder or given as memory snapshot to Hatari with the frame skip set equal to the VBL count. @@ -4408,7 +4649,7 @@ Note that these numbers can fluctuate qu when the SDL timings are used, so for (statistically) reliable numbers you may need to repeat the measurement several times. You should of course make also sure that the system doesn't have any other activity -at the same time you're making the measurements. +at the same time you are making the measurements.