Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
audetto committed Dec 12, 2021
2 parents c758e68 + 651b57f commit 151ef94
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 10 additions & 3 deletions source/Harddisk.cpp
Expand Up @@ -556,7 +556,7 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY
break;
case 0x02: //write
{
pHDD->m_status_next = DISK_STATUS_WRITE;
pHDD->m_status_next = DISK_STATUS_WRITE; // or DISK_STATUS_PROT if we ever enable write-protect on HDD
bool bRes = true;
const bool bAppendBlocks = (pHDD->m_diskblock * HD_BLOCK_SIZE) >= ImageGetImageSize(pHDD->m_imagehandle);

Expand Down Expand Up @@ -619,7 +619,7 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY
}
break;
case 0x03: //format
pHDD->m_status_next = DISK_STATUS_WRITE;
pHDD->m_status_next = DISK_STATUS_WRITE; // or DISK_STATUS_PROT if we ever enable write-protect on HDD
break;
}
}
Expand Down Expand Up @@ -684,10 +684,17 @@ BYTE __stdcall HarddiskInterfaceCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, B
HardDiskDrive* pHDD = &(pCard->m_hardDiskDrive[pCard->m_unitNum >> 7]); // bit7 = drive select

BYTE r = DEVICE_OK;
pHDD->m_status_next = DISK_STATUS_PROT; // TODO: FIXME: If we ever enable write-protect on HD then need to change to something else ...

switch (addr & 0xF)
{
case 0x0: // r/o: status
case 0x1: // r/o: execute
case 0x8: // r/o: legacy next-data port
// Writing to these 3 read-only registers is a no-op.
// NB. Don't change m_status_next, as UpdateLightStatus() has a huge performance cost!
// Firmware has a busy-wait loop doing "rol hd_status,x"
// - this RMW opcode does an IORead() then an IOWrite(), and the loop iterates ~100 times!
break;
case 0x2:
pCard->m_command = d;
break;
Expand Down
2 changes: 1 addition & 1 deletion source/LanguageCard.cpp
Expand Up @@ -48,7 +48,7 @@ LanguageCardUnit::LanguageCardUnit(SS_CARDTYPE type, UINT slot) :
m_uLastRamWrite(0)
{
if (m_slot != LanguageCardUnit::kSlot0)
throw std::string("Card: wrong slot");
throw std::string("Language Card: wrong slot"); // throws to the top-level catch-handler, and shuts down

SetMemMainLanguageCard(NULL, true);
}
Expand Down
4 changes: 4 additions & 0 deletions source/Windows/AppleWin.cpp
Expand Up @@ -577,6 +577,10 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
{
ExceptionHandler(exception.what());
}
catch(std::string error)
{
ExceptionHandler(error.c_str());
}

Shutdown();
return 0;
Expand Down

0 comments on commit 151ef94

Please sign in to comment.