mirror of https://github.com/stella-emu/stella.git
added "code in RAM" execution check for F4SC, F6SC and F8SC (addresses #933)
This commit is contained in:
parent
5f1f90260c
commit
433d8da8a2
|
@ -254,6 +254,13 @@ class Cartridge : public Device
|
|||
*/
|
||||
virtual uInt16 ramBankCount() const { return 0; }
|
||||
|
||||
/**
|
||||
Query wether the current PC allows code execution.
|
||||
|
||||
@return true, if code execution is allowed
|
||||
*/
|
||||
virtual bool canExecute(uInt16 PC) const { return true; }
|
||||
|
||||
/**
|
||||
Get the number of segments supported by the cartridge.
|
||||
*/
|
||||
|
|
|
@ -99,6 +99,22 @@ class CartridgeEnhanced : public Cartridge
|
|||
*/
|
||||
uInt16 ramBankCount() const override;
|
||||
|
||||
/**
|
||||
Query wether the current PC allows code execution.
|
||||
|
||||
@return true, if code execution is allowed
|
||||
*/
|
||||
bool canExecute(uInt16 PC) const override {
|
||||
return !(PC & 0x1000) || (PC & ROM_MASK) >= myRomOffset || executableCartRam();
|
||||
}
|
||||
|
||||
/**
|
||||
Query wether the cart RAM allows code execution.
|
||||
|
||||
@return true, if code execution is allowed
|
||||
*/
|
||||
virtual bool executableCartRam() const { return true; }
|
||||
|
||||
/**
|
||||
Get the number of segments supported by the cartridge.
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,13 @@ class CartridgeF4SC : public CartridgeF4
|
|||
~CartridgeF4SC() override = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
Query wether the cart RAM allows code execution.
|
||||
|
||||
@return true, if code execution is allowed
|
||||
*/
|
||||
bool executableCartRam() const override { return false; }
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
||||
|
|
|
@ -49,6 +49,13 @@ class CartridgeF6SC : public CartridgeF6
|
|||
~CartridgeF6SC() override = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
Query wether the cart RAM allows code execution.
|
||||
|
||||
@return true, if code execution is allowed
|
||||
*/
|
||||
bool executableCartRam() const override { return false; }
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
||||
|
|
|
@ -49,6 +49,13 @@ class CartridgeF8SC : public CartridgeF8
|
|||
~CartridgeF8SC() override = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
Query wether the cart RAM allows code execution.
|
||||
|
||||
@return true, if code execution is allowed
|
||||
*/
|
||||
bool executableCartRam() const override { return false; }
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
||||
|
|
|
@ -339,6 +339,10 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
|
|||
icycles = 0;
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
const uInt16 oldPC = PC;
|
||||
|
||||
// Only check for code in RAM execution if we have debugger support
|
||||
if(!mySystem->cart().canExecute(PC))
|
||||
FatalEmulationError::raise("cannot run code from cart RAM");
|
||||
#endif
|
||||
|
||||
// Fetch instruction at the program counter
|
||||
|
|
Loading…
Reference in New Issue