Well, it looks like I can squeeze this into 2.8 after all.

Randomized value placed in accumulator after exiting the SC BIOS for
SuperCharger ROMs.  This should fix issues in Dragonstomper, where it
seems the randomization of its items depending on a random accumulator
value.

Re-added '-fastscbios', and when enabled, it completely skips
the emulation of SC BIOS progress bars (previously, the bars were
simply sped up).  This defaults to off, for more authentic emulation.
Related to this, added a UI item in VideoDialog to enable/disable it.

Thanks to Eckhard Stolberg for advice on the SCROM, and how to
modify it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1763 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-06-09 14:27:21 +00:00
parent 80a3ae83a3
commit 111ae9185f
12 changed files with 151 additions and 85 deletions

View File

@ -40,6 +40,10 @@
* Tweaked paddle control so that all positions are reachable in game
4 of Activision Casino in both NTSC and PAL versions.
* SuperCharger/AR ROMs now start with a random value in the CPU
accumulator. This should fix issues with Dragonstomper always
starting in exactly the same state.
* Auto-detection for '3F' bankswitching improved; several ROMs
previously detected as 'F8' now work correctly.
@ -52,8 +56,13 @@
using an external frontend (in which case exiting a ROM also exits
from Stella).
* Re-added '-fastscbios' commandline argument, and added an associated
UI item. When enabled, the SuperCharger load bars are now completely
removed (and not just sped up as in previous releases).
* The '-listrominfo' commandline argument now shows all ROM
information built in to the internal database.
information built in to the internal database, taking into account
any information in 'personal' stella.pro files.
-Have fun!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -813,6 +813,11 @@
systems, the default is 1.</td>
</tr>
<tr>
<td><pre>-fastscbios &lt;1|0&gt;</pre></td>
<td>Disable Supercharger BIOS progress loading bars.</td>
</tr>
<tr>
<td><pre>-ssdir &lt;path&gt;</pre></td>
<td>The directory to save snapshot files to.</td>
@ -1122,6 +1127,7 @@
<tr><td>GL VSync</td><td>enable OpenGL vertical synchronization</td><td>-gl_vsync</td></tr>
<tr><td>Grab mouse</td><td>keep mouse in SDL window</td><td>-grabmouse</td></tr>
<tr><td>Center window (*)</td><td>attempt to center SDL window (requires restart)</td><td>-center</td></tr>
<tr><td>Fast SC/AR BIOS</td><td>Skip progress loading bars for SuperCharger ROMs</td><td>-fastscbios</td></tr>
</table>
</td>
</tr>

View File

@ -103,7 +103,7 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size,
else if(type == "4K")
cartridge = new Cartridge4K(image);
else if(type == "AR")
cartridge = new CartridgeAR(image, size, true); //settings.getBool("fastscbios")
cartridge = new CartridgeAR(image, size, settings);
else if(type == "DPC")
cartridge = new CartridgeDPC(image, size);
else if(type == "E0")

View File

@ -25,16 +25,15 @@
#include "CartAR.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size, bool fastbios)
: my6502(0)
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings)
: my6502(0),
mySettings(settings)
{
// Create a load image buffer and copy the given image
myLoadImages = new uInt8[size];
myNumberOfLoadImages = size / 8448;
memcpy(myLoadImages, image, size);
// Initialize SC BIOS ROM
initializeROM(fastbios);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -51,6 +50,9 @@ void CartridgeAR::reset()
for(uInt32 i = 0; i < 6 * 1024; ++i)
myImage[i] = random.next();
// Initialize SC BIOS ROM
initializeROM();
myPower = true;
myPowerRomCycle = mySystem->cycles();
myWriteEnabled = false;
@ -279,7 +281,7 @@ void CartridgeAR::bankConfiguration(uInt8 configuration)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeAR::initializeROM(bool fastbios)
void CartridgeAR::initializeROM()
{
static uInt8 dummyROMCode[] = {
0xa5, 0xfa, 0x85, 0x80, 0x4c, 0x18, 0xf8, 0xff,
@ -292,53 +294,57 @@ void CartridgeAR::initializeROM(bool fastbios)
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xa2, 0x3, 0xbc, 0x1d, 0xf9, 0x94, 0xfa, 0xca,
0xa2, 0x3, 0xbc, 0x22, 0xf9, 0x94, 0xfa, 0xca,
0x10, 0xf8, 0xa0, 0x0, 0xa2, 0x28, 0x94, 0x4,
0xca, 0x10, 0xfb, 0xa2, 0x1c, 0x94, 0x81, 0xca,
0x10, 0xfb, 0xa9, 0x0, 0x85, 0x1b, 0x85, 0x1c,
0x85, 0x1d, 0x85, 0x1e, 0x85, 0x1f, 0x85, 0x19,
0x85, 0x1a, 0x85, 0x8, 0x85, 0x1, 0xa9, 0x10,
0x85, 0x21, 0x85, 0x2, 0xa2, 0x7, 0xca, 0xca,
0xd0, 0xfd, 0xa9, 0x0, 0x85, 0x20, 0x85, 0x10,
0x85, 0x11, 0x85, 0x2, 0x85, 0x2a, 0xa9, 0x5,
0x85, 0xa, 0xa9, 0xff, 0x85, 0xd, 0x85, 0xe,
0x85, 0xf, 0x85, 0x84, 0x85, 0x85, 0xa9, 0xf0,
0x85, 0x83, 0xa9, 0x74, 0x85, 0x9, 0xa9, 0xc,
0x85, 0x15, 0xa9, 0x1f, 0x85, 0x17, 0x85, 0x82,
0xa9, 0x7, 0x85, 0x19, 0xa2, 0x8, 0xa0, 0x0,
0x85, 0x2, 0x88, 0xd0, 0xfb, 0x85, 0x2, 0x85,
0x2, 0xa9, 0x2, 0x85, 0x2, 0x85, 0x0, 0x85,
0x2, 0x85, 0x2, 0x85, 0x2, 0xa9, 0x0, 0x85,
0x0, 0xca, 0x10, 0xe4, 0x6, 0x83, 0x66, 0x84,
0x26, 0x85, 0xa5, 0x83, 0x85, 0xd, 0xa5, 0x84,
0x85, 0xe, 0xa5, 0x85, 0x85, 0xf, 0xa6, 0x82,
0xca, 0x86, 0x82, 0x86, 0x17, 0xe0, 0xa, 0xd0,
0xc3, 0xa9, 0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a9, 0x2, 0x85, 0x1, 0xa2, 0x1c,
0xa0, 0x0, 0x84, 0x19, 0x84, 0x9, 0x94, 0x81,
0xca, 0x10, 0xfb, 0xa6, 0x80, 0xdd, 0x0, 0xf0,
0xa9, 0x9a, 0xa2, 0xff, 0xa0, 0x0, 0x9a, 0x4c,
0xfa, 0x0, 0xcd, 0xf8, 0xff, 0x4c
};
// If fastbios is enabled, set the wait time between vertical bars
// to 0 (default is 8), which is stored at address 189 of the bios
if(fastbios)
dummyROMCode[189] = 0x0;
// Note that the following offsets depend on the 'scrom.asm' file
// in src/emucore/misc. If that file is ever recompiled (and its
// contents placed in the array above), the offsets will almost
// definitely change
uInt32 size = sizeof(dummyROMCode);
// The scrom.asm code checks a value at offset 109 as follows:
// 0xff -> do a complete jump over the SC BIOS progress bars code
// 0x0 -> show SC BIOS progress bars as normal
dummyROMCode[109] = mySettings.getBool("fastscbios") ? 0xff : 0x0;
// The accumulator should contain a random value after exiting the
// SC BIOS code - a value placed in offset 281 will be stored in A
class Random random;
dummyROMCode[281] = random.next();
// Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam
for(uInt32 i = 0; i < 2048; ++i)
{
myImage[3 * 2048 + i] = 0x02;
}
// Copy the "dummy" Supercharger BIOS code into the ROM area
for(uInt32 j = 0; j < size; ++j)
{
for(uInt32 j = 0; j < sizeof(dummyROMCode); ++j)
myImage[3 * 2048 + j] = dummyROMCode[j];
}
// Finally set 6502 vectors to point to initial load code at 0xF80A of BIOS
myImage[3 * 2048 + 2044] = 0x0A;

View File

@ -24,6 +24,7 @@ class System;
#include "bspf.hxx"
#include "Cart.hxx"
#include "Settings.hxx"
/**
This is the cartridge class for Arcadia (aka Starpath) Supercharger
@ -45,9 +46,9 @@ class CartridgeAR : public Cartridge
@param image Pointer to the ROM image
@param size The size of the ROM image
@param fastbios Whether or not to quickly execute the BIOS code
@param settings Used to query 'fastscbios' option
*/
CartridgeAR(const uInt8* image, uInt32 size, bool fastbios);
CartridgeAR(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
@ -161,12 +162,15 @@ class CartridgeAR : public Cartridge
void loadIntoRAM(uInt8 load);
// Sets up a "dummy" BIOS ROM in the ROM bank of the cartridge
void initializeROM(bool fastbios);
void initializeROM();
private:
// Pointer to the 6502 processor in the system
M6502* my6502;
// Reference to the settings object (needed for 'fastscbios'
const Settings& mySettings;
// Indicates the offest within the image for the corresponding bank
uInt32 myImageOffset[2];

View File

@ -117,21 +117,25 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
myOSystem->settings().getBool("rominfo"))
{
// Run the system for 60 frames, looking for PAL scanline patterns
// We assume the first 30 frames are garbage, and only consider
// the second 30 (useful to get past SuperCharger BIOS)
// Unfortunately, this means we have to always enable 'fastscbios',
// since otherwise the BIOS loading will take over 250 frames!
// We turn off the SuperCharger progress bars, otherwise the SC BIOS
// will take over 250 frames!
// The 'fastscbios' option must be changed before the system is reset
bool fastscbios = myOSystem->settings().getBool("fastscbios");
myOSystem->settings().setBool("fastscbios", true);
mySystem->reset();
int palCount = 0;
for(int i = 0; i < 60; ++i)
{
myTIA->update();
if(i >= 30 && myTIA->scanlines() > 285)
if(myTIA->scanlines() > 285)
++palCount;
}
myDisplayFormat = (palCount >= 15) ? "PAL" : "NTSC";
myDisplayFormat = (palCount >= 30) ? "PAL" : "NTSC";
if(myProperties.get(Display_Format) == "AUTO-DETECT")
autodetected = "*";
// Don't forget to reset the SC progress bars again
myOSystem->settings().setBool("fastscbios", fastscbios);
}
myConsoleInfo.DisplayFormat = myDisplayFormat + autodetected;

View File

@ -117,6 +117,7 @@ Settings::Settings(OSystem* osystem)
setInternal("avoxport", "");
setInternal("stats", "false");
setInternal("audiofirst", "true");
setInternal("fastscbios", "false");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -354,6 +355,7 @@ void Settings::usage()
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
<< " -audiofirst <1|0> Initial audio before video (required for some ATI video cards)\n"
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n"
<< " -ssdir <path> The directory to save snapshot files to\n"
<< " -sssingle <1|0> Generate single snapshot instead of many\n"
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\n"

View File

@ -5,27 +5,37 @@
@version $Id$
*/
#include <iomanip.h>
#include <fstream.h>
#include <iomanip>
#include <fstream>
#include <iostream>
using namespace std;
main()
int main(int ac, char* av[])
{
ifstream in("scrom.bin");
ifstream in;
in.open("scrom.bin");
if(in.is_open())
{
in.seekg(0, ios::end);
int len = (int)in.tellg();
in.seekg(0, ios::beg);
unsigned char* data = new unsigned char[len];
in.read((char*)data, len);
in.close();
cout << " ";
for(int t = 0; ; ++t)
// Skip first two bytes; they shouldn't be used
for(int t = 2; t < len; ++t)
{
unsigned char c;
in.get(c);
if(in.eof())
break;
cout << "0x" << hex << (int)c << ", ";
if((t % 8) == 7)
cout << "0x" << hex << (int)data[t];
if(t < len - 1)
cout << ", ";
if(((t-2) % 8) == 7)
cout << endl << " ";
}
cout << endl;
delete[] data;
}
}

View File

@ -8,7 +8,7 @@
;; SS SS tt ee ll ll aa aa
;; SSSS ttt eeeee llll llll aaaaa
;;
;; Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
;; Copyright (c) 1995-2009 by Bradford W. Mott and the Stella team
;;
;; See the file "license" for information on usage and redistribution of
;; this file, and for a DISCLAIMER OF ALL WARRANTIES.
@ -124,6 +124,17 @@ mlclr2 STY $81,X
;;
;; Display the "emulated" Supercharger loading progress bar
;;
;; Check if we should skip the loading progress bar
;; Note that the following code seems to never do a jump
;; However, the comparison value can be patched outside this code
;;
LDA #$FF
CMP #$00 ; patch this value to $FF outside ROM to do a jump
BNE startbars
JMP skipbars
;; Otherwise we display them
startbars:
LDA #$00
STA GRP0
STA GRP1
@ -214,6 +225,7 @@ clear:
STY $81,x
DEX
BPL clear
skipbars:
;;
;; Setup value to be stored in the bank switching control register
@ -224,9 +236,7 @@ clear:
;;
;; Initialize A, X, Y, and SP registers
;;
LDA $80
EOR $FE
EOR $FF
LDA #$9a ;; This is patched outside the ROM to a random value
LDX #$FF
LDY #$00
TXS

View File

@ -215,6 +215,13 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myCenterCheckbox);
ypos += lineHeight + 4;
// Skip progress load bars for SuperCharger ROMs
// Doesn't really belong here, but I couldn't find a better place for it
myFastSCBiosCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
"Fast SC/AR BIOS");
wid.push_back(myFastSCBiosCheckbox);
ypos += lineHeight + 4;
// Add items for tab 0
addToFocusList(wid, tabID);
@ -394,6 +401,9 @@ void VideoDialog::loadConfig()
// Center window
myCenterCheckbox->setState(instance().settings().getBool("center"));
// Fast loading of Supercharger BIOS
myFastSCBiosCheckbox->setState(instance().settings().getBool("fastscbios"));
#ifdef DISPLAY_OPENGL
//////////////////////////////////////////////////////////////////////
// TV effects are only enabled in OpenGL mode, and only if OpenGL 2.0+
@ -476,6 +486,9 @@ void VideoDialog::saveConfig()
// Center window
instance().settings().setBool("center", myCenterCheckbox->getState());
// Fast loading of Supercharger BIOS
instance().settings().setBool("fastscbios", myFastSCBiosCheckbox->getState());
// TV color texture effect
instance().settings().setString("tv_tex", myTexturePopup->getSelectedTag());
@ -515,6 +528,7 @@ void VideoDialog::setDefaults()
myUseVSyncCheckbox->setState(true);
myGrabmouseCheckbox->setState(false);
myCenterCheckbox->setState(true);
myFastSCBiosCheckbox->setState(false);
myTexturePopup->setSelected("off", "");
myBleedPopup->setSelected("off", "");

View File

@ -73,6 +73,7 @@ class VideoDialog : public Dialog
CheckboxWidget* myUseVSyncCheckbox;
CheckboxWidget* myCenterCheckbox;
CheckboxWidget* myGrabmouseCheckbox;
CheckboxWidget* myFastSCBiosCheckbox;
// TV effects options
PopUpWidget* myTexturePopup;