mirror of https://github.com/stella-emu/stella.git
add get current segment from cart for debug widgets
This commit is contained in:
parent
f2d14f77c4
commit
27556405d8
|
@ -26,9 +26,10 @@ Cartridge3FWidget::Cartridge3FWidget(
|
|||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
{
|
||||
size_t size = cart.mySize;
|
||||
|
||||
ostringstream info;
|
||||
size_t size;
|
||||
|
||||
cart.getImage(size);
|
||||
info << "Tigervision 3F cartridge, 2-256 2K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n"
|
||||
<< "First 2K bank selected by writing to $3F\n"
|
||||
|
@ -88,7 +89,7 @@ string Cartridge3FWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
buf << "Bank = #" << std::dec << (myCart.myCurrentSegOffset[0] >> myCart.myBankShift) << ", hotspot = $3F";
|
||||
buf << "Bank = #" << std::dec << myCart.getSegmentBank() << ", hotspot = $3F";
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
|
|
@ -98,9 +98,9 @@ CartridgeE0Widget::CartridgeE0Widget(
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeE0Widget::loadConfig()
|
||||
{
|
||||
mySlice0->setSelectedIndex(myCart.myCurrentSegOffset[0] >> myCart.myBankShift);
|
||||
mySlice1->setSelectedIndex(myCart.myCurrentSegOffset[1] >> myCart.myBankShift);
|
||||
mySlice2->setSelectedIndex(myCart.myCurrentSegOffset[2] >> myCart.myBankShift);
|
||||
mySlice0->setSelectedIndex(myCart.getSegmentBank(0));
|
||||
mySlice1->setSelectedIndex(myCart.getSegmentBank(1));
|
||||
mySlice2->setSelectedIndex(myCart.getSegmentBank(2));
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
@ -136,9 +136,9 @@ string CartridgeE0Widget::bankState()
|
|||
ostringstream& buf = buffer();
|
||||
|
||||
buf << "Slices: " << std::dec
|
||||
<< seg0[myCart.myCurrentSegOffset[0] >> myCart.myBankShift] << " / "
|
||||
<< seg1[myCart.myCurrentSegOffset[1] >> myCart.myBankShift] << " / "
|
||||
<< seg2[myCart.myCurrentSegOffset[2] >> myCart.myBankShift];
|
||||
<< seg0[myCart.getSegmentBank(0)] << " / "
|
||||
<< seg1[myCart.getSegmentBank(1)] << " / "
|
||||
<< seg2[myCart.getSegmentBank(2)];
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class System;
|
|||
$00 to $3F will change banks. Although, the Tigervision games
|
||||
only used 8K this bankswitching scheme supports up to 512K.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@author Bradford W. Mott, Thomas Jentzsch
|
||||
*/
|
||||
class Cartridge3F : public CartridgeEnhanced
|
||||
{
|
||||
|
|
|
@ -182,6 +182,12 @@ uInt16 CartridgeEnhanced::getBank(uInt16 address) const
|
|||
return myCurrentSegOffset[(address & 0xFFF) >> myBankShift] >> myBankShift;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt16 CartridgeEnhanced::getSegmentBank(uInt16 segment) const
|
||||
{
|
||||
return myCurrentSegOffset[segment % myBankSegs] >> myBankShift;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt16 CartridgeEnhanced::bankCount() const
|
||||
{
|
||||
|
|
|
@ -79,6 +79,13 @@ class CartridgeEnhanced : public Cartridge
|
|||
*/
|
||||
uInt16 getBank(uInt16 address = 0) const override;
|
||||
|
||||
/**
|
||||
Get the current bank for a bank segment.
|
||||
|
||||
@param segment The segment to get the bank for
|
||||
*/
|
||||
uInt16 getSegmentBank(uInt16 segment = 0) const;
|
||||
|
||||
/**
|
||||
Query the number of banks supported by the cartridge.
|
||||
*/
|
||||
|
@ -165,9 +172,6 @@ class CartridgeEnhanced : public Cartridge
|
|||
// Pointer to a dynamically allocated RAM area of the cartridge
|
||||
ByteBuffer myRAM{nullptr};
|
||||
|
||||
// The size of the ROM image
|
||||
size_t mySize{0};
|
||||
|
||||
private:
|
||||
// Calculated as: log(ROM bank segment size) / log(2)
|
||||
static constexpr uInt16 BANK_SHIFT = 12; // default = 4K
|
||||
|
@ -175,6 +179,9 @@ class CartridgeEnhanced : public Cartridge
|
|||
// The size of extra RAM in ROM address space
|
||||
static constexpr uInt16 RAM_SIZE = 0; // default = none
|
||||
|
||||
// The size of the ROM image
|
||||
size_t mySize{0};
|
||||
|
||||
protected:
|
||||
/**
|
||||
Check hotspots and switch bank if triggered.
|
||||
|
|
Loading…
Reference in New Issue