diff --git a/source/CPU.cpp b/source/CPU.cpp index 865710a3..cd39707b 100644 --- a/source/CPU.cpp +++ b/source/CPU.cpp @@ -446,7 +446,6 @@ static __forceinline bool IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, (g_bmIRQ & 8) ? "MOUSE" : "UNKNOWN"; LogOutput("IRQ (%08X) (%s)\n", (UINT)g_nCycleIrqStart, pSrc); #endif - CheckSynchronousInterruptSources(7, uExecutedCycles); g_interruptInLastExecutionBatch = true; irqTaken = true; } diff --git a/source/CPU/cpu6502.h b/source/CPU/cpu6502.h index 96c7a58d..6887fbc2 100644 --- a/source/CPU/cpu6502.h +++ b/source/CPU/cpu6502.h @@ -50,18 +50,12 @@ static DWORD Cpu6502(DWORD uTotalCycles, const bool bVideoUpdate) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) } + else if (NMI(uExecutedCycles, flagc, flagn, flagv, flagz) || IRQ(uExecutedCycles, flagc, flagn, flagv, flagz)) + { + // Allow AppleWin debugger's single-stepping to just step the pending IRQ + } else { - if (IRQ(uExecutedCycles, flagc, flagn, flagv, flagz) || NMI(uExecutedCycles, flagc, flagn, flagv, flagz)) - { - if (bVideoUpdate) - { - ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles; - NTSC_VideoUpdateCycles(uElapsedCycles); - } - continue; // Allow AppleWin debugger's single-stepping to just step the pending IRQ - } - HEATMAP_X( regs.pc ); Fetch(iOpcode, uExecutedCycles); diff --git a/source/CPU/cpu65C02.h b/source/CPU/cpu65C02.h index fa1b4ff7..f9eb55f2 100644 --- a/source/CPU/cpu65C02.h +++ b/source/CPU/cpu65C02.h @@ -50,18 +50,12 @@ static DWORD Cpu65C02(DWORD uTotalCycles, const bool bVideoUpdate) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) } + else if (NMI(uExecutedCycles, flagc, flagn, flagv, flagz) || IRQ(uExecutedCycles, flagc, flagn, flagv, flagz)) + { + // Allow AppleWin debugger's single-stepping to just step the pending IRQ + } else { - if (IRQ(uExecutedCycles, flagc, flagn, flagv, flagz) || NMI(uExecutedCycles, flagc, flagn, flagv, flagz)) - { - if (bVideoUpdate) - { - ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles; - NTSC_VideoUpdateCycles(uElapsedCycles); - } - continue; // Allow AppleWin debugger's single-stepping to just step the pending IRQ - } - HEATMAP_X( regs.pc ); Fetch(iOpcode, uExecutedCycles); diff --git a/source/CardManager.cpp b/source/CardManager.cpp index 6655cbb8..7d20a057 100644 --- a/source/CardManager.cpp +++ b/source/CardManager.cpp @@ -140,9 +140,9 @@ void CardManager::RemoveInternal(UINT slot) m_slot[slot] = NULL; } -void CardManager::Remove(UINT slot) +void CardManager::Remove(UINT slot, bool updateRegistry/*=true*/) { - Insert(slot, CT_Empty); + Insert(slot, CT_Empty, updateRegistry); } void CardManager::InsertAuxInternal(SS_CARDTYPE type) diff --git a/source/CardManager.h b/source/CardManager.h index 3c808975..f1ad191c 100644 --- a/source/CardManager.h +++ b/source/CardManager.h @@ -29,7 +29,7 @@ public: } void Insert(UINT slot, SS_CARDTYPE type, bool updateRegistry = true); - void Remove(UINT slot); + void Remove(UINT slot, bool updateRegistry = true); SS_CARDTYPE QuerySlot(UINT slot) { _ASSERT(slotQueryType(); } Card& GetRef(UINT slot) { diff --git a/source/Configuration/PageInput.cpp b/source/Configuration/PageInput.cpp index ea286e05..8417b147 100644 --- a/source/Configuration/PageInput.cpp +++ b/source/Configuration/PageInput.cpp @@ -292,7 +292,7 @@ void CPageInput::DlgOK(HWND hWnd) UINT uNewJoyType1 = SendDlgItemMessage(hWnd, IDC_JOYSTICK1, CB_GETCURSEL, 0, 0); if (uNewJoyType1 >= J1C_MAX) uNewJoyType1 = 0; // GH#434 - const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[4] == CT_MouseInterface; + const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT4] == CT_MouseInterface; if (JoySetEmulationType(hWnd, m_nJoy0ChoiceTranlationTbl[uNewJoyType0], JN_JOYSTICK0, bIsSlot4Mouse)) { @@ -381,7 +381,7 @@ void CPageInput::InitJoystickChoices(HWND hWnd, int nJoyNum, int nIdcValue) pszMem += strlen(ppszJoyChoices[nJC_JOYSTICK])+1; pnJoyTranslationTbl[nIdx++] = nJC_JOYSTICK; - const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[4] == CT_MouseInterface; + const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT4] == CT_MouseInterface; // Now exclude: // . the other Joystick type (if it exists) from this new list diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index dfd657f0..d9a53857 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -814,7 +814,7 @@ Update_t CmdProfile (int nArgs) if (ProfileSave()) { TCHAR sText[ CONSOLE_WIDTH ]; - ConsoleBufferPushFormat ( sText, " Saved: %s", g_FileNameProfile ); + ConsoleBufferPushFormat ( sText, " Saved: %s", g_FileNameProfile.c_str() ); } else ConsoleBufferPush( TEXT(" ERROR: Couldn't save file. (In use?)" ) ); diff --git a/source/Debugger/Debugger_Help.cpp b/source/Debugger/Debugger_Help.cpp index 953b9657..bc4c2479 100644 --- a/source/Debugger/Debugger_Help.cpp +++ b/source/Debugger/Debugger_Help.cpp @@ -1066,11 +1066,11 @@ Update_t CmdHelpSpecific (int nArgs) // Config - Load / Save case CMD_CONFIG_LOAD: ConsoleColorizePrint( sText, " Usage: [\"filename\"]" ); - ConsoleBufferPushFormat( sText, " Load debugger configuration from '%s', or the specificed file.", g_sFileNameConfig ); + ConsoleBufferPushFormat( sText, " Load debugger configuration from '%s', or the specificed file.", g_sFileNameConfig.c_str() ); break; case CMD_CONFIG_SAVE: ConsoleColorizePrint( sText, " Usage: [\"filename\"]" ); - ConsoleBufferPushFormat( sText, " Save debugger configuration to '%s', or the specificed file.", g_sFileNameConfig ); + ConsoleBufferPushFormat( sText, " Save debugger configuration to '%s', or the specificed file.", g_sFileNameConfig.c_str() ); break; // Config - Color case CMD_CONFIG_COLOR: diff --git a/source/Disk.cpp b/source/Disk.cpp index ad8ff51e..b0848700 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -845,33 +845,20 @@ void Disk2InterfaceCard::NotifyInvalidImage(const int drive, LPCTSTR pszImageFil bool Disk2InterfaceCard::GetProtect(const int drive) { - if (IsDriveValid(drive)) - { - if (m_floppyDrive[drive].m_disk.m_bWriteProtected) - return true; - } + if (!IsDriveValid(drive)) + return true; - return false; + return m_floppyDrive[drive].m_disk.m_bWriteProtected; } //=========================================================================== void Disk2InterfaceCard::SetProtect(const int drive, const bool bWriteProtect) -{ - if (IsDriveValid( drive )) - { - m_floppyDrive[drive].m_disk.m_bWriteProtected = bWriteProtect; - } -} - -//=========================================================================== - -bool Disk2InterfaceCard::IsDiskImageWriteProtected(const int drive) { if (!IsDriveValid(drive)) - return true; + return; - return ImageIsWriteProtected(m_floppyDrive[drive].m_disk.m_imagehandle); + m_floppyDrive[drive].m_disk.m_bWriteProtected = bWriteProtect; } //=========================================================================== @@ -886,6 +873,16 @@ bool Disk2InterfaceCard::IsDriveEmpty(const int drive) //=========================================================================== +bool Disk2InterfaceCard::IsWozImageInDrive(const int drive) +{ + if (!IsDriveValid(drive)) + return false; + + return ImageIsWOZ(m_floppyDrive[drive].m_disk.m_imagehandle); +} + +//=========================================================================== + #if LOG_DISK_NIBBLES_WRITE bool Disk2InterfaceCard::LogWriteCheckSyncFF(ULONG& uCycleDelta) { diff --git a/source/Disk.h b/source/Disk.h index 484e5adf..651f39c6 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -148,8 +148,6 @@ public: bool IsConditionForFullSpeed(void); void NotifyInvalidImage(const int drive, LPCTSTR pszImageFilename, const ImageError_e Error); - bool GetProtect(const int drive); - void SetProtect(const int drive, const bool bWriteProtect); UINT GetCurrentFirmware(void) { return m_is13SectorFirmware ? 13 : 16; } int GetCurrentDrive(void); int GetCurrentTrack(void); @@ -173,8 +171,10 @@ public: void LoadLastDiskImage(const int drive); void SaveLastDiskImage(const int drive); - bool IsDiskImageWriteProtected(const int drive); + bool GetProtect(const int drive); + void SetProtect(const int drive, const bool bWriteProtect); bool IsDriveEmpty(const int drive); + bool IsWozImageInDrive(const int drive); bool GetEnhanceDisk(void); void SetEnhanceDisk(bool bEnhanceDisk); @@ -201,7 +201,6 @@ private: void DataLoadWriteWOZ(WORD pc, WORD addr, UINT bitCellRemainder); void DataShiftWriteWOZ(WORD pc, WORD addr, ULONG uExecutedCycles); void SetSequencerFunction(WORD addr); - void DumpSectorWOZ(FloppyDisk floppy); void DumpTrackWOZ(FloppyDisk floppy); bool GetFirmware(WORD lpNameId, BYTE* pDst); void InitFirmware(LPBYTE pCxRomPeripheral); diff --git a/source/DiskImage.cpp b/source/DiskImage.cpp index 1dc0e3d9..1f2f48ee 100644 --- a/source/DiskImage.cpp +++ b/source/DiskImage.cpp @@ -196,11 +196,6 @@ UINT ImageGetNumTracks(ImageInfo* const pImageInfo) return pImageInfo ? pImageInfo->uNumTracks : 0; } -bool ImageIsWriteProtected(ImageInfo* const pImageInfo) -{ - return pImageInfo ? pImageInfo->bWriteProtected : true; -} - bool ImageIsMultiFileZip(ImageInfo* const pImageInfo) { return pImageInfo ? (pImageInfo->uNumValidImagesInZip > 1) : false; diff --git a/source/DiskImage.h b/source/DiskImage.h index 1d6a30e1..7e91b9c5 100644 --- a/source/DiskImage.h +++ b/source/DiskImage.h @@ -86,7 +86,6 @@ bool ImageReadBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffe bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer); UINT ImageGetNumTracks(ImageInfo* const pImageInfo); -bool ImageIsWriteProtected(ImageInfo* const pImageInfo); bool ImageIsMultiFileZip(ImageInfo* const pImageInfo); const std::string & ImageGetPathname(ImageInfo* const pImageInfo); UINT ImageGetImageSize(ImageInfo* const pImageInfo); diff --git a/source/Log.h b/source/Log.h index d952e69a..82935a6a 100644 --- a/source/Log.h +++ b/source/Log.h @@ -12,5 +12,11 @@ extern FILE* g_fh; // Filehandle for log file void LogInit(void); void LogDone(void); + +#ifdef _MSC_VER void LogOutput(LPCTSTR format, ...); void LogFileOutput(LPCTSTR format, ...); +#else +void LogOutput(LPCTSTR format, ...) __attribute__ ((format (printf, 1, 2))); +void LogFileOutput(LPCTSTR format, ...) __attribute__ ((format (printf, 1, 2))); +#endif diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 58ec7111..d5b08886 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -1041,7 +1041,7 @@ static void MB_Update(void) static bool MB_DSInit() { - LogFileOutput("MB_DSInit\n", g_bMBAvailable); + LogFileOutput("MB_DSInit\n"); #ifdef NO_DIRECT_X return false; diff --git a/source/Tfe/tfearch.cpp b/source/Tfe/tfearch.cpp index 8608b80a..986f8b88 100644 --- a/source/Tfe/tfearch.cpp +++ b/source/Tfe/tfearch.cpp @@ -27,7 +27,12 @@ /* #define WPCAP */ +#ifdef _MSC_VER +#include "pcap.h" +#else +// on Linux and Mac OS X, we use system's pcap.h, which needs to be included as <> #include +#endif #include #include diff --git a/source/Windows/AppleWin.cpp b/source/Windows/AppleWin.cpp index 43b57c73..cc068cd6 100644 --- a/source/Windows/AppleWin.cpp +++ b/source/Windows/AppleWin.cpp @@ -552,7 +552,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) if (pMouseCard) { // dtor removes event from g_SynchronousEventMgr - do before g_SynchronousEventMgr.Reset() - GetCardMgr().Remove( pMouseCard->GetSlot() ); + GetCardMgr().Remove( pMouseCard->GetSlot(), false ); LogFileOutput("Main: CMouseInterface::dtor\n"); } diff --git a/source/Windows/WinFrame.cpp b/source/Windows/WinFrame.cpp index 6f2473fd..8b3e5b5a 100644 --- a/source/Windows/WinFrame.cpp +++ b/source/Windows/WinFrame.cpp @@ -2005,7 +2005,7 @@ void Win32Frame::ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) // Check menu depending on current floppy protection { int iMenuItem = ID_DISKMENU_WRITEPROTECTION_OFF; - if (disk2Card.GetProtect( iDrive )) + if (disk2Card.GetProtect(iDrive)) iMenuItem = ID_DISKMENU_WRITEPROTECTION_ON; CheckMenuItem(hmenu, iMenuItem, MF_CHECKED); @@ -2014,7 +2014,7 @@ void Win32Frame::ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) if (disk2Card.IsDriveEmpty(iDrive)) EnableMenuItem(hmenu, ID_DISKMENU_EJECT, MF_GRAYED); - if (disk2Card.IsDiskImageWriteProtected(iDrive)) + if (disk2Card.GetProtect(iDrive)) { // If image-file is read-only (or a gzip) then disable these menu items EnableMenuItem(hmenu, ID_DISKMENU_WRITEPROTECTION_ON, MF_GRAYED);