2008-11-14 20:47:53 +00:00
|
|
|
/*
|
|
|
|
* RSP Compiler plug in for Project 64 (A Nintendo 64 emulator).
|
|
|
|
*
|
|
|
|
* (c) Copyright 2001 jabo (jabo@emulation64.com) and
|
|
|
|
* zilmar (zilmar@emulation64.com)
|
|
|
|
*
|
|
|
|
* pj64 homepage: www.pj64.net
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute Project64 in both binary and
|
|
|
|
* source form, for non-commercial purposes, is hereby granted without fee,
|
|
|
|
* providing that this license information and copyright notice appear with
|
|
|
|
* all copies and any derived work.
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event shall the authors be held liable for any damages
|
|
|
|
* arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
|
|
|
* seek permission of the copyright holders first. Commercial use includes
|
|
|
|
* charging money for Project64 or software derived from Project64.
|
|
|
|
*
|
|
|
|
* The copyright holders request that bug fixes and improvements to the code
|
|
|
|
* should be forwarded to them so if they want them.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "RSP.h"
|
|
|
|
#include "CPU.h"
|
|
|
|
#include "RSP Registers.h"
|
|
|
|
#include "RSP Command.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "breakpoint.h"
|
|
|
|
|
|
|
|
#define RSP_MaxCommandLines 30
|
|
|
|
|
|
|
|
#define RSP_Status_PC 1
|
|
|
|
#define RSP_Status_BP 2
|
|
|
|
|
|
|
|
#define IDC_LIST 1000
|
|
|
|
#define IDC_ADDRESS 1001
|
|
|
|
#define IDC_FUNCTION_COMBO 1002
|
|
|
|
#define IDC_GO_BUTTON 1003
|
|
|
|
#define IDC_BREAK_BUTTON 1004
|
|
|
|
#define IDC_STEP_BUTTON 1005
|
|
|
|
#define IDC_SKIP_BUTTON 1006
|
|
|
|
#define IDC_BP_BUTTON 1007
|
|
|
|
#define IDC_R4300I_REGISTERS_BUTTON 1008
|
|
|
|
#define IDC_R4300I_DEBUGGER_BUTTON 1009
|
|
|
|
#define IDC_RSP_REGISTERS_BUTTON 1010
|
|
|
|
#define IDC_MEMORY_BUTTON 1011
|
|
|
|
#define IDC_SCRL_BAR 1012
|
|
|
|
|
|
|
|
void Paint_RSP_Commands (HWND hDlg);
|
|
|
|
void RSP_Commands_Setup ( HWND hDlg );
|
|
|
|
LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
DWORD Location;
|
|
|
|
DWORD opcode;
|
|
|
|
char String[150];
|
|
|
|
DWORD status;
|
|
|
|
} RSPCOMMANDLINE;
|
|
|
|
|
|
|
|
RSPCOMMANDLINE RSPCommandLine[30];
|
|
|
|
HWND RSPCommandshWnd, hList, hAddress, hFunctionlist, hGoButton, hBreakButton,
|
|
|
|
hStepButton, hSkipButton, hBPButton, hR4300iRegisters, hR4300iDebugger, hRSPRegisters,
|
|
|
|
hMemory, hScrlBar;
|
|
|
|
BOOL InRSPCommandsWindow;
|
|
|
|
char CommandName[100];
|
|
|
|
DWORD Stepping_Commands, WaitingForStep;
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void Create_RSP_Commands_Window ( int Child )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DWORD ThreadID;
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if ( Child )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
InRSPCommandsWindow = TRUE;
|
|
|
|
DialogBox( hinstDLL, "RSPCOMMAND", NULL,(DLGPROC)RSP_Commands_Proc );
|
|
|
|
|
|
|
|
InRSPCommandsWindow = FALSE;
|
|
|
|
memset(RSPCommandLine,0,sizeof(RSPCommandLine));
|
|
|
|
SetRSPCommandToRunning();
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!InRSPCommandsWindow)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
Stepping_Commands = TRUE;
|
|
|
|
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_RSP_Commands_Window,
|
|
|
|
(LPVOID)TRUE,0, &ThreadID);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SetForegroundWindow(RSPCommandshWnd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void Disable_RSP_Commands_Window ( void )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SCROLLINFO si;
|
|
|
|
|
|
|
|
if (!InRSPCommandsWindow) { return; }
|
|
|
|
EnableWindow(hList, FALSE);
|
|
|
|
EnableWindow(hAddress, FALSE);
|
|
|
|
EnableWindow(hScrlBar, FALSE);
|
|
|
|
EnableWindow(hGoButton, FALSE);
|
|
|
|
EnableWindow(hStepButton, FALSE);
|
|
|
|
EnableWindow(hSkipButton, FALSE);
|
|
|
|
EnableWindow(hR4300iRegisters, FALSE);
|
|
|
|
EnableWindow(hRSPRegisters, FALSE);
|
|
|
|
EnableWindow(hR4300iDebugger, FALSE);
|
|
|
|
EnableWindow(hMemory, FALSE);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
|
|
|
si.nMin = 0;
|
|
|
|
si.nMax = 0;
|
|
|
|
si.nPos = 1;
|
|
|
|
si.nPage = 1;
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
int DisplayRSPCommand (DWORD location, int InsertPos)
|
|
|
|
{
|
2015-02-26 03:45:33 +00:00
|
|
|
uint32_t OpCode;
|
|
|
|
DWORD LinesUsed = 1, status;
|
2008-11-14 20:47:53 +00:00
|
|
|
BOOL Redraw = FALSE;
|
|
|
|
|
|
|
|
RSP_LW_IMEM(location, &OpCode);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
status = 0;
|
|
|
|
if (location == *PrgCount) {status = RSP_Status_PC; }
|
|
|
|
if (CheckForRSPBPoint(location)) { status |= RSP_Status_BP; }
|
|
|
|
if (RSPCommandLine[InsertPos].opcode != OpCode) { Redraw = TRUE; }
|
|
|
|
if (RSPCommandLine[InsertPos].Location != location) { Redraw = TRUE; }
|
|
|
|
if (RSPCommandLine[InsertPos].status != status) { Redraw = TRUE; }
|
2015-03-18 04:50:48 +00:00
|
|
|
if (Redraw)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
RSPCommandLine[InsertPos].Location = location;
|
|
|
|
RSPCommandLine[InsertPos].status = status;
|
|
|
|
RSPCommandLine[InsertPos].opcode = OpCode;
|
|
|
|
sprintf(RSPCommandLine[InsertPos].String," 0x%03X\t%s",location,
|
|
|
|
RSPOpcodeName ( OpCode, location ));
|
2015-03-18 04:50:48 +00:00
|
|
|
if ( SendMessage(hList,LB_GETCOUNT,0,0) <= InsertPos)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hList,LB_INSERTSTRING,(WPARAM)InsertPos, (LPARAM)location);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
RECT ItemRC;
|
|
|
|
SendMessage(hList,LB_GETITEMRECT,(WPARAM)InsertPos, (LPARAM)&ItemRC);
|
|
|
|
RedrawWindow(hList,&ItemRC,NULL, RDW_INVALIDATE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return LinesUsed;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void DumpRSPCode (void)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
char string[100], LogFileName[255], *p ;
|
2015-02-26 03:45:33 +00:00
|
|
|
uint32_t OpCode;
|
|
|
|
DWORD location, dwWritten;
|
2008-11-14 20:47:53 +00:00
|
|
|
HANDLE hLogFile = NULL;
|
|
|
|
|
|
|
|
strcpy(LogFileName,GetCommandLine() + 1);
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if (strchr(LogFileName,'\"'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p = strchr(LogFileName,'\"');
|
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if (strchr(LogFileName,'\\'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p = LogFileName;
|
2015-03-18 04:50:48 +00:00
|
|
|
while (strchr(p,'\\'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p = strchr(p,'\\');
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
p -= 1;
|
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
strcat(LogFileName,"\\RSP code.txt");
|
|
|
|
|
|
|
|
hLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS,
|
|
|
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
|
|
|
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
|
|
|
|
|
|
|
for (location = 0; location < 0x1000; location += 4) {
|
|
|
|
RSP_LW_IMEM(location, &OpCode);
|
|
|
|
sprintf(string," 0x%03X\t%s\r\n",location, RSPOpcodeName ( OpCode, location ));
|
|
|
|
WriteFile( hLogFile,string,strlen(string),&dwWritten,NULL );
|
|
|
|
}
|
|
|
|
CloseHandle(hLogFile);
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void DumpRSPData (void)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
char string[100], LogFileName[255], *p ;
|
2015-02-26 03:45:33 +00:00
|
|
|
uint32_t value;
|
|
|
|
DWORD location, dwWritten;
|
2008-11-14 20:47:53 +00:00
|
|
|
HANDLE hLogFile = NULL;
|
|
|
|
|
|
|
|
strcpy(LogFileName,GetCommandLine() + 1);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
if (strchr(LogFileName,'\"'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p = strchr(LogFileName,'\"');
|
|
|
|
*p = '\0';
|
|
|
|
}
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
if (strchr(LogFileName,'\\'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p = LogFileName;
|
|
|
|
while (strchr(p,'\\')) {
|
|
|
|
p = strchr(p,'\\');
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
p -= 1;
|
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
strcat(LogFileName,"\\RSP data.txt");
|
|
|
|
|
|
|
|
hLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS,
|
|
|
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
|
|
|
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
for (location = 0; location < 0x1000; location += 4)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
RSP_LW_DMEM(location, &value);
|
|
|
|
sprintf(string," 0x%03X\t0x%08X\r\n", location, value);
|
|
|
|
WriteFile( hLogFile,string,strlen(string),&dwWritten,NULL );
|
|
|
|
}
|
|
|
|
CloseHandle(hLogFile);
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void DrawRSPCommand ( LPARAM lParam )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
char Command[150], Offset[30], Instruction[30], Arguments[40];
|
|
|
|
LPDRAWITEMSTRUCT ditem;
|
2015-01-29 08:57:13 +00:00
|
|
|
COLORREF oldColor = {0};
|
2008-11-14 20:47:53 +00:00
|
|
|
int ResetColor;
|
|
|
|
HBRUSH hBrush;
|
|
|
|
RECT TextRect;
|
|
|
|
char *p1, *p2;
|
|
|
|
|
|
|
|
ditem = (LPDRAWITEMSTRUCT)lParam;
|
|
|
|
strcpy(Command, RSPCommandLine[ditem->itemID].String);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
if (strchr(Command,'\t'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p1 = strchr(Command,'\t');
|
|
|
|
sprintf(Offset,"%.*s",p1 - Command, Command);
|
|
|
|
p1++;
|
2015-03-18 04:50:48 +00:00
|
|
|
if (strchr(p1,'\t'))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
p2 = strchr(p1,'\t');
|
|
|
|
sprintf(Instruction,"%.*s",p2 - p1, p1);
|
|
|
|
sprintf(Arguments,"%s",p2 + 1);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Instruction,"%s",p1);
|
|
|
|
sprintf(Arguments,"\0");
|
|
|
|
}
|
|
|
|
sprintf(Command,"\0");
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Offset,"\0");
|
|
|
|
sprintf(Instruction,"\0");
|
|
|
|
sprintf(Arguments,"\0");
|
|
|
|
}
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
if (*PrgCount == RSPCommandLine[ditem->itemID].Location)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
ResetColor = TRUE;
|
|
|
|
hBrush = (HBRUSH)(COLOR_HIGHLIGHT + 1);
|
|
|
|
oldColor = SetTextColor(ditem->hDC,RGB(255,255,255));
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
ResetColor = FALSE;
|
|
|
|
hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if (CheckForRSPBPoint( RSPCommandLine[ditem->itemID].Location ))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
ResetColor = TRUE;
|
2015-03-18 04:50:48 +00:00
|
|
|
if (*PrgCount == RSPCommandLine[ditem->itemID].Location)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SetTextColor(ditem->hDC,RGB(255,0,0));
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
oldColor = SetTextColor(ditem->hDC,RGB(255,0,0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FillRect( ditem->hDC, &ditem->rcItem,hBrush);
|
|
|
|
SetBkMode( ditem->hDC, TRANSPARENT );
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if (strlen (Command) == 0 )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SetRect(&TextRect,ditem->rcItem.left,ditem->rcItem.top, ditem->rcItem.left + 83,
|
|
|
|
ditem->rcItem.bottom);
|
|
|
|
DrawText(ditem->hDC,Offset,strlen(Offset), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
SetRect(&TextRect,ditem->rcItem.left + 83,ditem->rcItem.top, ditem->rcItem.left + 165,
|
|
|
|
ditem->rcItem.bottom);
|
|
|
|
DrawText(ditem->hDC,Instruction,strlen(Instruction), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
|
|
|
|
|
|
|
SetRect(&TextRect,ditem->rcItem.left + 165,ditem->rcItem.top, ditem->rcItem.right,
|
|
|
|
ditem->rcItem.bottom);
|
|
|
|
DrawText(ditem->hDC,Arguments,strlen(Arguments), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DrawText(ditem->hDC,Command,strlen(Command), &ditem->rcItem,DT_SINGLELINE | DT_VCENTER);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ResetColor == TRUE) {
|
|
|
|
SetTextColor( ditem->hDC, oldColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void Enable_RSP_Commands_Window ( void )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SCROLLINFO si;
|
|
|
|
|
|
|
|
if (!InRSPCommandsWindow) { return; }
|
|
|
|
EnableWindow(hList, TRUE);
|
|
|
|
EnableWindow(hAddress, TRUE);
|
|
|
|
EnableWindow(hScrlBar, TRUE);
|
|
|
|
EnableWindow(hGoButton, TRUE);
|
|
|
|
EnableWindow(hStepButton, TRUE);
|
|
|
|
EnableWindow(hSkipButton, FALSE);
|
|
|
|
EnableWindow(hR4300iRegisters, TRUE);
|
|
|
|
EnableWindow(hRSPRegisters, TRUE);
|
|
|
|
EnableWindow(hR4300iDebugger, TRUE);
|
|
|
|
EnableWindow(hMemory, TRUE);
|
|
|
|
SendMessage(hBPButton, BM_SETSTYLE, BS_PUSHBUTTON,TRUE);
|
|
|
|
SendMessage(hStepButton, BM_SETSTYLE, BS_DEFPUSHBUTTON,TRUE);
|
|
|
|
SendMessage(RSPCommandshWnd, DM_SETDEFID,IDC_STEP_BUTTON,0);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
if (Stepping_Commands) {
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
|
|
|
si.nMin = 0;
|
|
|
|
si.nMax = (0x1000 >> 2) -1;
|
|
|
|
si.nPos = (*PrgCount >> 2);
|
|
|
|
si.nPage = 30;
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
SetRSPCommandViewto( *PrgCount );
|
|
|
|
SetForegroundWindow(RSPCommandshWnd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void Enter_RSP_Commands_Window ( void )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
Create_RSP_Commands_Window ( FALSE );
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void Paint_RSP_Commands (HWND hDlg)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
PAINTSTRUCT ps;
|
|
|
|
RECT rcBox;
|
|
|
|
HFONT hOldFont;
|
|
|
|
int OldBkMode;
|
|
|
|
|
|
|
|
BeginPaint( hDlg, &ps );
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
rcBox.left = 5; rcBox.top = 5;
|
|
|
|
rcBox.right = 343; rcBox.bottom = 463;
|
|
|
|
DrawEdge( ps.hdc, &rcBox, EDGE_RAISED, BF_RECT );
|
|
|
|
|
|
|
|
rcBox.left = 8; rcBox.top = 8;
|
|
|
|
rcBox.right = 340; rcBox.bottom = 460;
|
|
|
|
DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT );
|
|
|
|
|
|
|
|
rcBox.left = 347; rcBox.top = 7;
|
|
|
|
rcBox.right = 446; rcBox.bottom = 42;
|
|
|
|
DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT );
|
|
|
|
|
|
|
|
rcBox.left = 352; rcBox.top = 2;
|
|
|
|
rcBox.right = 400; rcBox.bottom = 15;
|
|
|
|
FillRect( ps.hdc, &rcBox,(HBRUSH)COLOR_WINDOW);
|
|
|
|
|
|
|
|
rcBox.left = 14; rcBox.top = 14;
|
|
|
|
rcBox.right = 88; rcBox.bottom = 32;
|
|
|
|
DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED , BF_RECT );
|
|
|
|
|
|
|
|
rcBox.left = 86; rcBox.top = 14;
|
|
|
|
rcBox.right = 173; rcBox.bottom = 32;
|
|
|
|
DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED , BF_RECT );
|
|
|
|
|
|
|
|
rcBox.left = 171; rcBox.top = 14;
|
|
|
|
rcBox.right = 320; rcBox.bottom = 32;
|
|
|
|
DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED , BF_RECT );
|
|
|
|
|
|
|
|
hOldFont = (HFONT)SelectObject( ps.hdc,GetStockObject(DEFAULT_GUI_FONT ) );
|
|
|
|
OldBkMode = SetBkMode( ps.hdc, TRANSPARENT );
|
|
|
|
|
|
|
|
TextOut( ps.hdc, 23,16,"Offset",6);
|
|
|
|
TextOut( ps.hdc, 97,16,"Instruction",11);
|
|
|
|
TextOut( ps.hdc, 180,16,"Arguments",9);
|
|
|
|
TextOut( ps.hdc, 354,2," Address ",9);
|
|
|
|
TextOut( ps.hdc, 358,19,"0x",2);
|
|
|
|
|
|
|
|
SelectObject( ps.hdc,hOldFont );
|
|
|
|
SetBkMode( ps.hdc, OldBkMode );
|
|
|
|
|
|
|
|
EndPaint( hDlg, &ps );
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void RefreshRSPCommands ( void )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DWORD location, LinesUsed;
|
|
|
|
char AsciiAddress[20];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
if (InRSPCommandsWindow == FALSE) { return; }
|
|
|
|
|
|
|
|
GetWindowText(hAddress,AsciiAddress,sizeof(AsciiAddress));
|
|
|
|
location = AsciiToHex(AsciiAddress) & ~3;
|
|
|
|
|
|
|
|
if (location > 0xF88) { location = 0xF88; }
|
2015-03-18 04:50:48 +00:00
|
|
|
for (count = 0 ; count < RSP_MaxCommandLines; count += LinesUsed )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
LinesUsed = DisplayRSPCommand ( location, count );
|
|
|
|
location += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case WM_INITDIALOG:
|
|
|
|
RSPCommandshWnd = hDlg;
|
|
|
|
RSP_Commands_Setup( hDlg );
|
|
|
|
break;
|
|
|
|
case WM_MOVE:
|
|
|
|
//StoreCurrentWinPos("RSP Commands",hDlg);
|
|
|
|
break;
|
|
|
|
case WM_DRAWITEM:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (wParam == IDC_LIST)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DrawRSPCommand (lParam);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_PAINT:
|
|
|
|
Paint_RSP_Commands( hDlg );
|
|
|
|
RedrawWindow(hScrlBar,NULL,NULL, RDW_INVALIDATE |RDW_ERASE);
|
|
|
|
return TRUE;
|
|
|
|
case WM_COMMAND:
|
2015-03-18 04:50:48 +00:00
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case IDC_LIST:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (HIWORD(wParam) == LBN_DBLCLK )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DWORD Location, Selected;
|
|
|
|
Selected = SendMessage(hList,LB_GETCURSEL,(WPARAM)0, (LPARAM)0);
|
|
|
|
Location = RSPCommandLine[Selected].Location;
|
2015-03-18 04:50:48 +00:00
|
|
|
if (Location != (DWORD)-1)
|
|
|
|
{
|
|
|
|
if (CheckForRSPBPoint(Location))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
RemoveRSPBreakPoint(Location);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
AddRSP_BPoint(Location, FALSE);
|
|
|
|
}
|
|
|
|
RefreshRSPCommands();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDC_ADDRESS:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (HIWORD(wParam) == EN_CHANGE )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
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:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_BPoint_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DebugInfo.Enter_BPoint_Window();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDC_RSP_REGISTERS_BUTTON:
|
|
|
|
Enter_RSP_Register_Window();
|
|
|
|
break;
|
|
|
|
case IDC_R4300I_DEBUGGER_BUTTON:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_R4300i_Commands_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DebugInfo.Enter_R4300i_Commands_Window();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDC_R4300I_REGISTERS_BUTTON:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_R4300i_Register_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DebugInfo.Enter_R4300i_Register_Window();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDC_MEMORY_BUTTON:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_Memory_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DebugInfo.Enter_Memory_Window();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog( hDlg, IDCANCEL );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_VSCROLL:
|
2015-03-18 04:50:48 +00:00
|
|
|
if ((HWND)lParam == hScrlBar)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
DWORD location;
|
|
|
|
char Value[20];
|
|
|
|
SCROLLINFO si;
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
GetWindowText(hAddress,Value,sizeof(Value));
|
|
|
|
location = AsciiToHex(Value) & ~3;
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
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:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (location < 0xF88)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
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);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
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:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (location > 0x4 )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
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);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Value,"%03X",0);
|
|
|
|
SetWindowText(hAddress,Value);
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
si.nPos = 0;
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SB_PAGEDOWN:
|
2015-03-18 04:50:48 +00:00
|
|
|
if ((location + 0x74)< 0xF88)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Value,"%03X",location + 0x74);
|
|
|
|
SetWindowText(hAddress,Value);
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
si.nPos = ((location + 0x74) >> 2);
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Value,"%03X",0xF88);
|
|
|
|
SetWindowText(hAddress,Value);
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
si.nPos = (0xF8F >> 2);
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SB_PAGEUP:
|
2015-03-18 04:50:48 +00:00
|
|
|
if ((location - 0x74) > 0x74 )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Value,"%03X",location - 0x74);
|
|
|
|
SetWindowText(hAddress,Value);
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
si.nPos = ((location - 0x74) >> 2);
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Value,"%03X",0);
|
|
|
|
SetWindowText(hAddress,Value);
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
si.nPos = 0;
|
|
|
|
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void RSP_Commands_Setup ( HWND hDlg )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
#define WindowWidth 457
|
|
|
|
#define WindowHeight 494
|
|
|
|
char Location[10];
|
|
|
|
DWORD X, Y, WndPos;
|
|
|
|
|
|
|
|
hList = CreateWindowEx(WS_EX_STATICEDGE, "LISTBOX","", WS_CHILD | WS_VISIBLE |
|
|
|
|
LBS_OWNERDRAWFIXED | LBS_NOTIFY,14,30,303,445, hDlg,
|
|
|
|
(HMENU)IDC_LIST, hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if ( hList)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hList,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
SendMessage(hList,LB_SETITEMHEIGHT, (WPARAM)0,(LPARAM)MAKELPARAM(14, 0));
|
|
|
|
}
|
|
|
|
|
2015-05-16 00:55:23 +00:00
|
|
|
sprintf(Location, "%03X", PrgCount ? *PrgCount : 0);
|
2008-11-14 20:47:53 +00:00
|
|
|
hAddress = CreateWindowEx(0,"EDIT",Location, WS_CHILD | ES_UPPERCASE | WS_VISIBLE |
|
|
|
|
WS_BORDER | WS_TABSTOP,375,17,36,18, hDlg,(HMENU)IDC_ADDRESS,hinstDLL, NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hAddress)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hAddress,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
SendMessage(hAddress,EM_SETLIMITTEXT, (WPARAM)3,(LPARAM)0);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
2008-11-14 20:47:53 +00:00
|
|
|
|
|
|
|
hFunctionlist = CreateWindowEx(0,"COMBOBOX","", WS_CHILD | WS_VSCROLL |
|
|
|
|
CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP,352,56,89,150,hDlg,
|
|
|
|
(HMENU)IDC_FUNCTION_COMBO,hinstDLL,NULL);
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hFunctionlist)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hFunctionlist,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
|
|
|
|
hGoButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Go", WS_CHILD |
|
|
|
|
BS_DEFPUSHBUTTON | WS_VISIBLE | WS_TABSTOP, 347,56,100,24, hDlg,(HMENU)IDC_GO_BUTTON,
|
|
|
|
hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hGoButton)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hGoButton,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
hBreakButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Break", WS_DISABLED |
|
|
|
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,85,100,24,hDlg,
|
|
|
|
(HMENU)IDC_BREAK_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hBreakButton)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hBreakButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
|
|
|
|
hStepButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Step", WS_CHILD |
|
|
|
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,114,100,24,hDlg,
|
|
|
|
(HMENU)IDC_STEP_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hStepButton)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hStepButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
|
|
|
|
hSkipButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Skip", WS_CHILD |
|
|
|
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,143,100,24,hDlg,
|
|
|
|
(HMENU)IDC_SKIP_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hSkipButton)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hSkipButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
|
|
|
|
WndPos = 324;
|
|
|
|
if (DebugInfo.Enter_BPoint_Window == NULL) { WndPos += 29;}
|
|
|
|
if (DebugInfo.Enter_R4300i_Commands_Window == NULL) { WndPos += 29;}
|
|
|
|
if (DebugInfo.Enter_R4300i_Register_Window == NULL) { WndPos += 29;}
|
|
|
|
if (DebugInfo.Enter_Memory_Window == NULL) { WndPos += 29;}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_BPoint_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
hBPButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Break Points", WS_CHILD |
|
|
|
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
|
|
|
(HMENU)IDC_BP_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hBPButton)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hBPButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WndPos += 29;
|
|
|
|
hRSPRegisters = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "RSP &Registers...",
|
|
|
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
|
|
|
(HMENU)IDC_RSP_REGISTERS_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hRSPRegisters)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hRSPRegisters,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
|
|
|
|
WndPos += 29;
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_R4300i_Commands_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
hR4300iDebugger = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "R4300i &Debugger...",
|
|
|
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
|
|
|
(HMENU)IDC_R4300I_DEBUGGER_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hR4300iDebugger)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hR4300iDebugger,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WndPos += 29;
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_R4300i_Register_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
hR4300iRegisters = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON","R4300i R&egisters...",
|
|
|
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
|
|
|
(HMENU)IDC_R4300I_REGISTERS_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hR4300iRegisters)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hR4300iRegisters,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WndPos += 29;
|
2015-03-18 04:50:48 +00:00
|
|
|
if (DebugInfo.Enter_Memory_Window != NULL)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
hMemory = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "&Memory...", WS_CHILD |
|
|
|
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
|
|
|
(HMENU)IDC_MEMORY_BUTTON,hinstDLL,NULL );
|
2015-03-18 04:50:48 +00:00
|
|
|
if (hMemory)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
SendMessage(hMemory,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
}
|
|
|
|
}
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
hScrlBar = CreateWindowEx(WS_EX_STATICEDGE, "SCROLLBAR","", WS_CHILD | WS_VISIBLE |
|
|
|
|
WS_TABSTOP | SBS_VERT, 318,14,18,439, hDlg, (HMENU)IDC_SCRL_BAR, hinstDLL, NULL );
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if ( RSP_Running )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
Enable_RSP_Commands_Window();
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
Disable_RSP_Commands_Window();
|
|
|
|
}
|
2015-03-18 04:50:48 +00:00
|
|
|
|
2008-11-14 20:47:53 +00:00
|
|
|
//if ( !GetStoredWinPos("RSP Commands", &X, &Y ) ) {
|
|
|
|
X = (GetSystemMetrics( SM_CXSCREEN ) - WindowWidth) / 2;
|
|
|
|
Y = (GetSystemMetrics( SM_CYSCREEN ) - WindowHeight) / 2;
|
|
|
|
//}
|
|
|
|
SetWindowText(hDlg,"RSP Commands");
|
|
|
|
|
2015-01-29 08:57:13 +00:00
|
|
|
SetWindowPos(hDlg,NULL,X,Y,WindowWidth,WindowHeight, SWP_NOZORDER | SWP_SHOWWINDOW);
|
2008-11-14 20:47:53 +00:00
|
|
|
}
|
|
|
|
|
2015-06-20 03:45:17 +00:00
|
|
|
static const char unused_op[] = "invalid";
|
|
|
|
static const char* mnemonics_primary[8 << 3] = {
|
|
|
|
"SPECIAL","REGIMM" ,"J" ,"JAL" ,"BEQ" ,"BNE" ,"BLEZ" ,"BGTZ" ,
|
|
|
|
"ADDI" ,"ADDIU" ,"SLTI" ,"SLTIU" ,"ANDI" ,"ORI" ,"XORI" ,"LUI" ,
|
|
|
|
"COP0" ,unused_op,"COP2" ,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
"LB" ,"LH" ,unused_op,"LW" ,"LBU" ,"LHU" ,unused_op,unused_op,
|
|
|
|
"SB" ,"SH" ,unused_op,"SW" ,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,"LWC2" ,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,"SWC2" ,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
};/* 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 */
|
2015-06-20 03:47:18 +00:00
|
|
|
static const char* mnemonics_special[8 << 3] = {
|
|
|
|
"SLL" ,unused_op,"SRL" ,"SRA" ,"SLLV" ,unused_op,"SRLV" ,"SRAV" ,
|
|
|
|
"JR" ,"JALR" ,unused_op,unused_op,unused_op,"BREAK" ,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
"ADD" ,"ADDU" ,"SUB" ,"SUBU" ,"AND" ,"OR" ,"XOR" ,"NOR" ,
|
|
|
|
unused_op,unused_op,"SLT" ,"SLTU" ,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
};/* 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 */
|
2015-06-20 03:59:36 +00:00
|
|
|
static const char* mnemonics_regimm[8 << 2] = {
|
|
|
|
"BLTZ" ,"BGEZ" ,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
"BLTZAL" ,"BGEZAL" ,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
};/* 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 */
|
2015-06-20 04:03:22 +00:00
|
|
|
static const char* mnemonics_cop0[8 << 2] = {
|
|
|
|
"MFC0" ,unused_op,unused_op,unused_op,"MTC0" ,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
};/* 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 */
|
2015-06-20 04:05:49 +00:00
|
|
|
static const char* mnemonics_cop2[8 << 2] = {
|
|
|
|
"MFC2" ,unused_op,"CFC2" ,unused_op,"MTC2" ,unused_op,"CTC2" ,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,
|
|
|
|
"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,"C2" ,
|
|
|
|
};/* 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 */
|
2015-06-20 04:07:19 +00:00
|
|
|
static const char* mnemonics_vector[8 << 3] = {
|
|
|
|
"VMULF" ,"VMULU" ,unused_op,unused_op,"VMUDL" ,"VMUDM" ,"VMUDN" ,"VMUDH" ,
|
|
|
|
"VMACF" ,"VMACU" ,unused_op,"VMACQ" ,"VMADL" ,"VMADM" ,"VMADN" ,"VMADH" ,
|
|
|
|
"VADD" ,"VSUB" ,unused_op,"VABS" ,"VADDC" ,"VSUBC" ,unused_op,unused_op,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,"VSAW" ,unused_op,unused_op,
|
|
|
|
"VLT" ,"VEQ" ,"VNE" ,"VGE" ,"VCL" ,"VCH" ,"VCR" ,"VMRG" ,
|
|
|
|
"VAND" ,"VNAND" ,"VOR" ,"VNOR" ,"VXOR" ,"VNXOR" ,unused_op,unused_op,
|
|
|
|
"VRCP" ,"VRCPL" ,"VRCPH" ,"VMOV" ,"VRSQ" ,"VRSQL" ,"VRSQH" ,"VNOP" ,
|
|
|
|
unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,unused_op,
|
|
|
|
};/* 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 */
|
2015-06-20 03:45:17 +00:00
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPSpecialName ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
2015-01-29 08:57:13 +00:00
|
|
|
|
|
|
|
PC = PC; // unused
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
switch (command.funct)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case RSP_SPECIAL_SLL:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (command.rd != 0)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(CommandName,"SLL\t%s, %s, 0x%X",GPR_Name(command.rd),
|
|
|
|
GPR_Name(command.rt), command.sa);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(CommandName,"NOP");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SRL:
|
|
|
|
sprintf(CommandName,"SRL\t%s, %s, 0x%X",GPR_Name(command.rd),
|
|
|
|
GPR_Name(command.rt), command.sa);
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SRA:
|
|
|
|
sprintf(CommandName,"SRA\t%s, %s, 0x%X",GPR_Name(command.rd),
|
|
|
|
GPR_Name(command.rt), command.sa);
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SLLV:
|
|
|
|
sprintf(CommandName,"SLLV\t%s, %s, %s",GPR_Name(command.rd),
|
|
|
|
GPR_Name(command.rt), GPR_Name(command.rs));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SRLV:
|
|
|
|
sprintf(CommandName,"SRLV\t%s, %s, %s",GPR_Name(command.rd),
|
|
|
|
GPR_Name(command.rt), GPR_Name(command.rs));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SRAV:
|
|
|
|
sprintf(CommandName,"SRAV\t%s, %s, %s",GPR_Name(command.rd),
|
|
|
|
GPR_Name(command.rt), GPR_Name(command.rs));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_JR:
|
|
|
|
sprintf(CommandName,"JR\t%s",GPR_Name(command.rs));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_JALR:
|
|
|
|
sprintf(CommandName,"JALR\t%s, %s",GPR_Name(command.rd),GPR_Name(command.rs));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_BREAK:
|
|
|
|
sprintf(CommandName,"BREAK");
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_ADD:
|
|
|
|
sprintf(CommandName,"ADD\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_ADDU:
|
|
|
|
sprintf(CommandName,"ADDU\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SUB:
|
|
|
|
sprintf(CommandName,"SUB\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SUBU:
|
|
|
|
sprintf(CommandName,"SUBU\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_AND:
|
|
|
|
sprintf(CommandName,"AND\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_OR:
|
|
|
|
sprintf(CommandName,"OR\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_XOR:
|
|
|
|
sprintf(CommandName,"XOR\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_NOR:
|
|
|
|
sprintf(CommandName,"NOR\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SLT:
|
|
|
|
sprintf(CommandName,"SLT\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
case RSP_SPECIAL_SLTU:
|
|
|
|
sprintf(CommandName,"SLTU\t%s, %s, %s",GPR_Name(command.rd),GPR_Name(command.rs),
|
|
|
|
GPR_Name(command.rt));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPRegimmName ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
2015-06-20 03:59:36 +00:00
|
|
|
|
|
|
|
if (strcmp(mnemonics_regimm[command.rt], unused_op) == 0)
|
|
|
|
{
|
|
|
|
sprintf(
|
|
|
|
CommandName,
|
|
|
|
"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],
|
|
|
|
command.Ascii[2],
|
|
|
|
command.Ascii[1],
|
|
|
|
command.Ascii[0]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else if (command.rt == RSP_REGIMM_BGEZAL && command.rs == 0)
|
|
|
|
{ /* MIPS pseudo-instruction: BAL (Branch and Link) */
|
|
|
|
sprintf(
|
|
|
|
CommandName,
|
|
|
|
"BAL\t0x%03X",
|
|
|
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
2015-03-18 04:50:48 +00:00
|
|
|
{
|
2015-06-20 03:59:36 +00:00
|
|
|
sprintf(
|
|
|
|
CommandName,
|
|
|
|
"%s\t%s, 0x%03X",
|
|
|
|
mnemonics_regimm[command.rt],
|
|
|
|
GPR_Name(command.rs),
|
|
|
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC
|
|
|
|
);
|
2008-11-14 20:47:53 +00:00
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPCop0Name ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
2015-01-29 08:57:13 +00:00
|
|
|
|
|
|
|
PC = PC; // unused
|
|
|
|
|
2015-06-20 04:03:22 +00:00
|
|
|
if (strcmp(mnemonics_cop0[command.rs], unused_op) == 0)
|
2015-03-18 04:50:48 +00:00
|
|
|
{
|
2015-06-20 04:03:22 +00:00
|
|
|
sprintf(
|
|
|
|
CommandName,
|
|
|
|
"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],
|
|
|
|
command.Ascii[2],
|
|
|
|
command.Ascii[1],
|
|
|
|
command.Ascii[0]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(
|
|
|
|
CommandName,
|
|
|
|
"%s\t%s, %s",
|
|
|
|
mnemonics_cop0[command.rs],
|
|
|
|
GPR_Name(command.rt),
|
|
|
|
COP0_Name(command.rd)
|
|
|
|
);
|
2008-11-14 20:47:53 +00:00
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPCop2Name ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
2015-01-29 08:57:13 +00:00
|
|
|
|
|
|
|
PC = PC; // unused
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
if ( ( command.rs & 0x10 ) == 0 )
|
|
|
|
{
|
|
|
|
switch (command.rs)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case RSP_COP2_MF:
|
|
|
|
sprintf(CommandName,"MFC2\t%s, $v%d [%d]",GPR_Name(command.rt),
|
|
|
|
command.rd, command.sa >> 1);
|
|
|
|
break;
|
|
|
|
case RSP_COP2_CF:
|
|
|
|
sprintf(CommandName,"CFC2\t%s, %d",GPR_Name(command.rt),
|
|
|
|
command.rd % 4);
|
|
|
|
break;
|
|
|
|
case RSP_COP2_MT:
|
|
|
|
sprintf(CommandName,"MTC2\t%s, $v%d [%d]",GPR_Name(command.rt),
|
|
|
|
command.rd, command.sa >> 1);
|
|
|
|
break;
|
|
|
|
case RSP_COP2_CT:
|
|
|
|
sprintf(CommandName,"CTC2\t%s, %d",GPR_Name(command.rt),
|
|
|
|
command.rd % 4);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
|
|
|
}
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (command.funct)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case RSP_VECTOR_VMULF:
|
|
|
|
sprintf(CommandName,"VMULF\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMULU:
|
|
|
|
sprintf(CommandName,"VMULU\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRNDP:
|
|
|
|
sprintf(CommandName,"VRNDP\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMULQ:
|
|
|
|
sprintf(CommandName,"VMULQ\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMUDL:
|
|
|
|
sprintf(CommandName,"VMUDL\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMUDM:
|
|
|
|
sprintf(CommandName,"VMUDM\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMUDN:
|
|
|
|
sprintf(CommandName,"VMUDN\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMUDH:
|
|
|
|
sprintf(CommandName,"VMUDH\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMACF:
|
|
|
|
sprintf(CommandName,"VMACF\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMACU:
|
|
|
|
sprintf(CommandName,"VMACU\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRNDN:
|
|
|
|
sprintf(CommandName,"VRNDN\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMACQ:
|
|
|
|
sprintf(CommandName,"VMACQ\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMADL:
|
|
|
|
sprintf(CommandName,"VMADL\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMADM:
|
|
|
|
sprintf(CommandName,"VMADM\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMADN:
|
|
|
|
sprintf(CommandName,"VMADN\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMADH:
|
|
|
|
sprintf(CommandName,"VMADH\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VADD:
|
|
|
|
sprintf(CommandName,"VADD\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VSUB:
|
|
|
|
sprintf(CommandName,"VSUB\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VABS:
|
|
|
|
sprintf(CommandName,"VABS\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VADDC:
|
|
|
|
sprintf(CommandName,"VADDC\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VSUBC:
|
|
|
|
sprintf(CommandName,"VSUBC\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VSAW:
|
|
|
|
sprintf(CommandName,"VSAW\t$v%d [%d], $v%d, $v%d ",command.sa, (command.rs & 0xF),
|
|
|
|
command.rd, command.rt);
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VLT:
|
|
|
|
sprintf(CommandName,"VLT\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VEQ:
|
|
|
|
sprintf(CommandName,"VEQ\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VNE:
|
|
|
|
sprintf(CommandName,"VNE\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VGE:
|
|
|
|
sprintf(CommandName,"VGE\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VCL:
|
|
|
|
sprintf(CommandName,"VCL\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VCH:
|
|
|
|
sprintf(CommandName,"VCH\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VCR:
|
|
|
|
sprintf(CommandName,"VCR\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMRG:
|
|
|
|
sprintf(CommandName,"VMRG\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VAND:
|
|
|
|
sprintf(CommandName,"VAND\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VNAND:
|
|
|
|
sprintf(CommandName,"VNAND\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VOR:
|
|
|
|
sprintf(CommandName,"VOR\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VNOR:
|
|
|
|
sprintf(CommandName,"VNOR\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VXOR:
|
|
|
|
sprintf(CommandName,"VXOR\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VNXOR:
|
|
|
|
sprintf(CommandName,"VNXOR\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRCP:
|
|
|
|
sprintf(CommandName,"VRCP\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRCPL:
|
|
|
|
sprintf(CommandName,"VRCPL\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRCPH:
|
|
|
|
sprintf(CommandName,"VRCPH\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VMOV:
|
|
|
|
sprintf(CommandName,"VMOV\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRSQ:
|
|
|
|
sprintf(CommandName,"VRSQ\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRSQL:
|
|
|
|
sprintf(CommandName,"VRSQL\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VRSQH:
|
|
|
|
sprintf(CommandName,"VRSQH\t$v%d [%d], $v%d%s",command.sa, (command.rd & 0x7),
|
|
|
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
|
|
|
break;
|
|
|
|
case RSP_VECTOR_VNOOP:
|
|
|
|
sprintf(CommandName,"VNOOP");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPLc2Name ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
|
|
|
|
2015-01-29 08:57:13 +00:00
|
|
|
PC = PC; // unused
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
switch (command.rd)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case RSP_LSC2_BV:
|
|
|
|
sprintf(CommandName,"LBV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
command.voffset, GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_SV:
|
|
|
|
sprintf(CommandName,"LSV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 1), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_LV:
|
|
|
|
sprintf(CommandName,"LLV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 2), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_DV:
|
|
|
|
sprintf(CommandName,"LDV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 3), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_QV:
|
|
|
|
sprintf(CommandName,"LQV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_RV:
|
|
|
|
sprintf(CommandName,"LRV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_PV:
|
|
|
|
sprintf(CommandName,"LPV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 3), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_UV:
|
|
|
|
sprintf(CommandName,"LUV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 3), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_HV:
|
|
|
|
sprintf(CommandName,"LHV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_FV:
|
|
|
|
sprintf(CommandName,"LFV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_WV:
|
|
|
|
sprintf(CommandName,"LWV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_TV:
|
|
|
|
sprintf(CommandName,"LTV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPSc2Name ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
|
|
|
|
2015-01-29 08:57:13 +00:00
|
|
|
PC = PC; // unused
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
switch (command.rd)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case RSP_LSC2_BV:
|
|
|
|
sprintf(CommandName,"SBV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
command.voffset, GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_SV:
|
|
|
|
sprintf(CommandName,"SSV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 1), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_LV:
|
|
|
|
sprintf(CommandName,"SLV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 2), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_DV:
|
|
|
|
sprintf(CommandName,"SDV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 3), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_QV:
|
|
|
|
sprintf(CommandName,"SQV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_RV:
|
|
|
|
sprintf(CommandName,"SRV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_PV:
|
|
|
|
sprintf(CommandName,"SPV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 3), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_UV:
|
|
|
|
sprintf(CommandName,"SUV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 3), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_HV:
|
|
|
|
sprintf(CommandName,"SHV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_FV:
|
|
|
|
sprintf(CommandName,"SFV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_WV:
|
|
|
|
sprintf(CommandName,"SWV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LSC2_TV:
|
|
|
|
sprintf(CommandName,"STV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
|
|
|
(command.voffset << 4), GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
char * RSPOpcodeName ( DWORD OpCode, DWORD PC )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
OPCODE command;
|
|
|
|
command.Hex = OpCode;
|
2015-03-18 04:50:48 +00:00
|
|
|
|
|
|
|
switch (command.op)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
case RSP_SPECIAL:
|
|
|
|
return RSPSpecialName(OpCode,PC);
|
|
|
|
break;
|
|
|
|
case RSP_REGIMM:
|
|
|
|
return RSPRegimmName(OpCode,PC);
|
|
|
|
break;
|
|
|
|
case RSP_J:
|
|
|
|
sprintf(CommandName,"J\t0x%03X",(command.target << 2) & 0xFFC);
|
|
|
|
break;
|
|
|
|
case RSP_JAL:
|
|
|
|
sprintf(CommandName,"JAL\t0x%03X",(command.target << 2) & 0xFFC);
|
|
|
|
break;
|
|
|
|
case RSP_BEQ:
|
2015-03-18 04:50:48 +00:00
|
|
|
if (command.rs == 0 && command.rt == 0)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(CommandName,"B\t0x%03X",(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else if (command.rs == 0 || command.rt == 0)
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(CommandName,"BEQZ\t%s, 0x%03X",GPR_Name(command.rs == 0 ? command.rt : command.rs),
|
|
|
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(CommandName,"BEQ\t%s, %s, 0x%03X",GPR_Name(command.rs),GPR_Name(command.rt),
|
|
|
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RSP_BNE:
|
|
|
|
sprintf(CommandName,"BNE\t%s, %s, 0x%03X",GPR_Name(command.rs),GPR_Name(command.rt),
|
|
|
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
|
|
|
break;
|
|
|
|
case RSP_BLEZ:
|
|
|
|
sprintf(CommandName,"BLEZ\t%s, 0x%03X",GPR_Name(command.rs),(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
|
|
|
break;
|
|
|
|
case RSP_BGTZ:
|
|
|
|
sprintf(CommandName,"BGTZ\t%s, 0x%03X",GPR_Name(command.rs),(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
|
|
|
break;
|
|
|
|
case RSP_ADDI:
|
|
|
|
sprintf(CommandName,"ADDI\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_ADDIU:
|
|
|
|
sprintf(CommandName,"ADDIU\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_SLTI:
|
|
|
|
sprintf(CommandName,"SLTI\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_SLTIU:
|
|
|
|
sprintf(CommandName,"SLTIU\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_ANDI:
|
|
|
|
sprintf(CommandName,"ANDI\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_ORI:
|
|
|
|
sprintf(CommandName,"ORI\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_XORI:
|
|
|
|
sprintf(CommandName,"XORI\t%s, %s, 0x%04X",GPR_Name(command.rt), GPR_Name(command.rs),
|
|
|
|
command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_LUI:
|
|
|
|
sprintf(CommandName,"LUI\t%s, 0x%04X",GPR_Name(command.rt), command.immediate);
|
|
|
|
break;
|
|
|
|
case RSP_CP0:
|
|
|
|
return RSPCop0Name(OpCode,PC);
|
|
|
|
break;
|
|
|
|
case RSP_CP2:
|
|
|
|
return RSPCop2Name(OpCode,PC);
|
|
|
|
break;
|
|
|
|
case RSP_LB:
|
|
|
|
sprintf(CommandName,"LB\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LH:
|
|
|
|
sprintf(CommandName,"LH\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LW:
|
|
|
|
sprintf(CommandName,"LW\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LBU:
|
|
|
|
sprintf(CommandName,"LBU\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LHU:
|
|
|
|
sprintf(CommandName,"LHU\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_SB:
|
|
|
|
sprintf(CommandName,"SB\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_SH:
|
|
|
|
sprintf(CommandName,"SH\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_SW:
|
|
|
|
sprintf(CommandName,"SW\t%s, 0x%04X(%s)",GPR_Name(command.rt), command.offset,
|
|
|
|
GPR_Name(command.base));
|
|
|
|
break;
|
|
|
|
case RSP_LC2:
|
|
|
|
return RSPLc2Name(OpCode,PC);
|
|
|
|
break;
|
|
|
|
case RSP_SC2:
|
|
|
|
return RSPSc2Name(OpCode,PC);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
|
|
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
|
|
|
}
|
|
|
|
return CommandName;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void SetRSPCommandToRunning ( void )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
Stepping_Commands = FALSE;
|
|
|
|
if (InRSPCommandsWindow == FALSE) { return; }
|
|
|
|
EnableWindow(hGoButton, FALSE);
|
|
|
|
EnableWindow(hBreakButton, TRUE);
|
|
|
|
EnableWindow(hStepButton, FALSE);
|
|
|
|
EnableWindow(hSkipButton, FALSE);
|
|
|
|
SendMessage(RSPCommandshWnd, DM_SETDEFID,IDC_BREAK_BUTTON,0);
|
|
|
|
SendMessage(hGoButton, BM_SETSTYLE,BS_PUSHBUTTON,TRUE);
|
|
|
|
SendMessage(hBreakButton, BM_SETSTYLE,BS_DEFPUSHBUTTON,TRUE);
|
|
|
|
SetFocus(hBreakButton);
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void SetRSPCommandToStepping ( void )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
if (InRSPCommandsWindow == FALSE) { return; }
|
|
|
|
EnableWindow(hGoButton, TRUE);
|
|
|
|
EnableWindow(hBreakButton, FALSE);
|
|
|
|
EnableWindow(hStepButton, TRUE);
|
|
|
|
EnableWindow(hSkipButton, TRUE);
|
|
|
|
SendMessage(hBreakButton, BM_SETSTYLE, BS_PUSHBUTTON,TRUE);
|
|
|
|
SendMessage(hStepButton, BM_SETSTYLE, BS_DEFPUSHBUTTON,TRUE);
|
|
|
|
SendMessage(RSPCommandshWnd, DM_SETDEFID,IDC_STEP_BUTTON,0);
|
|
|
|
SetFocus(hStepButton);
|
|
|
|
Stepping_Commands = TRUE;
|
|
|
|
}
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
void SetRSPCommandViewto ( UINT NewLocation )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
unsigned int location;
|
|
|
|
char Value[20];
|
|
|
|
|
|
|
|
if (InRSPCommandsWindow == FALSE) { return; }
|
|
|
|
|
|
|
|
GetWindowText(hAddress,Value,sizeof(Value));
|
|
|
|
location = AsciiToHex(Value) & ~3;
|
|
|
|
|
2015-03-18 04:50:48 +00:00
|
|
|
if ( NewLocation < location || NewLocation >= location + 120 )
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
sprintf(Value,"%03X",NewLocation);
|
|
|
|
SetWindowText(hAddress,Value);
|
2015-03-18 04:50:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-14 20:47:53 +00:00
|
|
|
RefreshRSPCommands();
|
|
|
|
}
|
|
|
|
}
|