Fixed bug in peek handling for 2K and 4K ROMs.

This fixes cheatcode handling for those schemes.
This commit is contained in:
Stephen Anthony 2019-01-27 13:13:08 -03:30
parent c3671ac095
commit a1342afe34
3 changed files with 15 additions and 1 deletions

View File

@ -118,6 +118,13 @@ class Cartridge2K : public Cartridge
}
#endif
/**
Get the byte at the specified address.
@return The byte at the specified address
*/
uInt8 peek(uInt16 address) override { return myImage[address & myMask]; }
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;

View File

@ -115,6 +115,13 @@ class Cartridge4K : public Cartridge
}
#endif
/**
Get the byte at the specified address.
@return The byte at the specified address
*/
uInt8 peek(uInt16 address) override { return myImage[address & 0x0FFF]; }
private:
// The 4K ROM image for the cartridge
uInt8 myImage[4096];

View File

@ -85,7 +85,7 @@ class Device : public Serializable
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address) { return 0; }
virtual uInt8 peek(uInt16 address) = 0;
/**
Change the byte at the specified address to the given value