Implemented TIA RSYNC write functionality thanks to Omegamatrix.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2626 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-02-24 01:46:14 +00:00
parent bca6366bb2
commit 0650c48977
4 changed files with 98 additions and 87 deletions

View File

@ -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)

View File

@ -389,52 +389,21 @@
<h3><b><u>Linux/UNIX</u></b></h3>
<ul>
<li><b>Binary DEB</b> (stella-<i>release</i>-1_arch.deb)
<ol>
<ul>
<li>Install the binary DEB with the following command:
<pre> dpkg -i stella-<i>release</i>-1_arch.deb</pre></li>
</ol>
</ul>
</li>
<li><b>Binary RPM</b> (stella-<i>release</i>-1.arch.rpm)
<ol>
<ul>
<li>Install the binary RPM with the following command:
<pre> rpm -Uvh stella-<i>release</i>-1.arch.rpm</pre></li>
</ol>
</ul>
</li>
<li><b>Compressed tarball : building from source code</b> (stella-<i>release</i>-src.tar.gz)
<li><b>Building and installing from source code</b>
<ul>
<li>Debian-based distributions:
<ol>
<li>Extract files from the distribution:
<pre> tar zxvf stella-release-src.tar.gz</pre></li>
<li>Change directories to the stella-<i>release</i> directory</li>
<li>Build the executable with the following command:
<pre> dpkg-buildpackage</pre></li>
<li>Install the executable as indicated in the previous section</li>
</ol>
</li>
<li>RPM-based distributions:
<ol>
<li>Extract files from the distribution:
<pre> tar zxvf stella-release-src.tar.gz</pre></li>
<li>Change directories to the stella-<i>release</i>/src/unix directory</li>
<li>Build the executable with the following command:
<pre> rpmbuild -ba stella.spec</pre></li>
<li>Install the executable as indicated in the previous section</li>
</ol>
</li>
<li>Generic build:
<ol>
<li>Extract files from the distribution:
<pre> tar zxvf stella-release-src.tar.gz</pre></li>
<li>Change directories to the stella-<i>release</i> directory</li>
<li>Configure the build with the following command:
<pre> ./configure (--help for list of options)</pre></li>
<li>Build the executable with the following command:
<pre> make</pre></li>
<li>Install the executable with the following command:
<pre> make install</pre></li>
</ol>
</li>
<li>See the developers build instructions at the
<a href="http://stella.sourceforge.net/development.php">Stella Development Page</a>.
</ul>
</li>
</ul>
@ -443,30 +412,17 @@
<h3><b><u>Macintosh</u></b></h3>
<ul>
<li><b>Binary DMG file</b> (Stella-<i>release</i>-macosx.dmg)
<ol>
<ul>
<li>Double-click the disk image, open the 'Stella' folder, then copy the
<b>Stella.app</b> package to your 'Applications' folder.</li>
</ol>
</ul>
</li>
<li><b>Compressed tarball : building from source code</b> (stella-<i>release</i>-src.tar.gz)
<ol>
<li>Extract files from the distribution using an archiving program that supports
gzipped tar files</li>
<li>Open the <b>stella-<i>release</i>/src/macosx/stella.xcodeproj</b>
file using Xcode 3.2</li>
<li>Make sure you have the SDL runtime library/framework installed in src/macosx (located at
<a href="http://www.libsdl.org/download-1.2.php">libsdl.org</a>)</li>
<li>Build the 'Stella' project (making sure to select 'Deployment' mode)</li>
<li>For installation:
<ul>
<li>Run the script <b>Create_build.sh</b>, located in the src/macosx directory.
This will create a DMG installation archive on your desktop.</li>
&nbsp;&nbsp;&nbsp;<b>OR</b>
<li>Copy the <b>Stella.app</b> package to your 'Applications' folder.</li>
</ul>
<li>For compiling the Intel/Snow Leopard version, open the <b>stella-<i>release</i>/src/macosx/stella_intel.xcodeproj</b> file instead, and continue from
step 2 above.</li>
</ol>
<br/>
<li><b>Building and installing from source code</b>
<ul>
<li>See the developers build instructions at the
<a href="http://stella.sourceforge.net/development.php">Stella Development Page</a>.
</ul>
</li>
</ul>
@ -478,37 +434,19 @@
<li>Double-click on the installer and follow the onscreen instructions</li>
</ol>
</li>
<br/>
<li><b>Binary ZIP file</b> (stella-<i>release</i>-windows.zip)
<ol>
<li>Unzip the binary ZIP file using <b>Winzip</b> or <b>Total Commander</b></li>
<li>Copy the contents of either 32-bit or 64-bit directory somewhere on your system</li>
</ol>
</li>
<li><b>Compressed tarball : building from source code</b> (stella-<i>release</i>-src.tar.gz)
<ol>
<li>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</li>
<li>Extract files from the distribution using <b>Winzip</b>,
<b>Total Commander</b>, or some other archiving program that supports
gzipped tar files</li>
<li>Open the <b>stella-<i>release</i>/src/win32/Stella.sln</b>
file using Visual C++ 2010</li>
<li>Build the 'Stella' solution, making sure to correctly select either 'Win32'
or 'x64' mode (depending on the version of Windows you have installed)</li>
<li>For installation:
<ul>
<li>Double-click on <b>Create_builds.bat</b> 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</li>
&nbsp;&nbsp;&nbsp;<b>OR</b>
<li>Manually copy the <b>Stella.exe</b> and <b>SDL.dll</b> files somewhere
on your system (they may be located in the 'Release' or 'x64\Release'
directories)</li>
</ul>
</li>
</ol>
<br/>
<li><b>Building and installing from source code</b>
<ul>
<li>See the developers build instructions at the
<a href="http://stella.sourceforge.net/development.php">Stella Development Page</a>.
</ul>
</li>
</ul>
</blockquote>

View File

@ -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;
}

View File

@ -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();