mirror of
https://github.com/libretro/stella2023.git
synced 2024-11-27 10:50:38 +00:00
Add romSize and ramSize functions
This commit is contained in:
parent
8dcf3be270
commit
71a66ec9ba
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,6 +20,7 @@ build/
|
||||
src/macosx/M6502.ins
|
||||
*.dSYM
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/settings.json
|
||||
src/windows/sdl/*
|
||||
src/windows/x64/*
|
||||
src/windows/Win32/*
|
||||
|
61
src/.vscode/settings.json
vendored
61
src/.vscode/settings.json
vendored
@ -1,61 +0,0 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"array": "cpp",
|
||||
"bitset": "cpp",
|
||||
"string_view": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"regex": "cpp",
|
||||
"utility": "cpp",
|
||||
"memory": "cpp",
|
||||
"random": "cpp",
|
||||
"optional": "cpp",
|
||||
"atomic": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"chrono": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"deque": "cpp",
|
||||
"list": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"exception": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"map": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"numeric": "cpp",
|
||||
"ratio": "cpp",
|
||||
"set": "cpp",
|
||||
"string": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"fstream": "cpp",
|
||||
"iomanip": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"mutex": "cpp",
|
||||
"new": "cpp",
|
||||
"ostream": "cpp",
|
||||
"sstream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"thread": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"typeinfo": "cpp"
|
||||
}
|
||||
}
|
@ -23,27 +23,15 @@ CartridgeCDFInfoWidget::CartridgeCDFInfoWidget(
|
||||
int x, int y, int w, int h, CartridgeCDF& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h)
|
||||
{
|
||||
uInt32 size;
|
||||
ostringstream info;
|
||||
|
||||
if (cart.myCDFSubtype == CartridgeCDF::CDFSubtype::CDFJplus) {
|
||||
size = 512 * 1024;
|
||||
info << describeCDFVersion(cart.myCDFSubtype) << " cartridge\n"
|
||||
<< "512K ROM (seven 4K banks are accessible to 2600)\n"
|
||||
<< "32K RAM\n"
|
||||
<< "Functions accessible @ $FFF0 - $FFF3\n"
|
||||
<< "Banks accessible @ $FFF4 to $FFFB\n"
|
||||
<< "Startup bank = " << cart.startBank() << "\n";
|
||||
|
||||
} else {
|
||||
size = 8 * 4096;
|
||||
info << describeCDFVersion(cart.myCDFSubtype) << " cartridge\n"
|
||||
<< "32K ROM (seven 4K banks are accessible to 2600)\n"
|
||||
<< "8K RAM\n"
|
||||
<< "Functions accessible @ $FFF0 - $FFF3\n"
|
||||
<< "Banks accessible @ $FFF4 to $FFFB\n"
|
||||
<< "Startup bank = " << cart.startBank() << "\n";
|
||||
}
|
||||
info << describeCDFVersion(cart.myCDFSubtype) << " cartridge\n"
|
||||
<< (cart.romSize() / 1024) << "K ROM\n"
|
||||
<< (cart.ramSize() / 1024) << "K RAM\n"
|
||||
<< "Seven 4K banks are available to 2600\n"
|
||||
<< "Functions accessible @ $FFF0 - $FFF3\n"
|
||||
<< (cart.isCDFJplus() ? "Banks accessible @ $FFF4 to $FFFA\n" : "Banks accessible @ $FFF5 to $FFFB\n")
|
||||
<< "Startup bank = " << cart.startBank() << "\n";
|
||||
|
||||
#if 0
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
@ -56,7 +44,7 @@ CartridgeCDFInfoWidget::CartridgeCDFInfoWidget(
|
||||
}
|
||||
#endif
|
||||
|
||||
addBaseInformation(size, "AtariAge", info.str());
|
||||
addBaseInformation(cart.romSize(), "AtariAge", info.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -410,7 +410,7 @@ string CartridgeCDFWidget::bankState()
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeCDFWidget::internalRamSize()
|
||||
{
|
||||
return isCDFJplus() ? 32*1024 : 8*1024;
|
||||
return myCart.ramSize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@ -502,5 +502,5 @@ bool CartridgeCDFWidget::isCDFJ() const
|
||||
|
||||
bool CartridgeCDFWidget::isCDFJplus() const
|
||||
{
|
||||
return (myCart.myCDFSubtype == CartridgeCDF::CDFSubtype::CDFJplus);
|
||||
return (myCart.isCDFJplus());
|
||||
}
|
@ -75,15 +75,12 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
|
||||
// Detect cart version
|
||||
setupVersion();
|
||||
|
||||
// CDFJ+ has different settings
|
||||
bool cdfjPlus = (myCDFSubtype == CDFSubtype::CDFJplus);
|
||||
|
||||
// The lowest 2K is not accessible to the debugger
|
||||
createRomAccessArrays(cdfjPlus ? 510_KB : 28_KB);
|
||||
createRomAccessArrays(isCDFJplus() ? 510_KB : 28_KB);
|
||||
|
||||
// Pointer to the program ROM
|
||||
// which starts after the 2K driver (and 2K C Code for CDF)
|
||||
myProgramImage = myImage.get() + (cdfjPlus ? 2_KB : 4_KB);
|
||||
myProgramImage = myImage.get() + (isCDFJplus() ? 2_KB : 4_KB);
|
||||
|
||||
// Pointer to CDF driver in RAM
|
||||
myDriverImage = myRAM.data();
|
||||
@ -93,7 +90,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
|
||||
|
||||
// C addresses
|
||||
uInt32 cBase, cStart, cStack;
|
||||
if (cdfjPlus) {
|
||||
if (isCDFJplus()) {
|
||||
cBase = getUInt32(myImage.get(), 0x17F8) & 0xFFFFFFFE; // C Base Address
|
||||
cStart = cBase; // C Start Address
|
||||
cStack = getUInt32(myImage.get(), 0x17F4); // C Stack
|
||||
@ -123,7 +120,7 @@ void CartridgeCDF::reset()
|
||||
initializeRAM(myRAM.data()+2_KB, myRAM.size()-2_KB);
|
||||
|
||||
// CDF always starts in bank 6, CDFJ+ in bank 0
|
||||
initializeStartBank((myCDFSubtype == CDFSubtype::CDFJplus) ? 0 : 6);
|
||||
initializeStartBank(isCDFJplus() ? 0 : 6);
|
||||
|
||||
myAudioCycles = myARMCycles = 0;
|
||||
myFractionalClocks = 0.0;
|
||||
@ -218,8 +215,6 @@ inline void CartridgeCDF::callFunction(uInt8 value)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeCDF::peek(uInt16 address)
|
||||
{
|
||||
bool cdfjPlus = (myCDFSubtype == CDFSubtype::CDFJplus);
|
||||
|
||||
address &= 0x0FFF;
|
||||
uInt8 peekvalue = myProgramImage[myBankOffset + address];
|
||||
|
||||
@ -239,7 +234,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
|
||||
++myJMPoperandAddress;
|
||||
|
||||
pointer = getDatastreamPointer(myFastJumpStream);
|
||||
if (cdfjPlus) {
|
||||
if (isCDFJplus()) {
|
||||
value = myDisplayImage[ pointer >> 16 ];
|
||||
pointer += 0x00010000; // always increment by 1
|
||||
} else {
|
||||
@ -316,35 +311,35 @@ uInt8 CartridgeCDF::peek(uInt16 address)
|
||||
switch(address)
|
||||
{
|
||||
case 0x0FF4:
|
||||
bank(cdfjPlus ? 0 : 6);
|
||||
bank(isCDFJplus() ? 0 : 6);
|
||||
break;
|
||||
|
||||
case 0x0FF5:
|
||||
bank(cdfjPlus ? 1 : 0);
|
||||
bank(isCDFJplus() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case 0x0FF6:
|
||||
bank(cdfjPlus ? 2 : 1);
|
||||
bank(isCDFJplus() ? 2 : 1);
|
||||
break;
|
||||
|
||||
case 0x0FF7:
|
||||
bank(cdfjPlus ? 3 : 2);
|
||||
bank(isCDFJplus() ? 3 : 2);
|
||||
break;
|
||||
|
||||
case 0x0FF8:
|
||||
bank(cdfjPlus ? 4 : 3);
|
||||
bank(isCDFJplus() ? 4 : 3);
|
||||
break;
|
||||
|
||||
case 0x0FF9:
|
||||
bank(cdfjPlus ? 5 : 4);
|
||||
bank(isCDFJplus() ? 5 : 4);
|
||||
break;
|
||||
|
||||
case 0x0FFA:
|
||||
bank(cdfjPlus ? 6 : 5);
|
||||
bank(isCDFJplus() ? 6 : 5);
|
||||
break;
|
||||
|
||||
case 0x0FFB:
|
||||
bank(cdfjPlus ? 0 : 6);
|
||||
bank(isCDFJplus() ? 0 : 6);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -361,14 +356,13 @@ uInt8 CartridgeCDF::peek(uInt16 address)
|
||||
bool CartridgeCDF::poke(uInt16 address, uInt8 value)
|
||||
{
|
||||
uInt32 pointer;
|
||||
bool cdfjPlus = (myCDFSubtype == CDFSubtype::CDFJplus);
|
||||
|
||||
address &= 0x0FFF;
|
||||
switch(address)
|
||||
{
|
||||
case 0x0FF0: // DSWRITE
|
||||
pointer = getDatastreamPointer(COMMSTREAM);
|
||||
if (cdfjPlus) {
|
||||
if (isCDFJplus()) {
|
||||
myDisplayImage[ pointer >> 16 ] = value;
|
||||
pointer += 0x00010000; // always increment by 1 when writing
|
||||
} else {
|
||||
@ -381,7 +375,7 @@ bool CartridgeCDF::poke(uInt16 address, uInt8 value)
|
||||
case 0x0FF1: // DSPTR
|
||||
pointer = getDatastreamPointer(COMMSTREAM);
|
||||
pointer <<= 8;
|
||||
if (cdfjPlus) {
|
||||
if (isCDFJplus()) {
|
||||
pointer &= 0xff000000;
|
||||
pointer |= (value << 16);
|
||||
} else {
|
||||
@ -400,35 +394,35 @@ bool CartridgeCDF::poke(uInt16 address, uInt8 value)
|
||||
break;
|
||||
|
||||
case 0x00FF4:
|
||||
bank(cdfjPlus ? 0 : 6);
|
||||
bank(isCDFJplus() ? 0 : 6);
|
||||
break;
|
||||
|
||||
case 0x0FF5:
|
||||
bank(cdfjPlus ? 1 : 0);
|
||||
bank(isCDFJplus() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case 0x0FF6:
|
||||
bank(cdfjPlus ? 2 : 1);
|
||||
bank(isCDFJplus() ? 2 : 1);
|
||||
break;
|
||||
|
||||
case 0x0FF7:
|
||||
bank(cdfjPlus ? 3 : 2);
|
||||
bank(isCDFJplus() ? 3 : 2);
|
||||
break;
|
||||
|
||||
case 0x0FF8:
|
||||
bank(cdfjPlus ? 4 : 3);
|
||||
bank(isCDFJplus() ? 4 : 3);
|
||||
break;
|
||||
|
||||
case 0x0FF9:
|
||||
bank(cdfjPlus ? 5 : 4);
|
||||
bank(isCDFJplus() ? 5 : 4);
|
||||
break;
|
||||
|
||||
case 0x0FFA:
|
||||
bank(cdfjPlus ? 6 : 5);
|
||||
bank(isCDFJplus() ? 6 : 5);
|
||||
break;
|
||||
|
||||
case 0x0FFB:
|
||||
bank(cdfjPlus ? 0 : 6);
|
||||
bank(isCDFJplus() ? 0 : 6);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -654,7 +648,7 @@ uInt32 CartridgeCDF::getWaveform(uInt8 index) const
|
||||
|
||||
result -= (0x40000000 + 2_KB);
|
||||
|
||||
if (myCDFSubtype != CDFSubtype::CDFJplus) {
|
||||
if (!isCDFJplus()) {
|
||||
if (result >= 4096) {
|
||||
result &= 4095;
|
||||
}
|
||||
@ -698,8 +692,7 @@ uInt8 CartridgeCDF::readFromDatastream(uInt8 index)
|
||||
uInt16 increment = getDatastreamIncrement(index);
|
||||
|
||||
uInt8 value;
|
||||
bool cdfjPlus = (myCDFSubtype == CDFSubtype::CDFJplus);
|
||||
if (cdfjPlus) {
|
||||
if (isCDFJplus()) {
|
||||
value = myDisplayImage[ pointer >> 16 ];
|
||||
pointer += (increment << 8);
|
||||
} else {
|
||||
@ -794,6 +787,22 @@ string CartridgeCDF::name() const
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeCDF::isCDFJplus() const
|
||||
{
|
||||
return (myCDFSubtype == CDFSubtype::CDFJplus);
|
||||
}
|
||||
|
||||
uInt32 CartridgeCDF::ramSize() const
|
||||
{
|
||||
return isCDFJplus() ? 32_KB : 8_KB;
|
||||
}
|
||||
|
||||
uInt32 CartridgeCDF::romSize() const
|
||||
{
|
||||
return isCDFJplus() ? 512_KB : 32_KB;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
CartDebugWidget* CartridgeCDF::debugWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -154,6 +154,21 @@ class CartridgeCDF : public Cartridge
|
||||
*/
|
||||
uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) override;
|
||||
|
||||
/**
|
||||
Set if we are using CDFJ+ bankswitching
|
||||
*/
|
||||
bool isCDFJplus() const;
|
||||
|
||||
/**
|
||||
Size of SRAM (RAM) area in cart
|
||||
*/
|
||||
uInt32 ramSize() const;
|
||||
|
||||
/**
|
||||
Size of Flash memory (ROM) area in cart
|
||||
*/
|
||||
uInt32 romSize() const;
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
/**
|
||||
Get debugger widget responsible for accessing the inner workings
|
||||
|
Loading…
Reference in New Issue
Block a user