diff --git a/Changes.txt b/Changes.txt
index c49bd6ebc..6154b45ab 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -12,6 +12,15 @@
Release History
===========================================================================
+3.8 to 3.9: (XXXXX xx, 2013)
+
+ * Added support for TIA RSYNC writes, thanks to Omegamatrix of AtariAge.
+ This allows the recently released "Extra Terrestrials" ROM to run, as
+ well as improving emulation of "Fatal Run" and several other test ROMs.
+
+-Have fun!
+
+
3.7.5 to 3.8: (February 21, 2013)
* Huge changes to the sound system:
@@ -78,8 +87,6 @@
* Updated included PNG and ZLIB libraries to latest stable version.
--Have fun!
-
3.7.4 to 3.7.5: (December 22, 2012)
diff --git a/docs/index.html b/docs/index.html
index 9bef5bc99..c66623b1e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -389,52 +389,21 @@
Linux/UNIX
- Binary DEB (stella-release-1_arch.deb)
-
+
+
Binary RPM (stella-release-1.arch.rpm)
-
+
+
- Compressed tarball : building from source code (stella-release-src.tar.gz)
+ Building and installing from source code
- - Debian-based distributions:
-
- - Extract files from the distribution:
-
tar zxvf stella-release-src.tar.gz
- - Change directories to the stella-release directory
- - Build the executable with the following command:
-
dpkg-buildpackage
- - Install the executable as indicated in the previous section
-
-
- - RPM-based distributions:
-
- - Extract files from the distribution:
-
tar zxvf stella-release-src.tar.gz
- - Change directories to the stella-release/src/unix directory
- - Build the executable with the following command:
-
rpmbuild -ba stella.spec
- - Install the executable as indicated in the previous section
-
-
- - Generic build:
-
- - Extract files from the distribution:
-
tar zxvf stella-release-src.tar.gz
- - Change directories to the stella-release directory
- - Configure the build with the following command:
-
./configure (--help for list of options)
- - Build the executable with the following command:
-
make
- - Install the executable with the following command:
-
make install
-
-
+ - See the developers build instructions at the
+ Stella Development Page.
@@ -443,30 +412,17 @@
Macintosh
- Binary DMG file (Stella-release-macosx.dmg)
-
+
- Double-click the disk image, open the 'Stella' folder, then copy the
Stella.app package to your 'Applications' folder.
-
+
- Compressed tarball : building from source code (stella-release-src.tar.gz)
-
- - Extract files from the distribution using an archiving program that supports
- gzipped tar files
- - Open the stella-release/src/macosx/stella.xcodeproj
- file using Xcode 3.2
- - Make sure you have the SDL runtime library/framework installed in src/macosx (located at
- libsdl.org)
- - Build the 'Stella' project (making sure to select 'Deployment' mode)
- - For installation:
-
- - Run the script Create_build.sh, located in the src/macosx directory.
- This will create a DMG installation archive on your desktop.
- OR
- - Copy the Stella.app package to your 'Applications' folder.
-
- - For compiling the Intel/Snow Leopard version, open the stella-release/src/macosx/stella_intel.xcodeproj file instead, and continue from
- step 2 above.
-
+
+ Building and installing from source code
+
@@ -478,37 +434,19 @@
Double-click on the installer and follow the onscreen instructions
+
Binary ZIP file (stella-release-windows.zip)
- Unzip the binary ZIP file using Winzip or Total Commander
- Copy the contents of either 32-bit or 64-bit directory somewhere on your system
- Compressed tarball : building from source code (stella-release-src.tar.gz)
-
- - Make sure you have library and header files installed for SDL for
- the correct architecture (32-bit, 64-bit or both), and that Visual Studio
- is properly configured to find them
- - Extract files from the distribution using Winzip,
- Total Commander, or some other archiving program that supports
- gzipped tar files
- - Open the stella-release/src/win32/Stella.sln
- file using Visual C++ 2010
- - Build the 'Stella' solution, making sure to correctly select either 'Win32'
- or 'x64' mode (depending on the version of Windows you have installed)
- - For installation:
-
- - Double-click on Create_builds.bat to generate ZIP and EXE files;
- you must have the 'flip' and 'zip' applications installed on your system,
- as well as the InnoSetup application. This will generate the EXE and ZIP
- files, which can be installed as explained above
- OR
- - Manually copy the Stella.exe and SDL.dll files somewhere
- on your system (they may be located in the 'Release' or 'x64\Release'
- directories)
-
-
-
+
+ Building and installing from source code
+
diff --git a/src/emucore/TIA.cxx b/src/emucore/TIA.cxx
index 9c06005be..7d6925b9b 100644
--- a/src/emucore/TIA.cxx
+++ b/src/emucore/TIA.cxx
@@ -1170,6 +1170,69 @@ inline void TIA::waitHorizontalSync()
mySystem->incrementCycles(cyclesToEndOfLine);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+inline void TIA::waitHorizontalRSync()
+{
+ // 02-23-2013: RSYNC has now been updated to work correctly with
+ // Extra-Terrestrials. Fatal Run also uses RSYNC (in its VSYNC routine),
+ // and the NTSC prototype now displays 262 scanlines instead of 261.
+ // What is not emulated correctly is the "real time" effects. For example
+ // the VSYNC signal may not be 3 complete scanlines, although Stella will
+ // now count it as such.
+ //
+ // There are two extreme cases to demonstrate this "real time" variance
+ // effect over a proper three line VSYNC. 3*76 = 228 cycles properly needed:
+ //
+ // ====== SHORT TIME CASE ======
+ //
+ // lda #3 ;2 @67
+ // sta VSYNC ;3 @70 vsync starts
+ // sta RSYNC ;3 @73 +3
+ // sta WSYNC ;3 @76 +6
+ // ------------------------------
+ // sta WSYNC ;3 @76 +82
+ // ------------------------------
+ // lda #0 ;2 @2 +84
+ // sta VSYNC vsync ends
+ //
+ // ====== LONG TIME CASE ======
+ //
+ // lda #3 ;2 @70
+ // sta VSYNC ;3 @73 vsync starts
+ // sta RSYNC ;3 @74 +3
+ // sta WSYNC ;3 @.. +81 2 cycles are added to previous line, and then
+ // WSYNC halts the new line delaying 78 cycles total!
+ //------------------------------
+ // sta WSYNC ;3 @76 +157
+ //------------------------------
+ // lda #0 ;2 @2 +159
+ // sta VSYNC vsync ends
+
+ // The significance of the 'magic numbers' below is as follows (thanks to
+ // Eckhard Stolberg and Omegamatrix for explanation and implementation)
+ //
+ // Objects always get positioned three pixels further to the right after a
+ // WSYNC than they do after a RSYNC, but this is to be expected. Triggering
+ // WSYNC will halt the CPU until the horizontal sync counter wraps around to zero.
+ // Triggering RSYNC will reset the horizontal sync counter to zero immediately.
+ // But the warp-around will actually happen after one more cycle of this counter.
+ // Since the horizontal sync counter counts once every 4 pixels, one more CPU
+ // cycle occurs before the counter warps around to zero. Therefore the positioning
+ // code will hit RESPx one cycle sooner after a RSYNC than after a WSYNC.
+ //
+ // Essentially, HBLANK is completed after HBLANK/3 cycles have elapsed, after
+ // which point objects moved with RSYNC trail those moved with WSYNC by
+ // 3 pixels (or 1 cycle)
+
+ uInt32 cyclesToEndOfLine = 76 - ((mySystem->cycles() -
+ (myClockWhenFrameStarted / 3)) % 76);
+
+ if((cyclesToEndOfLine > HBLANK/3) && (cyclesToEndOfLine < 76))
+ mySystem->incrementCycles(cyclesToEndOfLine - 1);
+ else
+ mySystem->incrementCycles(cyclesToEndOfLine);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::clearBuffers()
{
@@ -1399,7 +1462,7 @@ bool TIA::poke(uInt16 addr, uInt8 value)
case RSYNC: // Reset horizontal sync counter
{
-// cerr << "TIA Poke: " << hex << addr << endl;
+ waitHorizontalRSync();
break;
}
diff --git a/src/emucore/TIA.hxx b/src/emucore/TIA.hxx
index 6c40f2df4..4219ceca1 100644
--- a/src/emucore/TIA.hxx
+++ b/src/emucore/TIA.hxx
@@ -357,6 +357,9 @@ class TIA : public Device
// Waste cycles until the current scanline is finished
void waitHorizontalSync();
+ // Reset horizontal sync counter
+ void waitHorizontalRSync();
+
// Clear both internal TIA buffers to black (palette color 0)
void clearBuffers();