コード例 #1
0
DWORD RunInterpreterCPU(DWORD Cycles) {
	DWORD CycleCount;
	RSP_Running = TRUE;
	Enable_RSP_Commands_Window();
	CycleCount = 0;

	while (RSP_Running) {
		if (NoOfBpoints != 0) {
			if (CheckForRSPBPoint(*PrgCount)) {
				if (InRSPCommandsWindow) {
					Enter_RSP_Commands_Window();
					if (Stepping_Commands) {
						DisplayError ( "Encounted a R4300i Breakpoint" );
					} else {
						DisplayError ( "Encounted a R4300i Breakpoint\n\nNow Stepping" );
						SetRSPCommandViewto( *PrgCount );
						SetRSPCommandToStepping();
					}
				} else {
					DisplayError ( "Encounted a RSP Breakpoint\n\nEntering Command Window" );
					Enter_RSP_Commands_Window();
				}
			}
		}
		
		if (Stepping_Commands) {
			WaitingForStep = TRUE;
			SetRSPCommandViewto( *PrgCount );
			UpdateRSPRegistersScreen();
			while ( WaitingForStep == TRUE ){ 
				Sleep(20);						
				if (!Stepping_Commands) {
					WaitingForStep = FALSE;
				}
			}
		}

		RSP_LW_IMEM(*PrgCount, &RSPOpC.Hex);
		((void (*)()) RSP_Opcode[ RSPOpC.op ])();

		switch (RSP_NextInstruction) {
		case NORMAL: 
			*PrgCount = (*PrgCount + 4) & 0xFFC; 
			break;
		case DELAY_SLOT:
			RSP_NextInstruction = JUMP;
			*PrgCount = (*PrgCount + 4) & 0xFFC; 
			break;
		case JUMP:
			RSP_NextInstruction = NORMAL;
			*PrgCount  = RSP_JumpTo;
			break;
		}
	}
	*PrgCount -= 4;

	return Cycles;
}
コード例 #2
0
ファイル: RSP Command.c プロジェクト: Hiro5/project64
LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_INITDIALOG:
		RSPCommandshWnd = hDlg;
		RSP_Commands_Setup( hDlg );
		break;
	case WM_MOVE:
		//StoreCurrentWinPos("RSP Commands",hDlg);
		break;
	case WM_DRAWITEM:
		if (wParam == IDC_LIST)
		{
			DrawRSPCommand (lParam);
		}
		break;
	case WM_PAINT:
		Paint_RSP_Commands( hDlg );
		RedrawWindow(hScrlBar,NULL,NULL, RDW_INVALIDATE |RDW_ERASE);
		return TRUE;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDC_LIST:
			if (HIWORD(wParam) == LBN_DBLCLK )
			{
				LRESULT Selected;
				DWORD Location;

				Selected = SendMessage(hList, LB_GETCURSEL, 0, 0);
				Location = RSPCommandLine[Selected].Location;
				if (Location != (DWORD)-1)
				{
					if (CheckForRSPBPoint(Location))
					{
						RemoveRSPBreakPoint(Location);
					}
					else
					{
						AddRSP_BPoint(Location, FALSE);
					}
					RefreshRSPCommands();
				}
			}
			break;
		case IDC_ADDRESS:
			if (HIWORD(wParam) == EN_CHANGE )
			{
				RefreshRSPCommands();
			}
			break;
		case IDC_GO_BUTTON:
			SetRSPCommandToRunning();
			break;
		case IDC_BREAK_BUTTON:	
			SetRSPCommandToStepping();
			break;
		case IDC_STEP_BUTTON:			
			WaitingForStep = FALSE;
			break;
		/*case IDC_SKIP_BUTTON:
			SkipNextRSPOpCode = TRUE;
			WaitingFor_RSPStep   = FALSE;
			break;*/
		case IDC_BP_BUTTON:	
			if (DebugInfo.Enter_BPoint_Window != NULL)
			{
				DebugInfo.Enter_BPoint_Window();
			}
			break;
		case IDC_RSP_REGISTERS_BUTTON:
			Enter_RSP_Register_Window();
			break;
		case IDC_R4300I_DEBUGGER_BUTTON: 
			if (DebugInfo.Enter_R4300i_Commands_Window != NULL)
			{
				DebugInfo.Enter_R4300i_Commands_Window();
			}
			break;
		case IDC_R4300I_REGISTERS_BUTTON:
			if (DebugInfo.Enter_R4300i_Register_Window != NULL)
			{
				DebugInfo.Enter_R4300i_Register_Window();
			}
			break;
		case IDC_MEMORY_BUTTON:
			if (DebugInfo.Enter_Memory_Window != NULL)
			{
				DebugInfo.Enter_Memory_Window();
			}
			break;
		case IDCANCEL:			
			EndDialog( hDlg, IDCANCEL );
			break;
		}
		break;
	case WM_VSCROLL:
		if ((HWND)lParam == hScrlBar)
		{
			DWORD location;
			char Value[20];
			SCROLLINFO si;

			GetWindowText(hAddress,Value,sizeof(Value));
			location = AsciiToHex(Value) & ~3;

			switch (LOWORD(wParam))
			{
			case SB_THUMBTRACK:
				sprintf(Value,"%03X",((short int)HIWORD(wParam) << 2 ));
				SetWindowText(hAddress,Value);
				si.cbSize = sizeof(si);
				si.fMask  = SIF_POS;
				si.nPos   = (short int)HIWORD(wParam);
				SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
				break;
			case SB_LINEDOWN:
				if (location < 0xF88)
				{
					sprintf(Value,"%03X",location + 0x4);
					SetWindowText(hAddress,Value);
					si.cbSize = sizeof(si);
					si.fMask  = SIF_POS;
					si.nPos   = ((location + 0x4) >> 2);
					SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
				}
				else
				{
					sprintf(Value,"%03X",0xF88);
					SetWindowText(hAddress,Value);
					si.cbSize = sizeof(si);
					si.fMask  = SIF_POS;
					si.nPos   = (0xFFC >> 2);
					SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
				}
				break;
			case SB_LINEUP:
				if (location > 0x4 )
				{
					sprintf(Value,"%03X",location - 0x4);
					SetWindowText(hAddress,Value);
					si.cbSize = sizeof(si);
					si.fMask  = SIF_POS;
					si.nPos   = ((location - 0x4) >> 2);
					SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
				}