diff --git a/AppleWin/docs/History.txt b/AppleWin/docs/History.txt index 3e37d5f6..ab022b90 100644 --- a/AppleWin/docs/History.txt +++ b/AppleWin/docs/History.txt @@ -19,8 +19,11 @@ Restrictions/bugs: - For an original Apple //e, 80-column (PR#3) and INVERSE, it still appears to be mousetext character, but it should be inverted upper-case from $40 to $5F. -1.xx.0 - ?? ??? 2012 +1.21.0 - 21 Jan 2012 -------------------- +Changes: +. [Feature #4399] Allow Z80 SoftCard to be inserted into slot 4 or 5. (Allows CP/M v3 to work) + Fixes: . Floating bus not returned for empty slot $Cnxx addresses (Fix for A2VGA.DSK: Apple][VGA card detection). diff --git a/AppleWin/resource/Applewin.rc b/AppleWin/resource/Applewin.rc index d056fe9e..27857278 100644 --- a/AppleWin/resource/Applewin.rc +++ b/AppleWin/resource/Applewin.rc @@ -122,8 +122,6 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTIO CAPTION "Input" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - CONTROL "&Restrict mouse to Apple window",IDC_MOUSE_RESTRICT_TO_WINDOW, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,123,121,10 GROUPBOX "Joystick Control",IDC_STATIC,5,7,200,66 LTEXT "Joystick &1:",IDC_STATIC,12,20,40,8 COMBOBOX IDC_JOYSTICK0,52,18,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -140,9 +138,11 @@ BEGIN CONTROL "&Mouse interface in slot 4",IDC_MOUSE_IN_SLOT4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,95,106,10 CONTROL "Show &crosshairs in window's frame",IDC_MOUSE_CROSSHAIR, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,109,159,10 - CONTROL "Microsoft C&P/M SoftCard in slot 5",IDC_Z80_IN_SLOT5, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,138,122,10 - PUSHBUTTON "Paste &From Clipboard",IDC_PASTE_FROM_CLIPBOARD,5,160,81,14 + CONTROL "&Restrict mouse to Apple window",IDC_MOUSE_RESTRICT_TO_WINDOW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,123,121,10 + LTEXT "Microsoft CP/M SoftCard:",IDC_STATIC,5,138,122,10 + COMBOBOX IDC_CPM_CONFIG,90,136,55,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Paste &From Clipboard",IDC_PASTE_FROM_CLIPBOARD,5,160,81,14 LTEXT "(Shift+Insert during emulation)",IDC_STATIC,90,163,111,8 END @@ -253,8 +253,8 @@ DISK_ICON ICON "DISK.ICO" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,20,1,0 - PRODUCTVERSION 1,20,1,0 + FILEVERSION 1,21,0,0 + PRODUCTVERSION 1,21,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -272,12 +272,12 @@ BEGIN VALUE "Comments", "http://applewin.berlios.de" VALUE "CompanyName", "AppleWin" VALUE "FileDescription", "Apple //e Emulator for Windows" - VALUE "FileVersion", "1, 20, 1, 0" + VALUE "FileVersion", "1, 21, 0, 0" VALUE "InternalName", "APPLEWIN" - VALUE "LegalCopyright", " 1994-2011 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis" + VALUE "LegalCopyright", " 1994-2012 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis" VALUE "OriginalFilename", "APPLEWIN.EXE" VALUE "ProductName", "Apple //e Emulator" - VALUE "ProductVersion", "1, 20, 1, 0" + VALUE "ProductVersion", "1, 21, 0, 0" END END BLOCK "VarFileInfo" diff --git a/AppleWin/resource/resource.h b/AppleWin/resource/resource.h index f80d6df9..3adf3151 100644 --- a/AppleWin/resource/resource.h +++ b/AppleWin/resource/resource.h @@ -87,7 +87,7 @@ #define IDC_MOUSE_RESTRICT_TO_WINDOW 1048 #define IDC_CIDERPRESS_BROWSE 1049 #define IDC_CIDERPRESS_FILENAME 1050 -#define IDC_Z80_IN_SLOT5 1051 +#define IDC_CPM_CONFIG 1051 #define IDC_DUMPTOPRINTER 1052 #define IDC_PRINTER_DUMP_FILENAME 1053 #define IDC_PRINTER_DUMP_FILENAME_BROWSE 1054 diff --git a/AppleWin/source/Applewin.cpp b/AppleWin/source/Applewin.cpp index 2a52db41..ea4ecc8a 100644 --- a/AppleWin/source/Applewin.cpp +++ b/AppleWin/source/Applewin.cpp @@ -85,11 +85,8 @@ CSuperSerialCard sg_SSC; CMouseInterface sg_Mouse; // TODO: CLEANUP! Move to peripherals.cpp!!! -#ifdef SUPPORT_CPM -UINT g_Slot4 = CT_Empty; -#else -UINT g_Slot4 = CT_Mockingboard; // CT_Mockingboard or CT_MouseInterface -#endif +SS_CARDTYPE g_Slot4 = CT_Empty; +SS_CARDTYPE g_Slot5 = CT_Empty; eCPU g_ActiveCPU = CPU_6502; @@ -555,24 +552,19 @@ void LoadConfiguration () if(REGLOAD(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), &dwTmp)) g_uMouseRestrictToWindow = dwTmp; -#ifdef SUPPORT_CPM - if(REGLOAD(TEXT(REGVALUE_Z80_IN_SLOT5), &dwTmp)) - g_uZ80InSlot5 = dwTmp; + if(REGLOAD(TEXT(REGVALUE_CPM_CONFIG), &dwTmp)) + g_CPMChoice = (CPMCHOICE) dwTmp; - if (g_uZ80InSlot5) + if (g_CPMChoice == CPM_SLOT4 || g_CPMChoice == CPM_SLOT5) MB_SetSoundcardType(SC_NONE); - g_Slot4 = - g_uMouseInSlot4 ? CT_MouseInterface - : g_uZ80InSlot5 ? CT_Empty - : CT_Mockingboard; -// : g_uClockInSlot4 ? CT_GenericClock -// : CT_Mockingboard; -#else - g_Slot4 = g_uMouseInSlot4 - ? CT_MouseInterface - : CT_Mockingboard; -#endif + g_Slot4 = + g_uMouseInSlot4 ? CT_MouseInterface + : (g_CPMChoice == CPM_SLOT4) ? CT_Z80 + : CT_Mockingboard; + + g_Slot5 = (g_CPMChoice == CPM_SLOT5) ? CT_Z80 + : CT_Mockingboard; // diff --git a/AppleWin/source/Applewin.h b/AppleWin/source/Applewin.h index 50f9cbf4..a19ca494 100644 --- a/AppleWin/source/Applewin.h +++ b/AppleWin/source/Applewin.h @@ -44,12 +44,12 @@ extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (s extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support // TODO: Make g_CurrentPeripherals[MAX_SLOTS] = { CT_Empty } -extern UINT g_Slot4; // Mockingboard or Mouse in slot4 +extern SS_CARDTYPE g_Slot4; // Mockingboard, Z80, Mouse in slot4 +extern SS_CARDTYPE g_Slot5; // Mockingboard, Z80, in slot5 // TODO: Move into: g_CurrentPeripherals[] extern UINT g_uMouseInSlot4; //extern UINT g_uClockInSlot4; -extern UINT g_uZ80InSlot5; extern HANDLE g_hCustomRomF8; // NULL if no custom rom diff --git a/AppleWin/source/CPU.cpp b/AppleWin/source/CPU.cpp index f12a1846..4db7cd37 100644 --- a/AppleWin/source/CPU.cpp +++ b/AppleWin/source/CPU.cpp @@ -87,11 +87,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "MouseInterface.h" -#ifdef SUPPORT_CPM #include "z80emu.h" #include "Z80VICE\z80.h" #include "Z80VICE\z80mem.h" -#endif #ifdef USE_SPEECH_API #include "Speech.h" @@ -461,10 +459,8 @@ void CpuInitialize () CpuIrqReset(); CpuNmiReset(); -#ifdef SUPPORT_CPM z80mem_initialize(); z80_reset(); -#endif } //=========================================================================== @@ -567,10 +563,8 @@ void CpuReset() regs.bJammed = 0; -#ifdef SUPPORT_CPM g_ActiveCPU = CPU_6502; z80_reset(); -#endif } //=========================================================================== diff --git a/AppleWin/source/CPU/cpu6502.h b/AppleWin/source/CPU/cpu6502.h index c196f115..eb140bac 100644 --- a/AppleWin/source/CPU/cpu6502.h +++ b/AppleWin/source/CPU/cpu6502.h @@ -44,13 +44,11 @@ static DWORD Cpu6502 (DWORD uTotalCycles) UINT uExtraCycles = 0; BYTE iOpcode; -#ifdef SUPPORT_CPM if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) } else -#endif { if (!Fetch(iOpcode, uExecutedCycles)) break; diff --git a/AppleWin/source/CPU/cpu65C02.h b/AppleWin/source/CPU/cpu65C02.h index 58897c7e..43223ef9 100644 --- a/AppleWin/source/CPU/cpu65C02.h +++ b/AppleWin/source/CPU/cpu65C02.h @@ -47,13 +47,11 @@ static DWORD Cpu65C02 (DWORD uTotalCycles) UINT uExtraCycles = 0; BYTE iOpcode; -#ifdef SUPPORT_CPM if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) } else -#endif { if (!Fetch(iOpcode, uExecutedCycles)) break; diff --git a/AppleWin/source/CPU/cpu65d02.h b/AppleWin/source/CPU/cpu65d02.h index 08953da9..80b800fa 100644 --- a/AppleWin/source/CPU/cpu65d02.h +++ b/AppleWin/source/CPU/cpu65d02.h @@ -106,13 +106,11 @@ static DWORD Cpu65D02 (DWORD uTotalCycles) UINT uExtraCycles = 0; BYTE iOpcode; -#ifdef SUPPORT_CPM if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) } else -#endif if (!Fetch(iOpcode, uExecutedCycles)) break; diff --git a/AppleWin/source/Common.h b/AppleWin/source/Common.h index e5ecff5d..b8db9677 100644 --- a/AppleWin/source/Common.h +++ b/AppleWin/source/Common.h @@ -1,6 +1,5 @@ #pragma once -#define SUPPORT_CPM #define USE_SPEECH_API const double _M14 = (157500000.0 / 11.0); // 14.3181818... * 10^6 @@ -90,7 +89,8 @@ enum AppMode_e #define REGVALUE_THE_FREEZES_F8_ROM "The Freeze's F8 Rom" #define REGVALUE_CLONETYPE "Clone Type" #define REGVALUE_CIDERPRESSLOC "CiderPress Location" -#define REGVALUE_Z80_IN_SLOT5 "Z80 in slot 5" +//#define REGVALUE_Z80_IN_SLOT5 "Z80 in slot 5" +#define REGVALUE_CPM_CONFIG "CPM Config" #define REGVALUE_DUMP_TO_PRINTER "Dump to printer" #define REGVALUE_CONVERT_ENCODING "Convert printer encoding for clones" #define REGVALUE_FILTER_UNPRINTABLE "Filter unprintable characters" diff --git a/AppleWin/source/Frame.cpp b/AppleWin/source/Frame.cpp index 8b787a62..5591e516 100644 --- a/AppleWin/source/Frame.cpp +++ b/AppleWin/source/Frame.cpp @@ -1685,9 +1685,7 @@ void ResetMachineState () MB_Reset(); SpkrReset(); sg_Mouse.Reset(); -#ifdef SUPPORT_CPM g_ActiveCPU = CPU_6502; -#endif #ifdef USE_SPEECH_API g_Speech.Reset(); #endif diff --git a/AppleWin/source/Memory.cpp b/AppleWin/source/Memory.cpp index 3527a8c0..2cbc7b47 100644 --- a/AppleWin/source/Memory.cpp +++ b/AppleWin/source/Memory.cpp @@ -30,11 +30,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Harddisk.h" #include "MouseInterface.h" #include "NoSlotClock.h" -#ifdef SUPPORT_CPM #include "z80emu.h" #include "Z80VICE\z80.h" #include "Z80VICE\z80mem.h" -#endif #include "..\resource\resource.h" // Memory Flag @@ -1172,21 +1170,25 @@ void MemInitialize() { sg_Mouse.Initialize(pCxRomPeripheral, 4); // $C400 : Mouse f/w } -// else if (g_Slot4 == CT_GenericClock) -// { -// LoadRom_Clock_Generic(pCxRomPeripheral, 4); -// } else if (g_Slot4 == CT_Mockingboard) { const UINT uSlot4 = 4; const UINT uSlot5 = 5; MB_InitializeIO(pCxRomPeripheral, uSlot4, uSlot5); } + else if (g_Slot4 == CT_Z80) + { + ConfigureSoftcard(pCxRomPeripheral, 4); // $C400 : Z80 card + } +// else if (g_Slot4 == CT_GenericClock) +// { +// LoadRom_Clock_Generic(pCxRomPeripheral, 4); +// } -#ifdef SUPPORT_CPM - if (g_uZ80InSlot5) - ConfigureSoftcard(pCxRomPeripheral, 5, g_uZ80InSlot5); // $C500 : Z80 card -#endif + if (g_Slot5 == CT_Z80) + { + ConfigureSoftcard(pCxRomPeripheral, 5); // $C500 : Z80 card + } DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w @@ -1241,9 +1243,7 @@ void MemReset () CpuInitialize(); //Sets Caps Lock = false (Pravets 8A/C only) -#ifdef SUPPORT_CPM z80_reset(); -#endif } //=========================================================================== diff --git a/AppleWin/source/Mockingboard.cpp b/AppleWin/source/Mockingboard.cpp index 43f8a25a..ea134b88 100644 --- a/AppleWin/source/Mockingboard.cpp +++ b/AppleWin/source/Mockingboard.cpp @@ -1498,18 +1498,11 @@ static BYTE __stdcall PhasorIO (WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, U void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5) { -#ifdef SUPPORT_CPM - if (g_Slot4 == CT_Mockingboard) - { - RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL); - RegisterIoHandler(uSlot5, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL); - } -#else - if (g_Slot4 == CT_Mockingboard) - RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL); - + if (g_Slot4 == CT_Mockingboard) + { + RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL); RegisterIoHandler(uSlot5, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL); -#endif + } } //----------------------------------------------------------------------------- diff --git a/AppleWin/source/PropertySheetPage.cpp b/AppleWin/source/PropertySheetPage.cpp index d11005d3..9d857f16 100644 --- a/AppleWin/source/PropertySheetPage.cpp +++ b/AppleWin/source/PropertySheetPage.cpp @@ -78,6 +78,15 @@ TCHAR soundchoices[] = TEXT("Disabled\0") TCHAR discchoices[] = TEXT("Authentic Speed\0") TEXT("Enhanced Speed\0"); +TCHAR g_szCPMSlotChoice_Slot4[] = TEXT("Slot 4\0"); +TCHAR g_szCPMSlotChoice_Slot5[] = TEXT("Slot 5\0"); +TCHAR g_szCPMSlotChoice_Unplugged[] = TEXT("Unplugged\0"); +TCHAR g_szCPMSlotChoice_Unavailable[] = TEXT("Unavailable\0"); + +static TCHAR g_szCPMSlotChoices[100]; +CPMCHOICE g_CPMChoice = CPM_UNPLUGGED; +CPMCHOICE g_CPMComboItemToChoice[_CPM_MAX_CHOICES]; + const UINT VOLUME_MIN = 0; const UINT VOLUME_MAX = 59; @@ -92,8 +101,6 @@ UINT g_uMouseInSlot4 = 0; UINT g_uMouseShowCrosshair = 0; UINT g_uMouseRestrictToWindow = 0; -UINT g_uZ80InSlot5 = 0; - // UINT g_uTheFreezesF8Rom = 0; @@ -219,6 +226,72 @@ static void InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue) FillComboBox(window, nIdcValue, pnzJoystickChoices, joytype[nJoyNum]); } +static void InitCPMChoices(HWND window) +{ + for (UINT i=0; i<_CPM_MAX_CHOICES; i++) + g_CPMComboItemToChoice[i] = CPM_UNAVAILABLE; + + UINT uStringOffset = 0; + UINT uComboItemIdx = 0; + const eSOUNDCARDTYPE SoundcardType = MB_GetSoundcardType(); + + const bool bIsSlot4Empty = g_uMouseInSlot4 == 0 && + SoundcardType == SC_NONE; // Mockingboard is in slots 4+5; Phasor is in slot 4 + const bool bIsSlot5Empty = SoundcardType != SC_MOCKINGBOARD; + + if (bIsSlot4Empty) // Slot-4 is empty + { + const UINT uStrLen = strlen(g_szCPMSlotChoice_Slot4)+1; + memcpy(&g_szCPMSlotChoices[uStringOffset], g_szCPMSlotChoice_Slot4, uStrLen); + uStringOffset += uStrLen; + + g_CPMComboItemToChoice[uComboItemIdx++] = CPM_SLOT4; + } + + if (bIsSlot5Empty) // Slot-5 is empty + { + const UINT uStrLen = strlen(g_szCPMSlotChoice_Slot5)+1; + memcpy(&g_szCPMSlotChoices[uStringOffset], g_szCPMSlotChoice_Slot5, uStrLen); + uStringOffset += uStrLen; + + g_CPMComboItemToChoice[uComboItemIdx++] = CPM_SLOT5; + } + + if (uStringOffset) + { + const UINT uStrLen = strlen(g_szCPMSlotChoice_Unplugged)+1; + memcpy(&g_szCPMSlotChoices[uStringOffset], g_szCPMSlotChoice_Unplugged, uStrLen); + uStringOffset += uStrLen; + + g_CPMComboItemToChoice[uComboItemIdx] = CPM_UNPLUGGED; + } + else + { + const UINT uStrLen = strlen(g_szCPMSlotChoice_Unavailable)+1; + memcpy(&g_szCPMSlotChoices[uStringOffset], g_szCPMSlotChoice_Unavailable, uStrLen); + uStringOffset += uStrLen; + + g_CPMChoice = CPM_UNAVAILABLE; // Force this + g_CPMComboItemToChoice[uComboItemIdx] = CPM_UNAVAILABLE; + } + + g_szCPMSlotChoices[uStringOffset] = 0; // Doubly null terminated + + // + + UINT uCurrentChoice = uComboItemIdx; // Default to last item (either UNPLUGGED or UNAVAILABLE) + for (UINT i=0; i<=uComboItemIdx; i++) + { + if (g_CPMComboItemToChoice[i] == g_CPMChoice) + { + uCurrentChoice = i; + break; + } + } + + FillComboBox(window, IDC_CPM_CONFIG, g_szCPMSlotChoices, uCurrentChoice); +} + //=========================================================================== static eApple2Type GetApple2Type(DWORD NewCompType, DWORD NewCloneType) @@ -541,7 +614,7 @@ static void InputDlg_OK(HWND window, UINT afterclose) REGSAVE(TEXT(REGVALUE_MOUSE_IN_SLOT4),g_uMouseInSlot4); REGSAVE(TEXT(REGVALUE_MOUSE_CROSSHAIR),g_uMouseShowCrosshair); REGSAVE(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW),g_uMouseRestrictToWindow); - REGSAVE(TEXT(REGVALUE_Z80_IN_SLOT5),g_uZ80InSlot5); + REGSAVE(TEXT(REGVALUE_CPM_CONFIG), g_CPMChoice); // @@ -667,30 +740,36 @@ static BOOL CALLBACK InputDlgProc(HWND window, } break; - case IDC_Z80_IN_SLOT5: + case IDC_CPM_CONFIG: + if(HIWORD(wparam) == CBN_SELCHANGE) { - UINT uNewState = IsDlgButtonChecked(window, IDC_Z80_IN_SLOT5) ? 1 : 0; - LPCSTR pMsg = uNewState ? + DWORD NewCPMChoiceItem = (DWORD) SendDlgItemMessage(window, IDC_CPM_CONFIG, CB_GETCURSEL, 0, 0); + CPMCHOICE NewCPMChoice = g_CPMComboItemToChoice[NewCPMChoiceItem]; + if (NewCPMChoice == g_CPMChoice) + break; + + LPCSTR pMsg = NewCPMChoice != CPM_UNPLUGGED ? TEXT("The emulator needs to restart as the slot configuration has changed.\n") - TEXT("Microsoft CP/M SoftCard will be placed in slot 5.\n\n") + TEXT("Microsoft CP/M SoftCard will be inserted.\n\n") TEXT("Would you like to restart the emulator now?") : - TEXT("The emulator needs to restart as the slot configuration has changed.\n") - TEXT("Microsoft CP/M SoftCard will be removed from slot 5\n\n") + TEXT("The emulator needs to restart as the slot configuration has changed.\n") + TEXT("Microsoft CP/M SoftCard will be removed.\n\n") TEXT("Would you like to restart the emulator now?"); if (MessageBox(window, pMsg, TEXT("Configuration"), MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES) { - g_uZ80InSlot5 = uNewState; + g_CPMChoice = NewCPMChoice; afterclose = WM_USER_RESTART; PropSheet_PressButton(GetParent(window), PSBTN_OK); } else { - CheckDlgButton(window, IDC_Z80_IN_SLOT5, g_uZ80InSlot5 ? BST_CHECKED : BST_UNCHECKED); + InitCPMChoices(window); // Restore original state } + } break; @@ -714,12 +793,17 @@ static BOOL CALLBACK InputDlgProc(HWND window, SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(false),0)); CheckDlgButton(window, IDC_SCROLLLOCK_TOGGLE, g_uScrollLockToggle ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(window, IDC_MOUSE_IN_SLOT4, g_uMouseInSlot4 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(window, IDC_MOUSE_CROSSHAIR, g_uMouseShowCrosshair ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(window, IDC_MOUSE_RESTRICT_TO_WINDOW, g_uMouseRestrictToWindow ? BST_CHECKED : BST_UNCHECKED); + + const eSOUNDCARDTYPE SoundcardType = MB_GetSoundcardType(); + EnableWindow(GetDlgItem(window, IDC_MOUSE_IN_SLOT4), (g_uMouseInSlot4 || (g_CPMChoice != CPM_SLOT4 && SoundcardType == SC_NONE)) ? TRUE : FALSE); EnableWindow(GetDlgItem(window, IDC_MOUSE_CROSSHAIR), g_uMouseInSlot4 ? TRUE : FALSE); EnableWindow(GetDlgItem(window, IDC_MOUSE_RESTRICT_TO_WINDOW), g_uMouseInSlot4 ? TRUE : FALSE); - CheckDlgButton(window, IDC_Z80_IN_SLOT5, g_uZ80InSlot5 ? BST_CHECKED : BST_UNCHECKED); + + InitCPMChoices(window); afterclose = 0; break; @@ -849,14 +933,14 @@ static BOOL CALLBACK SoundDlgProc (HWND window, CheckRadioButton(window, IDC_MB_ENABLE, IDC_SOUNDCARD_DISABLE, nID); - if (g_uMouseInSlot4) + if (g_uMouseInSlot4 || g_CPMChoice == CPM_SLOT4) { - EnableWindow(GetDlgItem(window, IDC_PHASOR_ENABLE), FALSE); + EnableWindow(GetDlgItem(window, IDC_PHASOR_ENABLE), FALSE); // Disable Phasor (slot 4) } - if (g_uZ80InSlot5) + if (g_uMouseInSlot4 || g_CPMChoice == CPM_SLOT4 || g_CPMChoice == CPM_SLOT5) { - EnableWindow(GetDlgItem(window, IDC_MB_ENABLE), FALSE); + EnableWindow(GetDlgItem(window, IDC_MB_ENABLE), FALSE); // Disable Mockingboard (slot 4 & 5) } afterclose = 0; diff --git a/AppleWin/source/PropertySheetPage.h b/AppleWin/source/PropertySheetPage.h index e29a5a31..26f1099d 100644 --- a/AppleWin/source/PropertySheetPage.h +++ b/AppleWin/source/PropertySheetPage.h @@ -9,6 +9,8 @@ extern HWND hwConfigTab; extern HWND hwAdvancedTab; + enum CPMCHOICE {CPM_SLOT4=0, CPM_SLOT5, CPM_UNPLUGGED, CPM_UNAVAILABLE, _CPM_MAX_CHOICES}; + extern CPMCHOICE g_CPMChoice; // Prototypes diff --git a/AppleWin/source/z80emu.cpp b/AppleWin/source/z80emu.cpp index 58468c85..d55b52f7 100644 --- a/AppleWin/source/z80emu.cpp +++ b/AppleWin/source/z80emu.cpp @@ -34,11 +34,11 @@ BYTE __stdcall CPMZ80_IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULO //=========================================================================== -void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot, UINT bEnable) +void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot) { memset(pCxRomPeripheral + (uSlot << 8), 0xFF, APPLE_SLOT_SIZE); g_uCPMZ80Slot = uSlot; - RegisterIoHandler(uSlot, CPMZ80_IONull, CPMZ80_IONull, CPMZ80_IONull, bEnable ? CPMZ80_IOWrite : NULL, NULL, NULL); + RegisterIoHandler(uSlot, CPMZ80_IONull, CPMZ80_IONull, CPMZ80_IONull, CPMZ80_IOWrite, NULL, NULL); } diff --git a/AppleWin/source/z80emu.h b/AppleWin/source/z80emu.h index abfb5f87..18d20504 100644 --- a/AppleWin/source/z80emu.h +++ b/AppleWin/source/z80emu.h @@ -13,4 +13,4 @@ // Emula a CPU Z80 // Protótipos -void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot, UINT bEnable); +void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot);