BS-X: Fixed flash erase, download process and reset behavior
This commit is contained in:
parent
26875e93ee
commit
75f170b739
5 changed files with 12 additions and 18 deletions
|
@ -23,7 +23,7 @@ BsxMemoryPack::~BsxMemoryPack()
|
|||
|
||||
void BsxMemoryPack::Serialize(Serializer& s)
|
||||
{
|
||||
s.Stream(_writeProtect, _enableCsr, _enableEsr, _enableVendorInfo, _writeByte, _command);
|
||||
s.Stream(_enableCsr, _enableEsr, _enableVendorInfo, _writeByte, _command);
|
||||
|
||||
if(s.IsSaving()) {
|
||||
//Save content of memory pack as an IPS patch
|
||||
|
@ -68,14 +68,13 @@ void BsxMemoryPack::ProcessCommand(uint8_t value, uint32_t page)
|
|||
}
|
||||
|
||||
switch(_command) {
|
||||
case 0x20D0: memset(_data + page * 0x10000, 0x10000, 0xFF); break; //Page erase
|
||||
case 0xA7D0: memset(_data, _dataSize, 0xFF); break; //Chip erase
|
||||
case 0x20D0: memset(_data + page * 0x10000, 0xFF, 0x10000); break; //Page erase
|
||||
case 0xA7D0: memset(_data, 0xFF, _dataSize); break; //Chip erase
|
||||
}
|
||||
}
|
||||
|
||||
void BsxMemoryPack::Reset()
|
||||
{
|
||||
_writeProtect = true;
|
||||
_enableCsr = false;
|
||||
_enableEsr = false;
|
||||
_writeByte = false;
|
||||
|
@ -141,10 +140,8 @@ uint8_t BsxMemoryPack::BsxMemoryPackHandler::Read(uint32_t addr)
|
|||
void BsxMemoryPack::BsxMemoryPackHandler::Write(uint32_t addr, uint8_t value)
|
||||
{
|
||||
if(_memPack->_writeByte) {
|
||||
if(!_memPack->_writeProtect) {
|
||||
uint8_t currentByte = RamHandler::Read(addr);
|
||||
RamHandler::Write(addr, value & currentByte);
|
||||
}
|
||||
uint8_t currentByte = RamHandler::Read(addr);
|
||||
RamHandler::Write(addr, value & currentByte);
|
||||
_memPack->_writeByte = false;
|
||||
} else if(addr == 0xC00000) {
|
||||
_memPack->ProcessCommand(value, _page);
|
||||
|
|
|
@ -15,7 +15,6 @@ class BsxMemoryPack : public ISerializable
|
|||
|
||||
uint8_t _calculatedSize = 0x0C;
|
||||
|
||||
bool _writeProtect = true;
|
||||
bool _enableCsr = false;
|
||||
bool _enableEsr = false;
|
||||
bool _enableVendorInfo = false;
|
||||
|
|
|
@ -99,13 +99,15 @@ void BsxSatellaview::ProcessClocks()
|
|||
{
|
||||
if(_stream[0].NeedUpdate() || _stream[1].NeedUpdate()) {
|
||||
uint64_t gap = _memoryManager->GetMasterClock() - _prevMasterClock;
|
||||
uint64_t clocksPerFrame = _console->GetMasterClockRate() / 1000; //1000 frames/sec (224kbits/sec)
|
||||
|
||||
while(gap >= 288 * 2) {
|
||||
while(gap >= clocksPerFrame) {
|
||||
bool needUpdate = _stream[0].FillQueues() || _stream[1].FillQueues();
|
||||
if(!needUpdate) {
|
||||
gap = 0;
|
||||
break;
|
||||
}
|
||||
gap -= 288 * 2;
|
||||
gap -= clocksPerFrame;
|
||||
}
|
||||
|
||||
_prevMasterClock = _memoryManager->GetMasterClock() - gap;
|
||||
|
|
|
@ -191,9 +191,6 @@ void BsxStream::SetChannelLow(uint8_t value)
|
|||
_fileIndex = 0;
|
||||
}
|
||||
_channel = (_channel & 0xFF00) | value;
|
||||
if(_channel == 0) {
|
||||
std::cout << "Test";
|
||||
}
|
||||
}
|
||||
|
||||
void BsxStream::SetChannelHigh(uint8_t value)
|
||||
|
@ -202,9 +199,6 @@ void BsxStream::SetChannelHigh(uint8_t value)
|
|||
_fileIndex = 0;
|
||||
}
|
||||
_channel = (_channel & 0xFF) | ((value & 0x3F) << 8);
|
||||
if(_channel == 0) {
|
||||
std::cout << "Test";
|
||||
}
|
||||
}
|
||||
|
||||
void BsxStream::SetPrefixLatch(uint8_t value)
|
||||
|
|
|
@ -318,10 +318,12 @@ void Console::Reset()
|
|||
_memoryManager->Reset();
|
||||
_spc->Reset();
|
||||
_ppu->Reset();
|
||||
_cpu->Reset();
|
||||
_cart->Reset();
|
||||
//_controlManager->Reset();
|
||||
|
||||
//Reset cart before CPU to ensure correct memory mappings when fetching reset vector
|
||||
_cpu->Reset();
|
||||
|
||||
_notificationManager->SendNotification(ConsoleNotificationType::GameReset);
|
||||
ProcessEvent(EventType::Reset);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue