EMU7800: A .NET Atari 7800 Emulator
Mike Murphy, mimurphy@u.washington.edu, mike@jones-murphy.dyndns.info
v0.41, January 15, 2004



1.0 Introduction

This is a pre-1.0 release of EMU7800, an Atari 7800 emulator implemented using Microsoft's .NET platform.  While 2600-specific emulation works well, 7800-specific emulation is still under development.  2600 support features authentic HMOVE emulation, per Andrew Tower's paper "A Small Opus on the TIA."  The stars in Cosmic Ark appear, but without emulation cheats.

You are probably asking, "Why would you want to implement an emulator in .NET for?"  This was an academic graduate capstone project, at UW Tacoma, where I needed to find a project that had lots of technical risk.  Emulator writing is fun too, so that was a helpful bonus.  Before I started this project, I had no experience in .NET or Win32 programming, no real object-oriented programming experience, or emulator writing for that matter.  So, there was plenty of risk indeed.

Regardless, send me a note if you have questions or feedback.

Enjoy!


1.1 Copyright Notice, Disclaimer, License

EMU7800 is Copyright (c) 2003, 2004 Mike Murphy.

THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY EXPRESSED OR IMPLIED WARRANTY. IN NO EVENT WILL THE AUTHOR BE HELD LIABLE FOR ANY DAMAGES ARISING FROM THE USE OF THIS SOFTWARE.  PLEASE SEE THE ENCLOSED "LICENSE.TXT" FILE FOR THE COMPLETE LICENSING TERMS.

THE "msvcr70.dll" FILE IS REDISTRIBUTED PER THE FOLLOWING MICROSOFT KNOWLEDGE BASE ARTICLE:

	Microsoft Knowledge Base Article - 326922
	Redistribution of the Shared C Runtime Component in Visual C++ .NET
	http://support.microsoft.com/default.aspx?scid=kb;en-us;326922

THE LICENSING TERMS OUTLINED IN "LICENSE.TXT" DO *NOT* APPLY TO THIS FILE.


1.2 Release Notes

0.41:

- Substituted use of Managed DirectX with the Simple DirectMedia Layer (SDL). Fullscreen performance is now on par with the most excellent Z26 emulator.
- Solved the sound syncronization problem; audio now works perfectly.
- Added Game controller (joystick) support.
- Added mouse-based paddle emulation on SDL fullscreen mode.
- No changes to emulation were made for this release.


0.33:

Further refined the HMOVE emulation, added a few illegal opcodes to enable some of the homebrew titles to work, and fixed several emulation bugs.  This cleaned up Pitfall2, and other Activision titles that had visual artifacts. 

Fixed: eliminated PIA bugs: no more jittering for Star Fox, Off Your Rocker, Spitfire, Omega Race, Blueprint, and others probably
Fixed: minor missle/ball positioning TIA bug
Fixed: booster grip controller now works right
Fixed: Omega Race rom was being ignored because of its odd size
Fixed: emulator no longer requires one line of VSYNC; this helps one of the Bowling ROMs and others probably


0.32:

Fixed: the file picker on the GameSelectTab hung in certain circumstances
Fixed: Pitfall2 rom was being ignored because of its odd size
Cleaned up the distribution by removing some unneeded junk


0.31:

Probably the most notable item in this release is an attempt at a general algorithm for handling "ill-advised" HMOVEs.  That is, when the HMregisters are fiddled with within 24 CPU cycles of an HMOVE register strobe.

Andrew Towers' excellent paper, A Small Opus on the TIA, provided invaluable insight for accomplishing this.  So, give Cosmic Ark a try.  You will see the starry background, but with no special hacks.


1.3 Acknowledgements

EMU7800 is a derived work of many people.  Please let me know if I need to
include someone else in this list.

Bradford W. Mott, Author of the Stella emulator
John Saeger, Author of the Z26 emulator
Andrew Towers, Author of "TIA Hardware Notes: A Small Opus on the TIA"
Ron Fries, Author of the Tiasound library
Erik Kovach, Author of the Stella property file 
Kevin Horton, Author of the 2600 bankswitching method paper


1.4 Known Issues/TODO List

ROM Problems:

Tetris (one scanline fast jitter)
Challenge: 4311a4115fb7bc68477c96cf44cebacf  (doesnt work, needs some illegal opcodes)
Pitfall II sound needs fixin'
River Raid: Leftmost house moves a pixel to the right onscreen
Asteroids: Copyright logo on start up needs aligning

Misc TODO:

Add Maria/7800 support
Finish illegal opcode support
Add Supercharger support
Figure out weird "off by two CLK" bug in Grand Prix
Add game state saving
Do PocketPC port


2.0 Installation

2.1 Prerequisites

To run EMU7800, you will need to have the .NET runtime installed onto your computer. Currently, this means that you will also need to be running Microsoft Windows.  (Hopefully this will change in the near future.)  In any case, it is a free download from Microsoft's website.  To have the capability to build from the included source code, be sure to install the SDK (software development kit) as opposed to just the redistributable runtime.

EMU7800 was developed on a machine with a Pentium 4 Celeron 1.7 GHZ processor.  This appeared more than adequate for emulator performance.  Your mileage may vary, and I would be interested in hearing how well it works (or doesn't) on other machines.


2.2 Unpacking

If you are reading this now, chances are that you have already figured out how to unpack the distribution ;)  Simply find a folder on your system, and unzip the archive.  Inside, you should find a single executable target:

	EMU7800.exe

Simply double-click to execute it.  Also in this directory, there are three .dll files:

	SDL.dll            
	A Visual C++ .NET build of the Simple DirectMedia Layer.

	EMU7800Audio.dll
	A thunking-layer for .NET P/Invoke access to the audio API.

	msvcr70.dll
	Visual C++ .NET Shared C Runtime Component.

All must be in the same directory as EMU7800.exe to play games.  


2.3 Rebuilding from Source

In true GNU spirit, the source code for the emulator is included in the distribution. To rebuild from source, simply start a command prompt (CMD.EXE), and change directories to the src/ subdirectory of the EMU7800 distribution.  Then to rebuild, enter the command:

	csc @build.rsp

The EMU7800.exe executable should appear within the directory within a few moments.  Be sure to remember to move it into the same directory as the .dlls to have it work.


2.3.1 ROMProperties

As in other emulators, there are properties that are associated with recognized roms. In EMU7800, these are stored in ROMProperties.txt in the source directory.  This file is embedded into the executable, so to make changes, the executable will need to be rebuilt.  Since the text file is a bit terse, there is an associated MS Access DB that is also included that makes updating the file a bit easier.

After the Access DB is updated, export to ROMProperties.txt, then move this file into the top-level src/ directory before rebuilding.


3.0 Running the Emulator

Some testing has shown that SDL may occasionally stop with a "DirectDraw is still drawing" error message to the console on some platforms.  Simply hitting the Resume button will continue running the machine where it left off last.  This will also happen if the Windows Key is pressed during gameplay.   

If the sound pops or buzzes, then the sound queue is underflowing due to the emulator not being able to generate the sound frames fast enough.  This is more likely to happen with the GDI host, versus the SDL host.  The framerate can be adjusted through the console to slow the emulator enough to prevent this (fps +/- number).  The sound playback rate will also be slowed, causing the overall pitch to lower as well.  A GUI control will be implemented in the near future to make these adjustments easier.


3.1 Keyboard Mappings

Key	Function

[ESC]	Escape (quit) from the currently running machine/game
[TAB]	Bring up the Control Panel GUI (only available on GDI Host)
[P]	Pause the emulator, any key resumes
[M]	Sound mute toggle
[F]	Show framerate
[J]	Show next joystick event (SDL host only, useful for assigning joystick buttons)

[R]	Game Reset Console Switch
[S]	Game Select Console Switch
[C]	Toggle between Color and B/W Console Switch settings
[1]	Toggle between A/B difficulty for left player
[2]	Toggle between A/B difficulty for right player

[F1]	Set keyboard to player 1 control
[F2]	Set keyboard to player 2 control
[F3]	Set keyboard to player 3 control
[F4]	Set keyboard to player 4 control

[F5]	Pan display left
[F6]	Pan display right
[F7]	Pan display up
[F8]	Pan display down

[F12]	Save Screenshot to outdir/ (only available on SDL Host)

[Up Arrow]     Move up: joystick, booster grip
[Left Arrow]   Move left: joystick, booster grip, paddles, driving
[Right Arrow]  Move right: joystick, booster grip, paddles, driving
[Down Arrow]   Move down: joystick, booster grip

[CTRL]	Trigger
[ALT]	Booster


Corresponding keys on keypad controller:

[7] [8] [9]	7 8 9
[4] [5] [6]	4 5 6
[1] [2] [3]	1 2 3
[*] [0] [/]	* 0 #


3.2 Game Controller/Joysticks

Up to four game controllers can be used, where the first four in the device list will be used.  Controllers 3 and 4 are only usable for paddle games that support that many players (e.g. Warlords).  Only axis 0 and 1 are used for directional input.

Controller button bindings can be set through the Console interface.  To help this process, pressing "J" during gameplay will display the next joystick event (SDL Host only).  This is helpful when trying to figure out what the number is for a particular button out of, say, a possible 11.

Game select, reset, and player 1 and 2 joystick swapping functions can also be assigned to controller buttons, but they will only work on the first controller in the device list.  To avoid assigning any button to these functions, use an unusually high number when using the Console:

> joybuttons 0 1 99 99 99

This will assign "99" to the select, reset, and swap functions.  Since your joystick probably does not have 99 buttons, they will never be triggered.

Entering "h" on the console will print a helplist that includes documentation on what each joybuttons parm represents.


3.3 Paddle emulation via Mouse

On paddle games, the mouse can be used as the paddle controller (SDL host only).  Sensitivity is currently not configurable, but may be in the future.


3.4 User Interface

3.4.1 Game Select Tab

The number of ROMs recognized in the roms/ directory is displayed in the lower left corner.  To select a new directory, Click the Select ROM File button, and navigate to the ROM directory of your choice.  When a ROM file is selected, the rest of the directory contents will be scanned and will be presented for subsequent selection.


3.4.2 Settings Tab

While not well-poplulated yet with controls, selection of the emulation host (GDI vs. SDL) can be made here.


3.4.3 Console Tab

This is a commandline interface to EMU7800.  To see what commands are available, enter "h" for help.














 