Installation of the Atari 800 Emulator
--------------------------------------

Irrespective of whether you are going to compile the emulator yourself
or install a pre-compiled binary version you must obtain a copy of the
Operating System ROMs.

The ROM images are distributed within the PC Xformer 2.5 package (other
versions of this program do not contain the ROMs in a suitable format)
which can be downloaded from:-

http://prdownloads.sf.net/atari800/xf25.zip

If you are creating the ROM images yourself they should be copied from
the following locations:-

1. Atari Basic (8192 bytes between $a000 and $bfff)
2. Atari OS/A (10240 bytes between $d800 and $ffff)
3. Atari OS/B (10240 bytes between $d800 and $ffff)
4. Atari XL/XE (16384 bytes between $c000 and $ffff)
5. Atari 5200 (2048 bytes between $f800 and $ffff)

Note: If you are extracting the atarixl.rom you will find that the
      ROM area under the custom chip ($d000 to $d7ff) are mapped
      between $5000 and $57ff when bit 7 of PORTB is set to 1.

      i.e. You should set bit 7 of PORTB and then dump the memory
           out in the following order:- $c000 to $cfff, $5000 to $57ff
           and finally $d800 to $ffff.

The first time you run the emulator you will be prompted for the
location of the ROMs and various other defaults. If you want to
change any of these in the future simply start the emulator with
the "-configure" command line option.

Compiling the Emulator
----------------------

The emulator can be compiled for the following systems (and probably
many others with a little work):-

1. X Window Version (including SUN OpenWindows) on a Unix Platform
   (prefer the SDL version)
2. CURSES version
3. Graphical Version for the Amiga (not maintained)
4. Graphical version for the Atari TT/Falcon and compatible computers
5. BASIC version (No Graphics). Should be straightforward to configure
   for any 32-bit environment supporting ANSI C.
6. VGA Version for DOS
7. DirectX Version for Microsoft Windows (also try the SDL version)
8. SDL (Linux/Unix, Windows, BeOS)
9. WinCE
10. Java (various platforms)

Installed zlib (compression library) enables building the emulator with
compressed statesave images support. Additionally installed libpng
makes the emulator capable of generating screenshots in the PNG format.

Building the Emulator on most platforms
---------------------------------------

1. Change your working dir to the atari800/src path
2. Check if "configure" script is there. If it is skip to step 4.
3. Run "./autogen.sh" (make sure you have autoconf >= 2.5x installed).
4. Type "./configure --target=" for a list of supported platforms.
5. Type "./configure --target=<YourTarget>" (choose from the list above)
6. Type "make".
7. Install the emulator by typing "make install".

Building the Emulator for Curses
--------------------------------

Follow the instruction for Unix but note that you must be using the
System V Curses Library. BSD Curses is lacking a few functions and
will not work (nodelay, attron, attroff, keypad and curs_set).

Building the Emulator for DOS
-----------------------------

To compile, use DJGPP the DOS port of gcc, which can be get from
http://www.delorie.com/djgpp/. You will need complete environment
in order to configure and build the executables.
You may need zlib (compression library) to use compressed statesave images
and libpng for PNG screenshots. To build curses (text mode) version install
curses-compatible library (e.g. PDCurses).

Since the source code contains files with long file names, you must unpack
and compile the source on a filesystem supporting long file names (for example
VFAT of Windows95). An additional change of DJGPP setting is required:
open the DJGPP.ENV file in editor and change the LFN= line to LFN=y

1. Run "configure_dos.bat".
2. Run "make" and "make joycfg".
3. If everything went good you should have atari800.exe and joycfg.exe -
   copy them to destination directory.

Building the Emulator for Windows using Cygwin
----------------------------------------------

Atari800 for Windows can be built using Cygwin environment:
http://cygwin.com/

1. Get and install at least one of SDL or DirectX for MinGW.
2. For SDL, get the file SDL_win32_main.c from the SDL source that matches
   your version and copy it into the Atari800 src directory.
3. Type "./configure --target=sdl" for SDL and --target=windx for DirectX
4. Type "make".
5. Copy atari800.exe to destination directory.
6. Copy the needed DLLs: /bin/mgwz.dll and (for SDL) sdl.dll

Building the Emulator for Windows using Microsoft 32-bit C/C++ Compiler
-----------------------------------------------------------------------

Atari800 for Windows can be built using command-line tools
from Microsoft Visual C++ 2005.  Avoid older compilers such as VC++ 6
because they are buggy (even with service packs) and unsupported.
In addition to the compiler suite you need Windows Platform SDK (included
in Visual C++ 2008 or newer) and DirectX SDK (not newer than the August 2007
version, as it is the last one to contain the now-deprecated DirectInput
libraries.) Set "Path", "INCLUDE" and "LIB" environment variables to point to
the correct locations in VC++, PSDK and DXSDK.

1. Install the ZLIB library:
a. Download the source code from http://www.zlib.org
b. Remove -MD from CFLAGS in win32\Makefile.msc
c. Compile with "nmake /f win32\Makefile.msc zlib.lib".
d. Copy zlib.h and zconf.h to the Include directory of VC++.
e. Copy zlib.lib to the Lib directory of VC++.
2. Install the LIBPNG library:
a. Download the source code from http://www.libpng.org
b. Remove -MD from CFLAGS in scripts\makefile.vcwin32
c. Compile with "nmake /f scripts\makefile.vcwin32".
d. Copy png.h and pngconf.h to the Include directory of VC++.
e. Copy libpng.lib to the Lib directory of VC++.
OR
1&2. #undef HAVE_LIBPNG and HAVE_LIBZ in Atari800's src\win32\msc\config.h.
     The compiled emulator won't handle zlib-compressed disk images
     and state files and won't produce PNG screenshots.
3. Navigate to the src directory of Atari800 sources.
4. Type "nmake /f win32\msc\Makefile".
5. If you are getting linking errors saying something about MSVCRT
   then you probably ignored step 1b or 2b.
6. Copy atari800.exe to destination directory.

Building the Emulator for Falcon
--------------------------------

You need a recent GCC, for example 2.7.2, running on a filesystem with long
file names (either minix-fs of MiNT, or VFAT of MagiC).

1. Type "./configure --target=falcon".
2. Type "make".
3. Copy atari800 to destination directory or try "make install".

Building the Emulator for SDL
-----------------------------

1. Please install (and configure) SDL library (http://www.libsdl.org).
2. If you are using MinGW or Cygwin, get the file SDL_win32_main.c from the SDL 
   source (in src/main/win32) and copy it to the atari800 src directory.
3. If you want to build an OpenGL-capable version, you'll need OpenGL headers
   installed. They should support OpenGL version 2.1 (support for the Pixel
   Buffer Object extension). The result binary however will only need OpenGL
   version 1.1 (PBOs simply won't be used). The same binary will work on
   machines without OpenGL support - only software modes will be available.
   For MinGW, get the OpenGL headers at
   http://www.libsdl.org/extras/win32/common/opengl-devel.tar.gz
   See also http://www.libsdl.org/extras/win32/mingw32/README.txt
4. Type "./configure --target=sdl". When building using MinGW, you might also
   need to add "--with-sdl-prefix=/mingw".
5. Type "make".
6. Type "make install".
7. You can run atari800 anytime you want.

Building the Emulator for Java using NestedVM
---------------------------------------------
1. Get and build NestedVM (nestedvm.ibex.org). make env.sh and unix_runtime.jar
2. source env.sh in the NestedVM directory.
3. In the atari800 directory:
   ./autogen.sh (only if you don't have configure, such as a CVS build)
   ./configure --host=mips-unknown-elf --target=javanvm
   You might want to add --enable-veryslow --disable-monitorbreak to the above.
   For the basic version, use --target=javanvm-basic
4. Type "make".
5. atari800.jar requires unix_runtime.jar in the same directory. Copy it from
   the NestedVM directory where you made it using "make unix_runtime.jar" as 
   stated above.
6. To run use: java -jar atari800.jar
Add -o UnixRuntime to the NestedVM compiler options to enable directory
browsing.
This requires changing Windows paths to the form: /c:/file in all configuration
files and on the command line.  It will look for .atari800.cfg in your
Windows home directory.
Applet version:
You must compile with -o UnixRuntime
Apply UnixRuntime.patch to NestedVM.
To use:
<APPLET CODE="atari800.class" WIDTH=672 HEIGHT=480 ARCHIVE="atari800.jar, unix_runtime.jar">
<PARAM name=args value="-config /resource/http://atari800_applet.cfg -xlxe_rom /resource/http://ospp.rom -basic_rom none -nobasic -nopatchall /resource/http://disk.atr">
</APPLET>
All files should have /resource/http:// in front of their names.
Edit atari800_applet.cfg and add /resource/http:// to all rom files, even those
you are not providing.
Legal distribution of Atari800 as an applet cannot include the OS and BASIC
ROM Files.  You can run without BASIC by using -basic_rom none and Thomas
Richter's Os++.

