Small clean-up to peripheral card IO config

This commit is contained in:
tomch 2009-04-16 21:18:13 +00:00
parent 8e1aeea6b9
commit 0d32e55f36
5 changed files with 39 additions and 47 deletions

View File

@ -1125,20 +1125,26 @@ void MemInitialize()
sg_SSC.CommInitialize(pCxRomPeripheral, 2); // $C200 : SSC
// Slot 3 is reserved for AuxMem/80Col Card!
// Slot 3 contains the Uthernet card (which can coexist with an 80-col+Ram card in AUX slot)
// . Uthernet card has no ROM and only IO mapped at $C0Bx
// Apple//e: Auxilary slot contains Extended 80 Column card or RamWorksIII card
if (g_Slot4 == CT_MouseInterface)
{
sg_Mouse.Initialize(pCxRomPeripheral, 4); // $C400 : Mouse f/w
}
else
if (g_Slot4 == CT_GenericClock)
else if (g_Slot4 == CT_GenericClock)
{
// LoadRom_Clock_Generic(pCxRomPeripheral, 4);
}
else
else if (g_Slot4 == CT_Mockingboard)
{
const UINT uSlot4 = 4;
const UINT uSlot5 = 5;
MB_InitializeIO(pCxRomPeripheral, uSlot4, uSlot5);
}
// Why isn't mockingboard here?
#ifdef SUPPORT_CPM
ConfigureSoftcard(pCxRomPeripheral, 5, g_uZ80InSlot5); // $C500 : Z80 card
#endif

View File

@ -1290,10 +1290,6 @@ static void MB_DSUninit()
//=============================================================================
static BYTE __stdcall PhasorIO (WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nCyclesLeft);
static BYTE __stdcall MB_Read(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nCyclesLeft);
static BYTE __stdcall MB_Write(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nCyclesLeft);
void MB_Initialize()
{
if(g_bDisableDirectSound)
@ -1322,31 +1318,7 @@ void MB_Initialize()
MB_Reset();
}
//
g_bMB_Active = (g_SoundcardType != SC_NONE);
//
#ifdef SUPPORT_CPM
if (g_Slot4 == CT_Mockingboard)
{
const UINT uSlot4 = 4;
RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
const UINT uSlot5 = 5;
RegisterIoHandler(uSlot5, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
}
#else
if (g_Slot4 == CT_Mockingboard)
{
const UINT uSlot4 = 4;
RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
}
const UINT uSlot5 = 5;
RegisterIoHandler(uSlot5, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
#endif
}
//-----------------------------------------------------------------------------
@ -1504,6 +1476,24 @@ 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);
RegisterIoHandler(uSlot5, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
#endif
}
//-----------------------------------------------------------------------------
void MB_Mute()
{
if(g_SoundcardType == SC_NONE)

View File

@ -9,6 +9,7 @@ void MB_Initialize();
void MB_Reinitialize();
void MB_Destroy();
void MB_Reset();
void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5);
void MB_Mute();
void MB_Demute();
void MB_StartOfCpuExecute();

View File

@ -19,8 +19,7 @@
#include "z80emu.h"
// Variaveis
static int CPMZ80Slot = 0;
int Z80_IRQ = 0; // Used by Z80Em
static int g_uCPMZ80Slot = 0;
BYTE __stdcall CPMZ80_IONull(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nCyclesLeft)
{
@ -29,21 +28,19 @@ BYTE __stdcall CPMZ80_IONull(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULON
BYTE __stdcall CPMZ80_IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nCyclesLeft)
{
if ((uAddr & 0xFF00) == (0xC000 + (CPMZ80Slot << 8)))
{
if ((uAddr & 0xFF00) == (0xC000 + (g_uCPMZ80Slot << 8)))
g_ActiveCPU = (g_ActiveCPU == CPU_6502) ? CPU_Z80 : CPU_6502;
}
return IO_Null(PC, uAddr, bWrite, uValue, nCyclesLeft);
}
//===========================================================================
void ConfigureSoftcard(LPBYTE pCxRomPeripheral, int Slot, UINT addOrRemove)
void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot, UINT bEnable)
{
memset(pCxRomPeripheral + (Slot << 8), 0xFF, APPLE_SLOT_SIZE);
memset(pCxRomPeripheral + (uSlot << 8), 0xFF, APPLE_SLOT_SIZE);
CPMZ80Slot = Slot;
g_uCPMZ80Slot = uSlot;
RegisterIoHandler(Slot, CPMZ80_IONull, CPMZ80_IONull, CPMZ80_IONull, addOrRemove ? CPMZ80_IOWrite : NULL, NULL, NULL);
RegisterIoHandler(uSlot, CPMZ80_IONull, CPMZ80_IONull, CPMZ80_IONull, bEnable ? CPMZ80_IOWrite : NULL, NULL, NULL);
}
// EOF

View File

@ -13,6 +13,4 @@
// Emula a CPU Z80
// Protótipos
void ConfigureSoftcard(LPBYTE pCxRomPeripheral, int slot, UINT addOrRemove);
// EOF
void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot, UINT bEnable);