This commit is contained in:
Bart Trzynadlowski 2011-07-13 05:29:02 +00:00
parent c73cb830dc
commit b2afd274cb
6 changed files with 100 additions and 73 deletions

View file

@ -1324,6 +1324,7 @@ static void ppc_stwcx_rc(UINT32 op)
ea = REG(RA) + REG(RB);
/*if( ppc.reserved ) {
*/
WRITE32(ea, REG(RS));
ppc.reserved = 0;
@ -1332,12 +1333,14 @@ static void ppc_stwcx_rc(UINT32 op)
CR(0) = 0x2;
if( XER & XER_SO )
CR(0) |= 0x1;
} else*/ {
/*
} else {
//CR(0) = 0;
CR(0) = 2; // set EQ to indicate success
if( XER & XER_SO )
CR(0) |= 0x1;
}
*/
}
static void ppc_stwu(UINT32 op)

View file

@ -408,6 +408,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-19225.40", 0x91a985eb, 0x200000, 2, 28, 32, FALSE },
{ "VROM", "mpr-19226.41", 0x00091722, 0x200000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr19231.21", 0xB416FE96, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr-19209.22", 0x3715E38C, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr-19210.24", 0xC03D6502, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},
@ -467,6 +472,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-19885.40", 0xD1AE5473, 0x200000, 2, 28, 32, FALSE },
{ "VROM", "mpr-19886.41", 0x278AAE0B, 0x200000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr-19891.21", 0xC3ECD448, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr-19869.22", 0xEA1EF1CC, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr-19870.24", 0x49C70296, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},
@ -596,6 +606,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-19686.40", 0x84EED592, 0x200000, 2, 28, 32, FALSE },
{ "VROM", "mpr-19687.41", 0x776CE694, 0x200000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr-20096a.21",0x0FEF288B, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr-19670.22", 0xBD31CC06, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr-20101.24", 0x66D1E31F, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},
@ -661,6 +676,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-19916.40", 0x10B0C52E, 0x200000, 2, 28, 32, FALSE },
{ "VROM", "mpr-19917.41", 0x3035833B, 0x200000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr-19940.21", 0xB06FFE5F, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr19934.22", 0xC7D8E194, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr19935.24", 0x91C1B618, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},
@ -791,6 +811,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-19801.40", 0xBEB79A00, 0x200000, 2, 28, 32, FALSE },
{ "VROM", "mpr-19802.41", 0xF2C3A7B7, 0x200000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr-20921.21", 0x30F032A7, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr-20903.22", 0xE343E131, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr-20904.24", 0x21A91B84, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},
@ -850,6 +875,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-20630.40", 0xCC5881B8, 0x400000, 2, 28, 32, FALSE },
{ "VROM", "mpr-20631.41", 0x5CB69FFD, 0x400000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr-20636.21", 0x7139EBF8, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr-20614.22", 0xA3930E4A, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr-20615.24", 0x62E8A94A, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},
@ -1282,6 +1312,11 @@ const struct GameInfo Model3GameList[] =
{ "VROM", "mpr-21373.40", 0xB76AD261, 0x400000, 2, 28, 32, FALSE },
{ "VROM", "mpr-21374.41", 0xAE6C4D28, 0x400000, 2, 30, 32, FALSE },
// Sound ROMs
{ "SndProg","epr-21383.21", 0x544d1e28, 0x80000, 2, 0, 2, TRUE },
{ "Samples","mpr-21355.22", 0xc1b2d326, 0x400000, 2, 0x000000, 2, FALSE },
{ "Samples","mpr-21357.24", 0x02703fab, 0x400000, 2, 0x400000, 2, FALSE },
{ NULL, NULL, 0, 0, 0, 0, 0, FALSE }
}
},

View file

@ -1,4 +1,3 @@
int midiCtrlPort=0, midiPort=0;
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
@ -190,6 +189,7 @@ int midiCtrlPort=0, midiPort=0;
#include <string.h>
#include "Supermodel.h"
/******************************************************************************
Model 3 Inputs
@ -624,7 +624,6 @@ UINT32 CModel3::ReadSecurity(unsigned reg)
else
{
data = 0xFFFFFFFF;
//ErrorLog("Protection device for %s not yet implemented!", Game->title);
DebugLog("Security read: reg=%X, PC=%08X, LR=%08X\n", reg, ppc_get_pc(), ppc_get_lr());
}
return data;
@ -808,7 +807,7 @@ UINT8 CModel3::Read8(UINT32 addr)
// Sound Board
case 0x08:
printf("Read8 %08X\n", addr);
printf("PPC: Read8 %08X\n", addr);
break;
// System registers
@ -885,7 +884,7 @@ UINT16 CModel3::Read16(UINT32 addr)
// Sound Board
case 0x08:
printf("Read16 %08X\n", addr);
printf("PPC: Read16 %08X\n", addr);
break;
// MPC105
@ -977,7 +976,7 @@ UINT32 CModel3::Read32(UINT32 addr)
// Sound Board
case 0x08:
printf("Read32 %08X\n", addr);
printf("PPC: Read32 %08X\n", addr);
break;
// Backup RAM
@ -1121,35 +1120,13 @@ void CModel3::Write8(UINT32 addr, UINT8 data)
break;
// Sound Board
#if 0 //def SUPERMODEL_SOUND
case 0x08:
//printf("%08X=%02X * (PC=%08X, LR=%08X)\n", addr, data, ppc_get_pc(), ppc_get_lr());
if ((addr&0xF)==0)
{
midiPort = data;
//SoundBoard.WriteMIDIPort(data);
Turbo68KRun(480);
IRQ.Deassert(0x40);
}
else if ((addr&0xF)==4)
{
printf("Ctrl port=%02X\n", data);
SCSP_WriteMIDICtrlPort(data);
/*
if (data==0x27)
;//IRQ.Assert(0x40);
*/
midiCtrlPort=data;
if (data==0x6)
{
printf("MIDI port=%02X\n", midiPort);
if (midiPort!=0xFF)
SoundBoard.WriteMIDIPort(midiPort);
}
}
break;
#endif
printf("PPC: %08X=%02X * (PC=%08X, LR=%08X)\n", addr, data, ppc_get_pc(), ppc_get_lr());
if ((addr&0xF) == 0) // MIDI data port
SoundBoard.WriteMIDIPort(data);
else if ((addr&0xF) == 4) // MIDI control port
midiCtrlPort = data;
break;
// Backup RAM
case 0x0C:
@ -1225,7 +1202,7 @@ void CModel3::Write16(UINT32 addr, UINT16 data)
{
// Sound Board
case 0x08:
printf("%08X=%04X\n", addr, data);
printf("PPC: %08X=%04X\n", addr, data);
break;
// Backup RAM
@ -1334,7 +1311,7 @@ void CModel3::Write32(UINT32 addr, UINT32 data)
// Sound Board
case 0x08:
printf("%08X=%08X\n", addr, data);
printf("PPC: %08X=%08X\n", addr, data);
break;
// Backup RAM
@ -1641,6 +1618,13 @@ void CModel3::Write8(UINT32 addr, UINT8 data)
GPU.WriteDMARegister8(addr&0xFF,data);
else if (((addr>=0xF0040000) && (addr<0xF0040040)) || ((addr>=0xFE040000) && (addr<0xFE040040)))
WriteInputs(addr&0x3F,data);
else if (((addr>=0xF0080000) && (addr<=0xF0080007)) || ((addr>=0xFE080000) && (addr<=0xFE080007)))
{
if ((addr&0xF) == 0) // MIDI data port
SoundBoard.WriteMIDIPort(data);
else if ((addr&0xF) == 4) // MIDI control port
midiCtrlPort = data;
}
else if (((addr>=0xF00C0000) && (addr<0xF00E0000)) || ((addr>=0xFE0C0000) && (addr<0xFE0E0000)))
backupRAM[(addr&0x1FFFF)^3] = data;
else if (((addr>=0xF0100000) && (addr<0xF0100040)) || ((addr>=0xFE100000) && (addr<0xFE100040)))
@ -1886,27 +1870,25 @@ void CModel3::RunFrame(void)
IRQ.Assert(0x02);
ppc_execute(10000); // TO-DO: Vblank probably needs to be longer. Maybe that's why some games run too fast/slow
// Update sound
#if 0 //def SUPERMODEL_SOUND
//if (midiCtrlPort==0x27)
// Sound
int irqCount = 0;
while (midiCtrlPort == 0x27) // 27 triggers IRQ sequence, 06 stops it
{
//printf("*---\n");
IRQ.Assert(0x40);
ppc_execute(200);
IRQ.Deassert(0x40);
ppc_execute(200);
for (int i = 0; i < 128; i++)
++irqCount;
if (irqCount > (128*3))
{
IRQ.Assert(0x40);
ppc_execute(2000);
printf("MIDI TIMEOUT!\n");
break;
}
//printf("---*\n");
}
// Print out sound command buffer in Scud Race RAM
printf("cmdbuf=%08X %08X %08X %08X %08X %08X %08X %08X\n", Read32(0x100180), Read32(0x100184), Read32(0x100188), Read32(0x10018C), Read32(0x100190), Read32(0x100194), Read32(0x100198), Read32(0x10019C));
#endif
SoundBoard.RunFrame();
IRQ.Deassert(0x40);
SoundBoard.RunFrame();
// End frame
GPU.EndFrame();
@ -1931,6 +1913,9 @@ void CModel3::Reset(void)
serialFIFO2 = 0;
adcChannel = 0;
// MIDI
midiCtrlPort = 0;
// Reset all devices
ppc_reset();
IRQ.Reset();

View file

@ -221,7 +221,7 @@ public:
* Parameters:
* InputsPtr Pointer to the object containing input states.
*/
void AttachInputs(CInputs *InputsPtr);
void AttachInputs(CInputs *InputsPtr);
/*
* Init(ppcFrequencyParam):
@ -271,7 +271,7 @@ private:
const struct GameInfo *Game;
// Game inputs
CInputs *Inputs;
CInputs *Inputs;
// Input registers (game controls)
UINT8 inputBank;
@ -279,6 +279,9 @@ private:
UINT8 gunReg;
int adcChannel;
// MIDI port
UINT8 midiCtrlPort; // controls MIDI (SCSP) IRQ behavior
// Emulated core Model 3 memory regions
UINT8 *memoryPool; // single allocated region for all ROM and system RAM
UINT8 *ram; // 8 MB PowerPC RAM

View file

@ -1,6 +1,3 @@
unsigned char midiCtrlPort=0;
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
@ -30,6 +27,13 @@ unsigned char midiCtrlPort=0;
* callbacks. Some minor interface changes were made (external global variables
* were removed).
*
* The MIDI input buffer has been increased from 8 (which I assume is the
* actual size) in order to accommodate Model 3's PowerPC/68K communication.
* There is probably tight synchronization between the CPUs, with PowerPC-side
* interrupts being generated to fill the MIDI buffer as the 68K pulls data
* out, or there may be a UART with a large FIFO buffer. This can be simulated
* by increasing the MIDI buffer (MIDI_STACK_SIZE).
*
* To-Do List
* ----------
* - Remove asserts() in DSP code and make sure memory allocation errors are
@ -118,9 +122,12 @@ static DWORD IrqTimA=1;
static DWORD IrqTimBC=2;
static DWORD IrqMidi=3;
#define MIDI_STACK_SIZE 128
#define MIDI_STACK_SIZE_MASK (MIDI_STACK_SIZE-1)
static BYTE MidiOutStack[8];
static BYTE MidiOutW=0,MidiOutR=0;
static BYTE MidiStack[8];
static BYTE MidiStack[MIDI_STACK_SIZE];
static BYTE MidiOutFill;
static BYTE MidiInFill;
static BYTE MidiW=0,MidiR=0;
@ -329,7 +336,7 @@ void CheckPendingIRQ()
{
//SCSP.data[0x20/2]|=0x8; //Hold midi line while there are commands pending
Int68kCB(IrqMidi);
printf("MIDI IRQ\n");
//printf("68K: MIDI IRQ\n");
//ErrorLogMessage("Midi");
return;
}
@ -738,7 +745,7 @@ void SCSP_UpdateSlotReg(int s,int r)
if(KEYONB(s2) && (!s2->active || (s2->active && s2->EG.state==RELEASE)))
{
DebugLog("KEYON %d",sl);
printf("KEYON %d\n",sl);
printf("68K: KEYON %d\n",sl);
SCSP_StartSlot(s2);
}
if(!KEYONB(s2) && s2->active)
@ -885,7 +892,7 @@ void SCSP_UpdateRegR(int reg)
if(MidiR!=MidiW)
{
++MidiR;
MidiR&=7;
MidiR&=MIDI_STACK_SIZE_MASK;
//Int68kCB(IrqMidi);
}
@ -914,8 +921,8 @@ void SCSP_w8(unsigned int addr,unsigned char val)
{
int slot=addr/0x20;
addr&=0x1f;
DebugLog("Slot %02X Reg %02X write byte %04X",slot,addr^1,val);
printf("Slot %02X Reg %02X write byte %04X\n",slot,addr^1,val);
DebugLog("Slot %02X Reg %02X write byte %04X\n",slot,addr^1,val);
//printf("Slot %02X Reg %02X write byte %04X\n",slot,addr^1,val);
*((unsigned char *) (SCSP->Slots[slot].datab+(addr^1))) = val;
SCSP_UpdateSlotReg(slot,(addr^1)&0x1f);
}
@ -954,8 +961,8 @@ void SCSP_w16(unsigned int addr,unsigned short val)
{
int slot=addr/0x20;
addr&=0x1f;
DebugLog("Slot %02X Reg %02X write word %04X",slot,addr,val);
printf("Slot %02X Reg %02X write word %04X\n",slot,addr,val);
DebugLog("Slot %02X Reg %02X write word %04X\n",slot,addr,val);
//printf("Slot %02X Reg %02X write word %04X\n",slot,addr,val);
*((unsigned short *) (SCSP->Slots[slot].datab+(addr))) = val;
SCSP_UpdateSlotReg(slot,addr&0x1f);
}
@ -994,8 +1001,8 @@ void SCSP_w32(unsigned int addr,unsigned int val)
{
int slot=addr/0x20;
addr&=0x1f;
DebugLog("Slot %02X Reg %02X write dword %08X",slot,addr,val);
printf("Slot %02X Reg %02X write dword %08X\n",slot,addr,val);
DebugLog("Slot %02X Reg %02X write dword %08X\n",slot,addr,val);
//printf("Slot %02X Reg %02X write dword %08X\n",slot,addr,val);
_asm rol val,16
*((unsigned int *) (SCSP->Slots[slot].datab+(addr))) = val;
SCSP_UpdateSlotReg(slot,addr&0x1f);
@ -1857,7 +1864,7 @@ void SCSP_MidiIn(BYTE val)
DebugLog("Midi Buffer push %02X",val);
MidiStack[MidiW++]=val;
MidiW&=7;
MidiW&=MIDI_STACK_SIZE_MASK;
MidiInFill++;
//Int68kCB(IrqMidi);
// SCSP.data[0x20/2]|=0x8;
@ -1865,7 +1872,7 @@ void SCSP_MidiIn(BYTE val)
void SCSP_MidiOutW(BYTE val)
{
printf("MIDI out\n");
printf("68K: MIDI out\n");
DebugLog("Midi Out Buffer push %02X",val);
MidiStack[MidiOutW++]=val;
MidiOutW&=7;
@ -2000,11 +2007,6 @@ unsigned int SCSP_Slave_r32(unsigned int addr)
Extra Supermodel Interface Functions
******************************************************************************/
void SCSP_WriteMIDICtrlPort(UINT8 data)
{
midiCtrlPort = data;
}
void SCSP_SetBuffers(INT16 *leftBufferPtr, INT16 *rightBufferPtr, int bufferLength)
{
SysFPS = 60.0; // should this be updated to reflect actual FPS?

View file

@ -63,7 +63,6 @@ unsigned short SCSP_Slave_r16(unsigned int addr);
unsigned int SCSP_Slave_r32(unsigned int addr);
// Supermodel interface functions
void SCSP_WriteMIDICtrlPort(UINT8 data);
void SCSP_SetBuffers(INT16 *leftBufferPtr, INT16 *rightBufferPtr, int bufferLength);
void SCSP_Deinit(void);