Check for division by 0 in DIV/DIVU.

AboutWindow credits changes.
Console when using MiniDebugger.

git-svn-id: http://svn.purei.org/purei/trunk@373 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
jpd002 2008-10-10 22:13:36 +00:00
parent 1ff8fd0aec
commit 9407512bb9
6 changed files with 75 additions and 11 deletions

View File

@ -234,6 +234,14 @@ void CCodeGen::BeginIfElse(bool nCondition)
m_IfStack.Push(ifLabel);
m_IfStack.Push(IFELSEBLOCK);
}
else if(FitsPattern<SingleRelative>())
{
SingleRegister::PatternValue value(GetPattern<SingleRelative>());
unsigned int registerId = AllocateRegister();
LoadRelativeInRegister(registerId, value);
PushReg(registerId);
CCodeGen::BeginIfElse(nCondition);
}
else if(FitsPattern<SingleConstant>())
{
SingleConstant::PatternValue constant(GetPattern<SingleConstant>());

View File

@ -114,17 +114,38 @@ void CMA_MIPSIV::Template_Div32::operator()(const OperationFunctionType& functio
break;
}
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nRS].nV[0]));
//Check for zero
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[0]));
function();
m_codeGen->BeginIfElse(false);
{
m_codeGen->PushCst(~0);
m_codeGen->SeX();
m_codeGen->PullRel(lo[1]);
m_codeGen->PullRel(lo[0]);
m_codeGen->PushTop();
m_codeGen->PullRel(lo[1]);
m_codeGen->SeX();
m_codeGen->PullRel(hi[1]);
m_codeGen->PullRel(hi[0]);
m_codeGen->PushTop();
m_codeGen->PullRel(lo[0]);
m_codeGen->PushTop();
m_codeGen->PullRel(hi[1]);
m_codeGen->PullRel(hi[0]);
}
m_codeGen->BeginIfElseAlt();
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nRS].nV[0]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[0]));
function();
m_codeGen->SeX();
m_codeGen->PullRel(lo[1]);
m_codeGen->PullRel(lo[0]);
m_codeGen->SeX();
m_codeGen->PullRel(hi[1]);
m_codeGen->PullRel(hi[0]);
}
m_codeGen->EndIf();
}
void CMA_MIPSIV::Template_MovEqual::operator()(bool isEqual) const

View File

@ -27,7 +27,7 @@ CModalWindow(parent)
aboutText += _T("\r\n");
aboutText += tstring(_T("By Jean-Philip Desjardins")) + _T("\r\n");
aboutText += _T("\r\n");
aboutText += tstring(_T("Thanks to Neill Corlett for creating the PSF format and also for his ADSR analysis.")) + _T("\r\n");
aboutText += tstring(_T("Thanks to Neill Corlett for creating the PSF format and also for his ADSR and reverb analysis.")) + _T("\r\n");
m_layout = Win32::CLayoutWindow::CreateTextBoxBehavior(100, 60, new Win32::CStatic(m_hWnd, aboutText.c_str()));

View File

@ -2,7 +2,7 @@
#define _APPDEF_H_
#define APP_NAME _T("PsfPlayer")
#define APP_VERSION (13)
#define APP_VERSIONSTR _T("0.13")
#define APP_VERSION (14)
#define APP_VERSIONSTR _T("0.14")
#endif

View File

@ -2,6 +2,9 @@
#include "win32/Rect.h"
#include "win32ui/resource.h"
#include <boost/bind.hpp>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#define CLSNAME _T("MiniDebugger")
#define WNDSTYLE (WS_CAPTION | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU)
@ -9,6 +12,7 @@
#define ID_VM_PAUSE (0xBEEF)
using namespace std;
using namespace Framework;
using namespace boost;
@ -59,6 +63,18 @@ m_memoryView(NULL)
m_mainSplitter->SetChild(0, *m_subSplitter);
m_mainSplitter->SetChild(1, *m_memoryView);
m_disAsmView->SetAddress(m_virtualMachine.GetCpu().m_State.nPC);
InitializeConsole();
// CMIPS& context = m_virtualMachine.GetCpu();
// for(unsigned int i = 0; i < CPsxVm::RAMSIZE / 4; i++)
// {
// uint32 nVal = context.m_pMemoryMap->GetWord(i * 4);
// if((nVal & 0xFFFF) == 0x2910)
// {
// printf("Rawr: 0x%0.8X.\r\n", i * 4);
// }
// }
}
CMiniDebugger::~CMiniDebugger()
@ -184,3 +200,21 @@ void CMiniDebugger::CreateAccelerators()
m_acceleratorTable = CreateAcceleratorTable(Accel, sizeof(Accel) / sizeof(ACCEL));
}
void CMiniDebugger::InitializeConsole()
{
AllocConsole();
CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &ScreenBufferInfo);
ScreenBufferInfo.dwSize.Y = 1000;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), ScreenBufferInfo.dwSize);
(*stdout) = *_fdopen(_open_osfhandle(
reinterpret_cast<intptr_t>(GetStdHandle(STD_OUTPUT_HANDLE)),
_O_TEXT), "w");
setvbuf(stdout, NULL, _IONBF, 0);
ios::sync_with_stdio();
}

View File

@ -24,6 +24,7 @@ private:
void CreateAccelerators();
void StepCPU();
void OnFunctionDblClick(uint32);
void InitializeConsole();
CPsxVm& m_virtualMachine;
Framework::Win32::CHorizontalSplitter* m_subSplitter;