mirror of https://github.com/PCSX2/pcsx2.git
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@407 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
e4e6d8ad3a
commit
57616b8916
1989
pcsx2/CDVD.c
1989
pcsx2/CDVD.c
File diff suppressed because it is too large
Load Diff
144
pcsx2/CDVD.h
144
pcsx2/CDVD.h
|
@ -1,144 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __CDVD_H__
|
||||
#define __CDVD_H__
|
||||
|
||||
#include "PsxCommon.h"
|
||||
|
||||
typedef struct {
|
||||
u8 status;
|
||||
u8 second;
|
||||
u8 minute;
|
||||
u8 hour;
|
||||
u8 pad;
|
||||
u8 day;
|
||||
u8 month;
|
||||
u8 year;
|
||||
} cdvdRTC;
|
||||
|
||||
typedef struct {
|
||||
u8 nCommand;
|
||||
u8 Ready;
|
||||
u8 Error;
|
||||
u8 PwOff;
|
||||
u8 Status;
|
||||
u8 Type;
|
||||
u8 sCommand;
|
||||
u8 sDataIn;
|
||||
u8 sDataOut;
|
||||
u8 HowTo;
|
||||
|
||||
u8 Param[32];
|
||||
u8 Result[32];
|
||||
|
||||
u8 ParamC;
|
||||
u8 ParamP;
|
||||
u8 ResultC;
|
||||
u8 ResultP;
|
||||
|
||||
u8 CBlockIndex;
|
||||
u8 COffset;
|
||||
u8 CReadWrite;
|
||||
u8 CNumBlocks;
|
||||
|
||||
int RTCcount;
|
||||
cdvdRTC RTC;
|
||||
|
||||
u32 Sector;
|
||||
int nSectors;
|
||||
int Readed;
|
||||
int Reading;
|
||||
int ReadMode;
|
||||
int BlockSize;
|
||||
int Speed;
|
||||
int RetryCnt;
|
||||
int RetryCntP;
|
||||
int RErr;
|
||||
int SpindlCtrl;
|
||||
|
||||
u8 Key[16];
|
||||
u8 KeyXor;
|
||||
u8 decSet;
|
||||
|
||||
u8 mg_buffer[65536];
|
||||
int mg_size;
|
||||
int mg_maxsize;
|
||||
int mg_datatype;//0-data(encrypted); 1-header
|
||||
u8 mg_kbit[16];//last BIT key 'seen'
|
||||
u8 mg_kcon[16];//last content key 'seen'
|
||||
// char Unused[4096];
|
||||
} cdvdStruct;
|
||||
|
||||
extern cdvdStruct cdvd;
|
||||
|
||||
void cdvdReset();
|
||||
void cdvdReadTimeRcnt(int mode);
|
||||
void cdvdVsync();
|
||||
int cdvdInterrupt();
|
||||
int cdvdFreeze(gzFile f, int Mode);
|
||||
void cdvdReadInterrupt();
|
||||
void cdvdNewDiskCB();
|
||||
u8 cdvdRead04(void);
|
||||
u8 cdvdRead05(void);
|
||||
u8 cdvdRead06(void);
|
||||
u8 cdvdRead07(void);
|
||||
u8 cdvdRead08(void);
|
||||
u8 cdvdRead0A(void);
|
||||
u8 cdvdRead0B(void);
|
||||
u8 cdvdRead0C(void);
|
||||
u8 cdvdRead0D(void);
|
||||
u8 cdvdRead0E(void);
|
||||
u8 cdvdRead0F(void);
|
||||
u8 cdvdRead13(void);
|
||||
u8 cdvdRead15(void);
|
||||
u8 cdvdRead16(void);
|
||||
u8 cdvdRead17(void);
|
||||
u8 cdvdRead18(void);
|
||||
u8 cdvdRead20(void);
|
||||
u8 cdvdRead21(void);
|
||||
u8 cdvdRead22(void);
|
||||
u8 cdvdRead23(void);
|
||||
u8 cdvdRead24(void);
|
||||
u8 cdvdRead28(void);
|
||||
u8 cdvdRead29(void);
|
||||
u8 cdvdRead2A(void);
|
||||
u8 cdvdRead2B(void);
|
||||
u8 cdvdRead2C(void);
|
||||
u8 cdvdRead30(void);
|
||||
u8 cdvdRead31(void);
|
||||
u8 cdvdRead32(void);
|
||||
u8 cdvdRead33(void);
|
||||
u8 cdvdRead34(void);
|
||||
u8 cdvdRead38(void);
|
||||
u8 cdvdRead39(void);
|
||||
u8 cdvdRead3A(void);
|
||||
void cdvdWrite04(u8 rt);
|
||||
void cdvdWrite05(u8 rt);
|
||||
void cdvdWrite06(u8 rt);
|
||||
void cdvdWrite07(u8 rt);
|
||||
void cdvdWrite08(u8 rt);
|
||||
void cdvdWrite0A(u8 rt);
|
||||
void cdvdWrite0F(u8 rt);
|
||||
void cdvdWrite14(u8 rt);
|
||||
void cdvdWrite16(u8 rt);
|
||||
void cdvdWrite17(u8 rt);
|
||||
void cdvdWrite18(u8 rt);
|
||||
void cdvdWrite3A(u8 rt);
|
||||
|
||||
#endif /* __CDVD_H__ */
|
853
pcsx2/CDVDiso.c
853
pcsx2/CDVDiso.c
|
@ -1,853 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/*
|
||||
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
|
||||
* Modified by Florin for PCSX2 emu
|
||||
* Fixed CdRead by linuzappz
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "CDVDiso.h"
|
||||
#include "CDVDisodrv.h"
|
||||
|
||||
struct dir_toc_data{
|
||||
unsigned int start_LBA;
|
||||
unsigned int num_sectors;
|
||||
unsigned int num_entries;
|
||||
unsigned int current_entry;
|
||||
unsigned int current_sector;
|
||||
unsigned int current_sector_offset;
|
||||
unsigned int inc_dirs;
|
||||
unsigned char extension_list[128+1];
|
||||
};
|
||||
|
||||
//static u8 cdVolDescriptor[2048];
|
||||
static struct dir_toc_data getDirTocData;
|
||||
static struct cdVolDesc CDVolDesc;
|
||||
|
||||
void _splitpath2(const char *constpath, char *dir, char *fname){
|
||||
// 255 char max path-length is an ISO9660 restriction
|
||||
// we must change this for Joliet or relaxed iso restriction support
|
||||
static char pathcopy[1024+1];
|
||||
|
||||
char* slash;
|
||||
|
||||
strncpy(pathcopy, constpath, 1024);
|
||||
|
||||
slash = strrchr (pathcopy, '/');
|
||||
|
||||
// if the path doesn't contain a '/' then look for a '\'
|
||||
if (!slash)
|
||||
slash = strrchr (pathcopy, (int)'\\');
|
||||
|
||||
// if a slash was found
|
||||
if (slash != NULL)
|
||||
{
|
||||
// null terminate the path
|
||||
slash[0] = 0;
|
||||
// and copy the path into 'dir'
|
||||
strncpy(dir, pathcopy, 1024);
|
||||
dir[255]=0;
|
||||
|
||||
// copy the filename into 'fname'
|
||||
strncpy(fname, slash+1, 128);
|
||||
fname[128]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir[0] = 0;
|
||||
|
||||
strncpy(fname, pathcopy, 128);
|
||||
fname[128]=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Used in findfile
|
||||
int tolower(int c);
|
||||
int strcasecmp(const char *s1, const char *s2){
|
||||
while (*s1 != '\0' && tolower(*s1) == tolower(*s2))
|
||||
{
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
|
||||
}
|
||||
|
||||
// Copy a TOC Entry from the CD native format to our tidier format
|
||||
void TocEntryCopy(struct TocEntry* tocEntry, struct dirTocEntry* internalTocEntry){
|
||||
int i;
|
||||
int filenamelen;
|
||||
|
||||
tocEntry->fileSize = internalTocEntry->fileSize;
|
||||
tocEntry->fileLBA = internalTocEntry->fileLBA;
|
||||
tocEntry->fileProperties = internalTocEntry->fileProperties;
|
||||
memcpy(tocEntry->date, internalTocEntry->dateStamp, 7);
|
||||
|
||||
if (CDVolDesc.filesystemType == 2){
|
||||
// This is a Joliet Filesystem, so use Unicode to ISO string copy
|
||||
|
||||
filenamelen = internalTocEntry->filenameLength/2;
|
||||
|
||||
if (!(tocEntry->fileProperties & 0x02)){
|
||||
// strip the ;1 from the filename
|
||||
// filenamelen -= 2;//(Florin) nah, do not strip ;1
|
||||
}
|
||||
|
||||
for (i=0; i < filenamelen; i++)
|
||||
tocEntry->filename[i] = internalTocEntry->filename[(i<<1)+1];
|
||||
|
||||
tocEntry->filename[filenamelen] = 0;
|
||||
}
|
||||
else{
|
||||
filenamelen = internalTocEntry->filenameLength;
|
||||
|
||||
if (!(tocEntry->fileProperties & 0x02)){
|
||||
// strip the ;1 from the filename
|
||||
// filenamelen -= 2;//(Florin) nah, do not strip ;1
|
||||
}
|
||||
|
||||
// use normal string copy
|
||||
strncpy(tocEntry->filename,internalTocEntry->filename,128);
|
||||
tocEntry->filename[filenamelen] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if a TOC Entry matches our extension list
|
||||
int TocEntryCompare(char* filename, char* extensions){
|
||||
static char ext_list[129];
|
||||
|
||||
char* token;
|
||||
|
||||
char* ext_point;
|
||||
|
||||
strncpy(ext_list,extensions,128);
|
||||
ext_list[128]=0;
|
||||
|
||||
token = strtok( ext_list, " ," );
|
||||
while( token != NULL )
|
||||
{
|
||||
// if 'token' matches extension of 'filename'
|
||||
// then return a match
|
||||
ext_point = strrchr(filename,'.');
|
||||
|
||||
if (strnicmp(ext_point, token, strlen(token)) == 0)
|
||||
return (TRUE);
|
||||
|
||||
/* Get next token: */
|
||||
token = strtok( NULL, " ," );
|
||||
}
|
||||
|
||||
// If not match found then return FALSE
|
||||
return (FALSE);
|
||||
|
||||
}
|
||||
|
||||
#define CD_SECS 60 /* seconds per minute */
|
||||
#define CD_FRAMES 75 /* frames per second */
|
||||
#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
|
||||
|
||||
int CdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode){
|
||||
u32 i;
|
||||
u8* buff;
|
||||
int rmode;
|
||||
|
||||
switch (mode->datapattern) {
|
||||
case CdSecS2048:
|
||||
rmode = CDVD_MODE_2048; break;
|
||||
case CdSecS2328:
|
||||
rmode = CDVD_MODE_2328; break;
|
||||
case CdSecS2340:
|
||||
rmode = CDVD_MODE_2340; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i=0; i<sectors; i++){
|
||||
if (CDVDreadTrack(lsn+i, rmode)==-1)
|
||||
return 0;
|
||||
buff = CDVDgetBuffer();
|
||||
if (buff==NULL) return 0;
|
||||
FreezeMMXRegs(1);
|
||||
switch (mode->datapattern){
|
||||
case CdSecS2048:
|
||||
memcpy_fast((void*)((uptr)buf+2048*i), buff, 2048);break;//only data
|
||||
case CdSecS2328:
|
||||
memcpy_fast((void*)((uptr)buf+2328*i), buff, 2328);break;//without sync & head & sub
|
||||
case CdSecS2340:
|
||||
memcpy_fast((void*)((uptr)buf+2340*i), buff, 2340);break;//without sync
|
||||
}
|
||||
FreezeMMXRegs(0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DvdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode){
|
||||
u32 i;
|
||||
u8* buff;
|
||||
|
||||
for (i=lsn; i<(lsn+sectors); i++){
|
||||
if (CDVDreadTrack(i, CDVD_MODE_2048)==-1)
|
||||
return 0;
|
||||
buff = CDVDgetBuffer();
|
||||
if (buff==NULL) return 0;
|
||||
|
||||
// switch (mode->datapattern){
|
||||
// case CdSecS2064:
|
||||
((u32*)buf)[0] = i + 0x30000;
|
||||
FreezeMMXRegs(1);
|
||||
memcpy_fast((u8*)buf+12, buff, 2048);
|
||||
FreezeMMXRegs(0);
|
||||
buf = (char*)buf + 2064; break;
|
||||
// default:
|
||||
// return 0;
|
||||
// }
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
* The functions below are not exported for normal file-system *
|
||||
* operations, but are used by the file-system operations, and *
|
||||
* may also be exported for use via RPC *
|
||||
**************************************************************/
|
||||
|
||||
int CDVD_GetVolumeDescriptor(void){
|
||||
// Read until we find the last valid Volume Descriptor
|
||||
int volDescSector;
|
||||
|
||||
static struct cdVolDesc localVolDesc;
|
||||
|
||||
#ifdef DEBUG
|
||||
SysPrintf("CDVD_GetVolumeDescriptor called\n");
|
||||
#endif
|
||||
|
||||
for (volDescSector = 16; volDescSector<20; volDescSector++)
|
||||
{
|
||||
CdRead(volDescSector,1,&localVolDesc,&cdReadMode);
|
||||
// CdSync(0x00);
|
||||
|
||||
// If this is still a volume Descriptor
|
||||
if (strncmp(localVolDesc.volID, "CD001", 5) == 0)
|
||||
{
|
||||
if ((localVolDesc.filesystemType == 1) ||
|
||||
(localVolDesc.filesystemType == 2))
|
||||
{
|
||||
FreezeMMXRegs(1);
|
||||
memcpy_fast(&CDVolDesc, &localVolDesc, sizeof(struct cdVolDesc));
|
||||
FreezeMMXRegs(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (CDVolDesc.filesystemType == 1)
|
||||
SysPrintf("CD FileSystem is ISO9660\n");
|
||||
else if (CDVolDesc.filesystemType == 2)
|
||||
SysPrintf("CD FileSystem is Joliet\n");
|
||||
else SysPrintf("Could not detect CD FileSystem type\n");
|
||||
#endif
|
||||
// CdStop();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CDVD_findfile(char* fname, struct TocEntry* tocEntry){
|
||||
static char filename[128+1];
|
||||
static char pathname[1024+1];
|
||||
static char toc[2048];
|
||||
char* dirname;
|
||||
|
||||
|
||||
static struct TocEntry localTocEntry; // used for internal checking only
|
||||
|
||||
int found_dir;
|
||||
|
||||
int num_dir_sectors;
|
||||
int current_sector;
|
||||
|
||||
int dir_lba;
|
||||
|
||||
struct dirTocEntry* tocEntryPointer;
|
||||
|
||||
#ifdef DEBUG
|
||||
SysPrintf("CDVD_findfile called\n");
|
||||
#endif
|
||||
|
||||
//make sure we have good cdReadMode
|
||||
cdReadMode.trycount = 0;
|
||||
cdReadMode.spindlctrl = CdSpinStm;
|
||||
cdReadMode.datapattern = CdSecS2048;
|
||||
|
||||
_splitpath2(fname, pathname, filename);
|
||||
|
||||
// Find the TOC for a specific directory
|
||||
if (CDVD_GetVolumeDescriptor() != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("Could not get CD Volume Descriptor\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Read the TOC of the root directory
|
||||
if (CdRead(CDVolDesc.rootToc.tocLBA,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
// point the tocEntryPointer at the first real toc entry
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
|
||||
num_dir_sectors = (tocEntryPointer->fileSize+2047) >> 11; //round up fix
|
||||
current_sector = tocEntryPointer->fileLBA;
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
|
||||
|
||||
localTocEntry.fileLBA = CDVolDesc.rootToc.tocLBA;
|
||||
// while (there are more dir names in the path)
|
||||
dirname = strtok( pathname, "\\/" );
|
||||
|
||||
while( dirname != NULL )
|
||||
{
|
||||
found_dir = FALSE;
|
||||
/*
|
||||
while(tocEntryPointer->length > 0)
|
||||
{
|
||||
// while there are still more directory entries then search through
|
||||
// for the one we want
|
||||
|
||||
if (tocEntryPointer->fileProperties & 0x02)
|
||||
{
|
||||
// Copy the CD format TOC Entry to our format
|
||||
TocEntryCopy(&localTocEntry, tocEntryPointer);
|
||||
|
||||
// If this TOC Entry is a directory,
|
||||
// then see if it has the right name
|
||||
if (strcasecmp(dirname,localTocEntry.filename) == 0)
|
||||
{
|
||||
// if the name matches then we've found the directory
|
||||
found_dir = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// point to the next entry
|
||||
(char*)tocEntryPointer += tocEntryPointer->length;
|
||||
}
|
||||
*/
|
||||
while(1)
|
||||
{
|
||||
if ((tocEntryPointer->length == 0) || (((char*)tocEntryPointer-toc)>=2048))
|
||||
{
|
||||
num_dir_sectors--;
|
||||
|
||||
if (num_dir_sectors > 0)
|
||||
{
|
||||
// If we've run out of entries, but arent on the last sector
|
||||
// then load another sector
|
||||
|
||||
current_sector++;
|
||||
if (CdRead(current_sector,1,toc,&cdReadMode) != TRUE)
|
||||
{
|
||||
SysPrintf("Couldn't Read from CD !\n");
|
||||
return -1;
|
||||
}
|
||||
// CdSync(0x00);
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Couldnt find the directory, and got to end of directory
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tocEntryPointer->fileProperties & 0x02)
|
||||
{
|
||||
TocEntryCopy(&localTocEntry, tocEntryPointer);
|
||||
|
||||
// If this TOC Entry is a directory,
|
||||
// then see if it has the right name
|
||||
if (strcmp(dirname,localTocEntry.filename) == 0)
|
||||
{
|
||||
// if the name matches then we've found the directory
|
||||
found_dir = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// point to the next entry
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
}
|
||||
|
||||
// If we havent found the directory name we wanted then fail
|
||||
if (found_dir != TRUE)
|
||||
{
|
||||
SysPrintf("CDVD_findfile: could not find dir\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get next directory name
|
||||
dirname = strtok( NULL, "\\/" );
|
||||
|
||||
// Read the TOC of the found subdirectory
|
||||
if (CdRead(localTocEntry.fileLBA,1,toc,&cdReadMode) != TRUE)
|
||||
{
|
||||
SysPrintf("Couldn't Read from CD !\n");
|
||||
return -1;
|
||||
}
|
||||
// CdSync(0x00);
|
||||
|
||||
num_dir_sectors = (localTocEntry.fileSize+2047) >> 11; //round up fix
|
||||
current_sector = localTocEntry.fileLBA;
|
||||
|
||||
// and point the tocEntryPointer at the first real toc entry
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
SysPrintf("CDVD_findfile: found dir, now looking for file\n");
|
||||
#endif
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
|
||||
num_dir_sectors = (tocEntryPointer->fileSize+2047) >> 11; //round up fix
|
||||
dir_lba = tocEntryPointer->fileLBA;
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
|
||||
while (num_dir_sectors > 0)
|
||||
{
|
||||
while(tocEntryPointer->length != 0)
|
||||
{
|
||||
// Copy the CD format TOC Entry to our format
|
||||
TocEntryCopy(&localTocEntry, tocEntryPointer);
|
||||
|
||||
if ((strnicmp(localTocEntry.filename, filename, strlen(filename)) == 0) ||
|
||||
((filename[strlen(filename)-2] == ';') &&
|
||||
(localTocEntry.filename[strlen(localTocEntry.filename)-2] == ';') &&
|
||||
(strnicmp(localTocEntry.filename, filename, strlen(filename)-2) == 0)))
|
||||
{
|
||||
// if the filename matches then copy the toc Entry
|
||||
tocEntry->fileLBA = localTocEntry.fileLBA;
|
||||
tocEntry->fileProperties = localTocEntry.fileProperties;
|
||||
tocEntry->fileSize = localTocEntry.fileSize;
|
||||
|
||||
strcpy(tocEntry->filename, localTocEntry.filename);
|
||||
memcpy(tocEntry->date, localTocEntry.date, 7);
|
||||
|
||||
#ifdef DEBUG
|
||||
SysPrintf("CDVD_findfile: found file\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
}
|
||||
|
||||
num_dir_sectors--;
|
||||
|
||||
if (num_dir_sectors > 0)
|
||||
{
|
||||
dir_lba++;
|
||||
|
||||
if (CdRead(dir_lba,1,toc,&cdReadMode) != TRUE){
|
||||
SysPrintf("Couldn't Read from CD !\n");
|
||||
return -1;
|
||||
}
|
||||
// CdSync(0x00);
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
SysPrintf("CDVD_findfile: could not find file\n");
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// This is the RPC-ready function which takes the request to start the tocEntry retrieval
|
||||
int CDVD_GetDir_RPC_request(char* pathname, char* extensions, unsigned int inc_dirs){
|
||||
// int dir_depth = 1;
|
||||
static char toc[2048];
|
||||
char* dirname;
|
||||
int found_dir;
|
||||
int num_dir_sectors;
|
||||
unsigned int toc_entry_num;
|
||||
struct dirTocEntry* tocEntryPointer;
|
||||
static struct TocEntry localTocEntry;
|
||||
int current_sector;
|
||||
|
||||
// store the extension list statically for the retrieve function
|
||||
strncpy(getDirTocData.extension_list, extensions, 128);
|
||||
getDirTocData.extension_list[128]=0;
|
||||
|
||||
getDirTocData.inc_dirs = inc_dirs;
|
||||
|
||||
// Find the TOC for a specific directory
|
||||
if (CDVD_GetVolumeDescriptor() != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC:cdvd] Could not get CD Volume Descriptor\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC:cdvd] Getting Directory Listing for: \"%s\"\n", pathname);
|
||||
#endif
|
||||
|
||||
// Read the TOC of the root directory
|
||||
if (CdRead(CDVolDesc.rootToc.tocLBA,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC: ] Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
// point the tocEntryPointer at the first real toc entry
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
|
||||
num_dir_sectors = (tocEntryPointer->fileSize+2047) >> 11;
|
||||
current_sector = tocEntryPointer->fileLBA;
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
|
||||
// use strtok to get the next dir name
|
||||
|
||||
// if there isnt one, then assume we want the LBA
|
||||
// for the current one, and exit the while loop
|
||||
|
||||
// if there is another dir name then increment dir_depth
|
||||
// and look through dir table entries until we find the right name
|
||||
// if we dont find the right name
|
||||
// before finding an entry at a higher level (lower num), then return nothing
|
||||
|
||||
localTocEntry.fileLBA = CDVolDesc.rootToc.tocLBA;
|
||||
|
||||
// while (there are more dir names in the path)
|
||||
dirname = strtok( pathname, "\\/" );
|
||||
while( dirname != NULL ){
|
||||
found_dir = FALSE;
|
||||
|
||||
while(1){
|
||||
if ((tocEntryPointer->length == 0) || (((char*)tocEntryPointer-toc)>=2048)) {
|
||||
num_dir_sectors--;
|
||||
|
||||
if (num_dir_sectors > 0){
|
||||
// If we've run out of entries, but arent on the last sector
|
||||
// then load another sector
|
||||
|
||||
current_sector++;
|
||||
if (CdRead(current_sector,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC: ] Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
}
|
||||
else{
|
||||
// Couldnt find the directory, and got to end of directory
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (tocEntryPointer->fileProperties & 0x02){
|
||||
TocEntryCopy(&localTocEntry, tocEntryPointer);
|
||||
|
||||
// If this TOC Entry is a directory,
|
||||
// then see if it has the right name
|
||||
if (strcmp(dirname,localTocEntry.filename) == 0){
|
||||
// if the name matches then we've found the directory
|
||||
found_dir = TRUE;
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC: ] Found directory %s in subdir at sector %d\n",dirname,current_sector);
|
||||
RPC_LOG("[RPC: ] LBA of found subdirectory = %d\n",localTocEntry.fileLBA);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// point to the next entry
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
}
|
||||
|
||||
// If we havent found the directory name we wanted then fail
|
||||
if (found_dir != TRUE)
|
||||
return -1;
|
||||
|
||||
// Get next directory name
|
||||
dirname = strtok( NULL, "\\/" );
|
||||
|
||||
// Read the TOC of the found subdirectory
|
||||
if (CdRead(localTocEntry.fileLBA,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC: ] Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
num_dir_sectors = (localTocEntry.fileSize+2047) >> 11;
|
||||
current_sector = localTocEntry.fileLBA;
|
||||
|
||||
// and point the tocEntryPointer at the first real toc entry
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
}
|
||||
|
||||
// We know how much data we need to read in from the DirTocHeader
|
||||
// but we need to read in at least 1 sector before we can get this value
|
||||
|
||||
// Now we need to COUNT the number of entries (dont do anything with info at this point)
|
||||
// so set the tocEntryPointer to point to the first actual file entry
|
||||
|
||||
// This is a bit of a waste of reads since we're not actually copying the data out yet,
|
||||
// but we dont know how big this TOC might be, so we cant allocate a specific size
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
|
||||
// Need to STORE the start LBA and number of Sectors, for use by the retrieve func.
|
||||
getDirTocData.start_LBA = localTocEntry.fileLBA;
|
||||
getDirTocData.num_sectors = (tocEntryPointer->fileSize+2047) >> 11;
|
||||
getDirTocData.num_entries = 0;
|
||||
getDirTocData.current_entry = 0;
|
||||
getDirTocData.current_sector = getDirTocData.start_LBA;
|
||||
getDirTocData.current_sector_offset = 0;
|
||||
|
||||
num_dir_sectors = getDirTocData.num_sectors;
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
|
||||
toc_entry_num=0;
|
||||
|
||||
while(1){
|
||||
if ((tocEntryPointer->length == 0) || (((char*)tocEntryPointer-toc)>=2048)){
|
||||
// decrease the number of dirs remaining
|
||||
num_dir_sectors--;
|
||||
|
||||
if (num_dir_sectors > 0){
|
||||
// If we've run out of entries, but arent on the last sector
|
||||
// then load another sector
|
||||
getDirTocData.current_sector++;
|
||||
|
||||
if (CdRead(getDirTocData.current_sector,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC: ] Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
|
||||
// continue;
|
||||
}
|
||||
else{
|
||||
getDirTocData.num_entries = toc_entry_num;
|
||||
getDirTocData.current_sector = getDirTocData.start_LBA;
|
||||
return (toc_entry_num);
|
||||
}
|
||||
}
|
||||
|
||||
// We've found a file/dir in this directory
|
||||
// now check if it matches our extension list (if there is one)
|
||||
TocEntryCopy(&localTocEntry, tocEntryPointer);
|
||||
|
||||
if (localTocEntry.fileProperties & 0x02){
|
||||
// If this is a subdir, then check if we want to include subdirs
|
||||
if (getDirTocData.inc_dirs){
|
||||
toc_entry_num++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (strlen(getDirTocData.extension_list) > 0){
|
||||
if (TocEntryCompare(localTocEntry.filename, getDirTocData.extension_list) == TRUE){
|
||||
// increment the number of matching entries counter
|
||||
toc_entry_num++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
toc_entry_num++;
|
||||
}
|
||||
}
|
||||
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
}
|
||||
|
||||
|
||||
// THIS SHOULD BE UNREACHABLE -
|
||||
// since we are trying to count ALL matching entries, rather than upto a limit
|
||||
|
||||
|
||||
// STORE total number of TOC entries
|
||||
getDirTocData.num_entries = toc_entry_num;
|
||||
getDirTocData.current_sector = getDirTocData.start_LBA;
|
||||
|
||||
|
||||
// we've reached the toc entry limit, so return how many we've done
|
||||
return (toc_entry_num);
|
||||
|
||||
}
|
||||
|
||||
// This function can be called repeatedly after CDVD_GetDir_RPC_request to get the actual entries
|
||||
// buffer (tocEntry) must be 18KB in size, and this will be filled with a maximum of 128 entries in one go
|
||||
int CDVD_GetDir_RPC_get_entries(struct TocEntry tocEntry[], int req_entries){
|
||||
static char toc[2048];
|
||||
int toc_entry_num;
|
||||
|
||||
struct dirTocEntry* tocEntryPointer;
|
||||
|
||||
if (CdRead(getDirTocData.current_sector,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC:cdvd] Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
if (getDirTocData.current_entry == 0){
|
||||
// if this is the first read then make sure we point to the first real entry
|
||||
tocEntryPointer = (struct dirTocEntry*)toc;
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
tocEntryPointer = (struct dirTocEntry*)((char*)tocEntryPointer + tocEntryPointer->length);
|
||||
|
||||
|
||||
getDirTocData.current_sector_offset = (char*)tocEntryPointer - toc;
|
||||
}
|
||||
else{
|
||||
tocEntryPointer = (struct dirTocEntry*)(toc + getDirTocData.current_sector_offset);
|
||||
}
|
||||
|
||||
if (req_entries > 128)
|
||||
req_entries = 128;
|
||||
|
||||
for (toc_entry_num=0; toc_entry_num < req_entries;){
|
||||
if ((tocEntryPointer->length == 0) || (getDirTocData.current_sector_offset >= 2048)){
|
||||
// decrease the number of dirs remaining
|
||||
getDirTocData.num_sectors--;
|
||||
|
||||
if (getDirTocData.num_sectors > 0){
|
||||
// If we've run out of entries, but arent on the last sector
|
||||
// then load another sector
|
||||
getDirTocData.current_sector++;
|
||||
|
||||
if (CdRead(getDirTocData.current_sector,1,toc,&cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[RPC:cdvd] Couldn't Read from CD !\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
//CdSync(0x00);
|
||||
|
||||
getDirTocData.current_sector_offset = 0;
|
||||
tocEntryPointer = (struct dirTocEntry*)(toc + getDirTocData.current_sector_offset);
|
||||
|
||||
// continue;
|
||||
}
|
||||
else{
|
||||
return (toc_entry_num);
|
||||
}
|
||||
}
|
||||
|
||||
// This must be incremented even if the filename doesnt match extension list
|
||||
getDirTocData.current_entry++;
|
||||
|
||||
// We've found a file in this directory
|
||||
// now check if it matches our extension list (if there is one)
|
||||
|
||||
// Copy the entry regardless, as it makes the comparison easier
|
||||
// if it doesn't match then it will just be overwritten
|
||||
TocEntryCopy(&tocEntry[toc_entry_num], tocEntryPointer);
|
||||
|
||||
if (tocEntry[toc_entry_num].fileProperties & 0x02){
|
||||
// If this is a subdir, then check if we want to include subdirs
|
||||
if (getDirTocData.inc_dirs) {
|
||||
toc_entry_num++;
|
||||
}
|
||||
|
||||
getDirTocData.current_sector_offset += tocEntryPointer->length;
|
||||
tocEntryPointer = (struct dirTocEntry*)(toc + getDirTocData.current_sector_offset);
|
||||
}
|
||||
else{
|
||||
if (strlen(getDirTocData.extension_list) > 0){
|
||||
if (TocEntryCompare(tocEntry[toc_entry_num].filename, getDirTocData.extension_list) == TRUE){
|
||||
// increment the number of matching entries counter
|
||||
toc_entry_num++;
|
||||
}
|
||||
|
||||
getDirTocData.current_sector_offset += tocEntryPointer->length;
|
||||
tocEntryPointer = (struct dirTocEntry*)(toc + getDirTocData.current_sector_offset);
|
||||
|
||||
}
|
||||
else{
|
||||
toc_entry_num++;
|
||||
getDirTocData.current_sector_offset += tocEntryPointer->length;
|
||||
tocEntryPointer = (struct dirTocEntry*)(toc + getDirTocData.current_sector_offset);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (strlen(getDirTocData.extension_list) > 0)
|
||||
{
|
||||
if (TocEntryCompare(tocEntry[toc_entry_num].filename, getDirTocData.extension_list) == TRUE)
|
||||
{
|
||||
|
||||
// increment this here, rather than in the main for loop
|
||||
// since this should count the number of matching entries
|
||||
toc_entry_num++;
|
||||
}
|
||||
|
||||
getDirTocData.current_sector_offset += tocEntryPointer->length;
|
||||
(char*)tocEntryPointer = toc + getDirTocData.current_sector_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
toc_entry_num++;
|
||||
getDirTocData.current_sector_offset += tocEntryPointer->length;
|
||||
(char*)tocEntryPointer = toc + getDirTocData.current_sector_offset;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return (toc_entry_num);
|
||||
}
|
149
pcsx2/CDVDiso.h
149
pcsx2/CDVDiso.h
|
@ -1,149 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/*
|
||||
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
|
||||
* Modified by Florin for PCSX2 emu
|
||||
*/
|
||||
|
||||
#ifndef __CDVDISO_H__
|
||||
#define __CDVDISO_H__
|
||||
|
||||
#include "CDVDlib.h"
|
||||
|
||||
int CDVD_findfile(char* fname, struct TocEntry* tocEntry);
|
||||
int CDVD_GetDir_RPC_request(char* pathname, char* extensions, unsigned int inc_dirs);
|
||||
int CDVD_GetDir_RPC_get_entries(struct TocEntry tocEntry[], int req_entries);
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#pragma warning(disable:4996) //ignore the stricmp deprecated warning
|
||||
#endif
|
||||
|
||||
struct rootDirTocHeader
|
||||
{
|
||||
u16 length; //+00
|
||||
u32 tocLBA; //+02
|
||||
u32 tocLBA_bigend; //+06
|
||||
u32 tocSize; //+0A
|
||||
u32 tocSize_bigend; //+0E
|
||||
u8 dateStamp[8]; //+12
|
||||
u8 reserved[6]; //+1A
|
||||
u8 reserved2; //+20
|
||||
u8 reserved3; //+21
|
||||
#if defined(_MSC_VER)
|
||||
}; //+22
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
struct asciiDate
|
||||
{
|
||||
char year[4];
|
||||
char month[2];
|
||||
char day[2];
|
||||
char hours[2];
|
||||
char minutes[2];
|
||||
char seconds[2];
|
||||
char hundreths[2];
|
||||
char terminator[1];
|
||||
#if defined(_MSC_VER)
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
struct cdVolDesc
|
||||
{
|
||||
u8 filesystemType; // 0x01 = ISO9660, 0x02 = Joliet, 0xFF = NULL
|
||||
u8 volID[5]; // "CD001"
|
||||
u8 reserved2;
|
||||
u8 reserved3;
|
||||
u8 sysIdName[32];
|
||||
u8 volName[32]; // The ISO9660 Volume Name
|
||||
u8 reserved5[8];
|
||||
u32 volSize; // Volume Size
|
||||
u32 volSizeBig; // Volume Size Big-Endian
|
||||
u8 reserved6[32];
|
||||
u32 unknown1;
|
||||
u32 unknown1_bigend;
|
||||
u16 volDescSize; //+80
|
||||
u16 volDescSize_bigend; //+82
|
||||
u32 unknown3; //+84
|
||||
u32 unknown3_bigend; //+88
|
||||
u32 priDirTableLBA; // LBA of Primary Dir Table //+8C
|
||||
u32 reserved7; //+90
|
||||
u32 secDirTableLBA; // LBA of Secondary Dir Table //+94
|
||||
u32 reserved8; //+98
|
||||
struct rootDirTocHeader rootToc;
|
||||
u8 volSetName[128];
|
||||
u8 publisherName[128];
|
||||
u8 preparerName[128];
|
||||
u8 applicationName[128];
|
||||
u8 copyrightFileName[37];
|
||||
u8 abstractFileName[37];
|
||||
u8 bibliographyFileName[37];
|
||||
struct asciiDate creationDate;
|
||||
struct asciiDate modificationDate;
|
||||
struct asciiDate effectiveDate;
|
||||
struct asciiDate expirationDate;
|
||||
u8 reserved10;
|
||||
u8 reserved11[1166];
|
||||
#if defined(_MSC_VER)
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
struct dirTableEntry
|
||||
{
|
||||
u8 dirNameLength;
|
||||
u8 reserved;
|
||||
u32 dirTOCLBA;
|
||||
u16 dirDepth;
|
||||
u8 dirName[32];
|
||||
#if defined(_MSC_VER)
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
struct dirTocEntry
|
||||
{
|
||||
short length;
|
||||
unsigned int fileLBA;
|
||||
unsigned int fileLBA_bigend;
|
||||
unsigned int fileSize;
|
||||
unsigned int fileSize_bigend;
|
||||
unsigned char dateStamp[6];
|
||||
unsigned char reserved1;
|
||||
unsigned char fileProperties;
|
||||
unsigned char reserved2[6];
|
||||
unsigned char filenameLength;
|
||||
unsigned char filename[128];
|
||||
#if defined(_MSC_VER)
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif // This is the internal format on the CD
|
||||
// TocEntry structure contains only the important stuff needed for export
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif//__CDVDISO_H__
|
|
@ -1,284 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/*
|
||||
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
|
||||
* Modified by Florin for PCSX2 emu
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "CDVDiso.h"
|
||||
#include "CDVDisodrv.h"
|
||||
|
||||
CdRMode cdReadMode;
|
||||
|
||||
struct fdtable{
|
||||
//int fd;
|
||||
int fileSize;
|
||||
int LBA;
|
||||
int filePos;
|
||||
};
|
||||
|
||||
static struct fdtable fd_table[16];
|
||||
static int fd_used[16];
|
||||
static int files_open=0;
|
||||
static int inited=FALSE;
|
||||
|
||||
/*************************************************************
|
||||
* The functions below are the normal file-system operations, *
|
||||
* used to provide a standard filesystem interface *
|
||||
*************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CDVDFS_init
|
||||
// called by 80000592 sceCdInit()
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void CDVDFS_init(){
|
||||
|
||||
if (inited) return;//might change in the future as a param; forceInit/Reset
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:init] CDVD Filesystem v1.00\n");
|
||||
RPC_LOG("[CDVDisodrv ] \tby A.Lee (aka Hiryu) & Nicholas Van Veen (aka Sjeep)\n");
|
||||
RPC_LOG("[CDVDisodrv ] Initializing '%s' file driver.\n", "cdfs");
|
||||
#endif
|
||||
|
||||
//CdInit(0); already called by plugin loading system ;)
|
||||
|
||||
cdReadMode.trycount = 0;
|
||||
cdReadMode.spindlctrl = CdSpinStm;
|
||||
cdReadMode.datapattern = CdSecS2048; //isofs driver only needs
|
||||
//2KB sectors
|
||||
|
||||
memset(fd_table, 0, sizeof(fd_table));
|
||||
memset(fd_used, 0, 16*sizeof(int));
|
||||
|
||||
inited = TRUE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CDVDFS_open
|
||||
// called by 80000001 fileio_open for devices: "cdrom:", "cdrom0:"
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CDVDFS_open(char *name, int mode){
|
||||
register int j;
|
||||
static struct TocEntry tocEntry;
|
||||
|
||||
// check if the file exists
|
||||
if (CDVD_findfile(name, &tocEntry) != TRUE)
|
||||
return -1;
|
||||
|
||||
if(mode != 1) return -2; //SCE_RDONLY
|
||||
|
||||
// set up a new file descriptor
|
||||
for(j=0; j < 16; j++) if(fd_used[j] == 0) break;
|
||||
if(j >= 16) return -3;
|
||||
|
||||
fd_used[j] = 1;
|
||||
files_open++;
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:open] internal fd=%d\n", j);
|
||||
#endif
|
||||
|
||||
fd_table[j].fileSize = tocEntry.fileSize;
|
||||
fd_table[j].LBA = tocEntry.fileLBA;
|
||||
fd_table[j].filePos = 0;
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv ] tocEntry.fileSize = %d\n",tocEntry.fileSize);
|
||||
#endif
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CDVDFS_lseek
|
||||
// called by 80000001 fileio_lseek for devices: "cdrom:", "cdrom0:"
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CDVDFS_lseek(int fd, int offset, int whence){
|
||||
|
||||
if ((fd >= 16) || (fd_used[fd]==0)){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:lseek] ERROR: File does not appear to be open!\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(whence){
|
||||
case SEEK_SET:
|
||||
fd_table[fd].filePos = offset;
|
||||
break;
|
||||
|
||||
case SEEK_CUR:
|
||||
fd_table[fd].filePos += offset;
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
fd_table[fd].filePos = fd_table[fd].fileSize + offset;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fd_table[fd].filePos < 0)
|
||||
fd_table[fd].filePos = 0;
|
||||
|
||||
if (fd_table[fd].filePos > fd_table[fd].fileSize)
|
||||
fd_table[fd].filePos = fd_table[fd].fileSize;
|
||||
|
||||
return fd_table[fd].filePos;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CDVDFS_read
|
||||
// called by 80000001 fileio_read for devices: "cdrom:", "cdrom0:", "cdfs:"
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CDVDFS_read( int fd, char *buffer, int size ){
|
||||
// int start_sector;
|
||||
int off_sector;
|
||||
// int num_sectors;
|
||||
|
||||
//static char local_buffer[2024*2048]; //4MB
|
||||
static char lb[2048]; //2KB
|
||||
//Start, Aligned, End
|
||||
int ssector, asector, esector;
|
||||
int ssize=0, asize, esize;
|
||||
|
||||
if ((fd >= 16) || (fd_used[fd]==0)){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:read] ERROR: File does not appear to be open!\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
// A few sanity checks
|
||||
if (fd_table[fd].filePos > fd_table[fd].fileSize){
|
||||
// We cant start reading from past the beginning of the file
|
||||
return 0; // File exists but we couldnt read anything from it
|
||||
}
|
||||
|
||||
if ((fd_table[fd].filePos + size) > fd_table[fd].fileSize)
|
||||
size = fd_table[fd].fileSize - fd_table[fd].filePos;
|
||||
|
||||
// Now work out where we want to start reading from
|
||||
asector = ssector = fd_table[fd].LBA + (fd_table[fd].filePos >> 11);
|
||||
off_sector = (fd_table[fd].filePos & 0x7FF);
|
||||
if (off_sector){
|
||||
ssize = min(2048 - off_sector, size);
|
||||
size -= ssize;
|
||||
asector++;
|
||||
}
|
||||
asize = size & 0xFFFFF800;
|
||||
esize = size & 0x000007FF;
|
||||
esector=asector + (asize >> 11);
|
||||
size += ssize;
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:read] read sectors 0x%08X to 0x%08X\n", ssector, esector-(esize==0));
|
||||
#endif
|
||||
|
||||
if (ssize){ if (CdRead(ssector, 1, lb, &cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv: ] Couldn't Read from file for some reason\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
FreezeMMXRegs(1);
|
||||
memcpy_fast(buffer, lb + off_sector, ssize);
|
||||
FreezeMMXRegs(0);
|
||||
}
|
||||
if (asize) if (CdRead(asector, asize >> 11, buffer+ssize, &cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv: ] Couldn't Read from file for some reason\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (esize){ if (CdRead(esector, 1, lb, &cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv: ] Couldn't Read from file for some reason\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
FreezeMMXRegs(1);
|
||||
memcpy_fast(buffer+ssize+asize, lb, esize);
|
||||
FreezeMMXRegs(0);
|
||||
}
|
||||
/***********************
|
||||
// Now work out where we want to start reading from
|
||||
start_sector = fd_table[fd].LBA + (fd_table[fd].filePos >> 11);
|
||||
off_sector = (fd_table[fd].filePos & 0x7FF);
|
||||
num_sectors = ((off_sector + size) >> 11) + 1;
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:read] read sectors 0x%08X to 0x%08X\n",start_sector,start_sector+num_sectors);
|
||||
#endif
|
||||
|
||||
// Read the data (we only ever get 16KB max request at once)
|
||||
if (CdRead(start_sector, num_sectors, local_buffer, &cdReadMode) != TRUE){
|
||||
#ifdef RPC_LOG
|
||||
//RPC_LOG("sector = %d, start sector = %d\n",sector,start_sector);
|
||||
RPC_LOG("[CDVDisodrv: ] Couldn't Read from file for some reason\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
//CdSync(0); hm, a wait function maybe...
|
||||
|
||||
memcpy_fast(buffer,local_buffer+off_sector,size);
|
||||
**************************/
|
||||
fd_table[fd].filePos += size;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CDVDFS_write
|
||||
// called by 80000001 fileio_write for devices: "cdrom:", "cdrom0:"
|
||||
// hehe, this ain't a CD writing option :D
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CDVDFS_write( int fd, char * buffer, int size ){
|
||||
if(size == 0) return 0;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CDVDFS_close
|
||||
// called by 80000001 fileio_close for devices: "cdrom:", "cdrom0:"
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CDVDFS_close( int fd){
|
||||
|
||||
if ((fd >= 16) || (fd_used[fd]==0)){
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:close] ERROR: File does not appear to be open!\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef RPC_LOG
|
||||
RPC_LOG("[CDVDisodrv:close] internal fd %d\n", fd);
|
||||
#endif
|
||||
|
||||
fd_used[fd] = 0;
|
||||
files_open--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/*
|
||||
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
|
||||
* Modified by Florin for PCSX2 emu
|
||||
*/
|
||||
|
||||
#ifndef __CDVDISODRV_H__
|
||||
#define __CDVDISODRV_H__
|
||||
|
||||
//#include "Common.h"
|
||||
#include "CDVDlib.h"
|
||||
|
||||
extern CdRMode cdReadMode;
|
||||
|
||||
/* Filing-system exported functions */
|
||||
void CDVDFS_init();
|
||||
int CDVDFS_open(char *name, int mode);
|
||||
int CDVDFS_lseek(int fd, int offset, int whence);
|
||||
int CDVDFS_read( int fd, char * buffer, int size );
|
||||
int CDVDFS_write( int fd, char * buffer, int size );
|
||||
int CDVDFS_close( int fd);
|
||||
|
||||
#endif//__CDVDISODRV_H__
|
202
pcsx2/CDVDlib.h
202
pcsx2/CDVDlib.h
|
@ -1,202 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/*
|
||||
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
|
||||
* Linux kernel headers
|
||||
* Modified by Florin for PCSX2 emu
|
||||
*/
|
||||
|
||||
#ifndef _CDVDLIB_H
|
||||
#define _CDVDLIB_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// Macros for READ Data pattan
|
||||
#define CdSecS2048 0 // sector size 2048
|
||||
#define CdSecS2328 1 // sector size 2328
|
||||
#define CdSecS2340 2 // sector size 2340
|
||||
|
||||
//#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/
|
||||
//#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/
|
||||
//#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
|
||||
//#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */
|
||||
//#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */
|
||||
|
||||
/*
|
||||
* A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336,
|
||||
* 2340, or 2352 bytes long.
|
||||
* Sector types of the standard CD-ROM data formats:
|
||||
*
|
||||
* format sector type user data size (bytes)
|
||||
* -----------------------------------------------------------------------------
|
||||
* 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW)
|
||||
* 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE)
|
||||
* 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0)
|
||||
* 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE)
|
||||
* 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes)
|
||||
*
|
||||
*
|
||||
* The layout of the standard CD-ROM data formats:
|
||||
* -----------------------------------------------------------------------------
|
||||
* - audio (red): | audio_sample_bytes |
|
||||
* | 2352 |
|
||||
*
|
||||
* - data (yellow, mode1): | sync - head - data - EDC - zero - ECC |
|
||||
* | 12 - 4 - 2048 - 4 - 8 - 276 |
|
||||
*
|
||||
* - data (yellow, mode2): | sync - head - data |
|
||||
* | 12 - 4 - 2336 |
|
||||
*
|
||||
* - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC |
|
||||
* | 12 - 4 - 8 - 2048 - 4 - 276 |
|
||||
*
|
||||
* - XA data (green, mode2 form2): | sync - head - sub - data - Spare |
|
||||
* | 12 - 4 - 8 - 2324 - 4 |
|
||||
*
|
||||
*/
|
||||
|
||||
// Macros for Spindle control
|
||||
#define CdSpinMax 0
|
||||
#define CdSpinNom 1 // Starts reading data at maximum rotational velocity and if a read error occurs, the rotational velocity is reduced.
|
||||
#define CdSpinStm 0 // Recommended stream rotation speed.
|
||||
|
||||
// Macros for TrayReq
|
||||
#define CdTrayOpen 0
|
||||
#define CdTrayClose 1
|
||||
#define CdTrayCheck 2
|
||||
|
||||
/*
|
||||
* Macros for sceCdGetDiskType() //comments translated from japanese;)
|
||||
*/
|
||||
#define SCECdIllgalMedia 0xff
|
||||
/* ILIMEDIA (Illegal Media)
|
||||
A non-PS / non-PS2 Disc. */
|
||||
#define SCECdDVDV 0xfe
|
||||
/* DVDV (DVD Video)
|
||||
A non-PS / non-PS2 Disc, but a DVD Video Disc */
|
||||
#define SCECdCDDA 0xfd
|
||||
/* CDDA (CD DA)
|
||||
A non-PS / non-PS2 Disc that include a DA track */
|
||||
#define SCECdPS2DVD 0x14
|
||||
/* PS2DVD PS2 consumer DVD. */
|
||||
#define SCECdPS2CDDA 0x13
|
||||
/* PS2CDDA PS2 consumer CD that includes a DA track */
|
||||
#define SCECdPS2CD 0x12
|
||||
/* PS2CD PS2 consumer CD that does not include a DA track */
|
||||
#define SCECdPSCDDA 0x11
|
||||
/* PSCDDA PS CD that includes a DA track */
|
||||
#define SCECdPSCD 0x10
|
||||
/* PSCD PS CD that does not include a DA track */
|
||||
#define SCECdDETCT 0x01
|
||||
/* DETCT (Detecting) Disc distinction action */
|
||||
#define SCECdNODISC 0x00
|
||||
/* NODISC (No disc) No disc entered */
|
||||
|
||||
/*
|
||||
* Media mode
|
||||
*/
|
||||
#define SCECdCD 1
|
||||
#define SCECdDVD 2
|
||||
|
||||
typedef struct {
|
||||
u8 stat; // 0: normal. Any other: error
|
||||
u8 second; // second (BCD value)
|
||||
u8 minute; // minute (BCD value)
|
||||
u8 hour; // hour (BCD value)
|
||||
u8 week; // week (BCD value)
|
||||
u8 day; // day (BCD value)
|
||||
u8 month; // month (BCD value)
|
||||
u8 year; // year (BCD value)
|
||||
} CdCLOCK;
|
||||
|
||||
typedef struct {
|
||||
u32 lsn; // Logical sector number of file
|
||||
u32 size; // File size (in bytes)
|
||||
char name[16]; // Filename
|
||||
u8 date[8]; // 1th: Seconds
|
||||
// 2th: Minutes
|
||||
// 3th: Hours
|
||||
// 4th: Date
|
||||
// 5th: Month
|
||||
// 6th 7th: Year (4 digits)
|
||||
} CdlFILE;
|
||||
|
||||
typedef struct {
|
||||
u8 minute; // Minutes
|
||||
u8 second; // Seconds
|
||||
u8 sector; // Sector
|
||||
u8 track; // Track number
|
||||
} CdlLOCCD;
|
||||
|
||||
typedef struct {
|
||||
u8 trycount; // Read try count (No. of error retries + 1) (0 - 255)
|
||||
u8 spindlctrl; // SCECdSpinStm: Recommended stream rotation speed.
|
||||
// SCECdSpinNom: Starts reading data at maximum rotational velocity and if a read error occurs, the rotational velocity is reduced.
|
||||
u8 datapattern; // SCECdSecS2048: Data size 2048 bytes
|
||||
// SCECdSecS2328: 2328 bytes
|
||||
// SCECdSecS2340: 2340 bytes
|
||||
u8 pad; // Padding data produced by alignment.
|
||||
} CdRMode;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
struct TocEntry
|
||||
{
|
||||
u32 fileLBA;
|
||||
u32 fileSize;
|
||||
u8 fileProperties;
|
||||
u8 padding1[3];
|
||||
u8 filename[128+1];
|
||||
u8 date[7];
|
||||
#if defined(_WIN32)
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
int CDVD_findfile(char* fname, struct TocEntry* tocEntry);
|
||||
/*
|
||||
int CdBreak(void);
|
||||
int CdCallback( void (*func)() );
|
||||
int CdDiskReady(int mode);
|
||||
int CdGetDiskType(void);
|
||||
int CdGetError(void);
|
||||
u32 CdGetReadPos(void);
|
||||
int CdGetToc(u8 *toc);
|
||||
int CdInit(int init_mode);
|
||||
CdlLOCCD *CdIntToPos(int i, CdlLOCCD *p);
|
||||
int CdPause(void);
|
||||
int CdPosToInt(CdlLOCCD *p);*/
|
||||
int CdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode);
|
||||
int DvdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode);
|
||||
/*int CdReadClock(CdCLOCK *rtc);
|
||||
int CdSearchFile (CdlFILE *fp, const char *name);
|
||||
int CdSeek(u32 lsn);
|
||||
int CdStandby(void);
|
||||
int CdStatus(void);
|
||||
int CdStop(void);
|
||||
int CdSync(int mode);
|
||||
int CdTrayReq(int mode, u32 *traycnt);
|
||||
*/
|
||||
#endif // _CDVDLIB_H
|
369
pcsx2/COP0.c
369
pcsx2/COP0.c
|
@ -1,369 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "R5900.h"
|
||||
#include "InterTables.h"
|
||||
|
||||
//extern BOOL bExecBIOS;
|
||||
|
||||
void COP0() {
|
||||
Int_COP0PrintTable[_Rs_]();
|
||||
}
|
||||
|
||||
void COP0_BC0() {
|
||||
#ifdef COP0_LOG
|
||||
COP0_LOG("%s\n", disR5900F(cpuRegs.code, cpuRegs.pc));
|
||||
#endif
|
||||
Int_COP0BC0PrintTable[(cpuRegs.code >> 16) & 0x03]();
|
||||
}
|
||||
|
||||
void COP0_Func() {
|
||||
#ifdef COP0_LOG
|
||||
COP0_LOG("%s\n", disR5900F(cpuRegs.code, cpuRegs.pc));
|
||||
#endif
|
||||
Int_COP0C0PrintTable[_Funct_]();
|
||||
}
|
||||
|
||||
void COP0_Unknown() {
|
||||
#ifdef CPU_LOG
|
||||
CPU_LOG("COP0 Unknown opcode called\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void UpdateCP0Status() {
|
||||
u32 value = cpuRegs.CP0.n.Status.val;
|
||||
|
||||
if (value & 0x06 ||
|
||||
(value & 0x18) == 0) { // Kernel Mode (KSU = 0 | EXL = 1 | ERL = 1)*/
|
||||
memSetKernelMode(); // Kernel memory always
|
||||
} else { // User Mode
|
||||
memSetUserMode();
|
||||
}
|
||||
cpuTestHwInts();
|
||||
}
|
||||
|
||||
void WriteCP0Status(u32 value) {
|
||||
cpuRegs.CP0.n.Status.val = value;
|
||||
UpdateCP0Status();
|
||||
}
|
||||
|
||||
extern u32 s_iLastCOP0Cycle;
|
||||
extern u32 s_iLastPERFCycle[2];
|
||||
|
||||
void MFC0() {
|
||||
if (!_Rt_) return;
|
||||
#ifdef COP0_LOG
|
||||
if (_Rd_ != 9) { COP0_LOG("%s\n", disR5900F(cpuRegs.code, cpuRegs.pc)); }
|
||||
#endif
|
||||
|
||||
//if(bExecBIOS == FALSE && _Rd_ == 25) SysPrintf("MFC0 _Rd_ %x = %x\n", _Rd_, cpuRegs.CP0.r[_Rd_]);
|
||||
switch (_Rd_) {
|
||||
|
||||
case 12: cpuRegs.GPR.r[_Rt_].UD[0] = (s64)(cpuRegs.CP0.r[_Rd_] & 0xf0c79c1f); break;
|
||||
case 25:
|
||||
switch(_Imm_ & 0x3F){
|
||||
case 0: cpuRegs.GPR.r[_Rt_].UD[0] = (s64)cpuRegs.PERF.n.pccr; break;
|
||||
case 1:
|
||||
if((cpuRegs.PERF.n.pccr & 0x800003E0) == 0x80000020) {
|
||||
cpuRegs.PERF.n.pcr0 += cpuRegs.cycle-s_iLastPERFCycle[0];
|
||||
s_iLastPERFCycle[0] = cpuRegs.cycle;
|
||||
}
|
||||
|
||||
cpuRegs.GPR.r[_Rt_].UD[0] = (s64)cpuRegs.PERF.n.pcr0;
|
||||
break;
|
||||
case 3:
|
||||
if((cpuRegs.PERF.n.pccr & 0x800F8000) == 0x80008000) {
|
||||
cpuRegs.PERF.n.pcr1 += cpuRegs.cycle-s_iLastPERFCycle[1];
|
||||
s_iLastPERFCycle[1] = cpuRegs.cycle;
|
||||
}
|
||||
cpuRegs.GPR.r[_Rt_].UD[0] = (s64)cpuRegs.PERF.n.pcr1;
|
||||
break;
|
||||
}
|
||||
/*SysPrintf("MFC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
|
||||
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);*/
|
||||
break;
|
||||
case 24:
|
||||
SysPrintf("MFC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
|
||||
break;
|
||||
case 9:
|
||||
// update
|
||||
cpuRegs.CP0.n.Count += cpuRegs.cycle-s_iLastCOP0Cycle;
|
||||
s_iLastCOP0Cycle = cpuRegs.cycle;
|
||||
default: cpuRegs.GPR.r[_Rt_].UD[0] = (s64)cpuRegs.CP0.r[_Rd_];
|
||||
}
|
||||
}
|
||||
|
||||
void MTC0() {
|
||||
#ifdef COP0_LOG
|
||||
COP0_LOG("%s\n", disR5900F(cpuRegs.code, cpuRegs.pc));
|
||||
#endif
|
||||
//if(bExecBIOS == FALSE && _Rd_ == 25) SysPrintf("MTC0 _Rd_ %x = %x\n", _Rd_, cpuRegs.CP0.r[_Rd_]);
|
||||
switch (_Rd_) {
|
||||
case 25:
|
||||
/*if(bExecBIOS == FALSE && _Rd_ == 25) SysPrintf("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
|
||||
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);*/
|
||||
switch(_Imm_ & 0x3F){
|
||||
case 0:
|
||||
if((cpuRegs.PERF.n.pccr & 0x800003E0) == 0x80000020)
|
||||
cpuRegs.PERF.n.pcr0 += cpuRegs.cycle-s_iLastPERFCycle[0];
|
||||
if((cpuRegs.PERF.n.pccr & 0x800F8000) == 0x80008000)
|
||||
cpuRegs.PERF.n.pcr1 += cpuRegs.cycle-s_iLastPERFCycle[1];
|
||||
cpuRegs.PERF.n.pccr = cpuRegs.GPR.r[_Rt_].UL[0];
|
||||
s_iLastPERFCycle[0] = cpuRegs.cycle;
|
||||
s_iLastPERFCycle[1] = cpuRegs.cycle;
|
||||
break;
|
||||
case 1: cpuRegs.PERF.n.pcr0 = cpuRegs.GPR.r[_Rt_].UL[0]; s_iLastPERFCycle[0] = cpuRegs.cycle; break;
|
||||
case 3: cpuRegs.PERF.n.pcr1 = cpuRegs.GPR.r[_Rt_].UL[0]; s_iLastPERFCycle[1] = cpuRegs.cycle; break;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
SysPrintf("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
|
||||
break;
|
||||
case 12: WriteCP0Status(cpuRegs.GPR.r[_Rt_].UL[0]); break;
|
||||
case 9: s_iLastCOP0Cycle = cpuRegs.cycle; cpuRegs.CP0.r[9] = cpuRegs.GPR.r[_Rt_].UL[0]; break;
|
||||
default: cpuRegs.CP0.r[_Rd_] = cpuRegs.GPR.r[_Rt_].UL[0]; break;
|
||||
}
|
||||
}
|
||||
|
||||
int CPCOND0() {
|
||||
if(((psHu16(DMAC_STAT) & psHu16(DMAC_PCR)) & 0x3ff) == (psHu16(DMAC_PCR) & 0x3ff)) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
//#define CPCOND0 1
|
||||
|
||||
#define BC0(cond) \
|
||||
if (CPCOND0() cond) { \
|
||||
intDoBranch(_BranchTarget_); \
|
||||
}
|
||||
|
||||
void BC0F() {
|
||||
BC0(== 0);
|
||||
}
|
||||
|
||||
void BC0T() {
|
||||
BC0(== 1);
|
||||
}
|
||||
|
||||
#define BC0L(cond) \
|
||||
if (CPCOND0() cond) { \
|
||||
intDoBranch(_BranchTarget_); \
|
||||
} else cpuRegs.pc+= 4;
|
||||
|
||||
void BC0FL() {
|
||||
BC0L(== 0);
|
||||
}
|
||||
|
||||
void BC0TL() {
|
||||
BC0L(== 1);
|
||||
}
|
||||
|
||||
void TLBR() {
|
||||
#ifdef CPU_LOG
|
||||
/* CPU_LOG("COP0_TLBR %d:%x,%x,%x,%x\n",
|
||||
cpuRegs.CP0.n.Random, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
|
||||
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);*/
|
||||
#endif
|
||||
int i = cpuRegs.CP0.n.Index&0x1f;
|
||||
|
||||
// if( !bExecBIOS )
|
||||
// __Log("TLBR %d\n", cpuRegs.CP0.n.Index&0x1f);
|
||||
|
||||
SysPrintf("COP0_TLBR\n");
|
||||
cpuRegs.CP0.n.PageMask = tlb[i].PageMask;
|
||||
cpuRegs.CP0.n.EntryHi = tlb[i].EntryHi&~(tlb[i].PageMask|0x1f00);
|
||||
cpuRegs.CP0.n.EntryLo0 = (tlb[i].EntryLo0&~1)|((tlb[i].EntryHi>>12)&1);
|
||||
cpuRegs.CP0.n.EntryLo1 =(tlb[i].EntryLo1&~1)|((tlb[i].EntryHi>>12)&1);
|
||||
}
|
||||
|
||||
void ClearTLB(int i) {
|
||||
u32 mask, addr;
|
||||
u32 saddr, eaddr;
|
||||
|
||||
|
||||
if (tlb[i].EntryLo0 & 0x2) {
|
||||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = tlb[i].VPN2 >> 12;
|
||||
eaddr = saddr + tlb[i].Mask + 1;
|
||||
|
||||
for (addr=saddr; addr<eaddr; addr++) {
|
||||
if ((addr & mask) == ((tlb[i].VPN2 >> 12) & mask)) { //match
|
||||
memClearPageAddr(addr << 12);
|
||||
Cpu->Clear(addr << 12, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tlb[i].EntryLo1 & 0x2) {
|
||||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = (tlb[i].VPN2 >> 12) + tlb[i].Mask + 1;
|
||||
eaddr = saddr + tlb[i].Mask + 1;
|
||||
|
||||
for (addr=saddr; addr<eaddr; addr++) {
|
||||
if ((addr & mask) == ((tlb[i].VPN2 >> 12) & mask)) { //match
|
||||
memClearPageAddr(addr << 12);
|
||||
Cpu->Clear(addr << 12, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WriteTLB(int i) {
|
||||
u32 mask, addr;
|
||||
u32 saddr, eaddr;
|
||||
|
||||
tlb[i].PageMask = cpuRegs.CP0.n.PageMask;
|
||||
tlb[i].EntryHi = cpuRegs.CP0.n.EntryHi;
|
||||
tlb[i].EntryLo0 = cpuRegs.CP0.n.EntryLo0;
|
||||
tlb[i].EntryLo1 = cpuRegs.CP0.n.EntryLo1;
|
||||
|
||||
tlb[i].Mask = (cpuRegs.CP0.n.PageMask >> 13) & 0xfff;
|
||||
tlb[i].nMask = (~tlb[i].Mask) & 0xfff;
|
||||
tlb[i].VPN2 = ((cpuRegs.CP0.n.EntryHi >> 13) & (~tlb[i].Mask)) << 13;
|
||||
tlb[i].ASID = cpuRegs.CP0.n.EntryHi & 0xfff;
|
||||
tlb[i].G = cpuRegs.CP0.n.EntryLo0 & cpuRegs.CP0.n.EntryLo1 & 0x1;
|
||||
tlb[i].PFN0 = (((cpuRegs.CP0.n.EntryLo0 >> 6) & 0xFFFFF) & (~tlb[i].Mask)) << 12;
|
||||
tlb[i].PFN0|= (0x80000000);
|
||||
tlb[i].PFN1 = (((cpuRegs.CP0.n.EntryLo1 >> 6) & 0xFFFFF) & (~tlb[i].Mask)) << 12;
|
||||
tlb[i].PFN1|= (0x80000000);
|
||||
if (tlb[i].VPN2 == 0x70000000) return;
|
||||
|
||||
if (tlb[i].EntryLo0 & 0x2) {
|
||||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = tlb[i].VPN2 >> 12;
|
||||
eaddr = saddr + tlb[i].Mask + 1;
|
||||
|
||||
for (addr=saddr; addr<eaddr; addr++) {
|
||||
if ((addr & mask) == ((tlb[i].VPN2 >> 12) & mask)) { //match
|
||||
memSetPageAddr(addr << 12, tlb[i].PFN0 + ((addr - saddr) << 12));
|
||||
Cpu->Clear(addr << 12, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tlb[i].EntryLo1 & 0x2) {
|
||||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = (tlb[i].VPN2 >> 12) + tlb[i].Mask + 1;
|
||||
eaddr = saddr + tlb[i].Mask + 1;
|
||||
|
||||
for (addr=saddr; addr<eaddr; addr++) {
|
||||
if ((addr & mask) == ((tlb[i].VPN2 >> 12) & mask)) { //match
|
||||
memSetPageAddr(addr << 12, tlb[i].PFN1 + ((addr - saddr) << 12));
|
||||
Cpu->Clear(addr << 12, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TLBWI() {
|
||||
int j = cpuRegs.CP0.n.Index & 0x3f;
|
||||
|
||||
if (j > 48) return;
|
||||
|
||||
#ifdef CPU_LOG
|
||||
/* CPU_LOG("COP0_TLBWI %d:%x,%x,%x,%x\n",
|
||||
cpuRegs.CP0.n.Index, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
|
||||
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);*/
|
||||
#endif
|
||||
|
||||
// if( !bExecBIOS )
|
||||
// __Log("TLBWI %d\n", j);
|
||||
|
||||
ClearTLB(j);
|
||||
WriteTLB(j);
|
||||
}
|
||||
|
||||
void TLBWR() {
|
||||
int j = cpuRegs.CP0.n.Random & 0x3f;
|
||||
|
||||
if (j > 48) return;
|
||||
|
||||
#ifdef CPU_LOG
|
||||
/* CPU_LOG("COP0_TLBWR %d:%x,%x,%x,%x\n",
|
||||
cpuRegs.CP0.n.Random, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
|
||||
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);*/
|
||||
#endif
|
||||
|
||||
// if( !bExecBIOS )
|
||||
// __Log("TLBWR %d\n", j);
|
||||
|
||||
ClearTLB(j);
|
||||
WriteTLB(j);
|
||||
}
|
||||
|
||||
void TLBP() {
|
||||
int i;
|
||||
|
||||
|
||||
union {
|
||||
struct {
|
||||
u32 VPN2:19;
|
||||
u32 VPN2X:2;
|
||||
u32 G:3;
|
||||
u32 ASID:8;
|
||||
} s;
|
||||
u32 u;
|
||||
} EntryHi32;
|
||||
|
||||
// if( !bExecBIOS )
|
||||
// __Log("TLBP %x\n", cpuRegs.CP0.n.EntryHi);
|
||||
|
||||
EntryHi32.u=cpuRegs.CP0.n.EntryHi;
|
||||
|
||||
cpuRegs.CP0.n.Index=0xFFFFFFFF;
|
||||
for(i=0;i<48;i++){
|
||||
if(tlb[i].VPN2==((~tlb[i].Mask)&(EntryHi32.s.VPN2))
|
||||
&&((tlb[i].G&1)||((tlb[i].ASID & 0xff) == EntryHi32.s.ASID))) {
|
||||
cpuRegs.CP0.n.Index=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(cpuRegs.CP0.n.Index == 0xFFFFFFFF) cpuRegs.CP0.n.Index = 0x80000000;
|
||||
}
|
||||
|
||||
void ERET() {
|
||||
if (cpuRegs.CP0.n.Status.b.ERL) {
|
||||
cpuRegs.pc = cpuRegs.CP0.n.ErrorEPC;
|
||||
cpuRegs.CP0.n.Status.b.ERL = 0;
|
||||
} else {
|
||||
cpuRegs.pc = cpuRegs.CP0.n.EPC;
|
||||
cpuRegs.CP0.n.Status.b.EXL = 0;
|
||||
}
|
||||
UpdateCP0Status();
|
||||
intSetBranch();
|
||||
}
|
||||
|
||||
void DI() {
|
||||
if (cpuRegs.CP0.n.Status.b._EDI || cpuRegs.CP0.n.Status.b.EXL ||
|
||||
cpuRegs.CP0.n.Status.b.ERL || (cpuRegs.CP0.n.Status.b.KSU == 0)) {
|
||||
cpuRegs.CP0.n.Status.b.EIE = 0;
|
||||
UpdateCP0Status();
|
||||
}
|
||||
}
|
||||
|
||||
void EI() {
|
||||
if (cpuRegs.CP0.n.Status.b._EDI || cpuRegs.CP0.n.Status.b.EXL ||
|
||||
cpuRegs.CP0.n.Status.b.ERL || (cpuRegs.CP0.n.Status.b.KSU == 0)) {
|
||||
cpuRegs.CP0.n.Status.b.EIE = 1;
|
||||
UpdateCP0Status();
|
||||
}
|
||||
}
|
||||
|
27
pcsx2/COP0.h
27
pcsx2/COP0.h
|
@ -1,27 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __COP0_H__
|
||||
#define __COP0_H__
|
||||
|
||||
void WriteCP0Status(u32 value);
|
||||
void UpdateCP0Status();
|
||||
void WriteTLB(int i);
|
||||
void ClearTLB(int i);
|
||||
|
||||
#endif /* __COP0_H__ */
|
391
pcsx2/Cache.c
391
pcsx2/Cache.c
|
@ -1,391 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Cache.h"
|
||||
|
||||
#ifndef PCSX2_VIRTUAL_MEM
|
||||
_cacheS pCache[64];
|
||||
int getFreeCache(u32 mem, int mode, int * way) {
|
||||
u8 * out;
|
||||
u32 paddr;
|
||||
u32 taddr[2];
|
||||
u8 * t;
|
||||
int number;
|
||||
int i = (mem >> 6) & 0x3F;
|
||||
|
||||
paddr = memLUTR[mem >> 12];
|
||||
taddr[0] = memLUTW[pCache[i].tag[0]>>12];
|
||||
taddr[1] = memLUTW[pCache[i].tag[1]>>12];
|
||||
|
||||
if (taddr[0] == paddr && (pCache[i].tag[0] & 0x20))
|
||||
{
|
||||
*way = 0;
|
||||
return i;
|
||||
}else if(taddr[1] == paddr && (pCache[i].tag[1] & 0x20))
|
||||
{
|
||||
*way = 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
number = ((pCache[i].tag[0]>>4) & 1) ^ ((pCache[i].tag[1]>>4) & 1);
|
||||
|
||||
if(pCache[i].tag[number] & 0x60) // Valid Dirty
|
||||
{
|
||||
t = (char *)(taddr[number]);
|
||||
out = (u8*)(t + (mem & 0xFC0));
|
||||
((u64*)out)[0] = ((u64*)pCache[i].data[number][0].b8._8)[0];
|
||||
((u64*)out)[1] = ((u64*)pCache[i].data[number][0].b8._8)[1];
|
||||
((u64*)out)[2] = ((u64*)pCache[i].data[number][1].b8._8)[0];
|
||||
((u64*)out)[3] = ((u64*)pCache[i].data[number][1].b8._8)[1];
|
||||
((u64*)out)[4] = ((u64*)pCache[i].data[number][2].b8._8)[0];
|
||||
((u64*)out)[5] = ((u64*)pCache[i].data[number][2].b8._8)[1];
|
||||
((u64*)out)[6] = ((u64*)pCache[i].data[number][3].b8._8)[0];
|
||||
((u64*)out)[7] = ((u64*)pCache[i].data[number][3].b8._8)[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(mode == 1)
|
||||
{
|
||||
pCache[i].tag[number] |= 0x40; // Set Dirty Bit if mode == write
|
||||
}
|
||||
|
||||
pCache[i].tag[number] &= ~(0xFFFFF000);
|
||||
pCache[i].tag[number] |= ((mem>>12) & 0xFFFFF) << 12;
|
||||
|
||||
|
||||
t = (u8 *)paddr;
|
||||
out= (u8*)(t + (mem & 0xFC0));
|
||||
((u64*)pCache[i].data[number][0].b8._8)[0] = ((u64*)out)[0];
|
||||
((u64*)pCache[i].data[number][0].b8._8)[1] = ((u64*)out)[1];
|
||||
((u64*)pCache[i].data[number][1].b8._8)[0] = ((u64*)out)[2];
|
||||
((u64*)pCache[i].data[number][1].b8._8)[1] = ((u64*)out)[3];
|
||||
((u64*)pCache[i].data[number][2].b8._8)[0] = ((u64*)out)[4];
|
||||
((u64*)pCache[i].data[number][2].b8._8)[1] = ((u64*)out)[5];
|
||||
((u64*)pCache[i].data[number][3].b8._8)[0] = ((u64*)out)[6];
|
||||
((u64*)pCache[i].data[number][3].b8._8)[1] = ((u64*)out)[7];
|
||||
|
||||
if(pCache[i].tag[number] & 0x10) pCache[i].tag[number] &= ~(0x10);
|
||||
else pCache[i].tag[number] |= 0x10;
|
||||
|
||||
pCache[i].tag[number] |= 0x20;
|
||||
*way = number;
|
||||
return i;
|
||||
}
|
||||
|
||||
void writeCache8(u32 mem, u8 value) {
|
||||
int i, number;
|
||||
|
||||
i = getFreeCache(mem,1,&number);
|
||||
// CACHE_LOG("writeCache8 %8.8x adding to %d, way %d, value %x\n", mem, i,number,value);
|
||||
|
||||
pCache[i].data[number][(mem>>4) & 0x3].b8._8[(mem&0xf)] = value;
|
||||
}
|
||||
|
||||
void writeCache16(u32 mem, u16 value) {
|
||||
int i, number;
|
||||
|
||||
i = getFreeCache(mem,1,&number);
|
||||
// CACHE_LOG("writeCache16 %8.8x adding to %d, way %d, value %x\n", mem, i,number,value);
|
||||
|
||||
*(u16*)(&pCache[i].data[number][(mem>>4) & 0x3].b8._8[(mem&0xf)]) = value;
|
||||
}
|
||||
|
||||
void writeCache32(u32 mem, u32 value) {
|
||||
int i, number;
|
||||
|
||||
i = getFreeCache(mem,1,&number);
|
||||
// CACHE_LOG("writeCache32 %8.8x adding to %d, way %d, value %x\n", mem, i,number,value);
|
||||
*(u32*)(&pCache[i].data[number][(mem>>4) & 0x3].b8._8[(mem&0xf)]) = value;
|
||||
}
|
||||
|
||||
void writeCache64(u32 mem, u64 value) {
|
||||
int i, number;
|
||||
|
||||
i = getFreeCache(mem,1,&number);
|
||||
// CACHE_LOG("writeCache64 %8.8x adding to %d, way %d, value %x\n", mem, i,number,value);
|
||||
*(u64*)(&pCache[i].data[number][(mem>>4) & 0x3].b8._8[(mem&0xf)]) = value;
|
||||
}
|
||||
|
||||
void writeCache128(u32 mem, u64 *value) {
|
||||
int i, number;
|
||||
|
||||
i = getFreeCache(mem,1,&number);
|
||||
// CACHE_LOG("writeCache128 %8.8x adding to %d\n", mem, i);
|
||||
((u64*)pCache[i].data[number][(mem>>4) & 0x3].b8._8)[0] = value[0];
|
||||
((u64*)pCache[i].data[number][(mem>>4) & 0x3].b8._8)[1] = value[1];
|
||||
}
|
||||
|
||||
u8 *readCache(u32 mem) {
|
||||
int i, number;
|
||||
|
||||
i = getFreeCache(mem,0,&number);
|
||||
// CACHE_LOG("readCache %8.8x from %d, way %d\n", mem, i,number);
|
||||
|
||||
return pCache[i].data[number][(mem>>4) & 0x3].b8._8;
|
||||
}
|
||||
|
||||
extern int Dcache;
|
||||
void CACHE() {
|
||||
u32 addr;
|
||||
//if(Dcache == 0) return;
|
||||
addr = cpuRegs.GPR.r[_Rs_].UL[0] + _Imm_;
|
||||
switch (_Rt_) {
|
||||
case 0x1a:
|
||||
{
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
u32 paddr[2];
|
||||
int way;
|
||||
u32 taddr = memLUTR[addr >> 12];
|
||||
paddr[0] = memLUTW[pCache[index].tag[0] >> 12];
|
||||
paddr[1] = memLUTW[pCache[index].tag[1] >> 12];
|
||||
|
||||
if(paddr[0] == taddr && (pCache[index].tag[0] & 0x20))
|
||||
{
|
||||
way = 0;
|
||||
}
|
||||
else if(paddr[1] == taddr && (pCache[index].tag[1] & 0x20))
|
||||
{
|
||||
way = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DHIN addr %x, index %d, way %d, Flags %x\n",addr,index,way,pCache[index].tag[way] & 0x78);
|
||||
#endif
|
||||
pCache[index].tag[way] &= ~(0x6F);
|
||||
((u64*)pCache[index].data[way][0].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][0].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[1] = 0;
|
||||
break;
|
||||
}
|
||||
case 0x18:
|
||||
{
|
||||
u8 * out;
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
u32 paddr[2];
|
||||
int way;
|
||||
u32 taddr = memLUTW[addr >> 12];
|
||||
paddr[0] = memLUTW[pCache[index].tag[0] >> 12];
|
||||
paddr[1] = memLUTW[pCache[index].tag[1] >> 12];
|
||||
|
||||
if(paddr[0] == taddr && (pCache[index].tag[0] & 0x20))
|
||||
{
|
||||
way = 0;
|
||||
}
|
||||
else if(paddr[1] == taddr && (pCache[index].tag[1] & 0x20))
|
||||
{
|
||||
way = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DHWBIN addr %x, index %d, way %d, Flags %x\n",addr,index,way,pCache[index].tag[way] & 0x78);
|
||||
#endif
|
||||
|
||||
if(pCache[index].tag[way] & 0x60) // Valid Dirty
|
||||
{
|
||||
char * t = (char *)(taddr);//paddr[way]);
|
||||
out = (u8*)(t + (addr & 0xFC0));
|
||||
((u64*)out)[0] = ((u64*)pCache[index].data[way][0].b8._8)[0];
|
||||
((u64*)out)[1] = ((u64*)pCache[index].data[way][0].b8._8)[1];
|
||||
((u64*)out)[2] = ((u64*)pCache[index].data[way][1].b8._8)[0];
|
||||
((u64*)out)[3] = ((u64*)pCache[index].data[way][1].b8._8)[1];
|
||||
((u64*)out)[4] = ((u64*)pCache[index].data[way][2].b8._8)[0];
|
||||
((u64*)out)[5] = ((u64*)pCache[index].data[way][2].b8._8)[1];
|
||||
((u64*)out)[6] = ((u64*)pCache[index].data[way][3].b8._8)[0];
|
||||
((u64*)out)[7] = ((u64*)pCache[index].data[way][3].b8._8)[1];
|
||||
}
|
||||
|
||||
pCache[index].tag[way] &= ~(0x6F);
|
||||
((u64*)pCache[index].data[way][0].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][0].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[1] = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x1c:
|
||||
{
|
||||
u8 * out;
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
u32 paddr[2];
|
||||
int way;
|
||||
u32 taddr = memLUTW[addr >> 12];
|
||||
paddr[0] = memLUTW[pCache[index].tag[0] >> 12];
|
||||
paddr[1] = memLUTW[pCache[index].tag[1] >> 12];
|
||||
|
||||
if(paddr[0] == taddr && (pCache[index].tag[0] & 0x20))
|
||||
{
|
||||
way = 0;
|
||||
}
|
||||
else if(paddr[1] == taddr && (pCache[index].tag[1] & 0x20))
|
||||
{
|
||||
way = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DHWOIN addr %x, index %d, way %d, Flags %x\n",addr,index,way,pCache[index].tag[way] & 0x78);
|
||||
#endif
|
||||
if(pCache[index].tag[way] & 0x60) // Valid Dirty
|
||||
{
|
||||
char * t = (char *)(taddr);
|
||||
out = (u8*)(t + (addr & 0xFC0));
|
||||
((u64*)out)[0] = ((u64*)pCache[index].data[way][0].b8._8)[0];
|
||||
((u64*)out)[1] = ((u64*)pCache[index].data[way][0].b8._8)[1];
|
||||
((u64*)out)[2] = ((u64*)pCache[index].data[way][1].b8._8)[0];
|
||||
((u64*)out)[3] = ((u64*)pCache[index].data[way][1].b8._8)[1];
|
||||
((u64*)out)[4] = ((u64*)pCache[index].data[way][2].b8._8)[0];
|
||||
((u64*)out)[5] = ((u64*)pCache[index].data[way][2].b8._8)[1];
|
||||
((u64*)out)[6] = ((u64*)pCache[index].data[way][3].b8._8)[0];
|
||||
((u64*)out)[7] = ((u64*)pCache[index].data[way][3].b8._8)[1];
|
||||
}
|
||||
|
||||
pCache[index].tag[way] &= ~(0x40);
|
||||
break;
|
||||
}
|
||||
case 0x16:
|
||||
{
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
int way = addr & 0x1;
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DXIN addr %x, index %d, way %d, flag %x\n",addr,index,way,pCache[index].tag[way] & 0x78);
|
||||
#endif
|
||||
pCache[index].tag[way] &= ~(0x6F);
|
||||
|
||||
((u64*)pCache[index].data[way][0].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][0].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[1] = 0;
|
||||
break;
|
||||
}
|
||||
case 0x11:
|
||||
{
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
int way = addr & 0x1;
|
||||
u8 * out = pCache[index].data[way][(addr>>4) & 0x3].b8._8;
|
||||
cpuRegs.CP0.r[28] = *(u32 *)(out+(addr&0xf));
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DXLDT addr %x, index %d, way %d, DATA %x\n",addr,index,way,cpuRegs.CP0.r[28]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 0x10:
|
||||
{
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
int way = addr & 0x1;
|
||||
|
||||
cpuRegs.CP0.r[28] = 0;
|
||||
cpuRegs.CP0.r[28] = pCache[index].tag[way];
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DXLTG addr %x, index %d, way %d, DATA %x\n",addr,index,way,cpuRegs.CP0.r[28]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 0x13:
|
||||
{
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
int way = addr & 0x1;
|
||||
u8 * out = pCache[index].data[way][(addr>>4) & 0x3].b8._8;
|
||||
*(u32*)(&pCache[index].data[way][(addr>>4) & 0x3].b8._8[(addr&0xf)]) = cpuRegs.CP0.r[28];
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DXSDT addr %x, index %d, way %d, DATA %x\n",addr,index,way,cpuRegs.CP0.r[28]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 0x12:
|
||||
{
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
int way = addr & 0x1;
|
||||
pCache[index].tag[way] = cpuRegs.CP0.r[28];
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DXSTG addr %x, index %d, way %d, DATA %x\n",addr,index,way,cpuRegs.CP0.r[28] & 0x6F);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 0x14:
|
||||
{
|
||||
|
||||
u8 * out;
|
||||
int index = (addr >> 6) & 0x3F;
|
||||
int way = addr & 0x1;
|
||||
|
||||
#ifdef CACHE_LOG
|
||||
CACHE_LOG("CACHE DXWBIN addr %x, index %d, way %d, Flags %x\n",addr,index,way,pCache[index].tag[way] & 0x78);
|
||||
#endif
|
||||
if(pCache[index].tag[way] & 0x60) // Dirty
|
||||
{
|
||||
u32 paddr = memLUTW[pCache[index].tag[way] >> 12];
|
||||
char * t = (char *)(paddr);
|
||||
out = (u8*)(t + (addr & 0xFC0));
|
||||
((u64*)out)[0] = ((u64*)pCache[index].data[way][0].b8._8)[0];
|
||||
((u64*)out)[1] = ((u64*)pCache[index].data[way][0].b8._8)[1];
|
||||
((u64*)out)[2] = ((u64*)pCache[index].data[way][1].b8._8)[0];
|
||||
((u64*)out)[3] = ((u64*)pCache[index].data[way][1].b8._8)[1];
|
||||
((u64*)out)[4] = ((u64*)pCache[index].data[way][2].b8._8)[0];
|
||||
((u64*)out)[5] = ((u64*)pCache[index].data[way][2].b8._8)[1];
|
||||
((u64*)out)[6] = ((u64*)pCache[index].data[way][3].b8._8)[0];
|
||||
((u64*)out)[7] = ((u64*)pCache[index].data[way][3].b8._8)[1];
|
||||
}
|
||||
|
||||
pCache[index].tag[way] &= ~(0x6F);
|
||||
((u64*)pCache[index].data[way][0].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][0].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][1].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][2].b8._8)[1] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[0] = 0;
|
||||
((u64*)pCache[index].data[way][3].b8._8)[1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
void CACHE() {
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __CACHE_H__
|
||||
#define __CACHE_H__
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
typedef struct __u8bit_128 {
|
||||
u8 _8[16];
|
||||
|
||||
}_u8bit_128;
|
||||
|
||||
typedef struct _u128v2 {
|
||||
_u8bit_128 b8;
|
||||
|
||||
}u128;
|
||||
|
||||
typedef struct {
|
||||
u32 tag[2];
|
||||
u128 data[2][4];
|
||||
} _cacheS;
|
||||
|
||||
_cacheS pCache[64];
|
||||
void writeCache8(u32 mem, u8 value);
|
||||
void writeCache16(u32 mem, u16 value);
|
||||
void writeCache32(u32 mem, u32 value);
|
||||
void writeCache64(u32 mem, u64 value);
|
||||
void writeCache128(u32 mem, u64 *value);
|
||||
u8 *readCache(u32 mem);
|
||||
|
||||
#endif /* __CACHE_H__ */
|
1092
pcsx2/CdRom.c
1092
pcsx2/CdRom.c
File diff suppressed because it is too large
Load Diff
|
@ -1,92 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __CDROM_H__
|
||||
#define __CDROM_H__
|
||||
|
||||
#include "PsxCommon.h"
|
||||
#include "Decode_XA.h"
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
typedef struct {
|
||||
u8 OCUP;
|
||||
u8 Reg1Mode;
|
||||
u8 Reg2;
|
||||
u8 CmdProcess;
|
||||
u8 Ctrl;
|
||||
u8 Stat;
|
||||
|
||||
u8 StatP;
|
||||
|
||||
u8 Transfer[2352];
|
||||
u8 *pTransfer;
|
||||
|
||||
u8 Prev[4];
|
||||
u8 Param[8];
|
||||
u8 Result[8];
|
||||
|
||||
u8 ParamC;
|
||||
u8 ParamP;
|
||||
u8 ResultC;
|
||||
u8 ResultP;
|
||||
u8 ResultReady;
|
||||
u8 Cmd;
|
||||
u8 Readed;
|
||||
unsigned long Reading;
|
||||
|
||||
cdvdTN ResultTN;
|
||||
u8 ResultTD[4];
|
||||
u8 SetSector[4];
|
||||
u8 SetSectorSeek[4];
|
||||
u8 Track;
|
||||
int Play;
|
||||
int CurTrack;
|
||||
int Mode, File, Channel, Muted;
|
||||
int Reset;
|
||||
int RErr;
|
||||
int FirstSector;
|
||||
|
||||
xa_decode_t Xa;
|
||||
|
||||
int Init;
|
||||
|
||||
u8 Irq;
|
||||
unsigned long eCycle;
|
||||
|
||||
char Unused[4087];
|
||||
} cdrStruct;
|
||||
|
||||
cdrStruct cdr;
|
||||
|
||||
s32 MSFtoLSN(u8 *Time);
|
||||
void LSNtoMSF(u8 *Time, s32 lsn);
|
||||
|
||||
void cdrReset();
|
||||
void cdrInterrupt();
|
||||
void cdrReadInterrupt();
|
||||
u8 cdrRead0(void);
|
||||
u8 cdrRead1(void);
|
||||
u8 cdrRead2(void);
|
||||
u8 cdrRead3(void);
|
||||
void cdrWrite0(u8 rt);
|
||||
void cdrWrite1(u8 rt);
|
||||
void cdrWrite2(u8 rt);
|
||||
void cdrWrite3(u8 rt);
|
||||
int cdrFreeze(gzFile f, int Mode);
|
||||
|
||||
#endif /* __CDROM_H__ */
|
267
pcsx2/Common.h
267
pcsx2/Common.h
|
@ -1,267 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __COMMON_H__
|
||||
#define __COMMON_H__
|
||||
|
||||
#if defined (__linux__) // some distributions are lower case
|
||||
#define __LINUX__
|
||||
#endif
|
||||
|
||||
#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define DONT_USE_GETTEXT
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct {
|
||||
HWND hWnd; // Main window handle
|
||||
HINSTANCE hInstance; // Application instance
|
||||
HMENU hMenu; // Main window menu
|
||||
HANDLE hConsole;
|
||||
} AppData;
|
||||
|
||||
extern AppData gApp;
|
||||
#define pthread_mutex__unlock pthread_mutex_unlock
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <math.h>
|
||||
#define BOOL int
|
||||
#include <stdlib.h> // posix_memalign()
|
||||
#undef TRUE
|
||||
#define TRUE 1
|
||||
#undef FALSE
|
||||
#define FALSE 0
|
||||
|
||||
//#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
//#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define __declspec(x)
|
||||
#define __assume(x) ;
|
||||
#define strnicmp strncasecmp
|
||||
#define stricmp strcasecmp
|
||||
#include <winbase.h>
|
||||
//#pragma intrinsic (InterlockedAnd)
|
||||
// Definitions added Feb 16, 2006 by efp
|
||||
//#define __declspec(x)
|
||||
#include <malloc.h>
|
||||
#define __forceinline inline
|
||||
#define _aligned_malloc(x,y) __mingw_aligned_malloc(x,y)
|
||||
#define _aligned_free(x) __mingw_aligned_free(x)
|
||||
#define pthread_mutex__unlock pthread_mutex_unlock
|
||||
|
||||
#define fpusqrtf sqrtf
|
||||
#define fpufabsf fabsf
|
||||
#define fpusinf sinf
|
||||
#define fpucosf cosf
|
||||
#define fpuexpf expf
|
||||
#define fpuatanf atanf
|
||||
#define fpuatan2f atan2f
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h> // posix_memalign()
|
||||
|
||||
// Definitions added Feb 16, 2006 by efp
|
||||
//#ifndef __declspec
|
||||
//#define __declspec(x)
|
||||
//#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
||||
#ifdef __MSCW32__
|
||||
#include "libintlmsc.h"
|
||||
#else
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
|
||||
#undef _
|
||||
#define _(String) dgettext (PACKAGE, String)
|
||||
#ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
#else
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define _(msgid) msgid
|
||||
#define N_(msgid) msgid
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct _TESTRUNARGS
|
||||
{
|
||||
u8 enabled;
|
||||
u8 jpgcapture;
|
||||
|
||||
int frame; // if < 0, frame is unlimited (run until crash).
|
||||
int numimages;
|
||||
int curimage;
|
||||
u32 autopad; // mask for auto buttons
|
||||
int efile;
|
||||
int snapdone;
|
||||
|
||||
char* ptitle;
|
||||
char* pimagename;
|
||||
char* plogname;
|
||||
char* pgsdll, *pcdvddll, *pspudll;
|
||||
|
||||
} TESTRUNARGS;
|
||||
|
||||
extern TESTRUNARGS g_TestRun;
|
||||
|
||||
#define BIAS 2 // Bus is half of the actual ps2 speed
|
||||
//#define PS2CLK 36864000 /* 294.912 mhz */
|
||||
//#define PSXCLK 9216000 /* 36.864 Mhz */
|
||||
//#define PSXCLK 186864000 /* 36.864 Mhz */
|
||||
#define PS2CLK 294912000 /* 294.912 mhz */
|
||||
|
||||
|
||||
/* Config.PsxType == 1: PAL:
|
||||
VBlank interlaced 50.00 Hz
|
||||
VBlank non-interlaced 49.76 Hz
|
||||
HBlank 15.625 KHz
|
||||
Config.PsxType == 0: NSTC
|
||||
VBlank interlaced 59.94 Hz
|
||||
VBlank non-interlaced 59.82 Hz
|
||||
HBlank 15.73426573 KHz */
|
||||
|
||||
//VBlanks per second
|
||||
#define VBLANK_NTSC ((Config.PsxType & 2) ? 59.94 : 59.82)
|
||||
#define VBLANK_PAL ((Config.PsxType & 2) ? 50.00 : 49.76)
|
||||
|
||||
//HBlanks per second
|
||||
#define HBLANK_NTSC (15734.26573)
|
||||
#define HBLANK_PAL (15625)
|
||||
|
||||
//VBlank timers for EE, bit more accurate.
|
||||
#define VBLANKCNT(count) ((u32)((Config.PsxType & 1) ? (VBLANKPALSELECT * count) : (VBLANKNTSCSELECT * count)))
|
||||
#define VBLANKPALSELECT ((Config.PsxType & 2) ? (PS2CLK / 50.00) : (PS2CLK / 49.76))
|
||||
#define VBLANKNTSCSELECT ((Config.PsxType & 2) ? (PS2CLK / 59.94) : (PS2CLK / 59.82))
|
||||
|
||||
//EE VBlank speeds
|
||||
#define PS2VBLANK_NTSC_INT ((PS2CLK / 59.94))
|
||||
#define PS2VBLANK_NTSC ((PS2CLK / 59.82))
|
||||
#define PS2VBLANK_PAL_INT ((PS2CLK / 50.00))
|
||||
#define PS2VBLANK_PAL ((PS2CLK / 49.76))
|
||||
|
||||
//HBlank timer for EE, bit more accurate.
|
||||
#define HBLANKCNT(count) ((u32)(PS2HBLANK * count))
|
||||
|
||||
//EE HBlank speeds
|
||||
#define PS2HBLANK_NTSC ((int)(PS2CLK / HBLANK_NTSC))
|
||||
#define PS2HBLANK_PAL ((int)(PS2CLK / HBLANK_PAL))
|
||||
#define PS2HBLANK ((int)((Config.PsxType & 1) ? PS2HBLANK_PAL : PS2HBLANK_NTSC))
|
||||
|
||||
//IOP VBlank speeds
|
||||
#define PSXVBLANK_NTSC ((int)(PSXCLK / VBLANK_NTSC))
|
||||
#define PSXVBLANK_PAL ((int)(PSXCLK / VBLANK_PAL))
|
||||
#define PSXVBLANK ((int)((Config.PsxType & 1) ? PSXVBLANK_PAL : PSXVBLANK_NTSC))
|
||||
|
||||
//IOP HBlank speeds
|
||||
#define PSXHBLANK_NTSC ((int)(PSXCLK / HBLANK_NTSC))
|
||||
#define PSXHBLANK_PAL ((int)(PSXCLK / HBLANK_PAL))
|
||||
#define PSXHBLANK ((int)((Config.PsxType & 1) ? PSXHBLANK_PAL : PSXHBLANK_NTSC))
|
||||
|
||||
//Misc Clocks
|
||||
#define PSXPIXEL ((int)(PSXCLK / 13500000))
|
||||
#define PSXSOUNDCLK ((int)(48000))
|
||||
|
||||
#define COLOR_BLACK "\033[30m"
|
||||
#define COLOR_RED "\033[31m"
|
||||
#define COLOR_GREEN "\033[32m"
|
||||
#define COLOR_YELLOW "\033[33m"
|
||||
#define COLOR_BLUE "\033[34m"
|
||||
#define COLOR_MAGENTA "\033[35m"
|
||||
#define COLOR_CYAN "\033[36m"
|
||||
#define COLOR_WHITE "\033[37m"
|
||||
#define COLOR_RESET "\033[0m"
|
||||
|
||||
#include <pthread.h> // sync functions
|
||||
|
||||
#include "Plugins.h"
|
||||
#include "DebugTools/Debug.h"
|
||||
#include "R5900.h"
|
||||
#include "System.h"
|
||||
#include "Memory.h"
|
||||
#include "Elfheader.h"
|
||||
#include "Hw.h"
|
||||
//#include "GS.h"
|
||||
#include "Vif.h"
|
||||
#include "SPR.h"
|
||||
#include "Sif.h"
|
||||
#include "Plugins.h"
|
||||
#include "PS2Edefs.h"
|
||||
#include "Misc.h"
|
||||
#include "Counters.h"
|
||||
#include "IPU/IPU.h"
|
||||
#include "Patch.h"
|
||||
#include "COP0.h"
|
||||
#include "VifDma.h"
|
||||
#if (defined(__i386__) || defined(__x86_64__))
|
||||
#include "x86/ix86/ix86.h"
|
||||
#endif
|
||||
|
||||
int cdCaseopen;
|
||||
|
||||
extern void __Log(char *fmt, ...);
|
||||
extern u16 logProtocol;
|
||||
extern u8 logSource;
|
||||
#define PCSX2_VERSION "0.9.5"
|
||||
|
||||
// C++ code for sqrtf
|
||||
void InitFPUOps();
|
||||
extern float (*fpusqrtf)(float fval);
|
||||
extern float (*fpufabsf)(float fval);
|
||||
extern float (*fpusinf)(float fval);
|
||||
extern float (*fpucosf)(float fval);
|
||||
extern float (*fpuexpf)(float fval);
|
||||
extern float (*fpuatanf)(float fval);
|
||||
extern float (*fpuatan2f)(float fvalx, float fvaly);
|
||||
|
||||
// Added Feb 16, 2006 by efp
|
||||
#ifdef __LINUX__
|
||||
#include <errno.h> // EBUSY
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
#define DESTROY_MUTEX(mutex) { \
|
||||
int err = pthread_mutex_destroy(&mutex); \
|
||||
if( err == EBUSY ) \
|
||||
SysPrintf("cannot destroy"#mutex"\n"); \
|
||||
} \
|
||||
|
||||
#define DESTROY_COND(cond) { \
|
||||
int err = pthread_cond_destroy(&cond); \
|
||||
if( err == EBUSY ) \
|
||||
SysPrintf("cannot destroy"#cond"\n"); \
|
||||
} \
|
||||
|
||||
#endif /* __COMMON_H__ */
|
815
pcsx2/Counters.c
815
pcsx2/Counters.c
|
@ -1,815 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include "Common.h"
|
||||
#include "PsxCommon.h"
|
||||
#include "GS.h"
|
||||
|
||||
u64 profile_starttick = 0;
|
||||
u64 profile_totalticks = 0;
|
||||
|
||||
int gates = 0;
|
||||
extern u8 psxhblankgate;
|
||||
int hblankend = 0;
|
||||
Counter counters[6];
|
||||
u32 nextCounter, nextsCounter;
|
||||
static void (*s_prevExecuteVU1Block)() = NULL;
|
||||
LARGE_INTEGER lfreq;
|
||||
|
||||
// its so it doesnt keep triggering an interrupt once its reached its target
|
||||
// if it doesnt reset the counter it needs stopping
|
||||
u32 eecntmask = 0;
|
||||
|
||||
void rcntUpdTarget(int index) {
|
||||
counters[index].sCycleT = cpuRegs.cycle;
|
||||
}
|
||||
|
||||
void rcntUpd(int index) {
|
||||
counters[index].sCycle = cpuRegs.cycle;
|
||||
rcntUpdTarget(index);
|
||||
}
|
||||
|
||||
void rcntReset(int index) {
|
||||
counters[index].count = 0;
|
||||
//counters[index].mode&= ~0x00400C00;
|
||||
rcntUpd(index);
|
||||
}
|
||||
|
||||
void rcntSet() {
|
||||
u32 c;
|
||||
int i;
|
||||
|
||||
nextCounter = 0xffffffff;
|
||||
nextsCounter = cpuRegs.cycle;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (!(counters[i].mode & 0x80) || (counters[i].mode & 0x3) == 0x3) continue; // Stopped
|
||||
c = ((0x10000 - counters[i].count) * counters[i].rate) - (cpuRegs.cycle - counters[i].sCycleT);
|
||||
if (c < nextCounter) {
|
||||
nextCounter = c;
|
||||
}
|
||||
|
||||
// the + 10 is just in case of overflow
|
||||
//if(!(counters[i].mode & 0x100) || counters[i].target > 0xffff) continue;
|
||||
c = ((counters[i].target - counters[i].count) * counters[i].rate) - (cpuRegs.cycle - counters[i].sCycleT);
|
||||
if (c < nextCounter) {
|
||||
nextCounter = c;
|
||||
}
|
||||
|
||||
}
|
||||
//Calculate HBlank
|
||||
c = counters[4].CycleT - (cpuRegs.cycle - counters[4].sCycleT);
|
||||
if (c < nextCounter) {
|
||||
nextCounter = c;
|
||||
}
|
||||
//if(nextCounter > 0x1000) SysPrintf("Nextcounter %x HBlank %x VBlank %x\n", nextCounter, c, counters[5].CycleT - (cpuRegs.cycle - counters[5].sCycleT));
|
||||
//Calculate VBlank
|
||||
c = counters[5].CycleT - (cpuRegs.cycle - counters[5].sCycleT);
|
||||
if (c < nextCounter) {
|
||||
nextCounter = c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void rcntInit() {
|
||||
int i;
|
||||
|
||||
memset(counters, 0, sizeof(counters));
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
counters[i].rate = 2;
|
||||
counters[i].target = 0xffff;
|
||||
}
|
||||
counters[0].interrupt = 9;
|
||||
counters[1].interrupt = 10;
|
||||
counters[2].interrupt = 11;
|
||||
counters[3].interrupt = 12;
|
||||
|
||||
counters[4].mode = 0x3c0; // The VSync counter mode
|
||||
counters[5].mode = 0x3c0;
|
||||
|
||||
|
||||
|
||||
UpdateVSyncRate();
|
||||
/*hblankend = 0;
|
||||
counters[5].mode &= ~0x10000;
|
||||
counters[4].sCycleT = cpuRegs.cycle;
|
||||
counters[4].CycleT = HBLANKCNT(1);
|
||||
counters[4].count = 1;
|
||||
counters[5].CycleT = VBLANKCNT(1);
|
||||
counters[5].count = 1;
|
||||
counters[5].sCycleT = cpuRegs.cycle;*/
|
||||
|
||||
#ifdef _WIN32
|
||||
QueryPerformanceFrequency(&lfreq);
|
||||
#endif
|
||||
|
||||
for (i=0; i<4; i++) rcntUpd(i);
|
||||
rcntSet();
|
||||
|
||||
assert(Cpu != NULL && Cpu->ExecuteVU1Block != NULL );
|
||||
s_prevExecuteVU1Block = Cpu->ExecuteVU1Block;
|
||||
}
|
||||
|
||||
// debug code, used for stats
|
||||
int g_nCounters[4];
|
||||
extern u32 s_lastvsync[2];
|
||||
static int iFrame = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
u64 iTicks=0;
|
||||
|
||||
u64 GetTickFrequency()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return lfreq.QuadPart;
|
||||
#else
|
||||
return 1000000;
|
||||
#endif
|
||||
}
|
||||
|
||||
u64 GetCPUTicks()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER count;
|
||||
QueryPerformanceCounter(&count);
|
||||
return count.QuadPart;
|
||||
#else
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
return (u64)t.tv_sec*1000000+t.tv_usec;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void UpdateVSyncRate() {
|
||||
if (Config.PsxType & 1) {
|
||||
SysPrintf("PAL\n");
|
||||
counters[4].Cycle = 227000;
|
||||
/*if(Config.PsxType & 2)counters[5].rate = PS2VBLANK_PAL_INT;
|
||||
else counters[5].rate = PS2VBLANK_PAL;*/
|
||||
|
||||
counters[5].Cycle = 720;
|
||||
} else {
|
||||
SysPrintf("NTSC\n");
|
||||
counters[4].Cycle = 227000;
|
||||
/*if(Config.PsxType & 2)counters[5].rate = PS2VBLANK_NTSC_INT;
|
||||
else counters[5].rate = PS2VBLANK_NTSC;*/
|
||||
|
||||
counters[5].Cycle = 720;
|
||||
}
|
||||
|
||||
hblankend = 0;
|
||||
counters[5].mode &= ~0x10000;
|
||||
counters[4].sCycleT = cpuRegs.cycle;
|
||||
counters[4].CycleT = HBLANKCNT(1);
|
||||
counters[4].count = 1;
|
||||
counters[5].CycleT = VBLANKCNT(1);
|
||||
counters[5].count = 1;
|
||||
counters[5].sCycleT = cpuRegs.cycle;
|
||||
|
||||
//rcntUpdTarget(4);
|
||||
//counters[4].CycleT = counters[4].rate;
|
||||
///rcntUpdTarget(5);
|
||||
/*counters[5].CycleT = counters[5].rate;
|
||||
counters[5].Cycle = PS2VBLANKEND;*/
|
||||
|
||||
{
|
||||
u32 vsyncs = (Config.PsxType&1) ? 50:60;
|
||||
if(Config.CustomFps>0) vsyncs = Config.CustomFps;
|
||||
iTicks = GetTickFrequency()/vsyncs;
|
||||
SysPrintf("Framelimiter rate updated (UpdateVSyncRate): %d fps\n",vsyncs);
|
||||
}
|
||||
rcntSet();
|
||||
}
|
||||
|
||||
u32 pauses=0;
|
||||
|
||||
void FrameLimiter()
|
||||
{
|
||||
static u64 iStart=0, iEnd=0, iExpectedEnd=0;
|
||||
|
||||
if(iStart==0) iStart = GetCPUTicks();
|
||||
|
||||
iExpectedEnd = iStart + iTicks;
|
||||
iEnd = GetCPUTicks();
|
||||
|
||||
if(iEnd>=iExpectedEnd)
|
||||
{
|
||||
u64 diff = iEnd-iExpectedEnd;
|
||||
if((diff>>3)>iTicks) iExpectedEnd=iEnd;
|
||||
}
|
||||
else do {
|
||||
Sleep(1);
|
||||
pauses++;
|
||||
iEnd = GetCPUTicks();
|
||||
} while(iEnd<iExpectedEnd);
|
||||
iStart = iExpectedEnd; //remember the expected value frame. improves smoothness
|
||||
}
|
||||
|
||||
extern u32 CSRw;
|
||||
extern u64 SuperVUGetRecTimes(int clear);
|
||||
extern u32 vu0time;
|
||||
|
||||
extern void DummyExecuteVU1Block(void);
|
||||
|
||||
static u32 lastWasSkip=0;
|
||||
//extern u32 unpacktotal;
|
||||
|
||||
#include "VU.h"
|
||||
void VSync()
|
||||
{
|
||||
|
||||
if (counters[5].mode & 0x10000) { // VSync End (22 hsyncs)
|
||||
|
||||
// swap the vsync field
|
||||
u32 newfield = (*(u32*)(PS2MEM_GS+0x1000)&0x2000) ? 0 : 0x2000;
|
||||
*(u32*)(PS2MEM_GS+0x1000) = (*(u32*)(PS2MEM_GS+0x1000) & ~(1<<13)) | newfield;
|
||||
iFrame++;
|
||||
|
||||
// wait until GS stops
|
||||
if( CHECK_MULTIGS ) {
|
||||
GSRingBufSimplePacket(GS_RINGTYPE_VSYNC, newfield, 0, 0);
|
||||
}
|
||||
else {
|
||||
GSvsync(newfield);
|
||||
|
||||
// update here on single thread mode *OBSOLETE*
|
||||
if( PAD1update != NULL ) PAD1update(0);
|
||||
if( PAD2update != NULL ) PAD2update(1);
|
||||
}
|
||||
|
||||
counters[5].mode&= ~0x10000;
|
||||
hwIntcIrq(3);
|
||||
psxVSyncEnd();
|
||||
|
||||
if(gates)rcntEndGate(0x8);
|
||||
SysUpdate();
|
||||
// used to limit frames
|
||||
switch(CHECK_FRAMELIMIT) {
|
||||
case PCSX2_FRAMELIMIT_LIMIT:
|
||||
FrameLimiter();
|
||||
break;
|
||||
|
||||
case PCSX2_FRAMELIMIT_SKIP:
|
||||
case PCSX2_FRAMELIMIT_VUSKIP:
|
||||
{
|
||||
// the 6 was after trial and error
|
||||
static u32 uPrevTimes[6] = {0}, uNextFrame = 0, uNumFrames = 0, uTotalTime = 0;
|
||||
static u32 uLastTime = 0;
|
||||
static int nConsecutiveSkip = 0, nConsecutiveRender = 0;
|
||||
static short int changed = 0;
|
||||
static short int nNoSkipFrames = 0;
|
||||
|
||||
u32 uExpectedTime;
|
||||
u32 uCurTime = timeGetTime();
|
||||
u32 uDeltaTime = uCurTime - uLastTime;
|
||||
|
||||
if( uLastTime > 0 ) {
|
||||
|
||||
if( uNumFrames == ARRAYSIZE(uPrevTimes) ) uTotalTime -= uPrevTimes[uNextFrame];
|
||||
|
||||
uPrevTimes[uNextFrame] = uDeltaTime;
|
||||
uNextFrame = (uNextFrame + 1) % ARRAYSIZE(uPrevTimes);
|
||||
uTotalTime += uDeltaTime;
|
||||
|
||||
if( uNumFrames < ARRAYSIZE(uPrevTimes) ) ++uNumFrames;
|
||||
}
|
||||
//the +6 accounts for calling FrameLimiter() instead Sleep()
|
||||
uExpectedTime = (Config.PsxType&1) ? (ARRAYSIZE(uPrevTimes) * 1000 / 50 +6) : (ARRAYSIZE(uPrevTimes) * 1000 / 60 +6);
|
||||
|
||||
if( nNoSkipFrames > 0 ) --nNoSkipFrames;
|
||||
|
||||
// hmm... this might be more complicated than it needs to be... or not?
|
||||
if( changed != 0 ) {
|
||||
if( changed > 0 ) {
|
||||
++nConsecutiveRender;
|
||||
--changed;
|
||||
|
||||
if( nConsecutiveRender > 20 && uTotalTime + 1 < uExpectedTime ) nNoSkipFrames = ARRAYSIZE(uPrevTimes);
|
||||
|
||||
}
|
||||
else {
|
||||
++nConsecutiveSkip;
|
||||
++changed;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if( nNoSkipFrames == 0 && nConsecutiveRender > 1 && nConsecutiveSkip < 1 &&
|
||||
(CHECK_MULTIGS? (uTotalTime >= uExpectedTime + uDeltaTime/4 && (uTotalTime >= uExpectedTime + uDeltaTime*3/4 || nConsecutiveSkip==0)) :
|
||||
(uTotalTime >= uExpectedTime + (uDeltaTime/4))) ) {
|
||||
|
||||
|
||||
if( nConsecutiveSkip == 0 ) {
|
||||
|
||||
//first freeze GS regs THEN send dummy packet
|
||||
if( CHECK_MULTIGS ) GSRingBufSimplePacket(GS_RINGTYPE_FRAMESKIP, 1, 0, 0);
|
||||
else GSsetFrameSkip(1);
|
||||
if( CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_VUSKIP ) {
|
||||
Cpu->ExecuteVU1Block = DummyExecuteVU1Block;
|
||||
}
|
||||
}
|
||||
|
||||
changed = -1;
|
||||
nConsecutiveSkip++;
|
||||
}
|
||||
else {
|
||||
|
||||
if( nConsecutiveSkip > 1) {
|
||||
//first set VU1 to enabled THEN unfreeze GS regs
|
||||
if( CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_VUSKIP )
|
||||
Cpu->ExecuteVU1Block = s_prevExecuteVU1Block;
|
||||
if( CHECK_MULTIGS ) GSRingBufSimplePacket(GS_RINGTYPE_FRAMESKIP, 0, 0, 0);
|
||||
else GSsetFrameSkip(0);
|
||||
|
||||
nConsecutiveRender = 0;
|
||||
}
|
||||
|
||||
changed = 3;
|
||||
nConsecutiveRender++;
|
||||
nConsecutiveSkip = 0;
|
||||
|
||||
if( nConsecutiveRender > 20 && uTotalTime + 1 < uExpectedTime ) {
|
||||
|
||||
nNoSkipFrames = ARRAYSIZE(uPrevTimes);
|
||||
}
|
||||
}
|
||||
}
|
||||
uLastTime = uCurTime;
|
||||
//dont get too fast, instead keep at smooth full fps
|
||||
FrameLimiter();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // VSync Start (240 hsyncs)
|
||||
//UpdateVSyncRateEnd();
|
||||
#ifdef EE_PROFILING
|
||||
if( (iFrame%20) == 0 ) {
|
||||
SysPrintf("Profiled Cycles at %d frames %d\n", iFrame, profile_totalticks);
|
||||
CLEAR_EE_PROFILE();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//SysPrintf("c: %x, %x\n", cpuRegs.cycle, *(u32*)&VU1.Micro[16]);
|
||||
//if( (iFrame%20) == 0 ) SysPrintf("svu time: %d\n", SuperVUGetRecTimes(1) * 100000 / lfreq.QuadPart);
|
||||
// if( (iFrame%10) == 0 ) {
|
||||
// SysPrintf("vu0 time: %d\n", vu0time);
|
||||
// vu0time = 0;
|
||||
// }
|
||||
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if( g_TestRun.enabled && g_TestRun.frame > 0 ) {
|
||||
if( iFrame > g_TestRun.frame ) {
|
||||
// take a snapshot
|
||||
if( g_TestRun.pimagename != NULL && GSmakeSnapshot2 != NULL ) {
|
||||
if( g_TestRun.snapdone ) {
|
||||
g_TestRun.curimage++;
|
||||
g_TestRun.snapdone = 0;
|
||||
g_TestRun.frame += 20;
|
||||
if( g_TestRun.curimage >= g_TestRun.numimages ) {
|
||||
// exit
|
||||
SysClose();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// query for the image
|
||||
GSmakeSnapshot2(g_TestRun.pimagename, &g_TestRun.snapdone, g_TestRun.jpgcapture);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// exit
|
||||
SysClose();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GSVSYNC();
|
||||
|
||||
if( g_SaveGSStream == 1 ) {
|
||||
freezeData fP;
|
||||
|
||||
g_SaveGSStream = 2;
|
||||
gsFreeze(g_fGSSave, 1);
|
||||
|
||||
if (GSfreeze(FREEZE_SIZE, &fP) == -1) {
|
||||
gzclose(g_fGSSave);
|
||||
g_SaveGSStream = 0;
|
||||
}
|
||||
else {
|
||||
fP.data = (s8*)malloc(fP.size);
|
||||
if (fP.data == NULL) {
|
||||
gzclose(g_fGSSave);
|
||||
g_SaveGSStream = 0;
|
||||
}
|
||||
else {
|
||||
if (GSfreeze(FREEZE_SAVE, &fP) == -1) {
|
||||
gzclose(g_fGSSave);
|
||||
g_SaveGSStream = 0;
|
||||
}
|
||||
else {
|
||||
gzwrite(g_fGSSave, &fP.size, sizeof(fP.size));
|
||||
if (fP.size) {
|
||||
gzwrite(g_fGSSave, fP.data, fP.size);
|
||||
free(fP.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( g_SaveGSStream == 2 ) {
|
||||
|
||||
if( --g_nLeftGSFrames <= 0 ) {
|
||||
gzclose(g_fGSSave);
|
||||
g_fGSSave = NULL;
|
||||
g_SaveGSStream = 0;
|
||||
SysPrintf("Done saving GS stream\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//counters[5].mode&= ~0x10000;
|
||||
//UpdateVSyncRate();
|
||||
|
||||
//SysPrintf("ctrs: %d %d %d %d\n", g_nCounters[0], g_nCounters[1], g_nCounters[2], g_nCounters[3]);
|
||||
//SysPrintf("vif: %d\n", (((LARGE_INTEGER*)g_nCounters)->QuadPart * 1000000) / lfreq.QuadPart);
|
||||
//memset(g_nCounters, 0, 16);
|
||||
counters[5].mode|= 0x10000;
|
||||
if ((CSRw & 0x8))
|
||||
GSCSRr|= 0x8;
|
||||
|
||||
if (!(GSIMR&0x800) )
|
||||
gsIrq();
|
||||
|
||||
hwIntcIrq(2);
|
||||
psxVSyncStart();
|
||||
|
||||
if(Config.Patch) applypatch(1);
|
||||
if(gates)rcntStartGate(0x8);
|
||||
|
||||
// __Log("%u %u 0\n", cpuRegs.cycle-s_lastvsync[1], timeGetTime()-s_lastvsync[0]);
|
||||
// s_lastvsync[0] = timeGetTime();
|
||||
// s_lastvsync[1] = cpuRegs.cycle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rcntUpdate()
|
||||
{
|
||||
int i;
|
||||
u32 change = 0;
|
||||
for (i=0; i<=3; i++) {
|
||||
if(gates & (1<<i) ){
|
||||
//SysPrintf("Stopped accidental update of ee counter %x when using a gate\n", i);
|
||||
continue;
|
||||
}
|
||||
if ((counters[i].mode & 0x80) && (counters[i].mode & 0x3) != 0x3){
|
||||
change = cpuRegs.cycle - counters[i].sCycleT;
|
||||
counters[i].count += (int)(change / counters[i].rate);
|
||||
change -= (change / counters[i].rate) * counters[i].rate;
|
||||
} else change = 0;
|
||||
counters[i].sCycleT = cpuRegs.cycle - change;
|
||||
//if(change > 0) SysPrintf("Change saved on %x = %x\n", i, change);
|
||||
}
|
||||
|
||||
if ((u32)(cpuRegs.cycle - counters[4].sCycleT) >= (u32)counters[4].CycleT && hblankend == 1){
|
||||
|
||||
|
||||
if ((CSRw & 0x4))
|
||||
GSCSRr |= 4; // signal
|
||||
|
||||
|
||||
if (!(GSIMR&0x400) )
|
||||
gsIrq();
|
||||
|
||||
if(gates)rcntEndGate(0);
|
||||
if(psxhblankgate)psxCheckEndGate(0);
|
||||
hblankend = 0;
|
||||
|
||||
counters[4].CycleT = HBLANKCNT(counters[4].count);
|
||||
} else
|
||||
if ((u32)(cpuRegs.cycle - counters[4].sCycleT) >= (u32)counters[4].CycleT) {
|
||||
|
||||
if(counters[4].count >= counters[4].Cycle){
|
||||
//SysPrintf("%x of %x hblanks reorder in %x cycles cpuRegs.cycle = %x\n", counters[4].count, counters[4].Cycle, cpuRegs.cycle - counters[4].sCycleT, cpuRegs.cycle);
|
||||
counters[4].sCycleT += HBLANKCNT(counters[4].Cycle);
|
||||
counters[4].count -= counters[4].Cycle;
|
||||
|
||||
}
|
||||
//counters[4].sCycleT += HBLANKCNT(1);
|
||||
counters[4].count++;
|
||||
|
||||
counters[4].CycleT = HBLANKCNT(counters[4].count) - (HBLANKCNT(0.5));
|
||||
|
||||
rcntStartGate(0);
|
||||
psxCheckStartGate(0);
|
||||
hblankend = 1;
|
||||
//if(cpuRegs.cycle > 0xffff0000 || cpuRegs.cycle < 0x1000
|
||||
//SysPrintf("%x hsync done in %x cycles cpuRegs.cycle = %x next will happen on %x\n", counters[4].count, counters[4].CycleT, cpuRegs.cycle, (u32)(counters[4].sCycleT + counters[4].CycleT));
|
||||
}
|
||||
|
||||
if((counters[5].mode & 0x10000)){
|
||||
if ((cpuRegs.cycle - counters[5].sCycleT) >= counters[5].CycleT){
|
||||
//counters[5].sCycleT = cpuRegs.cycle;
|
||||
counters[5].CycleT = VBLANKCNT(counters[5].count);
|
||||
VSync();
|
||||
}
|
||||
} else if ((cpuRegs.cycle - counters[5].sCycleT) >= counters[5].CycleT) {
|
||||
if(counters[5].count >= counters[5].Cycle){
|
||||
//SysPrintf("reset %x of %x frames done in %x cycles cpuRegs.cycle = %x\n", counters[5].count, counters[5].Cycle, cpuRegs.cycle - counters[5].sCycleT, cpuRegs.cycle);
|
||||
counters[5].sCycleT += VBLANKCNT(counters[5].Cycle);
|
||||
counters[5].count -= counters[5].Cycle;
|
||||
}
|
||||
counters[5].count++;
|
||||
//counters[5].sCycleT += VBLANKCNT(1);
|
||||
counters[5].CycleT = VBLANKCNT(counters[5].count) - (VBLANKCNT(1)/2);
|
||||
//SysPrintf("%x frames done in %x cycles cpuRegs.cycle = %x cycletdiff %x\n", counters[5].Cycle, counters[5].sCycleT, cpuRegs.cycle, (counters[5].CycleT - VBLANKCNT(1)) - (cpuRegs.cycle - counters[5].sCycleT));
|
||||
VSync();
|
||||
}
|
||||
|
||||
for (i=0; i<=3; i++) {
|
||||
if (!(counters[i].mode & 0x80)) continue; // Stopped
|
||||
|
||||
if ((s64)(counters[i].target - counters[i].count) <= 0 /*&& (counters[i].target & 0xffff) > 0*/) { // Target interrupt
|
||||
|
||||
if((counters[i].target > 0xffff)) {
|
||||
//SysPrintf("EE Correcting target %x after reset on target\n", i);
|
||||
counters[i].target &= 0xffff;
|
||||
}
|
||||
|
||||
if(counters[i].mode & 0x100 ) {
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE counter %d target reached mode %x count %x target %x\n", i, counters[i].mode, counters[i].count, counters[i].target);
|
||||
#endif
|
||||
|
||||
counters[i].mode|= 0x0400; // Target flag
|
||||
hwIntcIrq(counters[i].interrupt);
|
||||
if (counters[i].mode & 0x40) { //The PS2 only resets if the interrupt is enabled - Tested on PS2
|
||||
|
||||
counters[i].count -= counters[i].target; // Reset on target
|
||||
}
|
||||
else counters[i].target += 0x10000000;
|
||||
} else counters[i].target += 0x10000000;
|
||||
|
||||
}
|
||||
if (counters[i].count > 0xffff) {
|
||||
|
||||
|
||||
if (counters[i].mode & 0x0200) { // Overflow interrupt
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE counter %d overflow mode %x count %x target %x\n", i, counters[i].mode, counters[i].count, counters[i].target);
|
||||
#endif
|
||||
counters[i].mode|= 0x0800; // Overflow flag
|
||||
hwIntcIrq(counters[i].interrupt);
|
||||
//SysPrintf("counter[%d] overflow interrupt (%x)\n", i, cpuRegs.cycle);
|
||||
}
|
||||
counters[i].count -= 0x10000;
|
||||
if(counters[i].target > 0xffff) {
|
||||
//SysPrintf("EE %x Correcting target on overflow\n", i);
|
||||
counters[i].target &= 0xffff;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
rcntSet();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rcntWcount(int index, u32 value) {
|
||||
u32 change = 0;
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE count write %d count %x with %x target %x eecycle %x\n", index, counters[index].count, value, counters[index].target, cpuRegs.eCycle);
|
||||
#endif
|
||||
counters[index].count = value & 0xffff;
|
||||
if(counters[index].target > 0xffff) {
|
||||
counters[index].target &= 0xffff;
|
||||
//SysPrintf("EE Counter %x count write, target > 0xffff\n", index);
|
||||
}
|
||||
//rcntUpd(index);
|
||||
if((counters[index].mode & 0x3) != 0x3){
|
||||
change = cpuRegs.cycle - counters[index].sCycleT;
|
||||
change -= (change / counters[index].rate) * counters[index].rate;
|
||||
counters[index].sCycleT = cpuRegs.cycle - change;
|
||||
}/* else {
|
||||
SysPrintf("EE Counter %x count write %x\n", index, value);
|
||||
}*/
|
||||
rcntSet();
|
||||
}
|
||||
|
||||
void rcntWmode(int index, u32 value)
|
||||
{
|
||||
u32 change = 0;
|
||||
|
||||
|
||||
if (value & 0xc00) { //Clear status flags, the ps2 only clears what is given in the value
|
||||
counters[index].mode &= ~(value & 0xc00);
|
||||
}
|
||||
|
||||
if(counters[index].mode & 0x80){
|
||||
if((counters[index].mode & 0x3) != 0x3){
|
||||
change = cpuRegs.cycle - counters[index].sCycleT;
|
||||
counters[index].count += (int)(change / counters[index].rate);
|
||||
change -= (change / counters[index].rate) * counters[index].rate;
|
||||
counters[index].sCycleT = cpuRegs.cycle - change;
|
||||
}
|
||||
//if(change != 0) SysPrintf("Weee\n");
|
||||
//counters[index].sCycleT = cpuRegs.cycle - ((cpuRegs.cycle - counters[index].sCycleT) % counters[index].rate);
|
||||
if(!(value & 0x80)) SysPrintf("Stopping\n");
|
||||
}
|
||||
else {
|
||||
SysPrintf("Counter %d not running c%x s%x c%x\n", index, counters[index].count, counters[index].sCycleT, cpuRegs.cycle);
|
||||
if(value & 0x80) SysPrintf("Starting %d, v%x\n", index, value);
|
||||
counters[index].sCycleT = cpuRegs.cycle;
|
||||
}
|
||||
//if((value & 0x80) && !(counters[index].mode & 0x80)) rcntUpd(index); //Counter wasnt started, so set the start cycle
|
||||
|
||||
counters[index].mode = (counters[index].mode & 0xc00) | (value & 0x3ff);
|
||||
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE counter set %d mode %x count %x\n", index, counters[index].mode, rcntCycle(index));
|
||||
#endif
|
||||
/*if((value & 0x3) && (counters[index].mode & 0x3) != 0x3){
|
||||
//SysPrintf("Syncing %d with HBLANK clock\n", index);
|
||||
counters[index].CycleT = counters[4].CycleT;
|
||||
}*/
|
||||
|
||||
switch (value & 0x3) { //Clock rate divisers *2, they use BUSCLK speed not PS2CLK
|
||||
case 0: counters[index].rate = 2; break;
|
||||
case 1: counters[index].rate = 32; break;
|
||||
case 2: counters[index].rate = 512; break;
|
||||
case 3: counters[index].rate = PS2HBLANK; break;
|
||||
}
|
||||
|
||||
if((counters[index].mode & 0xF) == 0x7) {
|
||||
gates &= ~(1<<index);
|
||||
SysPrintf("Gate Disabled\n");
|
||||
// counters[index].mode &= ~0x80;
|
||||
}else if(counters[index].mode & 0x4){
|
||||
// SysPrintf("Gate enable on counter %x mode %x\n", index, counters[index].mode);
|
||||
gates |= 1<<index;
|
||||
counters[index].mode &= ~0x80;
|
||||
rcntReset(index);
|
||||
}
|
||||
else gates &= ~(1<<index);
|
||||
|
||||
/*if((counters[index].target > 0xffff) && (counters[index].target & 0xffff) > rcntCycle(index)) {
|
||||
//SysPrintf("EE Correcting target %x after mode write\n", index);
|
||||
counters[index].target &= 0xffff;
|
||||
}*/
|
||||
rcntSet();
|
||||
|
||||
}
|
||||
|
||||
void rcntStartGate(int mode){
|
||||
int i;
|
||||
|
||||
if(mode == 0){
|
||||
for(i = 0; i < 4; i++){ //Update counters using the hblank as the clock
|
||||
if((counters[i].mode & 0x83) == 0x83) counters[i].count++;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i <=3; i++){ //Gates for counters
|
||||
if(!(gates & (1<<i))) continue;
|
||||
if ((counters[i].mode & 0x8) != mode) continue;
|
||||
//SysPrintf("Gate %d mode %d Start\n", i, (counters[i].mode & 0x30) >> 4);
|
||||
switch((counters[i].mode & 0x30) >> 4){
|
||||
case 0x0: //Count When Signal is low (off)
|
||||
counters[i].count = rcntRcount(i);
|
||||
rcntUpd(i);
|
||||
counters[i].mode &= ~0x80;
|
||||
break;
|
||||
case 0x1: //Reset and start counting on Vsync start
|
||||
counters[i].mode |= 0x80;
|
||||
rcntReset(i);
|
||||
counters[i].target &= 0xffff;
|
||||
break;
|
||||
case 0x2: //Reset and start counting on Vsync end
|
||||
//Do Nothing
|
||||
break;
|
||||
case 0x3: //Reset and start counting on Vsync start and end
|
||||
counters[i].mode |= 0x80;
|
||||
rcntReset(i);
|
||||
counters[i].target &= 0xffff;
|
||||
break;
|
||||
default:
|
||||
SysPrintf("EE Start Counter %x Gate error\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void rcntEndGate(int mode){
|
||||
int i;
|
||||
|
||||
for(i=0; i <=3; i++){ //Gates for counters
|
||||
if(!(gates & (1<<i))) continue;
|
||||
if ((counters[i].mode & 0x8) != mode) continue;
|
||||
//SysPrintf("Gate %d mode %d End\n", i, (counters[i].mode & 0x30) >> 4);
|
||||
switch((counters[i].mode & 0x30) >> 4){
|
||||
case 0x0: //Count When Signal is low (off)
|
||||
rcntUpd(i);
|
||||
counters[i].mode |= 0x80;
|
||||
break;
|
||||
case 0x1: //Reset and start counting on Vsync start
|
||||
//Do Nothing
|
||||
break;
|
||||
case 0x2: //Reset and start counting on Vsync end
|
||||
counters[i].mode |= 0x80;
|
||||
rcntReset(i);
|
||||
counters[i].target &= 0xffff;
|
||||
break;
|
||||
case 0x3: //Reset and start counting on Vsync start and end
|
||||
counters[i].mode |= 0x80;
|
||||
rcntReset(i);
|
||||
counters[i].target &= 0xffff;
|
||||
break;
|
||||
default:
|
||||
SysPrintf("EE Start Counter %x Gate error\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void rcntWtarget(int index, u32 value) {
|
||||
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE target write %d target %x value %x\n", index, counters[index].target, value);
|
||||
#endif
|
||||
counters[index].target = value & 0xffff;
|
||||
if(counters[index].target <= rcntCycle(index)/* && counters[index].target != 0*/) {
|
||||
//SysPrintf("EE Saving target %d from early trigger, target = %x, count = %x\n", index, counters[index].target, rcntCycle(index));
|
||||
counters[index].target += 0x10000000;
|
||||
}
|
||||
rcntSet();
|
||||
}
|
||||
|
||||
void rcntWhold(int index, u32 value) {
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE hold write %d value %x\n", index, value);
|
||||
#endif
|
||||
counters[index].hold = value;
|
||||
}
|
||||
|
||||
u16 rcntRcount(int index) {
|
||||
u16 ret;
|
||||
|
||||
if ((counters[index].mode & 0x80)) {
|
||||
ret = counters[index].count + (int)((cpuRegs.cycle - counters[index].sCycleT) / counters[index].rate);
|
||||
}else{
|
||||
ret = counters[index].count;
|
||||
}
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE count read %d value %x\n", index, ret);
|
||||
#endif
|
||||
return (u16)ret;
|
||||
}
|
||||
|
||||
u32 rcntCycle(int index) {
|
||||
|
||||
if ((counters[index].mode & 0x80)) {
|
||||
return (u32)counters[index].count + (int)((cpuRegs.cycle - counters[index].sCycleT) / counters[index].rate);
|
||||
}else{
|
||||
return (u32)counters[index].count;
|
||||
}
|
||||
}
|
||||
|
||||
int rcntFreeze(gzFile f, int Mode) {
|
||||
gzfreezel(counters);
|
||||
gzfreeze(&nextCounter, sizeof(nextCounter));
|
||||
gzfreeze(&nextsCounter, sizeof(nextsCounter));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __COUNTERS_H__
|
||||
#define __COUNTERS_H__
|
||||
|
||||
typedef struct {
|
||||
u32 count, mode, target, hold;
|
||||
u32 rate, interrupt;
|
||||
u32 Cycle, sCycle;
|
||||
u32 CycleT, sCycleT;
|
||||
} Counter;
|
||||
|
||||
extern Counter counters[6];
|
||||
extern u32 nextCounter, nextsCounter;
|
||||
|
||||
void rcntInit();
|
||||
void rcntUpdate();
|
||||
void rcntStartGate(int mode);
|
||||
void rcntEndGate(int mode);
|
||||
void rcntWcount(int index, u32 value);
|
||||
void rcntWmode(int index, u32 value);
|
||||
void rcntWtarget(int index, u32 value);
|
||||
void rcntWhold(int index, u32 value);
|
||||
u16 rcntRcount(int index);
|
||||
u32 rcntCycle(int index);
|
||||
int rcntFreeze(gzFile f, int Mode);
|
||||
|
||||
void UpdateVSyncRate();
|
||||
|
||||
#endif /* __COUNTERS_H__ */
|
|
@ -1,145 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
#include "Misc.h"
|
||||
|
||||
extern FILE *emuLog;
|
||||
|
||||
char* disR5900F(u32 code, u32 pc);
|
||||
char* disR5900Fasm(u32 code, u32 pc);
|
||||
char* disR3000Fasm(u32 code, u32 pc);
|
||||
|
||||
void disR5900AddSym(u32 addr, char *name);
|
||||
char* disR5900GetSym(u32 addr);
|
||||
char* disR5900GetUpperSym(u32 addr);
|
||||
void disR5900FreeSyms();
|
||||
|
||||
char* disVU0MicroUF(u32 code, u32 pc);
|
||||
char* disVU0MicroLF(u32 code, u32 pc);
|
||||
char* disVU1MicroUF(u32 code, u32 pc);
|
||||
char* disVU1MicroLF(u32 code, u32 pc);
|
||||
|
||||
char* disR3000AF(u32 code, u32 pc);
|
||||
|
||||
extern char *CP2VFnames[];
|
||||
extern char *disRNameCP2f[];
|
||||
extern char *disRNameCP2i[];
|
||||
|
||||
//that way is slower but you now not need to compile every time ;P
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
|
||||
extern int Log;
|
||||
extern u32 varLog;
|
||||
extern u16 logProtocol;
|
||||
extern u8 logSource;
|
||||
|
||||
void __Log(char *fmt, ...);
|
||||
|
||||
//memcars has the same number as PAD_LOG
|
||||
#define MEMCARDS_LOG if (varLog & 0x02000000) {logProtocol=7; logSource='I';} if (varLog & 0x02000000) __Log
|
||||
|
||||
#define CPU_LOG if (varLog & 0x00000001) {logProtocol=1; logSource='E';} if (varLog & 0x00000001) __Log
|
||||
#define MEM_LOG if (varLog & 0x00000002) {logProtocol=6; logSource='E';} if (varLog & 0x00000002) __Log("%8.8lx: ", cpuRegs.pc); if (varLog & 0x00000002) __Log
|
||||
#define HW_LOG if (varLog & 0x00000004) {logProtocol=6; logSource='E';} if (varLog & 0x00000004) __Log("%8.8lx: ", cpuRegs.pc); if (varLog & 0x00000004) __Log
|
||||
#define DMA_LOG if (varLog & 0x00000008) {logProtocol=5; logSource='E';} if (varLog & 0x00000008) __Log
|
||||
#define BIOS_LOG if (varLog & 0x00000010) {logProtocol=0; logSource='E';} if (varLog & 0x00000010) __Log("%8.8lx: ", cpuRegs.pc); if (varLog & 0x00000010) __Log
|
||||
#define ELF_LOG if (varLog & 0x00000020) {logProtocol=7; logSource='E';} if (varLog & 0x00000020) __Log
|
||||
#define FPU_LOG if (varLog & 0x00000040) {logProtocol=1; logSource='E';} if (varLog & 0x00000040) __Log
|
||||
#define MMI_LOG if (varLog & 0x00000080) {logProtocol=1; logSource='E';} if (varLog & 0x00000080) __Log
|
||||
#define VU0_LOG if (varLog & 0x00000100) {logProtocol=2; logSource='E';} if (varLog & 0x00000100) __Log
|
||||
#define COP0_LOG if (varLog & 0x00000200) {logProtocol=1; logSource='E';} if (varLog & 0x00000200) __Log
|
||||
#define VIF_LOG if (varLog & 0x00000400) {logProtocol=3; logSource='E';} if (varLog & 0x00000400) __Log
|
||||
#define SPR_LOG if (varLog & 0x00000800) {logProtocol=7; logSource='E';} if (varLog & 0x00000800) __Log
|
||||
#define GIF_LOG if (varLog & 0x00001000) {logProtocol=4; logSource='E';} if (varLog & 0x00001000) __Log
|
||||
#define SIF_LOG if (varLog & 0x00002000) {logProtocol=9; logSource='E';} if (varLog & 0x00002000) __Log
|
||||
#define IPU_LOG if (varLog & 0x00004000) {logProtocol=8; logSource='E';} if (varLog & 0x00004000) __Log
|
||||
#define VUM_LOG if (varLog & 0x00008000) {logProtocol=2; logSource='E';} if (varLog & 0x00008000) __Log
|
||||
#define RPC_LOG if (varLog & 0x00010000) {logProtocol=9; logSource='E';} if (varLog & 0x00010000) __Log
|
||||
|
||||
#define PSXCPU_LOG if (varLog & 0x00100000) {logProtocol=1; logSource='I';} if (varLog & 0x00100000) __Log
|
||||
#define PSXMEM_LOG if (varLog & 0x00200000) {logProtocol=6; logSource='I';} if (varLog & 0x00200000) __Log("%8.8lx : ", psxRegs.pc); if (varLog & 0x00200000) __Log
|
||||
#define PSXHW_LOG if (varLog & 0x00400000) {logProtocol=2; logSource='I';} if (varLog & 0x00400000) __Log("%8.8lx : ", psxRegs.pc); if (varLog & 0x00400000) __Log
|
||||
#define PSXBIOS_LOG if (varLog & 0x00800000) {logProtocol=0; logSource='I';} if (varLog & 0x00800000) __Log("%8.8lx : ", psxRegs.pc); if (varLog & 0x00800000) __Log
|
||||
#define PSXDMA_LOG if (varLog & 0x01000000) {logProtocol=5; logSource='I';} if (varLog & 0x01000000) __Log
|
||||
|
||||
#define PAD_LOG if (varLog & 0x02000000) {logProtocol=7; logSource='I';} if (varLog & 0x02000000) __Log
|
||||
#define GTE_LOG if (varLog & 0x04000000) {logProtocol=3; logSource='I';} if (varLog & 0x04000000) __Log
|
||||
#define CDR_LOG if (varLog & 0x08000000) {logProtocol=8; logSource='I';} if (varLog & 0x08000000) __Log("%8.8lx %8.8lx: ", psxRegs.pc, psxRegs.cycle); if (varLog & 0x08000000) __Log
|
||||
#define GPU_LOG if (varLog & 0x10000000) {logProtocol=4; logSource='I';} if (varLog & 0x10000000) __Log
|
||||
#define PSXCNT_LOG if (varLog & 0x20000000) {logProtocol=0; logSource='I';} if (varLog & 0x20000000) __Log("%8.8lx %8.8lx: ", psxRegs.pc, psxRegs.cycle); if (varLog & 0x20000000) __Log
|
||||
#define EECNT_LOG if (varLog & 0x40000000) {logProtocol=0; logSource='I';} if (varLog & 0x40000000) __Log("%8.8lx %8.8lx: ", cpuRegs.pc, cpuRegs.cycle); if (varLog & 0x40000000) __Log
|
||||
|
||||
#if defined (CPU_LOG) || defined(MEM_LOG) || defined(HW_LOG) || defined(DMA_LOG) || \
|
||||
defined(BIOS_LOG) || defined(ELF_LOG) || defined(FPU_LOG) || defined(MMI_LOG) || \
|
||||
defined(VU0_LOG) || defined(COP0_LOG) || defined(VIF_LOG) || defined(SPR_LOG) || \
|
||||
defined(GIF_LOG) || defined(SIF_LOG) || defined(IPU_LOG) || defined(VUM_log) || \
|
||||
defined(PSXCPU_LOG) || defined(PSXMEM_LOG)|| defined(IOPBIOS_LOG)|| defined(IOPHW_LOG)|| \
|
||||
defined(PAD_LOG) || defined(GTE_LOG) || defined(CDR_LOG) || defined(GPU_LOG) || \
|
||||
defined(MEMCARDS_LOG)|| defined(PSXCNT_LOG) || defined(EECNT_LOG)
|
||||
#define EMU_LOG __Log
|
||||
#endif
|
||||
|
||||
#else // PCSX2_DEVBUILD
|
||||
|
||||
#define varLog 0
|
||||
#define Log 0
|
||||
|
||||
#define CPU_LOG 0&&
|
||||
#define MEM_LOG 0&&
|
||||
#define HW_LOG 0&&
|
||||
#define DMA_LOG 0&&
|
||||
#define BIOS_LOG 0&&
|
||||
#define ELF_LOG 0&&
|
||||
#define FPU_LOG 0&&
|
||||
#define MMI_LOG 0&&
|
||||
#define VU0_LOG 0&&
|
||||
#define COP0_LOG 0&&
|
||||
#define VIF_LOG 0&&
|
||||
#define SPR_LOG 0&&
|
||||
#define GIF_LOG 0&&
|
||||
#define SIF_LOG 0&&
|
||||
#define IPU_LOG 0&&
|
||||
#define VUM_LOG 0&&
|
||||
#define RPC_LOG 0&&
|
||||
|
||||
#define PSXCPU_LOG 0&&
|
||||
#define PSXMEM_LOG 0&&
|
||||
#define PSXHW_LOG 0&&
|
||||
#define PSXBIOS_LOG 0&&
|
||||
#define PSXDMA_LOG 0&&
|
||||
|
||||
#define PAD_LOG 0&&
|
||||
#define GTE_LOG 0&&
|
||||
#define CDR_LOG 0&&
|
||||
#define GPU_LOG 0&&
|
||||
#define PSXCNT_LOG 0&&
|
||||
#define EECNT_LOG 0&&
|
||||
|
||||
#define EMU_LOG 0&&
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __DEBUG_H__ */
|
|
@ -1,54 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "R5900.h"
|
||||
|
||||
//DECODE PROCUDURES
|
||||
|
||||
//cop0
|
||||
#define DECODE_FS (DECODE_RD)
|
||||
#define DECODE_FT (DECODE_RT)
|
||||
#define DECODE_FD (DECODE_SA)
|
||||
///********
|
||||
|
||||
#define DECODE_FUNCTION ((cpuRegs.code) & 0x3F)
|
||||
#define DECODE_RD ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define DECODE_RT ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define DECODE_RS ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define DECODE_SA ((cpuRegs.code >> 6) & 0x1F) // The sa part of the instruction register
|
||||
#define DECODE_IMMED ( cpuRegs.code & 0xFFFF) // The immediate part of the instruction register
|
||||
#define DECODE_OFFSET ((((short)DECODE_IMMED * 4) + opcode_addr + 4))
|
||||
#define DECODE_JUMP (opcode_addr & 0xf0000000)|((cpuRegs.code&0x3ffffff)<<2)
|
||||
#define DECODE_SYSCALL ((opcode_addr & 0x03FFFFFF) >> 6)
|
||||
#define DECODE_BREAK (DECODE_SYSCALL)
|
||||
#define DECODE_C0BC ((cpuRegs.code >> 16) & 0x03)
|
||||
#define DECODE_C1BC ((cpuRegs.code >> 16) & 0x03)
|
||||
#define DECODE_C2BC ((cpuRegs.code >> 16) & 0x03)
|
||||
|
||||
//IOP
|
||||
|
||||
#define DECODE_RD_IOP ((psxRegs.code >> 11) & 0x1F)
|
||||
#define DECODE_RT_IOP ((psxRegs.code >> 16) & 0x1F)
|
||||
#define DECODE_RS_IOP ((psxRegs.code >> 21) & 0x1F)
|
||||
#define DECODE_IMMED_IOP ( psxRegs.code & 0xFFFF)
|
||||
#define DECODE_SA_IOP ((psxRegs.code >> 6) & 0x1F)
|
||||
#define DECODE_FS_IOP (DECODE_RD_IOP)
|
||||
|
|
@ -1,318 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "Debug.h"
|
||||
|
||||
char ostr[256];
|
||||
|
||||
// Names of registers
|
||||
static char *disRNameGPR[] = {
|
||||
"r0", "at", "v0", "v1", "a0", "a1","a2", "a3",
|
||||
"t0", "t1", "t2", "t3", "t4", "t5","t6", "t7",
|
||||
"s0", "s1", "s2", "s3", "s4", "s5","s6", "s7",
|
||||
"t8", "t9", "k0", "k1", "gp", "sp","fp", "ra"};
|
||||
|
||||
static char *disRNameCP0[] = {
|
||||
"Index" , "Random" , "EntryLo0", "EntryLo1", "Context" , "PageMask" , "Wired" , "*Check me*",
|
||||
"BadVAddr" , "Count" , "EntryHi" , "Compare" , "Status" , "Cause" , "ExceptPC" , "PRevID" ,
|
||||
"Config" , "LLAddr" , "WatchLo" , "WatchHi" , "XContext", "*RES*" , "*RES*" , "*RES*" ,
|
||||
"*RES*" , "*RES* " , "PErr" , "CacheErr", "TagLo" , "TagHi" , "ErrorEPC" , "*RES*" };
|
||||
|
||||
|
||||
// Type deffinition of our functions
|
||||
|
||||
typedef char* (*TdisR3000AF)(u32 code, u32 pc);
|
||||
|
||||
// These macros are used to assemble the disassembler functions
|
||||
#define MakeDisFg(fn, b) char* fn(u32 code, u32 pc) { b; return ostr; }
|
||||
#define MakeDisF(fn, b) \
|
||||
static char* fn(u32 code, u32 pc) { \
|
||||
sprintf (ostr, "%8.8lx %8.8lx:", pc, code); \
|
||||
b; /*ostr[(strlen(ostr) - 1)] = 0;*/ return ostr; \
|
||||
}
|
||||
|
||||
|
||||
#include "R3000A.h"
|
||||
|
||||
#undef _Funct_
|
||||
#undef _Rd_
|
||||
#undef _Rt_
|
||||
#undef _Rs_
|
||||
#undef _Sa_
|
||||
#undef _Im_
|
||||
#undef _Target_
|
||||
|
||||
#define _Funct_ ((code ) & 0x3F) // The funct part of the instruction register
|
||||
#define _Rd_ ((code >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define _Rt_ ((code >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define _Rs_ ((code >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define _Sa_ ((code >> 6) & 0x1F) // The sa part of the instruction register
|
||||
#define _Im_ ( code & 0xFFFF) // The immediate part of the instruction register
|
||||
|
||||
#define _Target_ ((pc & 0xf0000000) + ((code & 0x03ffffff) * 4))
|
||||
#define _Branch_ (pc + 4 + ((short)_Im_ * 4))
|
||||
#define _OfB_ _Im_, _nRs_
|
||||
|
||||
#define dName(i) sprintf(ostr, "%s %-7s,", ostr, i)
|
||||
#define dGPR(i) sprintf(ostr, "%s %8.8lx (%s),", ostr, psxRegs.GPR.r[i], disRNameGPR[i])
|
||||
#define dCP0(i) sprintf(ostr, "%s %8.8lx (%s),", ostr, psxRegs.CP0.r[i], disRNameCP0[i])
|
||||
#define dHI() sprintf(ostr, "%s %8.8lx (%s),", ostr, psxRegs.GPR.n.hi, "hi")
|
||||
#define dLO() sprintf(ostr, "%s %8.8lx (%s),", ostr, psxRegs.GPR.n.lo, "lo")
|
||||
#define dImm() sprintf(ostr, "%s %4.4lx (%ld),", ostr, _Im_, _Im_)
|
||||
#define dTarget() sprintf(ostr, "%s %8.8lx,", ostr, _Target_)
|
||||
#define dSa() sprintf(ostr, "%s %2.2lx (%ld),", ostr, _Sa_, _Sa_)
|
||||
#define dOfB() sprintf(ostr, "%s %4.4lx (%8.8lx (%s)),", ostr, _Im_, psxRegs.GPR.r[_Rs_], disRNameGPR[_Rs_])
|
||||
#define dOffset() sprintf(ostr, "%s %8.8lx,", ostr, _Branch_)
|
||||
#define dCode() sprintf(ostr, "%s %8.8lx,", ostr, (code >> 6) & 0xffffff)
|
||||
|
||||
/*********************************************************
|
||||
* Arithmetic with immediate operand *
|
||||
* Format: OP rt, rs, immediate *
|
||||
*********************************************************/
|
||||
MakeDisF(disADDI, dName("ADDI"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
MakeDisF(disADDIU, dName("ADDIU"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
MakeDisF(disANDI, dName("ANDI"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
MakeDisF(disORI, dName("ORI"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
MakeDisF(disSLTI, dName("SLTI"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
MakeDisF(disSLTIU, dName("SLTIU"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
MakeDisF(disXORI, dName("XORI"); dGPR(_Rt_); dGPR(_Rs_); dImm();)
|
||||
|
||||
/*********************************************************
|
||||
* Register arithmetic *
|
||||
* Format: OP rd, rs, rt *
|
||||
*********************************************************/
|
||||
MakeDisF(disADD, dName("ADD"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disADDU, dName("ADDU"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disAND, dName("AND"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disNOR, dName("NOR"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disOR, dName("OR"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disSLT, dName("SLT"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disSLTU, dName("SLTU"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disSUB, dName("SUB"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disSUBU, dName("SUBU"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disXOR, dName("XOR"); dGPR(_Rd_); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* Register arithmetic & Register trap logic *
|
||||
* Format: OP rs, rt *
|
||||
*********************************************************/
|
||||
MakeDisF(disDIV, dName("DIV"); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disDIVU, dName("DIVU"); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disMULT, dName("MULT"); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
MakeDisF(disMULTU, dName("MULTU"); dGPR(_Rs_); dGPR(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* Register branch logic *
|
||||
* Format: OP rs, offset *
|
||||
*********************************************************/
|
||||
MakeDisF(disBGEZ, dName("BGEZ"); dGPR(_Rs_); dOffset();)
|
||||
MakeDisF(disBGEZAL, dName("BGEZAL"); dGPR(_Rs_); dOffset();)
|
||||
MakeDisF(disBGTZ, dName("BGTZ"); dGPR(_Rs_); dOffset();)
|
||||
MakeDisF(disBLEZ, dName("BLEZ"); dGPR(_Rs_); dOffset();)
|
||||
MakeDisF(disBLTZ, dName("BLTZ"); dGPR(_Rs_); dOffset();)
|
||||
MakeDisF(disBLTZAL, dName("BLTZAL"); dGPR(_Rs_); dOffset();)
|
||||
|
||||
/*********************************************************
|
||||
* Shift arithmetic with constant shift *
|
||||
* Format: OP rd, rt, sa *
|
||||
*********************************************************/
|
||||
MakeDisF(disSLL, if (code) { dName("SLL"); dGPR(_Rd_); dGPR(_Rt_); dSa(); } else { dName("NOP"); })
|
||||
MakeDisF(disSRA, dName("SRA"); dGPR(_Rd_); dGPR(_Rt_); dSa();)
|
||||
MakeDisF(disSRL, dName("SRL"); dGPR(_Rd_); dGPR(_Rt_); dSa();)
|
||||
|
||||
/*********************************************************
|
||||
* Shift arithmetic with variant register shift *
|
||||
* Format: OP rd, rt, rs *
|
||||
*********************************************************/
|
||||
MakeDisF(disSLLV, dName("SLLV"); dGPR(_Rd_); dGPR(_Rt_); dGPR(_Rs_);)
|
||||
MakeDisF(disSRAV, dName("SRAV"); dGPR(_Rd_); dGPR(_Rt_); dGPR(_Rs_);)
|
||||
MakeDisF(disSRLV, dName("SRLV"); dGPR(_Rd_); dGPR(_Rt_); dGPR(_Rs_);)
|
||||
|
||||
/*********************************************************
|
||||
* Load higher 16 bits of the first word in GPR with imm *
|
||||
* Format: OP rt, immediate *
|
||||
*********************************************************/
|
||||
MakeDisF(disLUI, dName("LUI"); dGPR(_Rt_); dImm();)
|
||||
|
||||
/*********************************************************
|
||||
* Move from HI/LO to GPR *
|
||||
* Format: OP rd *
|
||||
*********************************************************/
|
||||
MakeDisF(disMFHI, dName("MFHI"); dGPR(_Rd_); dHI();)
|
||||
MakeDisF(disMFLO, dName("MFLO"); dGPR(_Rd_); dLO();)
|
||||
|
||||
/*********************************************************
|
||||
* Move from GPR to HI/LO *
|
||||
* Format: OP rd *
|
||||
*********************************************************/
|
||||
MakeDisF(disMTHI, dName("MTHI"); dHI(); dGPR(_Rs_);)
|
||||
MakeDisF(disMTLO, dName("MTLO"); dLO(); dGPR(_Rs_);)
|
||||
|
||||
/*********************************************************
|
||||
* Special purpose instructions *
|
||||
* Format: OP *
|
||||
*********************************************************/
|
||||
MakeDisF(disBREAK, dName("BREAK"))
|
||||
MakeDisF(disRFE, dName("RFE"))
|
||||
MakeDisF(disSYSCALL, dName("SYSCALL"))
|
||||
|
||||
|
||||
|
||||
MakeDisF(disRTPS, dName("RTPS"))
|
||||
MakeDisF(disOP , dName("OP"))
|
||||
MakeDisF(disNCLIP, dName("NCLIP"))
|
||||
MakeDisF(disDPCS, dName("DPCS"))
|
||||
MakeDisF(disINTPL, dName("INTPL"))
|
||||
MakeDisF(disMVMVA, dName("MVMVA"))
|
||||
MakeDisF(disNCDS , dName("NCDS"))
|
||||
MakeDisF(disCDP , dName("CDP"))
|
||||
MakeDisF(disNCDT , dName("NCDT"))
|
||||
MakeDisF(disNCCS , dName("NCCS"))
|
||||
MakeDisF(disCC , dName("CC"))
|
||||
MakeDisF(disNCS , dName("NCS"))
|
||||
MakeDisF(disNCT , dName("NCT"))
|
||||
MakeDisF(disSQR , dName("SQR"))
|
||||
MakeDisF(disDCPL , dName("DCPL"))
|
||||
MakeDisF(disDPCT , dName("DPCT"))
|
||||
MakeDisF(disAVSZ3, dName("AVSZ3"))
|
||||
MakeDisF(disAVSZ4, dName("AVSZ4"))
|
||||
MakeDisF(disRTPT , dName("RTPT"))
|
||||
MakeDisF(disGPF , dName("GPF"))
|
||||
MakeDisF(disGPL , dName("GPL"))
|
||||
MakeDisF(disNCCT , dName("NCCT"))
|
||||
|
||||
MakeDisF(disMFC2, dName("MFC2"); dGPR(_Rt_);)
|
||||
MakeDisF(disCFC2, dName("CFC2"); dGPR(_Rt_);)
|
||||
MakeDisF(disMTC2, dName("MTC2"))
|
||||
MakeDisF(disCTC2, dName("CTC2"))
|
||||
|
||||
/*********************************************************
|
||||
* Register branch logic *
|
||||
* Format: OP rs, rt, offset *
|
||||
*********************************************************/
|
||||
MakeDisF(disBEQ, dName("BEQ"); dGPR(_Rs_); dGPR(_Rt_); dOffset();)
|
||||
MakeDisF(disBNE, dName("BNE"); dGPR(_Rs_); dGPR(_Rt_); dOffset();)
|
||||
|
||||
/*********************************************************
|
||||
* Jump to target *
|
||||
* Format: OP target *
|
||||
*********************************************************/
|
||||
MakeDisF(disJ, dName("J"); dTarget();)
|
||||
MakeDisF(disJAL, dName("JAL"); dTarget(); dGPR(31);)
|
||||
|
||||
/*********************************************************
|
||||
* Register jump *
|
||||
* Format: OP rs, rd *
|
||||
*********************************************************/
|
||||
MakeDisF(disJR, dName("JR"); dGPR(_Rs_);)
|
||||
MakeDisF(disJALR, dName("JALR"); dGPR(_Rs_); dGPR(_Rd_))
|
||||
|
||||
/*********************************************************
|
||||
* Load and store for GPR *
|
||||
* Format: OP rt, offset(base) *
|
||||
*********************************************************/
|
||||
MakeDisF(disLB, dName("LB"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLBU, dName("LBU"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLH, dName("LH"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLHU, dName("LHU"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLW, dName("LW"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLWL, dName("LWL"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLWR, dName("LWR"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disLWC2, dName("LWC2"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disSB, dName("SB"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disSH, dName("SH"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disSW, dName("SW"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disSWL, dName("SWL"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disSWR, dName("SWR"); dGPR(_Rt_); dOfB();)
|
||||
MakeDisF(disSWC2, dName("SWC2"); dGPR(_Rt_); dOfB();)
|
||||
|
||||
/*********************************************************
|
||||
* Moves between GPR and COPx *
|
||||
* Format: OP rt, fs *
|
||||
*********************************************************/
|
||||
MakeDisF(disMFC0, dName("MFC0"); dGPR(_Rt_); dCP0(_Rd_);)
|
||||
MakeDisF(disMTC0, dName("MTC0"); dCP0(_Rd_); dGPR(_Rt_);)
|
||||
MakeDisF(disCFC0, dName("CFC0"); dGPR(_Rt_); dCP0(_Rd_);)
|
||||
MakeDisF(disCTC0, dName("CTC0"); dCP0(_Rd_); dGPR(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* Unknow instruction (would generate an exception) *
|
||||
* Format: ? *
|
||||
*********************************************************/
|
||||
MakeDisF(disNULL, dName("*** Bad OP ***");)
|
||||
|
||||
|
||||
TdisR3000AF disR3000A_SPECIAL[] = { // Subset of disSPECIAL
|
||||
disSLL , disNULL , disSRL , disSRA , disSLLV , disNULL , disSRLV , disSRAV ,
|
||||
disJR , disJALR , disNULL, disNULL, disSYSCALL, disBREAK , disNULL , disNULL ,
|
||||
disMFHI, disMTHI , disMFLO, disMTLO, disNULL , disNULL , disNULL , disNULL ,
|
||||
disMULT, disMULTU, disDIV , disDIVU, disNULL , disNULL , disNULL , disNULL ,
|
||||
disADD , disADDU , disSUB , disSUBU, disAND , disOR , disXOR , disNOR ,
|
||||
disNULL, disNULL , disSLT , disSLTU, disNULL , disNULL , disNULL , disNULL ,
|
||||
disNULL, disNULL , disNULL, disNULL, disNULL , disNULL , disNULL , disNULL ,
|
||||
disNULL, disNULL , disNULL, disNULL, disNULL , disNULL , disNULL , disNULL};
|
||||
|
||||
MakeDisF(disSPECIAL, disR3000A_SPECIAL[_Funct_](code, pc))
|
||||
|
||||
TdisR3000AF disR3000A_BCOND[] = { // Subset of disBCOND
|
||||
disBLTZ , disBGEZ , disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL , disNULL , disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disBLTZAL, disBGEZAL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL , disNULL , disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disBCOND, disR3000A_BCOND[_Rt_](code, pc))
|
||||
|
||||
TdisR3000AF disR3000A_COP0[] = { // Subset of disCOP0
|
||||
disMFC0, disNULL, disCFC0, disNULL, disMTC0, disNULL, disCTC0, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disRFE , disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disCOP0, disR3000A_COP0[_Rs_](code, pc))
|
||||
|
||||
TdisR3000AF disR3000A_BASIC[] = { // Subset of disBASIC (based on rs)
|
||||
disMFC2, disNULL, disCFC2, disNULL, disMTC2, disNULL, disCTC2, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disBASIC, disR3000A_BASIC[_Rs_](code, pc))
|
||||
|
||||
TdisR3000AF disR3000A_COP2[] = { // Subset of disR3000F_COP2 (based on funct)
|
||||
disBASIC, disRTPS , disNULL , disNULL , disNULL, disNULL , disNCLIP, disNULL,
|
||||
disNULL , disNULL , disNULL , disNULL , disOP , disNULL , disNULL , disNULL,
|
||||
disDPCS , disINTPL, disMVMVA, disNCDS , disCDP , disNULL , disNCDT , disNULL,
|
||||
disNULL , disNULL , disNULL , disNCCS , disCC , disNULL , disNCS , disNULL,
|
||||
disNCT , disNULL , disNULL , disNULL , disNULL, disNULL , disNULL , disNULL,
|
||||
disSQR , disDCPL , disDPCT , disNULL , disNULL, disAVSZ3, disAVSZ4, disNULL,
|
||||
disRTPT , disNULL , disNULL , disNULL , disNULL, disNULL , disNULL , disNULL,
|
||||
disNULL , disNULL , disNULL , disNULL , disNULL, disGPF , disGPL , disNCCT };
|
||||
|
||||
MakeDisF(disCOP2, disR3000A_COP2[_Funct_](code, pc))
|
||||
|
||||
TdisR3000AF disR3000A[] = {
|
||||
disSPECIAL , disBCOND , disJ , disJAL , disBEQ , disBNE , disBLEZ , disBGTZ ,
|
||||
disADDI , disADDIU , disSLTI , disSLTIU, disANDI, disORI , disXORI , disLUI ,
|
||||
disCOP0 , disNULL , disCOP2 , disNULL , disNULL, disNULL, disNULL , disNULL ,
|
||||
disNULL , disNULL , disNULL , disNULL , disNULL, disNULL, disNULL , disNULL ,
|
||||
disLB , disLH , disLWL , disLW , disLBU , disLHU , disLWR , disNULL ,
|
||||
disSB , disSH , disSWL , disSW , disNULL, disNULL, disSWR , disNULL ,
|
||||
disNULL , disNULL , disLWC2 , disNULL , disNULL, disNULL, disNULL , disNULL ,
|
||||
disNULL , disNULL , disSWC2 , disNULL , disNULL, disNULL, disNULL , disNULL };
|
||||
|
||||
MakeDisFg(disR3000AF, disR3000A[code >> 26](code, pc))
|
|
@ -1,361 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Debug.h"
|
||||
#include "R5900.h"
|
||||
#include "R3000A.h"
|
||||
#include "DisASM.h"
|
||||
|
||||
unsigned long IOP_opcode_addr;
|
||||
|
||||
char *GPR_IOP_REG[32] = {
|
||||
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
|
||||
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
|
||||
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
|
||||
"t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"
|
||||
};
|
||||
char *COP0_IOP_REG[32] ={
|
||||
"Index","Random","EntryLo0","EntryLo1","Context","PageMask",
|
||||
"Wired","C0r7","BadVaddr","Count","EntryHi","Compare","Status",
|
||||
"Cause","EPC","PRId","Config","C0r17","C0r18","C0r19","C0r20",
|
||||
"C0r21","C0r22","C0r23","Debug","Perf","C0r26","C0r27","TagLo",
|
||||
"TagHi","ErrorPC","C0r31"
|
||||
};
|
||||
void IOPD_SPECIAL(char *buf);
|
||||
void IOPD_REGIMM(char *buf);
|
||||
void IOPD_J(char *buf);
|
||||
void IOPD_JAL(char *buf);
|
||||
void IOPD_BEQ(char *buf);
|
||||
void IOPD_BNE(char *buf);
|
||||
void IOPD_BLEZ(char *buf);
|
||||
void IOPD_BGTZ(char *buf);
|
||||
void IOPD_ADDI(char *buf);
|
||||
void IOPD_ADDIU(char *buf);
|
||||
void IOPD_SLTI(char *buf);
|
||||
void IOPD_SLTIU(char *buf);
|
||||
void IOPD_ANDI(char *buf);
|
||||
void IOPD_ORI(char *buf);
|
||||
void IOPD_XORI(char *buf);
|
||||
void IOPD_LUI(char *buf);
|
||||
void IOPD_COP0(char *buf);
|
||||
void IOPD_COP2(char *buf);
|
||||
void IOPD_LB(char *buf);
|
||||
void IOPD_LH(char *buf);
|
||||
void IOPD_LWL(char *buf);
|
||||
void IOPD_LW(char *buf);
|
||||
void IOPD_LBU(char *buf);
|
||||
void IOPD_LHU(char *buf);
|
||||
void IOPD_LWR(char *buf);
|
||||
void IOPD_SB(char *buf);
|
||||
void IOPD_SH(char *buf);
|
||||
void IOPD_SWL(char *buf);
|
||||
void IOPD_SW(char *buf);
|
||||
void IOPD_SWR(char *buf);
|
||||
void IOPD_LWC2(char *buf);
|
||||
void IOPD_SWC2(char *buf);
|
||||
|
||||
void IOPD_SLL(char *buf);
|
||||
void IOPD_SRL(char *buf);
|
||||
void IOPD_SRA(char *buf);
|
||||
void IOPD_SLLV(char *buf);
|
||||
void IOPD_SRLV(char *buf);
|
||||
void IOPD_SRAV(char *buf);
|
||||
void IOPD_JR(char *buf);
|
||||
void IOPD_JALR(char *buf);
|
||||
void IOPD_SYSCALL(char *buf);
|
||||
void IOPD_BREAK(char *buf);
|
||||
void IOPD_MFHI(char *buf);
|
||||
void IOPD_MTHI(char *buf);
|
||||
void IOPD_MFLO(char *buf);
|
||||
void IOPD_MTLO(char *buf);
|
||||
void IOPD_MULT(char *buf);
|
||||
void IOPD_MULTU(char *buf);
|
||||
void IOPD_DIV(char *buf);
|
||||
void IOPD_DIVU(char *buf);
|
||||
void IOPD_ADD(char *buf);
|
||||
void IOPD_ADDU(char *buf);
|
||||
void IOPD_SUB(char *buf);
|
||||
void IOPD_SUBU(char *buf);
|
||||
void IOPD_AND(char *buf);
|
||||
void IOPD_OR(char *buf);
|
||||
void IOPD_XOR(char *buf);
|
||||
void IOPD_NOR(char *buf);
|
||||
void IOPD_SLT(char *buf);
|
||||
void IOPD_SLTU(char *buf);
|
||||
|
||||
|
||||
void IOPD_BLTZ(char *buf);
|
||||
void IOPD_BGEZ(char *buf);
|
||||
void IOPD_BLTZAL(char *buf);
|
||||
void IOPD_BGEZAL(char *buf);
|
||||
|
||||
|
||||
|
||||
void IOPD_MFC0(char *buf);
|
||||
void IOPD_CFC0(char *buf);
|
||||
void IOPD_MTC0(char *buf);
|
||||
void IOPD_CTC0(char *buf);
|
||||
void IOPD_RFE(char *buf);
|
||||
|
||||
|
||||
|
||||
void IOPD_BASIC(char *buf);
|
||||
void IOPD_RTPS(char *buf);
|
||||
void IOPD_NCLIP(char *buf);
|
||||
void IOPD_OP(char *buf);
|
||||
void IOPD_DPCS(char *buf);
|
||||
void IOPD_INTPL(char *buf);
|
||||
void IOPD_MVMVA(char *buf);
|
||||
void IOPD_NCDS(char *buf);
|
||||
void IOPD_CDP(char *buf);
|
||||
void IOPD_NCDT(char *buf);
|
||||
void IOPD_NCCS(char *buf);
|
||||
void IOPD_CC(char *buf);
|
||||
void IOPD_NCS(char *buf);
|
||||
void IOPD_NCT(char *buf);
|
||||
void IOPD_SQR(char *buf);
|
||||
void IOPD_DCPL(char *buf);
|
||||
void IOPD_DPCT(char *buf);
|
||||
void IOPD_AVSZ3(char *buf);
|
||||
void IOPD_AVSZ4(char *buf);
|
||||
void IOPD_RTPT(char *buf);
|
||||
void IOPD_GPF(char *buf);
|
||||
void IOPD_GPL(char *buf);
|
||||
void IOPD_NCCT(char *buf);
|
||||
|
||||
|
||||
|
||||
void IOPD_MFC2(char *buf);
|
||||
void IOPD_CFC2(char *buf);
|
||||
void IOPD_MTC2(char *buf);
|
||||
void IOPD_CTC2(char *buf);
|
||||
void IOPD_NULL(char *buf);
|
||||
|
||||
|
||||
|
||||
void (*IOP_DEBUG_BSC[64])(char *buf) = {
|
||||
IOPD_SPECIAL, IOPD_REGIMM, IOPD_J , IOPD_JAL , IOPD_BEQ , IOPD_BNE , IOPD_BLEZ, IOPD_BGTZ,
|
||||
IOPD_ADDI , IOPD_ADDIU , IOPD_SLTI, IOPD_SLTIU, IOPD_ANDI, IOPD_ORI , IOPD_XORI, IOPD_LUI ,
|
||||
IOPD_COP0 , IOPD_NULL , IOPD_COP2, IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_LB , IOPD_LH , IOPD_LWL , IOPD_LW , IOPD_LBU , IOPD_LHU , IOPD_LWR , IOPD_NULL,
|
||||
IOPD_SB , IOPD_SH , IOPD_SWL , IOPD_SW , IOPD_NULL, IOPD_NULL, IOPD_SWR , IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_LWC2, IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_SWC2, IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL
|
||||
};
|
||||
|
||||
|
||||
void (*IOP_DEBUG_SPC[64])(char *buf) = {
|
||||
IOPD_SLL , IOPD_NULL , IOPD_SRL , IOPD_SRA , IOPD_SLLV , IOPD_NULL , IOPD_SRLV, IOPD_SRAV,
|
||||
IOPD_JR , IOPD_JALR , IOPD_NULL, IOPD_NULL, IOPD_SYSCALL, IOPD_BREAK, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_MFHI, IOPD_MTHI , IOPD_MFLO, IOPD_MTLO, IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL,
|
||||
IOPD_MULT, IOPD_MULTU, IOPD_DIV , IOPD_DIVU, IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL,
|
||||
IOPD_ADD , IOPD_ADDU , IOPD_SUB , IOPD_SUBU, IOPD_AND , IOPD_OR , IOPD_XOR , IOPD_NOR ,
|
||||
IOPD_NULL, IOPD_NULL , IOPD_SLT , IOPD_SLTU, IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL
|
||||
};
|
||||
|
||||
void (*IOP_DEBUG_REG[32])(char *buf) = {
|
||||
IOPD_BLTZ , IOPD_BGEZ , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_BLTZAL, IOPD_BGEZAL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL
|
||||
};
|
||||
|
||||
void (*IOP_DEBUG_CP0[32])(char *buf) = {
|
||||
IOPD_MFC0, IOPD_NULL, IOPD_CFC0, IOPD_NULL, IOPD_MTC0, IOPD_NULL, IOPD_CTC0, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_RFE , IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL
|
||||
};
|
||||
|
||||
void (*IOP_DEBUG_CP2[64])(char *buf) = {
|
||||
IOPD_BASIC, IOPD_RTPS , IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL , IOPD_NCLIP, IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_OP , IOPD_NULL , IOPD_NULL , IOPD_NULL,
|
||||
IOPD_DPCS , IOPD_INTPL, IOPD_MVMVA, IOPD_NCDS, IOPD_CDP , IOPD_NULL , IOPD_NCDT , IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_NULL , IOPD_NCCS, IOPD_CC , IOPD_NULL , IOPD_NCS , IOPD_NULL,
|
||||
IOPD_NCT , IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL , IOPD_NULL , IOPD_NULL,
|
||||
IOPD_SQR , IOPD_DCPL , IOPD_DPCT , IOPD_NULL, IOPD_NULL, IOPD_AVSZ3, IOPD_AVSZ4, IOPD_NULL,
|
||||
IOPD_RTPT , IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_NULL , IOPD_NULL , IOPD_NULL,
|
||||
IOPD_NULL , IOPD_NULL , IOPD_NULL , IOPD_NULL, IOPD_NULL, IOPD_GPF , IOPD_GPL , IOPD_NCCT
|
||||
};
|
||||
|
||||
void (*IOP_DEBUG_CP2BSC[32])(char *buf) = {
|
||||
IOPD_MFC2, IOPD_NULL, IOPD_CFC2, IOPD_NULL, IOPD_MTC2, IOPD_NULL, IOPD_CTC2, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL,
|
||||
IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL, IOPD_NULL
|
||||
};
|
||||
|
||||
static char dbuf2[1024];
|
||||
static char obuf2[1024];
|
||||
|
||||
char *disR3000Fasm(u32 code, u32 pc) {
|
||||
u32 scode = psxRegs.code;
|
||||
IOP_opcode_addr = pc;
|
||||
psxRegs.code = code;
|
||||
IOP_DEBUG_BSC[(code) >> 26](dbuf2);
|
||||
|
||||
sprintf(obuf2, "%08lX:\t%s", pc, dbuf2);
|
||||
|
||||
psxRegs.code = scode;
|
||||
return obuf2;
|
||||
}
|
||||
char *IOP_jump_decode(void)
|
||||
{
|
||||
static char buf[256];
|
||||
unsigned long addr;
|
||||
addr = (IOP_opcode_addr & 0xf0000000)|((psxRegs.code&0x3ffffff)<<2);
|
||||
sprintf(buf, "0x%08lX", addr);
|
||||
return buf;
|
||||
}
|
||||
char *IOP_offset_decode(void)
|
||||
{
|
||||
static char buf[256];
|
||||
unsigned long addr;
|
||||
addr = ((((short)( psxRegs.code & 0xFFFF) * 4) + IOP_opcode_addr + 4));
|
||||
sprintf(buf, "0x%08lX", addr);
|
||||
return buf;
|
||||
}
|
||||
//basic table
|
||||
void IOPD_SPECIAL(char *buf){IOP_DEBUG_SPC[((psxRegs.code) & 0x3F)](buf);}
|
||||
void IOPD_REGIMM(char *buf){IOP_DEBUG_REG[DECODE_RT_IOP](buf);}
|
||||
void IOPD_J(char *buf) { sprintf(buf, "j\t%s", IOP_jump_decode());}
|
||||
void IOPD_JAL(char *buf){sprintf(buf, "jal\t%s", IOP_jump_decode());}
|
||||
void IOPD_BEQ(char *buf){sprintf(buf, "beq\t%s, %s, %s", GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP], IOP_offset_decode()); }
|
||||
void IOPD_BNE(char *buf){sprintf(buf, "bne\t%s, %s, %s", GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP], IOP_offset_decode()); }
|
||||
void IOPD_BLEZ(char *buf){sprintf(buf, "blez\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], IOP_offset_decode()); }
|
||||
void IOPD_BGTZ(char *buf){sprintf(buf, "bgtz\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], IOP_offset_decode()); }
|
||||
void IOPD_ADDI(char *buf){sprintf(buf, "addi\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP);}
|
||||
void IOPD_ADDIU(char *buf){sprintf(buf, "addiu\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP);}
|
||||
void IOPD_SLTI(char *buf){sprintf(buf, "slti\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP);}
|
||||
void IOPD_SLTIU(char *buf){sprintf(buf, "sltiu\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP);}
|
||||
void IOPD_ANDI(char *buf){sprintf(buf, "andi\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP);}
|
||||
void IOPD_ORI(char *buf){sprintf(buf, "ori\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP); }
|
||||
void IOPD_XORI(char *buf){sprintf(buf, "xori\t%s, %s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP], DECODE_IMMED_IOP); }
|
||||
void IOPD_LUI(char *buf){sprintf(buf, "lui\t%s, 0x%04lX", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP); }
|
||||
void IOPD_COP0(char *buf){IOP_DEBUG_CP0[DECODE_RS_IOP](buf);}
|
||||
void IOPD_COP2(char *buf){IOP_DEBUG_CP2[((psxRegs.code) & 0x3F)](buf);}
|
||||
void IOPD_LB(char *buf){sprintf(buf, "lb\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_LH(char *buf){sprintf(buf, "lh\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_LWL(char *buf){sprintf(buf, "lwl\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_LW(char *buf){sprintf(buf, "lw\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_LBU(char *buf){sprintf(buf, "lbu\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_LHU(char *buf){sprintf(buf, "lhu\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_LWR(char *buf){sprintf(buf, "lwr\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]);}
|
||||
void IOPD_SB(char *buf){sprintf(buf, "sb\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]);}
|
||||
void IOPD_SH(char *buf){sprintf(buf, "sh\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_SWL(char *buf){sprintf(buf, "swl\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_SW(char *buf){sprintf(buf, "sw\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_SWR(char *buf){sprintf(buf, "swr\t%s, 0x%04lX(%s)", GPR_IOP_REG[DECODE_RT_IOP], DECODE_IMMED_IOP, GPR_IOP_REG[DECODE_RS_IOP]);}
|
||||
void IOPD_LWC2(char *buf){strcpy(buf, "lwc2");}
|
||||
void IOPD_SWC2(char *buf){strcpy(buf, "swc2");}
|
||||
//special table
|
||||
void IOPD_SLL(char *buf)
|
||||
{
|
||||
if (psxRegs.code == 0x00000000)
|
||||
strcpy(buf, "nop");
|
||||
else
|
||||
sprintf(buf, "sll\t%s, %s, 0x%02lX", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RT_IOP], DECODE_SA_IOP);
|
||||
}
|
||||
void IOPD_SRL(char *buf){sprintf(buf, "srl\t%s, %s, 0x%02lX", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RT_IOP], DECODE_SA_IOP); }
|
||||
void IOPD_SRA(char *buf){sprintf(buf, "sra\t%s, %s, 0x%02lX", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RT_IOP], DECODE_SA_IOP);}
|
||||
void IOPD_SLLV(char *buf){sprintf(buf, "sllv\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_SRLV(char *buf){sprintf(buf, "srlv\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP]);}
|
||||
void IOPD_SRAV(char *buf){sprintf(buf, "srav\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RT_IOP], GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_JR(char *buf){sprintf(buf, "jr\t%s", GPR_IOP_REG[DECODE_RS_IOP]);}
|
||||
void IOPD_JALR(char *buf)
|
||||
{
|
||||
int rd = DECODE_RD_IOP;
|
||||
|
||||
if (rd == 31)
|
||||
sprintf(buf, "jalr\t%s", GPR_IOP_REG[DECODE_RS_IOP]);
|
||||
else
|
||||
sprintf(buf, "jalr\t%s, %s", GPR_IOP_REG[rd], GPR_IOP_REG[DECODE_RS_IOP]);
|
||||
}
|
||||
|
||||
void IOPD_SYSCALL(char *buf){strcpy(buf, "syscall");}
|
||||
void IOPD_BREAK(char *buf){strcpy(buf, "break");}
|
||||
void IOPD_MFHI(char *buf){sprintf(buf, "mfhi\t%s", GPR_IOP_REG[DECODE_RD_IOP]); }
|
||||
void IOPD_MTHI(char *buf){sprintf(buf, "mthi\t%s", GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_MFLO(char *buf){sprintf(buf, "mflo\t%s", GPR_IOP_REG[DECODE_RD_IOP]); }
|
||||
void IOPD_MTLO(char *buf){sprintf(buf, "mtlo\t%s", GPR_IOP_REG[DECODE_RS_IOP]); }
|
||||
void IOPD_MULT(char *buf){sprintf(buf, "mult\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]);}
|
||||
void IOPD_MULTU(char *buf){sprintf(buf, "multu\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]);}
|
||||
void IOPD_DIV(char *buf){sprintf(buf, "div\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]);}
|
||||
void IOPD_DIVU(char *buf){sprintf(buf, "divu\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
|
||||
void IOPD_ADD(char *buf) { sprintf(buf, "add\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_ADDU(char *buf) { sprintf(buf, "addu\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_SUB(char *buf) { sprintf(buf, "sub\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_SUBU(char *buf) { sprintf(buf, "subu\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_AND(char *buf) { sprintf(buf, "and\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_OR(char *buf) { sprintf(buf, "or\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_XOR(char *buf) { sprintf(buf, "xor\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_NOR(char *buf) { sprintf(buf, "nor\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_SLT(char *buf) { sprintf(buf, "slt\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
void IOPD_SLTU(char *buf) { sprintf(buf, "sltu\t%s, %s, %s", GPR_IOP_REG[DECODE_RD_IOP], GPR_IOP_REG[DECODE_RS_IOP], GPR_IOP_REG[DECODE_RT_IOP]); }
|
||||
//regimm
|
||||
|
||||
void IOPD_BLTZ(char *buf) { sprintf(buf, "bltz\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], IOP_offset_decode()); }
|
||||
void IOPD_BGEZ(char *buf) { sprintf(buf, "bgez\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], IOP_offset_decode()); }
|
||||
void IOPD_BLTZAL(char *buf) { sprintf(buf, "bltzal\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], IOP_offset_decode()); }
|
||||
void IOPD_BGEZAL(char *buf) { sprintf(buf, "bgezal\t%s, %s", GPR_IOP_REG[DECODE_RS_IOP], IOP_offset_decode()); }
|
||||
|
||||
//cop0
|
||||
|
||||
void IOPD_MFC0(char *buf){ sprintf(buf, "mfc0\t%s, %s", GPR_IOP_REG[DECODE_RT_IOP], COP0_IOP_REG[DECODE_FS_IOP]); }
|
||||
void IOPD_MTC0(char *buf){ sprintf(buf, "mtc0\t%s, %s", GPR_IOP_REG[DECODE_RT_IOP], COP0_IOP_REG[DECODE_FS_IOP]); }
|
||||
void IOPD_CFC0(char *buf){ sprintf(buf, "cfc0\t%s, %s", GPR_IOP_REG[DECODE_RT_IOP], COP0_IOP_REG[DECODE_FS_IOP]); }
|
||||
void IOPD_CTC0(char *buf){ sprintf(buf, "ctc0\t%s, %s", GPR_IOP_REG[DECODE_RT_IOP], COP0_IOP_REG[DECODE_FS_IOP]); }
|
||||
void IOPD_RFE(char *buf){strcpy(buf, "rfe");}
|
||||
//cop2
|
||||
void IOPD_BASIC(char *buf){IOP_DEBUG_CP2BSC[DECODE_RS_IOP](buf);}
|
||||
void IOPD_RTPS(char *buf){strcpy(buf, "rtps");}
|
||||
void IOPD_NCLIP(char *buf){strcpy(buf, "nclip");}
|
||||
void IOPD_OP(char *buf){strcpy(buf, "op");}
|
||||
void IOPD_DPCS(char *buf){strcpy(buf, "dpcs");}
|
||||
void IOPD_INTPL(char *buf){strcpy(buf, "intpl");}
|
||||
void IOPD_MVMVA(char *buf){strcpy(buf, "mvmva");}
|
||||
void IOPD_NCDS(char *buf){strcpy(buf, "ncds");}
|
||||
void IOPD_CDP(char *buf){strcpy(buf, "cdp");}
|
||||
void IOPD_NCDT(char *buf){strcpy(buf, "ncdt");}
|
||||
void IOPD_NCCS(char *buf){strcpy(buf, "nccs");}
|
||||
void IOPD_CC(char *buf){strcpy(buf, "cc");}
|
||||
void IOPD_NCS(char *buf){strcpy(buf, "ncs");}
|
||||
void IOPD_NCT(char *buf){strcpy(buf, "nct");}
|
||||
void IOPD_SQR(char *buf){strcpy(buf, "sqr");}
|
||||
void IOPD_DCPL(char *buf){strcpy(buf, "dcpl");}
|
||||
void IOPD_DPCT(char *buf){strcpy(buf, "dpct");}
|
||||
void IOPD_AVSZ3(char *buf){strcpy(buf, "avsz3");}
|
||||
void IOPD_AVSZ4(char *buf){strcpy(buf, "avsz4");}
|
||||
void IOPD_RTPT(char *buf){strcpy(buf, "rtpt");}
|
||||
void IOPD_GPF(char *buf){strcpy(buf, "gpf");}
|
||||
void IOPD_GPL(char *buf){strcpy(buf, "gpl");}
|
||||
void IOPD_NCCT(char *buf){strcpy(buf, "ncct");}
|
||||
//cop2 basic
|
||||
void IOPD_MFC2(char *buf){strcpy(buf, "mfc2");}
|
||||
void IOPD_CFC2(char *buf){strcpy(buf, "cfc2");}
|
||||
void IOPD_MTC2(char *buf){strcpy(buf, "mtc2");}
|
||||
void IOPD_CTC2(char *buf){strcpy(buf, "ctc2");}
|
||||
//null
|
||||
void IOPD_NULL(char *buf){strcpy(buf, "????");}
|
|
@ -1,994 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Debug.h"
|
||||
#include "R5900.h"
|
||||
#include "VU.h"
|
||||
|
||||
long jumpMode;
|
||||
char ostr[1024];
|
||||
|
||||
// Names of registers
|
||||
char *disRNameGPR[] = {
|
||||
"r0", "at", "v0", "v1", "a0", "a1","a2", "a3",
|
||||
"t0", "t1", "t2", "t3", "t4", "t5","t6", "t7",
|
||||
"s0", "s1", "s2", "s3", "s4", "s5","s6", "s7",
|
||||
"t8", "t9", "k0", "k1", "gp", "sp","fp", "ra", "hi", "lo"}; // lo,hi used in rec
|
||||
|
||||
char *disRNameCP0[] = {
|
||||
"Index" , "Random" , "EntryLo0" , "EntryLo1", "Context" , "PageMask" , "Wired" , "*RES*",
|
||||
"BadVAddr" , "Count" , "EntryHi" , "Compare" , "Status" , "Cause" , "ExceptPC" , "PRevID",
|
||||
"Config" , "LLAddr" , "WatchLo" , "WatchHi" , "*RES*" , "*RES*" , "*RES*" , "Debug",
|
||||
"DEPC" , "PerfCnt" , "ErrCtl" , "CacheErr", "TagLo" , "TagHi" , "ErrorEPC" , "DESAVE"};
|
||||
|
||||
char *disRNameCP1[] = {
|
||||
"FPR0" , "FPR1" , "FPR2" , "FPR3" , "FPR4" , "FPR5" , "FPR6" , "FPR7",
|
||||
"FPR8" , "FPR9" , "FPR10", "FPR11", "FPR12", "FPR13", "FPR14", "FPR15",
|
||||
"FPR16", "FPR17", "FPR18", "FPR19", "FPR20", "FPR21", "FPR22", "FPR23",
|
||||
"FPR24", "FPR25", "FPR26", "FPR27", "FPR28", "FPR29", "FPR30", "FPR31"};
|
||||
|
||||
char *disRNameCP1c[] = {
|
||||
"FRevID", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*",
|
||||
"*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*",
|
||||
"*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*",
|
||||
"*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "*RES*", "FStatus"};
|
||||
|
||||
char *disRNameCP2f[] = {
|
||||
"VF00", "VF01", "VF02", "VF03", "VF04", "VF05", "VF06", "VF07",
|
||||
"VF08", "VF09", "VF10", "VF11", "VF12", "VF13", "VF14", "VF15",
|
||||
"VF16", "VF17", "VF18", "VF19", "VF20", "VF21", "VF22", "VF23",
|
||||
"VF24", "VF25", "VF26", "VF27", "VF28", "VF29", "VF30", "VF31"};
|
||||
|
||||
char *disRNameCP2i[] = {
|
||||
"VI00", "VI01", "VI02", "VI03", "VI04", "VI05", "VI06", "VI07",
|
||||
"VI08", "VI09", "VI10", "VI11", "VI12", "VI13", "VI14", "VI15",
|
||||
"Status", "MAC", "Clip", "*RES*", "R", "I", "Q", "*RES*",
|
||||
"*RES*", "*RES*", "TPC", "CMSAR0", "FBRST", "VPU-STAT", "*RES*", "CMSAR1"};
|
||||
|
||||
char *CP2VFnames[] = { "x", "y", "z", "w" };
|
||||
|
||||
// Type deffinition of our functions
|
||||
#define DisFInterface (u32 code, u32 pc)
|
||||
#define DisFInterfaceT (u32, u32)
|
||||
#define DisFInterfaceN (code, pc)
|
||||
|
||||
typedef char* (*TdisR5900F)DisFInterface;
|
||||
|
||||
// These macros are used to assemble the disassembler functions
|
||||
#define MakeDisF(fn, b) \
|
||||
char* fn DisFInterface { \
|
||||
sprintf (ostr, "%8.8x %8.8x:", pc, code); \
|
||||
b; /*ostr[(strlen(ostr) - 1)] = 0;*/ return ostr; \
|
||||
}
|
||||
|
||||
#undef _Target_
|
||||
#undef _Branch_
|
||||
#undef _Funct_
|
||||
#undef _Rd_
|
||||
#undef _Rt_
|
||||
#undef _Rs_
|
||||
#undef _Sa_
|
||||
#undef _Im_
|
||||
|
||||
#define _Funct_ ((code ) & 0x3F) // The funct part of the instruction register
|
||||
#define _Rd_ ((code >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define _Rt_ ((code >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define _Rs_ ((code >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define _Sa_ ((code >> 6) & 0x1F) // The sa part of the instruction register
|
||||
#define _Im_ ( code & 0xFFFF) // The immediate part of the instruction register
|
||||
|
||||
|
||||
#define _rRs_ cpuRegs.GPR.r[_Rs_].UL[1], cpuRegs.GPR.r[_Rs_].UL[0] // Rs register
|
||||
#define _rRt_ cpuRegs.GPR.r[_Rt_].UL[1], cpuRegs.GPR.r[_Rt_].UL[0] // Rt register
|
||||
#define _rRd_ cpuRegs.GPR.r[_Rd_].UL[1], cpuRegs.GPR.r[_Rd_].UL[0] // Rd register
|
||||
#define _rSa_ cpuRegs.GPR.r[_Sa_].UL[1], cpuRegs.GPR.r[_Sa_].UL[0] // Sa register
|
||||
|
||||
#define _rFs_ cpuRegs.CP0.r[_Rd_] // Fs register
|
||||
|
||||
#define _rRs32_ cpuRegs.GPR.r[_Rs_].UL[0] // Rs register
|
||||
#define _rRt32_ cpuRegs.GPR.r[_Rt_].UL[0] // Rt register
|
||||
#define _rRd32_ cpuRegs.GPR.r[_Rd_].UL[0] // Rd register
|
||||
#define _rSa32_ cpuRegs.GPR.r[_Sa_].UL[0] // Sa register
|
||||
|
||||
|
||||
#define _nRs_ _rRs_, disRNameGPR[_Rs_]
|
||||
#define _nRt_ _rRt_, disRNameGPR[_Rt_]
|
||||
#define _nRd_ _rRd_, disRNameGPR[_Rd_]
|
||||
#define _nSa_ _rSa_, disRNameGPR[_Sa_]
|
||||
#define _nRd0_ _rFs_, disRNameCP0[_Rd_]
|
||||
|
||||
#define _nRs32_ _rRs32_, disRNameGPR[_Rs_]
|
||||
#define _nRt32_ _rRt32_, disRNameGPR[_Rt_]
|
||||
#define _nRd32_ _rRd32_, disRNameGPR[_Rd_]
|
||||
#define _nSa32_ _rSa32_, disRNameGPR[_Sa_]
|
||||
|
||||
#define _I_ _Im_, _Im_
|
||||
#define _Target_ ((pc & 0xf0000000) + ((code & 0x03ffffff) * 4))
|
||||
#define _Branch_ (pc + 4 + ((short)_Im_ * 4))
|
||||
#define _OfB_ _Im_, _nRs_
|
||||
|
||||
#define _Fsf_ ((code >> 21) & 0x03)
|
||||
#define _Ftf_ ((code >> 23) & 0x03)
|
||||
|
||||
#define dName(i) sprintf(ostr, "%s %-7s,", ostr, i)
|
||||
#define dGPR128(i) sprintf(ostr, "%s %8.8x_%8.8x_%8.8x_%8.8x (%s),", ostr, cpuRegs.GPR.r[i].UL[3], cpuRegs.GPR.r[i].UL[2], cpuRegs.GPR.r[i].UL[1], cpuRegs.GPR.r[i].UL[0], disRNameGPR[i])
|
||||
#define dGPR64(i) sprintf(ostr, "%s %8.8x_%8.8x (%s),", ostr, cpuRegs.GPR.r[i].UL[1], cpuRegs.GPR.r[i].UL[0], disRNameGPR[i])
|
||||
#define dGPR64U(i) sprintf(ostr, "%s %8.8x_%8.8x (%s),", ostr, cpuRegs.GPR.r[i].UL[3], cpuRegs.GPR.r[i].UL[2], disRNameGPR[i])
|
||||
#define dGPR32(i) sprintf(ostr, "%s %8.8x (%s),", ostr, cpuRegs.GPR.r[i].UL[0], disRNameGPR[i])
|
||||
|
||||
#define dCP032(i) sprintf(ostr, "%s %8.8x (%s),", ostr, cpuRegs.CP0.r[i], disRNameCP0[i])
|
||||
|
||||
#define dCP132(i) sprintf(ostr, "%s %f (%s),", ostr, fpuRegs.fpr[i].f, disRNameCP1[i])
|
||||
#define dCP1c32(i) sprintf(ostr, "%s %8.8x (%s),", ostr, fpuRegs.fprc[i], disRNameCP1c[i])
|
||||
#define dCP1acc() sprintf(ostr, "%s %f (ACC),", ostr, fpuRegs.ACC.f)
|
||||
|
||||
#define dCP2128f(i) sprintf(ostr, "%s w=%f z=%f y=%f x=%f (%s),", ostr, VU0.VF[i].f.w, VU0.VF[i].f.z, VU0.VF[i].f.y, VU0.VF[i].f.x, disRNameCP2f[i])
|
||||
#define dCP232x(i) sprintf(ostr, "%s x=%f (%s),", ostr, VU0.VF[i].f.x, disRNameCP2f[i])
|
||||
#define dCP232y(i) sprintf(ostr, "%s y=%f (%s),", ostr, VU0.VF[i].f.y, disRNameCP2f[i])
|
||||
#define dCP232z(i) sprintf(ostr, "%s z=%f (%s),", ostr, VU0.VF[i].f.z, disRNameCP2f[i])
|
||||
#define dCP232w(i) sprintf(ostr, "%s w=%f (%s),", ostr, VU0.VF[i].f.w, disRNameCP2f[i])
|
||||
#define dCP2ACCf() sprintf(ostr, "%s w=%f z=%f y=%f x=%f (ACC),", ostr, VU0.ACC.f.w, VU0.ACC.f.z, VU0.ACC.f.y, VU0.ACC.f.x)
|
||||
#define dCP232i(i) sprintf(ostr, "%s %8.8x (%s),", ostr, VU0.VI[i].UL, disRNameCP2i[i])
|
||||
#define dCP232iF(i) sprintf(ostr, "%s %f (%s),", ostr, VU0.VI[i].F, disRNameCP2i[i])
|
||||
#define dCP232f(i, j) sprintf(ostr, "%s Q %s=%f (%s),", ostr, CP2VFnames[j], VU0.VF[i].F[j], disRNameCP2f[i])
|
||||
|
||||
#define dHI64() sprintf(ostr, "%s %8.8x_%8.8x (%s),", ostr, cpuRegs.HI.UL[1], cpuRegs.HI.UL[0], "hi")
|
||||
#define dLO64() sprintf(ostr, "%s %8.8x_%8.8x (%s),", ostr, cpuRegs.LO.UL[1], cpuRegs.LO.UL[0], "lo")
|
||||
#define dImm() sprintf(ostr, "%s %4.4x (%d),", ostr, _Im_, _Im_)
|
||||
#define dTarget() sprintf(ostr, "%s %8.8x,", ostr, _Target_)
|
||||
#define dSa() sprintf(ostr, "%s %2.2x (%d),", ostr, _Sa_, _Sa_)
|
||||
#define dSa32() sprintf(ostr, "%s %2.2x (%d),", ostr, _Sa_+32, _Sa_+32)
|
||||
#define dOfB() sprintf(ostr, "%s %4.4x (%8.8x (%s)),", ostr, _Im_, cpuRegs.GPR.r[_Rs_].UL[0], disRNameGPR[_Rs_])
|
||||
#define dOffset() sprintf(ostr, "%s %8.8x,", ostr, _Branch_)
|
||||
#define dCode() sprintf(ostr, "%s %8.8x,", ostr, (code >> 6) & 0xffffff)
|
||||
#define dSaR() sprintf(ostr, "%s %8.8x,", ostr, cpuRegs.sa)
|
||||
|
||||
typedef struct {
|
||||
u32 addr;
|
||||
char name[32];
|
||||
} sSymbol;
|
||||
|
||||
static sSymbol *dSyms = NULL;
|
||||
static int nSyms = 0;
|
||||
|
||||
void disR5900AddSym(u32 addr, char *name) {
|
||||
dSyms = (sSymbol*)realloc(dSyms, sizeof(sSymbol) * (nSyms+1));
|
||||
if (dSyms == NULL) return;
|
||||
dSyms[nSyms].addr = addr;
|
||||
strncpy(dSyms[nSyms].name, name, 32);
|
||||
nSyms++;
|
||||
}
|
||||
|
||||
void disR5900FreeSyms() {
|
||||
if (dSyms != NULL) { free(dSyms); dSyms = NULL; }
|
||||
nSyms = 0;
|
||||
}
|
||||
|
||||
char *disR5900GetSym(u32 addr) {
|
||||
int i;
|
||||
|
||||
if (dSyms == NULL) return NULL;
|
||||
for (i=0; i<nSyms; i++)
|
||||
if (dSyms[i].addr == addr) return dSyms[i].name;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *disR5900GetUpperSym(u32 addr) {
|
||||
u32 laddr;
|
||||
int i, j=-1;
|
||||
|
||||
if (dSyms == NULL) return NULL;
|
||||
for (i=0, laddr=0; i<nSyms; i++) {
|
||||
if (dSyms[i].addr < addr && dSyms[i].addr > laddr) {
|
||||
laddr = dSyms[i].addr;
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
if (j == -1) return NULL;
|
||||
return dSyms[j].name;
|
||||
}
|
||||
|
||||
#define dFindSym(i) { \
|
||||
char *str = disR5900GetSym(i); \
|
||||
if (str != NULL) sprintf(ostr, "%s %s", ostr, str); \
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
* Arithmetic with immediate operand *
|
||||
* Format: OP rt, rs, immediate *
|
||||
*********************************************************/
|
||||
MakeDisF(disADDI, dName("ADDI"); dGPR64(_Rt_); dGPR32(_Rs_); dImm();)
|
||||
MakeDisF(disADDIU, dName("ADDIU"); dGPR64(_Rt_); dGPR32(_Rs_); dImm();)
|
||||
MakeDisF(disANDI, dName("ANDI"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disORI, dName("ORI"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disSLTI, dName("SLTI"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disSLTIU, dName("SLTIU"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disXORI, dName("XORI"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disDADDI, dName("DADDI"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disDADDIU, dName("DADDIU"); dGPR64(_Rt_); dGPR64(_Rs_); dImm();)
|
||||
|
||||
/*********************************************************
|
||||
* Register arithmetic *
|
||||
* Format: OP rd, rs, rt *
|
||||
*********************************************************/
|
||||
MakeDisF(disADD, dName("ADD"); dGPR64(_Rd_); dGPR32(_Rs_); dGPR32(_Rt_);)
|
||||
MakeDisF(disADDU, dName("ADDU"); dGPR64(_Rd_); dGPR32(_Rs_); dGPR32(_Rt_);)
|
||||
MakeDisF(disDADD, dName("DADD"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disDADDU, dName("DADDU"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disSUB, dName("SUB"); dGPR64(_Rd_); dGPR32(_Rs_); dGPR32(_Rt_);)
|
||||
MakeDisF(disSUBU, dName("SUBU"); dGPR64(_Rd_); dGPR32(_Rs_); dGPR32(_Rt_);)
|
||||
MakeDisF(disDSUB, dName("DSUB"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disDSUBU, dName("DSDBU"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disAND, dName("AND"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disOR, dName("OR"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disXOR, dName("XOR"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disNOR, dName("NOR"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disSLT, dName("SLT"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disSLTU, dName("SLTU"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* Jump to target *
|
||||
* Format: OP target *
|
||||
*********************************************************/
|
||||
MakeDisF(disJ, dName("J"); dTarget(); dFindSym(_Target_);)
|
||||
MakeDisF(disJAL, dName("JAL"); dTarget(); dGPR32(31); dFindSym(_Target_);)
|
||||
|
||||
/*********************************************************
|
||||
* Register jump *
|
||||
* Format: OP rs, rd *
|
||||
*********************************************************/
|
||||
MakeDisF(disJR, dName("JR"); dGPR32(_Rs_); dFindSym(cpuRegs.GPR.r[_Rs_].UL[0]);)
|
||||
MakeDisF(disJALR, dName("JALR"); dGPR32(_Rs_); dGPR32(_Rd_); dFindSym(cpuRegs.GPR.r[_Rs_].UL[0]);)
|
||||
|
||||
/*********************************************************
|
||||
* Register mult/div & Register trap logic *
|
||||
* Format: OP rs, rt *
|
||||
*********************************************************/
|
||||
MakeDisF(disDIV, dName("DIV"); dGPR32(_Rs_); dGPR32(_Rt_);)
|
||||
MakeDisF(disDIVU, dName("DIVU"); dGPR32(_Rs_); dGPR32(_Rt_);)
|
||||
MakeDisF(disMULT, dName("MULT"); dGPR32(_Rs_); dGPR32(_Rt_); dGPR32(_Rd_);)
|
||||
MakeDisF(disMULTU, dName("MULTU"); dGPR32(_Rs_); dGPR32(_Rt_); dGPR32(_Rd_);)
|
||||
|
||||
/*********************************************************
|
||||
* Load higher 16 bits of the first word in GPR with imm *
|
||||
* Format: OP rt, immediate *
|
||||
*********************************************************/
|
||||
MakeDisF(disLUI, dName("LUI"); dGPR64(_Rt_); dImm();)
|
||||
|
||||
/*********************************************************
|
||||
* Move from HI/LO to GPR *
|
||||
* Format: OP rd *
|
||||
*********************************************************/
|
||||
MakeDisF(disMFHI, dName("MFHI"); dGPR64(_Rd_); dHI64();)
|
||||
MakeDisF(disMFLO, dName("MFLO"); dGPR64(_Rd_); dLO64();)
|
||||
|
||||
/*********************************************************
|
||||
* Move to GPR to HI/LO & Register jump *
|
||||
* Format: OP rs *
|
||||
*********************************************************/
|
||||
MakeDisF(disMTHI, dName("MTHI"); dHI64(); dGPR64(_Rs_);)
|
||||
MakeDisF(disMTLO, dName("MTLO"); dLO64(); dGPR64(_Rs_);)
|
||||
|
||||
/*********************************************************
|
||||
* Shift arithmetic with constant shift *
|
||||
* Format: OP rd, rt, sa *
|
||||
*********************************************************/
|
||||
MakeDisF(disSLL, if (code) { dName("SLL"); dGPR64(_Rd_); dGPR32(_Rt_); dSa(); } else { dName("NOP"); })
|
||||
MakeDisF(disDSLL, dName("DSLL"); dGPR64(_Rd_); dGPR64(_Rt_); dSa();)
|
||||
MakeDisF(disDSLL32, dName("DSLL32"); dGPR64(_Rd_); dGPR64(_Rt_); dSa32();)
|
||||
MakeDisF(disSRA, dName("SRA"); dGPR64(_Rd_); dGPR32(_Rt_); dSa();)
|
||||
MakeDisF(disDSRA, dName("DSRA"); dGPR64(_Rd_); dGPR64(_Rt_); dSa();)
|
||||
MakeDisF(disDSRA32, dName("DSRA32"); dGPR64(_Rd_); dGPR64(_Rt_); dSa32();)
|
||||
MakeDisF(disSRL, dName("SRL"); dGPR64(_Rd_); dGPR32(_Rt_); dSa();)
|
||||
MakeDisF(disDSRL, dName("DSRL"); dGPR64(_Rd_); dGPR64(_Rt_); dSa();)
|
||||
MakeDisF(disDSRL32, dName("DSRL32"); dGPR64(_Rd_); dGPR64(_Rt_); dSa32();)
|
||||
|
||||
/*********************************************************
|
||||
* Shift arithmetic with variant register shift *
|
||||
* Format: OP rd, rt, rs *
|
||||
*********************************************************/
|
||||
MakeDisF(disSLLV, dName("SLLV"); dGPR64(_Rd_); dGPR32(_Rt_); dGPR32(_Rs_);)
|
||||
MakeDisF(disDSLLV, dName("DSLLV"); dGPR64(_Rd_); dGPR64(_Rt_); dGPR32(_Rs_);)
|
||||
MakeDisF(disSRAV, dName("SRAV"); dGPR64(_Rd_); dGPR32(_Rt_); dGPR32(_Rs_);)
|
||||
MakeDisF(disDSRAV, dName("DSRAV"); dGPR64(_Rd_); dGPR64(_Rt_); dGPR32(_Rs_);)
|
||||
MakeDisF(disSRLV, dName("SRLV"); dGPR64(_Rd_); dGPR32(_Rt_); dGPR32(_Rs_);)
|
||||
MakeDisF(disDSRLV, dName("DSRLV"); dGPR64(_Rd_); dGPR64(_Rt_); dGPR32(_Rs_);)
|
||||
|
||||
/*********************************************************
|
||||
* Load and store for GPR *
|
||||
* Format: OP rt, offset(base) *
|
||||
*********************************************************/
|
||||
MakeDisF(disLB, dName("LB"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLBU, dName("LBU"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLH, dName("LH"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLHU, dName("LHU"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLW, dName("LW"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLWU, dName("LWU"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLWL, dName("LWL"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLWR, dName("LWR"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLD, dName("LD"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLDL, dName("LDL"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLDR, dName("LDR"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disLQ, dName("LQ"); dGPR128(_Rt_); dOfB();)
|
||||
MakeDisF(disSB, dName("SB"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSH, dName("SH"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSW, dName("SW"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSWL, dName("SWL"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSWR, dName("SWR"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSD, dName("SD"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSDL, dName("SDL"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSDR, dName("SDR"); dGPR64(_Rt_); dOfB();)
|
||||
MakeDisF(disSQ, dName("SQ"); dGPR128(_Rt_); dOfB();)
|
||||
|
||||
/*********************************************************
|
||||
* Register branch logic *
|
||||
* Format: OP rs, rt, offset *
|
||||
*********************************************************/
|
||||
MakeDisF(disBEQ, dName("BEQ"); dGPR64(_Rs_); dGPR64(_Rt_); dOffset();)
|
||||
MakeDisF(disBNE, dName("BNE"); dGPR64(_Rs_); dGPR64(_Rt_); dOffset();)
|
||||
|
||||
/*********************************************************
|
||||
* Moves between GPR and COPx *
|
||||
* Format: OP rt, rd *
|
||||
*********************************************************/
|
||||
MakeDisF(disMFC0, dName("MFC0"); dGPR32(_Rt_); dCP032(_Rd_);)
|
||||
MakeDisF(disMTC0, dName("MTC0"); dCP032(_Rd_); dGPR32(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* Register branch logic *
|
||||
* Format: OP rs, offset *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disBGEZ, dName("BGEZ"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBGEZAL, dName("BGEZAL"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBGTZ, dName("BGTZ"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBLEZ, dName("BLEZ"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBLTZ, dName("BLTZ"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBLTZAL, dName("BLTZAL"); dGPR64(_Rs_); dOffset();)
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* Register branch logic Likely *
|
||||
* Format: OP rs, offset *
|
||||
*********************************************************/
|
||||
|
||||
|
||||
MakeDisF(disBEQL, dName("BEQL"); dGPR64(_Rs_); dGPR64(_Rt_); dOffset();)
|
||||
MakeDisF(disBNEL, dName("BNEL"); dGPR64(_Rs_); dGPR64(_Rt_); dOffset();)
|
||||
MakeDisF(disBLEZL, dName("BLEZL"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBGTZL, dName("BGTZL"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBLTZL, dName("BLTZL"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBGEZL, dName("BGEZL"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBLTZALL, dName("BLTZALL"); dGPR64(_Rs_); dOffset();)
|
||||
MakeDisF(disBGEZALL, dName("BGEZALL"); dGPR64(_Rs_); dOffset();)
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* COP0 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disBC0F, dName("BC0F"); dOffset();)
|
||||
MakeDisF(disBC0T, dName("BC0T"); dOffset();)
|
||||
MakeDisF(disBC0FL, dName("BC0FL"); dOffset();)
|
||||
MakeDisF(disBC0TL, dName("BC0TL"); dOffset();)
|
||||
|
||||
MakeDisF(disTLBR, dName("TLBR");)
|
||||
MakeDisF(disTLBWI, dName("TLBWI");)
|
||||
MakeDisF(disTLBWR, dName("TLBWR");)
|
||||
MakeDisF(disTLBP, dName("TLBP");)
|
||||
MakeDisF(disERET, dName("ERET");)
|
||||
MakeDisF(disEI, dName("EI");)
|
||||
MakeDisF(disDI, dName("DI");)
|
||||
|
||||
/*********************************************************
|
||||
* COP1 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
#define _Ft_ _Rt_
|
||||
#define _Fs_ _Rd_
|
||||
#define _Fd_ _Sa_
|
||||
|
||||
MakeDisF(disMFC1, dName("MFC1"); dGPR64(_Rt_); dCP132(_Fs_);)
|
||||
MakeDisF(disCFC1, dName("CFC1"); dGPR64(_Rt_); dCP1c32(_Fs_);)
|
||||
MakeDisF(disMTC1, dName("MTC1"); dCP132(_Fs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disCTC1, dName("CTC1"); dCP1c32(_Fs_); dGPR64(_Rt_);)
|
||||
|
||||
MakeDisF(disBC1F, dName("BC1F");)
|
||||
MakeDisF(disBC1T, dName("BC1T");)
|
||||
MakeDisF(disBC1FL, dName("BC1FL");)
|
||||
MakeDisF(disBC1TL, dName("BC1TL");)
|
||||
|
||||
MakeDisF(disADDs, dName("ADDs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disSUBs, dName("SUBs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMULs, dName("MULs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disDIVs, dName("DIVs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disSQRTs, dName("SQRTs"); dCP132(_Fd_); dCP132(_Ft_);)
|
||||
MakeDisF(disABSs, dName("ABSs"); dCP132(_Fd_); dCP132(_Fs_);)
|
||||
MakeDisF(disMOVs, dName("MOVs"); dCP132(_Fd_); dCP132(_Fs_);)
|
||||
MakeDisF(disNEGs, dName("NEGs"); dCP132(_Fd_); dCP132(_Fs_);)
|
||||
MakeDisF(disRSQRTs, dName("RSQRTs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disADDAs, dName("ADDAs"); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disSUBAs, dName("SUBAs"); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMULAs, dName("MULAs"); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMADDs, dName("MADDs"); dCP132(_Fd_); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMSUBs, dName("MSUBs"); dCP132(_Fd_); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMADDAs, dName("MADDAs"); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMSUBAs, dName("MSUBAs"); dCP1acc(); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disCVTWs, dName("CVTWs"); dCP132(_Fd_); dCP132(_Fs_);)
|
||||
MakeDisF(disMAXs, dName("MAXs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disMINs, dName("MINs"); dCP132(_Fd_); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disCFs, dName("CFs"); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disCEQs, dName("CEQs"); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disCLTs, dName("CLTs"); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
MakeDisF(disCLEs, dName("CLEs"); dCP132(_Fs_); dCP132(_Ft_);)
|
||||
|
||||
MakeDisF(disCVTSw, dName("CVTSw"); dCP132(_Fd_); dCP132(_Fs_);)
|
||||
|
||||
/*********************************************************
|
||||
* Load and store for COP1 *
|
||||
* Format: OP rt, offset(base) *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disLWC1, dName("LWC1"); dCP132(_Rt_); dOffset();)
|
||||
MakeDisF(disSWC1, dName("SWC1"); dCP132(_Rt_); dOffset();)
|
||||
|
||||
/*********************************************************
|
||||
* Conditional Move *
|
||||
* Format: OP rd, rs, rt *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disMOVZ, dName("MOVZ"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disMOVN, dName("MOVN"); dGPR64(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* MMI opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disMULT1, dName("MULT1");)
|
||||
MakeDisF(disMULTU1, dName("MULTU1");)
|
||||
|
||||
/*********************************************************
|
||||
* MMI0 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disPADDW, dName("PADDW");)
|
||||
MakeDisF(disPADDH, dName("PADDH");)
|
||||
MakeDisF(disPADDB, dName("PADDB");)
|
||||
|
||||
MakeDisF(disPADDSW, dName("PADDSW");)
|
||||
MakeDisF(disPADDSH, dName("PADDSH");)
|
||||
MakeDisF(disPADDSB, dName("PADDSB");)
|
||||
|
||||
MakeDisF(disPSUBW, dName("PSUBW");)
|
||||
MakeDisF(disPSUBH, dName("PSUBH");)
|
||||
MakeDisF(disPSUBB, dName("PSUBB");)
|
||||
|
||||
MakeDisF(disPSUBSW, dName("PSUBSW");)
|
||||
MakeDisF(disPSUBSH, dName("PSUBSH");)
|
||||
MakeDisF(disPSUBSB, dName("PSUBSB");)
|
||||
|
||||
MakeDisF(disPCGTW, dName("PCGTW");)
|
||||
MakeDisF(disPCGTH, dName("PCGTH");)
|
||||
MakeDisF(disPCGTB, dName("PCGTB");)
|
||||
|
||||
MakeDisF(disPMAXW, dName("PMAXW");)
|
||||
MakeDisF(disPMAXH, dName("PMAXH");)
|
||||
|
||||
MakeDisF(disPEXTLW, dName("PEXTLW"); dGPR128(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disPEXTLH, dName("PEXTLH"); dGPR128(_Rd_); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disPEXTLB, dName("PEXTLB");)
|
||||
MakeDisF(disPEXTS, dName("PEXTS");)
|
||||
|
||||
MakeDisF(disPPACW, dName("PPACW");)
|
||||
MakeDisF(disPPACH, dName("PPACH");)
|
||||
MakeDisF(disPPACB, dName("PPACB");)
|
||||
MakeDisF(disPPACS, dName("PPACS");)
|
||||
|
||||
/*********************************************************
|
||||
* MMI1 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disPADSBH, dName("PADSBH");)
|
||||
|
||||
MakeDisF(disPABSW, dName("PABSW");)
|
||||
MakeDisF(disPABSH, dName("PABSH");)
|
||||
|
||||
MakeDisF(disPCEQW, dName("PCEQW");)
|
||||
MakeDisF(disPCEQH, dName("PCEQH");)
|
||||
MakeDisF(disPCEQB, dName("PCEQB");)
|
||||
|
||||
MakeDisF(disPMINW, dName("PMINW");)
|
||||
MakeDisF(disPMINH, dName("PMINH");)
|
||||
|
||||
MakeDisF(disPADDUW, dName("PADDUW");)
|
||||
MakeDisF(disPADDUH, dName("PADDUH");)
|
||||
MakeDisF(disPADDUB, dName("PADDUB");)
|
||||
|
||||
MakeDisF(disPSUBUW, dName("PSUBUW");)
|
||||
MakeDisF(disPSUBUH, dName("PSUBUH");)
|
||||
MakeDisF(disPSUBUB, dName("PSUBUB");)
|
||||
|
||||
MakeDisF(disPEXTUW, dName("PEXTUW"); dGPR128(_Rd_); dGPR64U(_Rs_); dGPR64U(_Rt_);)
|
||||
MakeDisF(disPEXTUH, dName("PEXTUH"); dGPR128(_Rd_); dGPR64U(_Rs_); dGPR64U(_Rt_);)
|
||||
MakeDisF(disPEXTUB, dName("PEXTUB");)
|
||||
|
||||
MakeDisF(disQFSRV, dName("QFSRV");)
|
||||
|
||||
/*********************************************************
|
||||
* MMI2 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disPMADDW, dName("PMADDW");)
|
||||
MakeDisF(disPMADDH, dName("PMADDH");)
|
||||
|
||||
MakeDisF(disPSLLVW, dName("PSLLVW");)
|
||||
MakeDisF(disPSRLVW, dName("PSRLVW");)
|
||||
|
||||
MakeDisF(disPMFHI, dName("PMFHI");)
|
||||
MakeDisF(disPMFLO, dName("PMFLO");)
|
||||
|
||||
MakeDisF(disPINTH, dName("PINTH");)
|
||||
|
||||
MakeDisF(disPMULTW, dName("PMULTW");)
|
||||
MakeDisF(disPMULTH, dName("PMULTH");)
|
||||
|
||||
MakeDisF(disPDIVW, dName("PDIVW");)
|
||||
MakeDisF(disPDIVH, dName("PDIVH");)
|
||||
|
||||
MakeDisF(disPCPYLD, dName("PCPYLD"); dGPR128(_Rd_); dGPR128(_Rs_); dGPR128(_Rt_);)
|
||||
|
||||
MakeDisF(disPAND, dName("PAND"); dGPR128(_Rd_); dGPR128(_Rs_); dGPR128(_Rt_);)
|
||||
MakeDisF(disPXOR, dName("PXOR"); dGPR128(_Rd_); dGPR128(_Rs_); dGPR128(_Rt_);)
|
||||
|
||||
MakeDisF(disPMSUBW, dName("PMSUBW");)
|
||||
MakeDisF(disPMSUBH, dName("PMSUBH");)
|
||||
|
||||
MakeDisF(disPHMADH, dName("PHMADH");)
|
||||
MakeDisF(disPHMSBH, dName("PHMSBH");)
|
||||
|
||||
MakeDisF(disPEXEW, dName("PEXEW");)
|
||||
MakeDisF(disPEXEH, dName("PEXEH");)
|
||||
|
||||
MakeDisF(disPREVH, dName("PREVH");)
|
||||
|
||||
MakeDisF(disPDIVBW, dName("PDIVBW");)
|
||||
|
||||
MakeDisF(disPROT3W, dName("PROT3W");)
|
||||
|
||||
/*********************************************************
|
||||
* MMI3 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disPMADDUW, dName("PMADDUW");)
|
||||
|
||||
MakeDisF(disPSRAVW, dName("PSRAVW");)
|
||||
|
||||
MakeDisF(disPMTHI, dName("PMTHI");)
|
||||
MakeDisF(disPMTLO, dName("PMTLO");)
|
||||
|
||||
MakeDisF(disPINTEH, dName("PINTEH");)
|
||||
|
||||
MakeDisF(disPMULTUW, dName("PMULTUW");)
|
||||
MakeDisF(disPDIVUW, dName("PDIVUW");)
|
||||
|
||||
MakeDisF(disPCPYUD, dName("PCPYUD"); dGPR128(_Rd_); dGPR128(_Rt_); dGPR128(_Rs_);)
|
||||
|
||||
MakeDisF(disPOR, dName("POR"); dGPR128(_Rd_); dGPR128(_Rs_); dGPR128(_Rt_);)
|
||||
MakeDisF(disPNOR, dName("PNOR"); dGPR128(_Rd_); dGPR128(_Rs_); dGPR128(_Rt_);)
|
||||
|
||||
MakeDisF(disPEXCH, dName("PEXCH");)
|
||||
MakeDisF(disPEXCW, dName("PEXCW");)
|
||||
|
||||
MakeDisF(disPCPYH, dName("PCPYH"); dGPR128(_Rd_); dGPR128(_Rt_);)
|
||||
|
||||
/*********************************************************
|
||||
* COP2 opcodes *
|
||||
* *
|
||||
*********************************************************/
|
||||
|
||||
#define _Ft_ _Rt_
|
||||
#define _Fs_ _Rd_
|
||||
#define _Fd_ _Sa_
|
||||
|
||||
#define _X code>>24
|
||||
#define _Y code>>23
|
||||
#define _Z code>>22
|
||||
#define _W code>>21
|
||||
|
||||
MakeDisF(disLQC2, dName("LQC2"); dCP2128f(_Rt_); dOfB();)
|
||||
MakeDisF(disSQC2, dName("SQC2"); dCP2128f(_Rt_); dOfB();)
|
||||
|
||||
MakeDisF(disQMFC2, dName("QMFC2");)
|
||||
MakeDisF(disQMTC2, dName("QMTC2");)
|
||||
MakeDisF(disCFC2, dName("CFC2"); dGPR32(_Rt_); dCP232i(_Fs_);)
|
||||
MakeDisF(disCTC2, dName("CTC2"); dCP232i(_Fs_); dGPR32(_Rt_);)
|
||||
|
||||
MakeDisF(disBC2F, dName("BC2F");)
|
||||
MakeDisF(disBC2T, dName("BC2T");)
|
||||
MakeDisF(disBC2FL, dName("BC2FL");)
|
||||
MakeDisF(disBC2TL, dName("BC2TL");)
|
||||
|
||||
// SPEC1
|
||||
MakeDisF(disVADD, dName("VADD");)
|
||||
MakeDisF(disVADDx, dName("VADDx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVADDy, dName("VADDy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVADDz, dName("VADDz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVADDw, dName("VADDw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVADDq, dName("VADDq"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_Q);)
|
||||
MakeDisF(disVADDi, dName("VADDi"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_I);)
|
||||
MakeDisF(disVSUB, dName("VSUB");)
|
||||
MakeDisF(disVSUBx, dName("VSUBx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVSUBy, dName("VSUBy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVSUBz, dName("VSUBz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVSUBw, dName("VSUBw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);)
|
||||
MakeDisF(disVSUBq, dName("VSUBq");)
|
||||
MakeDisF(disVSUBi, dName("VSUBi");)
|
||||
MakeDisF(disVMADD, dName("VMADD");)
|
||||
MakeDisF(disVMADDx, dName("VMADDx"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);)
|
||||
MakeDisF(disVMADDy, dName("VMADDy"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);)
|
||||
MakeDisF(disVMADDz, dName("VMADDz"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);)
|
||||
MakeDisF(disVMADDw, dName("VMADDw"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);)
|
||||
MakeDisF(disVMADDq, dName("VMADDq");)
|
||||
MakeDisF(disVMADDi, dName("VMADDi");)
|
||||
MakeDisF(disVMSUB, dName("VMSUB");)
|
||||
MakeDisF(disVMSUBx, dName("VMSUBx");)
|
||||
MakeDisF(disVMSUBy, dName("VMSUBy");)
|
||||
MakeDisF(disVMSUBz, dName("VMSUBz");)
|
||||
MakeDisF(disVMSUBw, dName("VMSUBw");)
|
||||
MakeDisF(disVMSUBq, dName("VMSUBq");)
|
||||
MakeDisF(disVMSUBi, dName("VMSUBi");)
|
||||
MakeDisF(disVMAX, dName("VMAX");)
|
||||
MakeDisF(disVMAXx, dName("VMAXx");)
|
||||
MakeDisF(disVMAXy, dName("VMAXy");)
|
||||
MakeDisF(disVMAXz, dName("VMAXz");)
|
||||
MakeDisF(disVMAXw, dName("VMAXw");)
|
||||
MakeDisF(disVMAXi, dName("VMAXi");)
|
||||
MakeDisF(disVMINI, dName("VMINI");)
|
||||
MakeDisF(disVMINIx, dName("VMINIx");)
|
||||
MakeDisF(disVMINIy, dName("VMINIy");)
|
||||
MakeDisF(disVMINIz, dName("VMINIz");)
|
||||
MakeDisF(disVMINIw, dName("VMINIw");)
|
||||
MakeDisF(disVMINIi, dName("VMINIi");)
|
||||
MakeDisF(disVMUL, dName("VMUL");)
|
||||
MakeDisF(disVMULx, dName("VMULx");)
|
||||
MakeDisF(disVMULy, dName("VMULy");)
|
||||
MakeDisF(disVMULz, dName("VMULz");)
|
||||
MakeDisF(disVMULw, dName("VMULw");)
|
||||
MakeDisF(disVMULq, dName("VMULq");)
|
||||
MakeDisF(disVMULi, dName("VMULi");)
|
||||
MakeDisF(disVIADD, dName("VIADD");)
|
||||
MakeDisF(disVIADDI, dName("VIADDI");)
|
||||
MakeDisF(disVISUB, dName("VISUB");)
|
||||
MakeDisF(disVIAND, dName("VIAND");)
|
||||
MakeDisF(disVIOR, dName("VIOR");)
|
||||
MakeDisF(disVOPMSUB, dName("VOPMSUB");)
|
||||
MakeDisF(disVCALLMS, dName("VCALLMS");)
|
||||
MakeDisF(disVCALLMSR, dName("VCALLMSR");)
|
||||
|
||||
// SPEC2
|
||||
MakeDisF(disVADDA, dName("VADDA");)
|
||||
MakeDisF(disVADDAx, dName("VADDAx");)
|
||||
MakeDisF(disVADDAy, dName("VADDAy");)
|
||||
MakeDisF(disVADDAz, dName("VADDAz");)
|
||||
MakeDisF(disVADDAw, dName("VADDAw");)
|
||||
MakeDisF(disVADDAq, dName("VADDAq");)
|
||||
MakeDisF(disVADDAi, dName("VADDAi");)
|
||||
MakeDisF(disVMADDA, dName("VMADDA");)
|
||||
MakeDisF(disVMADDAx, dName("VMADDAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);)
|
||||
MakeDisF(disVMADDAy, dName("VMADDAy"); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);)
|
||||
MakeDisF(disVMADDAz, dName("VMADDAz"); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);)
|
||||
MakeDisF(disVMADDAw, dName("VMADDAw"); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);)
|
||||
MakeDisF(disVMADDAq, dName("VMADDAq");)
|
||||
MakeDisF(disVMADDAi, dName("VMADDAi");)
|
||||
MakeDisF(disVSUBAx, dName("VSUBAx");)
|
||||
MakeDisF(disVSUBAy, dName("VSUBAy");)
|
||||
MakeDisF(disVSUBAz, dName("VSUBAz");)
|
||||
MakeDisF(disVSUBAw, dName("VSUBAw");)
|
||||
MakeDisF(disVMSUBAx, dName("VMSUBAx");)
|
||||
MakeDisF(disVMSUBAy, dName("VMSUBAy");)
|
||||
MakeDisF(disVMSUBAz, dName("VMSUBAz");)
|
||||
MakeDisF(disVMSUBAw, dName("VMSUBAw");)
|
||||
MakeDisF(disVITOF0, dName("VITOF0");)
|
||||
MakeDisF(disVITOF4, dName("VITOF4");)
|
||||
MakeDisF(disVITOF12, dName("VITOF12");)
|
||||
MakeDisF(disVITOF15, dName("VITOF15");)
|
||||
MakeDisF(disVFTOI0, dName("VFTOI0");)
|
||||
MakeDisF(disVFTOI4, dName("VFTOI4");)
|
||||
MakeDisF(disVFTOI12, dName("VFTOI12");)
|
||||
MakeDisF(disVFTOI15, dName("VFTOI15");)
|
||||
MakeDisF(disVMULA, dName("VMULA");)
|
||||
MakeDisF(disVMULAx, dName("VMULAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);)
|
||||
MakeDisF(disVMULAy, dName("VMULAy");)
|
||||
MakeDisF(disVMULAz, dName("VMULAz");)
|
||||
MakeDisF(disVMULAw, dName("VMULAw");)
|
||||
MakeDisF(disVMOVE, dName("VMOVE"); dCP2128f(_Ft_); dCP2128f(_Fs_);)
|
||||
MakeDisF(disVMR32, dName("VMR32");)
|
||||
MakeDisF(disVDIV, dName("VDIV");)
|
||||
MakeDisF(disVSQRT, dName("VSQRT"); dCP232f(_Ft_, _Ftf_);)
|
||||
MakeDisF(disVRSQRT, dName("VRSQRT");)
|
||||
MakeDisF(disVRNEXT, dName("VRNEXT");)
|
||||
MakeDisF(disVRGET, dName("VRGET");)
|
||||
MakeDisF(disVRINIT, dName("VRINIT");)
|
||||
MakeDisF(disVRXOR, dName("VRXOR");)
|
||||
MakeDisF(disVWAITQ, dName("VWAITQ");)
|
||||
|
||||
/*********************************************************
|
||||
* Special purpose instructions *
|
||||
* Format: OP *
|
||||
*********************************************************/
|
||||
|
||||
MakeDisF(disSYNC, dName("SYNC");)
|
||||
MakeDisF(disBREAK, dName("BREAK");)
|
||||
MakeDisF(disSYSCALL, dName("SYSCALL"); dCode();)
|
||||
MakeDisF(disCACHE, sprintf(ostr, "%s %-7s, %x,", ostr, "CACHE", _Rt_); dOfB();)
|
||||
MakeDisF(disPREF, dName("PREF");)
|
||||
|
||||
MakeDisF(disMFSA, dName("MFSA"); dGPR64(_Rd_); dSaR();)
|
||||
MakeDisF(disMTSA, dName("MTSA"); dGPR64(_Rs_); dSaR();)
|
||||
|
||||
MakeDisF(disMTSAB, dName("MTSAB");dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disMTSAH, dName("MTSAH");dGPR64(_Rs_); dImm();)
|
||||
|
||||
MakeDisF(disTGE, dName("TGE"); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disTGEU, dName("TGEU"); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disTLT, dName("TLT"); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disTLTU, dName("TLTU"); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disTEQ, dName("TEQ"); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
MakeDisF(disTNE, dName("TNE"); dGPR64(_Rs_); dGPR64(_Rt_);)
|
||||
|
||||
MakeDisF(disTGEI, dName("TGEI"); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disTGEIU, dName("TGEIU"); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disTLTI, dName("TLTI"); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disTLTIU, dName("TLTIU"); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disTEQI, dName("TEQI"); dGPR64(_Rs_); dImm();)
|
||||
MakeDisF(disTNEI, dName("TNEI"); dGPR64(_Rs_); dImm();)
|
||||
|
||||
/*********************************************************
|
||||
* Unknow instruction (would generate an exception) *
|
||||
* Format: ? *
|
||||
*********************************************************/
|
||||
MakeDisF(disNULL, dName("*** Bad OP ***");)
|
||||
|
||||
TdisR5900F disR5900_MMI0[] = { // Subset of disMMI0
|
||||
disPADDW, disPSUBW, disPCGTW, disPMAXW,
|
||||
disPADDH, disPSUBH, disPCGTH, disPMAXH,
|
||||
disPADDB, disPSUBB, disPCGTB, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL,
|
||||
disPADDSW, disPSUBSW, disPEXTLW, disPPACW,
|
||||
disPADDSH, disPSUBSH, disPEXTLH, disPPACH,
|
||||
disPADDSB, disPSUBSB, disPEXTLB, disPPACB,
|
||||
disNULL, disNULL, disPEXTS, disPPACS};
|
||||
|
||||
MakeDisF(disMMI0, disR5900_MMI0[_Sa_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_MMI1[] = { // Subset of disMMI1
|
||||
disNULL, disPABSW, disPCEQW, disPMINW,
|
||||
disPADSBH, disPABSH, disPCEQH, disPMINH,
|
||||
disNULL, disNULL, disPCEQB, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL,
|
||||
disPADDUW, disPSUBUW, disPEXTUW, disNULL,
|
||||
disPADDUH, disPSUBUH, disPEXTUH, disNULL,
|
||||
disPADDUB, disPSUBUB, disPEXTUB, disQFSRV,
|
||||
disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disMMI1, disR5900_MMI1[_Sa_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_MMI2[] = { // Subset of disMMI2
|
||||
disPMADDW, disNULL, disPSLLVW, disPSRLVW,
|
||||
disPMSUBW, disNULL, disNULL, disNULL,
|
||||
disPMFHI, disPMFLO, disPINTH, disNULL,
|
||||
disPMULTW, disPDIVW, disPCPYLD, disNULL,
|
||||
disPMADDH, disPHMADH, disPAND, disPXOR,
|
||||
disPMSUBH, disPHMSBH, disNULL, disNULL,
|
||||
disNULL, disNULL, disPEXEH, disPREVH,
|
||||
disPMULTH, disPDIVBW, disPEXEW, disPROT3W};
|
||||
|
||||
MakeDisF(disMMI2, disR5900_MMI2[_Sa_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_MMI3[] = { // Subset of disMMI3
|
||||
disPMADDUW, disNULL, disNULL, disPSRAVW,
|
||||
disNULL, disNULL, disNULL, disNULL,
|
||||
disPMTHI, disPMTLO, disPINTEH, disNULL,
|
||||
disPMULTUW, disPDIVUW, disPCPYUD, disNULL,
|
||||
disNULL, disNULL, disPOR, disPNOR,
|
||||
disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disPEXCH, disPCPYH,
|
||||
disNULL, disNULL, disPEXCW, disNULL};
|
||||
|
||||
MakeDisF(disMMI3, disR5900_MMI3[_Sa_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_MMI[] = { // Subset of disMMI
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disMMI0, disMMI2, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disMULT1, disMULTU1, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disMMI1, disMMI3, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disMMI, disR5900_MMI[_Funct_] DisFInterfaceN)
|
||||
|
||||
|
||||
TdisR5900F disR5900_COP0_BC0[] = { //subset of disCOP0 BC
|
||||
disBC0F, disBC0T, disBC0FL, disBC0TL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP0_BC0, disR5900_COP0_BC0[_Rt_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP0_Func[] = { //subset of disCOP0 Function
|
||||
disNULL, disTLBR, disTLBWI, disNULL, disNULL, disNULL, disTLBWR, disNULL,
|
||||
disTLBP, disNULL, disNULL , disNULL, disNULL, disNULL, disNULL , disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL, disNULL, disNULL, disNULL , disNULL,
|
||||
disERET, disNULL, disNULL , disNULL, disNULL, disNULL, disNULL , disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL, disNULL, disNULL, disNULL , disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL, disNULL, disNULL, disNULL , disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL, disNULL, disNULL, disNULL , disNULL,
|
||||
disEI , disDI , disNULL , disNULL, disNULL, disNULL, disNULL , disNULL
|
||||
};
|
||||
MakeDisF(disCOP0_Func, disR5900_COP0_Func[_Funct_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP0[] = { // Subset of disCOP0
|
||||
disMFC0, disNULL, disNULL, disNULL, disMTC0, disNULL, disNULL, disNULL,
|
||||
disCOP0_BC0, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disCOP0_Func, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disCOP0, disR5900_COP0[_Rs_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP1_S[] = { //subset of disCOP1 S
|
||||
disADDs, disSUBs, disMULs, disDIVs, disSQRTs, disABSs, disMOVs, disNEGs,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disRSQRTs, disNULL,
|
||||
disADDAs, disSUBAs, disMULAs, disNULL, disMADDs, disMSUBs, disMADDAs, disMSUBAs,
|
||||
disNULL, disNULL, disNULL, disNULL, disCVTWs, disNULL, disNULL, disNULL,
|
||||
disMINs, disMAXs, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disCFs, disNULL, disCEQs, disNULL, disCLTs, disNULL, disCLEs, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP1_S, disR5900_COP1_S[_Funct_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP1_W[] = { //subset of disCOP1 W
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disCVTSw, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP1_W, disR5900_COP1_W[_Funct_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP1_BC1[] = { //subset of disCOP1 BC
|
||||
disBC1F, disBC1T, disBC1FL, disBC1TL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP1_BC1, disR5900_COP1_BC1[_Rt_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP1[] = { // Subset of disCOP1
|
||||
disMFC1, disNULL, disCFC1, disNULL, disMTC1, disNULL, disCTC1, disNULL,
|
||||
disCOP1_BC1, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disCOP1_S, disNULL, disNULL, disNULL, disCOP1_W, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disCOP1, disR5900_COP1[_Rs_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP2_SPEC2[] = { //subset of disCOP2 SPEC2
|
||||
disVADDAx, disVADDAy, disVADDAz, disVADDAw, disVSUBAx, disVSUBAy, disVSUBAz, disVSUBAw,
|
||||
disVMADDAx, disVMADDAy, disVMADDAz, disVMADDAw, disVMSUBAx, disVMSUBAy, disVMSUBAz, disVMSUBAw,
|
||||
disVITOF0, disVITOF4, disVITOF12, disVITOF15, disVFTOI0, disVFTOI4, disVFTOI12, disVFTOI15,
|
||||
disVMULAx, disVMULAy, disVMULAz, disVMULAw, disNULL, disNULL, disNULL, disNULL,
|
||||
disVADDAq, disVMADDAq, disVADDAi, disVMADDAi, disNULL, disNULL, disNULL, disNULL,
|
||||
disVADDA, disVMADDA, disVMULA, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disVMOVE, disVMR32, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disVDIV, disVSQRT, disVRSQRT, disVWAITQ, disNULL, disNULL, disNULL, disNULL,
|
||||
disVRNEXT, disVRGET, disVRINIT, disVRXOR, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP2_SPEC2, disR5900_COP2_SPEC2[(code & 0x3) | ((code >> 4) & 0x7c)] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP2_SPEC1[] = { //subset of disCOP2 SPEC1
|
||||
disVADDx, disVADDy, disVADDz, disVADDw, disVSUBx, disVSUBy, disVSUBz, disVSUBw,
|
||||
disVMADDx, disVMADDy, disVMADDz, disVMADDw, disVMSUBx, disVMSUBy, disVMSUBz, disVMSUBw,
|
||||
disVMAXx, disVMAXy, disVMAXz, disVMAXw, disVMINIx, disVMINIy, disVMINIz, disVMINIw,
|
||||
disVMULx, disVMULy, disVMULz, disVMULw, disVMULq, disVMAXi, disVMULi, disVMINIi,
|
||||
disVADDq, disVMADDq, disVADDi, disVMADDi, disVSUBq, disVMSUBq, disVSUBi, disVMSUBi,
|
||||
disVADD, disVMADD, disVMUL, disVMAX, disVSUB, disVMSUB, disVOPMSUB, disVMINI,
|
||||
disVIADD, disVISUB, disVIADDI, disNULL, disVIAND, disVIOR, disNULL, disNULL,
|
||||
disVCALLMS, disVCALLMSR, disNULL, disNULL, disCOP2_SPEC2, disCOP2_SPEC2, disCOP2_SPEC2, disCOP2_SPEC2,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP2_SPEC1, disR5900_COP2_SPEC1[_Funct_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP2_BC2[] = { //subset of disCOP2 BC
|
||||
disBC2F, disBC2T, disBC2FL, disBC2TL, disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
disNULL, disNULL, disNULL , disNULL , disNULL, disNULL, disNULL, disNULL,
|
||||
};
|
||||
|
||||
MakeDisF(disCOP2_BC2, disR5900_COP2_BC2[_Rt_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_COP2[] = { // Subset of disCOP2
|
||||
disNULL, disQMFC2, disCFC2, disNULL, disNULL, disQMTC2, disCTC2, disNULL,
|
||||
disCOP2_BC2, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL, disNULL,
|
||||
disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1,
|
||||
disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1, disCOP2_SPEC1};
|
||||
|
||||
MakeDisF(disCOP2, disR5900_COP2[_Rs_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_REGIMM[] = { // Subset of disREGIMM
|
||||
disBLTZ, disBGEZ, disBLTZL, disBGEZL, disNULL, disNULL, disNULL, disNULL,
|
||||
disTGEI, disTGEIU, disTLTI, disTLTIU, disTEQI, disNULL, disTNEI, disNULL,
|
||||
disBLTZAL, disBGEZAL, disBLTZALL, disBGEZALL, disNULL, disNULL, disNULL, disNULL,
|
||||
disMTSAB, disMTSAH , disNULL, disNULL, disNULL, disNULL, disNULL, disNULL};
|
||||
|
||||
MakeDisF(disREGIMM, disR5900_REGIMM[_Rt_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900_SPECIAL[] = {
|
||||
disSLL, disNULL, disSRL, disSRA, disSLLV, disNULL, disSRLV, disSRAV,
|
||||
disJR, disJALR, disMOVZ, disMOVN, disSYSCALL, disBREAK,disNULL, disSYNC,
|
||||
disMFHI, disMTHI, disMFLO, disMTLO, disDSLLV, disNULL, disDSRLV, disDSRAV,
|
||||
disMULT, disMULTU,disDIV, disDIVU, disNULL, disNULL, disNULL, disNULL,
|
||||
disADD, disADDU, disSUB, disSUBU, disAND, disOR, disXOR, disNOR,
|
||||
disMFSA , disMTSA, disSLT, disSLTU, disDADD, disDADDU,disDSUB, disDSUBU,
|
||||
disTGE, disTGEU, disTLT, disTLTU, disTEQ, disNULL, disTNE, disNULL,
|
||||
disDSLL, disNULL, disDSRL, disDSRA, disDSLL32, disNULL, disDSRL32,disDSRA32 };
|
||||
|
||||
MakeDisF(disSPECIAL, disR5900_SPECIAL[_Funct_] DisFInterfaceN)
|
||||
|
||||
TdisR5900F disR5900[] = {
|
||||
disSPECIAL, disREGIMM, disJ , disJAL , disBEQ , disBNE , disBLEZ , disBGTZ ,
|
||||
disADDI , disADDIU , disSLTI, disSLTIU, disANDI, disORI , disXORI , disLUI ,
|
||||
disCOP0 , disCOP1 , disCOP2, disNULL , disBEQL, disBNEL, disBLEZL, disBGTZL,
|
||||
disDADDI , disDADDIU, disLDL , disLDR , disMMI , disNULL, disLQ , disSQ ,
|
||||
disLB , disLH , disLWL , disLW , disLBU , disLHU , disLWR , disLWU ,
|
||||
disSB , disSH , disSWL , disSW , disSDL , disSDR , disSWR , disCACHE,
|
||||
disNULL , disLWC1 , disNULL, disPREF , disNULL, disNULL, disLQC2 , disLD ,
|
||||
disNULL , disSWC1 , disNULL, disNULL , disNULL, disNULL, disSQC2 , disSD };
|
||||
|
||||
MakeDisF(disR5900F, disR5900[code >> 26] DisFInterfaceN)
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,83 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Debug.h"
|
||||
|
||||
char ostr[1024];
|
||||
|
||||
// Type deffinition of our functions
|
||||
#define DisFInterface (u32 code, u32 pc)
|
||||
#define DisFInterfaceT (u32, u32)
|
||||
#define DisFInterfaceN (code, pc)
|
||||
|
||||
typedef char* (*TdisR5900F)DisFInterface;
|
||||
|
||||
// These macros are used to assemble the disassembler functions
|
||||
#define MakeDisF(fn, b) \
|
||||
char* fn DisFInterface { \
|
||||
sprintf (ostr, "%8.8x %8.8x:", pc, code); \
|
||||
b; /*ostr[(strlen(ostr) - 1)] = 0;*/ return ostr; \
|
||||
}
|
||||
|
||||
//Lower/Upper instructions can use that..
|
||||
#define _Ft_ ((code >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define _Fs_ ((code >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define _Fd_ ((code >> 6) & 0x1F) // The sa part of the instruction register
|
||||
|
||||
#define dName(i) sprintf(ostr, "%s %-7s,", ostr, i)
|
||||
#define dNameU(i) { char op[256]; sprintf(op, "%s.%s%s%s%s", i, _X ? "x" : "", _Y ? "y" : "", _Z ? "z" : "", _W ? "w" : ""); sprintf(ostr, "%s %-7s,", ostr, op); }
|
||||
|
||||
|
||||
#define dCP2128f(i) sprintf(ostr, "%s w=%f z=%f y=%f x=%f (%s),", ostr, VU0.VF[i].f.w, VU0.VF[i].f.z, VU0.VF[i].f.y, VU0.VF[i].f.x, disRNameCP2f[i])
|
||||
#define dCP232x(i) sprintf(ostr, "%s x=%f (%s),", ostr, VU0.VF[i].f.x, disRNameCP2f[i])
|
||||
#define dCP232y(i) sprintf(ostr, "%s y=%f (%s),", ostr, VU0.VF[i].f.y, disRNameCP2f[i])
|
||||
#define dCP232z(i) sprintf(ostr, "%s z=%f (%s),", ostr, VU0.VF[i].f.z, disRNameCP2f[i])
|
||||
#define dCP232w(i) sprintf(ostr, "%s w=%f (%s),", ostr, VU0.VF[i].f.w, disRNameCP2f[i])
|
||||
#define dCP2ACCf() sprintf(ostr, "%s w=%f z=%f y=%f x=%f (ACC),", ostr, VU0.ACC.f.w, VU0.ACC.f.z, VU0.ACC.f.y, VU0.ACC.f.x)
|
||||
#define dCP232i(i) sprintf(ostr, "%s %8.8x (%s),", ostr, VU0.VI[i].UL, disRNameCP2i[i])
|
||||
#define dCP232iF(i) sprintf(ostr, "%s %f (%s),", ostr, VU0.VI[i].F, disRNameCP2i[i])
|
||||
#define dCP232f(i, j) sprintf(ostr, "%s Q %s=%f (%s),", ostr, CP2VFnames[j], VU0.VF[i].F[j], disRNameCP2f[i])
|
||||
#define dImm5() sprintf(ostr, "%s %d,", ostr, (code >> 6) & 0x1f)
|
||||
#define dImm11() sprintf(ostr, "%s %d,", ostr, code & 0x7ff)
|
||||
#define dImm15() sprintf(ostr, "%s %d,", ostr, ( ( code >> 10 ) & 0x7800 ) | ( code & 0x7ff ))
|
||||
|
||||
#define _X ((code>>24) & 0x1)
|
||||
#define _Y ((code>>23) & 0x1)
|
||||
#define _Z ((code>>22) & 0x1)
|
||||
#define _W ((code>>21) & 0x1)
|
||||
|
||||
#define _Fsf_ ((code >> 21) & 0x03)
|
||||
#define _Ftf_ ((code >> 23) & 0x03)
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* Unknow instruction (would generate an exception) *
|
||||
* Format: ? *
|
||||
*********************************************************/
|
||||
extern char* disNULL DisFInterface;
|
||||
|
||||
#include "DisVUmicro.h"
|
||||
#include "DisVUops.h"
|
||||
#include "VU.h"
|
||||
|
||||
_disVUOpcodes(VU0);
|
||||
_disVUTables(VU0);
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Debug.h"
|
||||
#include "VUmicro.h"
|
||||
|
||||
char ostr[1024];
|
||||
|
||||
// Type deffinition of our functions
|
||||
#define DisFInterface (u32 code, u32 pc)
|
||||
#define DisFInterfaceT (u32, u32)
|
||||
#define DisFInterfaceN (code, pc)
|
||||
|
||||
typedef char* (*TdisR5900F)DisFInterface;
|
||||
|
||||
// These macros are used to assemble the disassembler functions
|
||||
#define MakeDisF(fn, b) \
|
||||
char* fn DisFInterface { \
|
||||
if( !CHECK_VU1REC ) sprintf (ostr, "%8.8x %8.8x:", pc, code); \
|
||||
else ostr[0] = 0; \
|
||||
b; /*ostr[(strlen(ostr) - 1)] = 0;*/ return ostr; \
|
||||
}
|
||||
|
||||
//Lower/Upper instructions can use that..
|
||||
#define _Ft_ ((code >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define _Fs_ ((code >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define _Fd_ ((code >> 6) & 0x1F) // The sa part of the instruction register
|
||||
|
||||
#define dName(i) sprintf(ostr, "%s %-12s", ostr, i); \
|
||||
|
||||
#define dNameU(i) { \
|
||||
char op[256]; sprintf(op, "%s.%s%s%s%s", i, _X ? "x" : "", _Y ? "y" : "", _Z ? "z" : "", _W ? "w" : ""); \
|
||||
sprintf(ostr, "%s %-12s", ostr, op); \
|
||||
}
|
||||
|
||||
#define dCP2128f(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
|
||||
else sprintf(ostr, "%s w=%f (%8.8x) z=%f (%8.8x) y=%f (%8.8xl) x=%f (%8.8x) (%s),", ostr, VU1.VF[i].f.w, VU1.VF[i].UL[3], VU1.VF[i].f.z, VU1.VF[i].UL[2], VU1.VF[i].f.y, VU1.VF[i].UL[1], VU1.VF[i].f.x, VU1.VF[i].UL[0], disRNameCP2f[i]); \
|
||||
} \
|
||||
|
||||
#define dCP232x(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
|
||||
else sprintf(ostr, "%s x=%f (%s),", ostr, VU1.VF[i].f.x, disRNameCP2f[i]); \
|
||||
} \
|
||||
|
||||
#define dCP232y(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
|
||||
else sprintf(ostr, "%s y=%f (%s),", ostr, VU1.VF[i].f.y, disRNameCP2f[i]); \
|
||||
} \
|
||||
|
||||
#define dCP232z(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
|
||||
else sprintf(ostr, "%s z=%f (%s),", ostr, VU1.VF[i].f.z, disRNameCP2f[i]); \
|
||||
}
|
||||
|
||||
#define dCP232w(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
|
||||
else sprintf(ostr, "%s w=%f (%s),", ostr, VU1.VF[i].f.w, disRNameCP2f[i]); \
|
||||
}
|
||||
|
||||
#define dCP2ACCf() { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s ACC,", ostr); \
|
||||
else sprintf(ostr, "%s w=%f z=%f y=%f x=%f (ACC),", ostr, VU1.ACC.f.w, VU1.ACC.f.z, VU1.ACC.f.y, VU1.ACC.f.x); \
|
||||
} \
|
||||
|
||||
#define dCP232i(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2i[i]); \
|
||||
else sprintf(ostr, "%s %8.8x (%s),", ostr, VU1.VI[i].UL, disRNameCP2i[i]); \
|
||||
}
|
||||
|
||||
#define dCP232iF(i) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s,", ostr, disRNameCP2i[i]); \
|
||||
else sprintf(ostr, "%s %f (%s),", ostr, VU1.VI[i].F, disRNameCP2i[i]); \
|
||||
}
|
||||
|
||||
#define dCP232f(i, j) { \
|
||||
if( CHECK_VU1REC ) sprintf(ostr, "%s %s%s,", ostr, disRNameCP2f[i], CP2VFnames[j]); \
|
||||
else sprintf(ostr, "%s %s=%f (%s),", ostr, CP2VFnames[j], VU1.VF[i].F[j], disRNameCP2f[i]); \
|
||||
}
|
||||
|
||||
#define dImm5() sprintf(ostr, "%s %d,", ostr, (s16)((code >> 6) & 0x10 ? 0xfff0 | ((code >> 6) & 0xf) : (code >> 6) & 0xf))
|
||||
#define dImm11() sprintf(ostr, "%s %d,", ostr, (s16)(code & 0x400 ? 0xfc00 | (code & 0x3ff) : code & 0x3ff))
|
||||
#define dImm15() sprintf(ostr, "%s %d,", ostr, ( ( code >> 10 ) & 0x7800 ) | ( code & 0x7ff ))
|
||||
|
||||
#define _X ((code>>24) & 0x1)
|
||||
#define _Y ((code>>23) & 0x1)
|
||||
#define _Z ((code>>22) & 0x1)
|
||||
#define _W ((code>>21) & 0x1)
|
||||
|
||||
#define _Fsf_ ((code >> 21) & 0x03)
|
||||
#define _Ftf_ ((code >> 23) & 0x03)
|
||||
|
||||
/*********************************************************
|
||||
* Unknow instruction (would generate an exception) *
|
||||
* Format: ? *
|
||||
*********************************************************/
|
||||
extern char* disNULL DisFInterface;
|
||||
|
||||
#include "DisVUmicro.h"
|
||||
#include "DisVUops.h"
|
||||
|
||||
_disVUOpcodes(VU1);
|
||||
_disVUTables(VU1);
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#define _disVUTables(VU) \
|
||||
\
|
||||
/****************/ \
|
||||
/* LOWER TABLES */ \
|
||||
/****************/ \
|
||||
\
|
||||
TdisR5900F dis##VU##LowerOP_T3_00_OPCODE[32] = { \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##MI_MOVE , dis##VU##MI_LQI , dis##VU##MI_DIV , dis##VU##MI_MTIR, \
|
||||
dis##VU##MI_RNEXT , disNULL , disNULL , disNULL , /* 0x10 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , dis##VU##MI_MFP , dis##VU##MI_XTOP , dis##VU##MI_XGKICK, \
|
||||
dis##VU##MI_ESADD , dis##VU##MI_EATANxy, dis##VU##MI_ESQRT, dis##VU##MI_ESIN, \
|
||||
}; \
|
||||
\
|
||||
TdisR5900F dis##VU##LowerOP_T3_01_OPCODE[32] = { \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##MI_MR32 , dis##VU##MI_SQI , dis##VU##MI_SQRT , dis##VU##MI_MFIR, \
|
||||
dis##VU##MI_RGET , disNULL , disNULL , disNULL , /* 0x10 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , dis##VU##MI_XITOP, disNULL , \
|
||||
dis##VU##MI_ERSADD, dis##VU##MI_EATANxz, dis##VU##MI_ERSQRT, dis##VU##MI_EATAN, \
|
||||
}; \
|
||||
\
|
||||
TdisR5900F dis##VU##LowerOP_T3_10_OPCODE[32] = { \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , dis##VU##MI_LQD , dis##VU##MI_RSQRT, dis##VU##MI_ILWR, \
|
||||
dis##VU##MI_RINIT , disNULL , disNULL , disNULL , /* 0x10 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##MI_ELENG , dis##VU##MI_ESUM , dis##VU##MI_ERCPR, dis##VU##MI_EEXP, \
|
||||
}; \
|
||||
\
|
||||
TdisR5900F dis##VU##LowerOP_T3_11_OPCODE[32] = { \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , dis##VU##MI_SQD , dis##VU##MI_WAITQ, dis##VU##MI_ISWR, \
|
||||
dis##VU##MI_RXOR , disNULL , disNULL , disNULL , /* 0x10 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##MI_ERLENG, disNULL , dis##VU##MI_WAITP, disNULL , \
|
||||
}; \
|
||||
\
|
||||
MakeDisF(dis##VU##LowerOP_T3_00, dis##VU##LowerOP_T3_00_OPCODE[_Fd_] DisFInterfaceN) \
|
||||
MakeDisF(dis##VU##LowerOP_T3_01, dis##VU##LowerOP_T3_01_OPCODE[_Fd_] DisFInterfaceN) \
|
||||
MakeDisF(dis##VU##LowerOP_T3_10, dis##VU##LowerOP_T3_10_OPCODE[_Fd_] DisFInterfaceN) \
|
||||
MakeDisF(dis##VU##LowerOP_T3_11, dis##VU##LowerOP_T3_11_OPCODE[_Fd_] DisFInterfaceN) \
|
||||
\
|
||||
TdisR5900F dis##VU##LowerOP_OPCODE[64] = { \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , /* 0x10 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , /* 0x20 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##MI_IADD , dis##VU##MI_ISUB , dis##VU##MI_IADDI, disNULL , /* 0x30 */ \
|
||||
dis##VU##MI_IAND , dis##VU##MI_IOR , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##LowerOP_T3_00, dis##VU##LowerOP_T3_01, dis##VU##LowerOP_T3_10, dis##VU##LowerOP_T3_11, \
|
||||
}; \
|
||||
\
|
||||
MakeDisF(dis##VU##LowerOP, dis##VU##LowerOP_OPCODE[code & 0x3f] DisFInterfaceN) \
|
||||
\
|
||||
TdisR5900F dis##VU##MicroL[] = { \
|
||||
dis##VU##MI_LQ , dis##VU##MI_SQ , disNULL , disNULL, \
|
||||
dis##VU##MI_ILW , dis##VU##MI_ISW , disNULL , disNULL, \
|
||||
dis##VU##MI_IADDIU, dis##VU##MI_ISUBIU, disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
dis##VU##MI_FCEQ , dis##VU##MI_FCSET , dis##VU##MI_FCAND, dis##VU##MI_FCOR, /* 0x10 */ \
|
||||
dis##VU##MI_FSEQ , dis##VU##MI_FSSET , dis##VU##MI_FSAND, dis##VU##MI_FSOR, \
|
||||
dis##VU##MI_FMEQ , disNULL , dis##VU##MI_FMAND, dis##VU##MI_FMOR, \
|
||||
dis##VU##MI_FCGET , disNULL , disNULL , disNULL, \
|
||||
dis##VU##MI_B , dis##VU##MI_BAL , disNULL , disNULL, /* 0x20 */ \
|
||||
dis##VU##MI_JR , dis##VU##MI_JALR , disNULL , disNULL, \
|
||||
dis##VU##MI_IBEQ , dis##VU##MI_IBNE , disNULL , disNULL, \
|
||||
dis##VU##MI_IBLTZ , dis##VU##MI_IBGTZ , dis##VU##MI_IBLEZ, dis##VU##MI_IBGEZ, \
|
||||
disNULL , disNULL , disNULL , disNULL, /* 0x30 */ \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
dis##VU##LowerOP , disNULL , disNULL , disNULL, /* 0x40*/ \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, /* 0x50 */ \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, /* 0x60 */ \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, /* 0x70 */ \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
disNULL , disNULL , disNULL , disNULL, \
|
||||
}; \
|
||||
\
|
||||
\
|
||||
MakeDisF(dis##VU##MicroLF, dis##VU##MicroL[code >> 25] DisFInterfaceN) \
|
||||
\
|
||||
\
|
||||
/****************/ \
|
||||
/* UPPER TABLES */ \
|
||||
/****************/ \
|
||||
\
|
||||
TdisR5900F dis##VU##_UPPER_FD_00_TABLE[32] = { \
|
||||
dis##VU##MI_ADDAx, dis##VU##MI_SUBx , dis##VU##MI_MADDAx, dis##VU##MI_MSUBAx, \
|
||||
dis##VU##MI_ITOF0, dis##VU##MI_FTOI0, dis##VU##MI_MULAx , dis##VU##MI_MULAq , \
|
||||
dis##VU##MI_ADDAq, dis##VU##MI_SUBAq, dis##VU##MI_ADDA , dis##VU##MI_SUBA , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
}; \
|
||||
\
|
||||
TdisR5900F dis##VU##_UPPER_FD_01_TABLE[32] = { \
|
||||
dis##VU##MI_ADDAy , dis##VU##MI_SUBy , dis##VU##MI_MADDAy, dis##VU##MI_MSUBAy, \
|
||||
dis##VU##MI_ITOF4 , dis##VU##MI_FTOI4 , dis##VU##MI_MULAy , dis##VU##MI_ABS , \
|
||||
dis##VU##MI_MADDAq, dis##VU##MI_MSUBAq, dis##VU##MI_MADDA , dis##VU##MI_MSUBA , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
}; \
|
||||
\
|
||||
TdisR5900F dis##VU##_UPPER_FD_10_TABLE[32] = { \
|
||||
dis##VU##MI_ADDAz , dis##VU##MI_SUBz , dis##VU##MI_MADDAz, dis##VU##MI_MSUBAz, \
|
||||
dis##VU##MI_ITOF12, dis##VU##MI_FTOI12, dis##VU##MI_MULAz , dis##VU##MI_MULAi , \
|
||||
dis##VU##MI_ADDAi, dis##VU##MI_SUBAi , dis##VU##MI_MULA , dis##VU##MI_OPMULA, \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
}; \
|
||||
\
|
||||
TdisR5900F dis##VU##_UPPER_FD_11_TABLE[32] = { \
|
||||
dis##VU##MI_ADDAw , dis##VU##MI_SUBw , dis##VU##MI_MADDAw, dis##VU##MI_MSUBAw, \
|
||||
dis##VU##MI_ITOF15, dis##VU##MI_FTOI15, dis##VU##MI_MULAw , dis##VU##MI_CLIP , \
|
||||
dis##VU##MI_MADDAi, dis##VU##MI_MSUBAi, disNULL , dis##VU##MI_NOP , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
}; \
|
||||
\
|
||||
MakeDisF(dis##VU##_UPPER_FD_00, dis##VU##_UPPER_FD_00_TABLE[_Fd_] DisFInterfaceN) \
|
||||
MakeDisF(dis##VU##_UPPER_FD_01, dis##VU##_UPPER_FD_01_TABLE[_Fd_] DisFInterfaceN) \
|
||||
MakeDisF(dis##VU##_UPPER_FD_10, dis##VU##_UPPER_FD_10_TABLE[_Fd_] DisFInterfaceN) \
|
||||
MakeDisF(dis##VU##_UPPER_FD_11, dis##VU##_UPPER_FD_11_TABLE[_Fd_] DisFInterfaceN) \
|
||||
\
|
||||
TdisR5900F dis##VU##MicroU[] = { \
|
||||
dis##VU##MI_ADDx , dis##VU##MI_ADDy , dis##VU##MI_ADDz , dis##VU##MI_ADDw, \
|
||||
dis##VU##MI_SUBx , dis##VU##MI_SUBy , dis##VU##MI_SUBz , dis##VU##MI_SUBw, \
|
||||
dis##VU##MI_MADDx , dis##VU##MI_MADDy , dis##VU##MI_MADDz , dis##VU##MI_MADDw, \
|
||||
dis##VU##MI_MSUBx , dis##VU##MI_MSUBy , dis##VU##MI_MSUBz , dis##VU##MI_MSUBw, \
|
||||
dis##VU##MI_MAXx , dis##VU##MI_MAXy , dis##VU##MI_MAXz , dis##VU##MI_MAXw, /* 0x10 */ \
|
||||
dis##VU##MI_MINIx , dis##VU##MI_MINIy , dis##VU##MI_MINIz , dis##VU##MI_MINIw, \
|
||||
dis##VU##MI_MULx , dis##VU##MI_MULy , dis##VU##MI_MULz , dis##VU##MI_MULw, \
|
||||
dis##VU##MI_MULq , dis##VU##MI_MAXi , dis##VU##MI_MULi , dis##VU##MI_MINIi, \
|
||||
dis##VU##MI_ADDq , dis##VU##MI_MADDq , dis##VU##MI_ADDi , dis##VU##MI_MADDi, /* 0x20 */ \
|
||||
dis##VU##MI_SUBq , dis##VU##MI_MSUBq , dis##VU##MI_SUBi , dis##VU##MI_MSUBi, \
|
||||
dis##VU##MI_ADD , dis##VU##MI_MADD , dis##VU##MI_MUL , dis##VU##MI_MAX, \
|
||||
dis##VU##MI_SUB , dis##VU##MI_MSUB , dis##VU##MI_OPMSUB, dis##VU##MI_MINI, \
|
||||
disNULL , disNULL , disNULL , disNULL , /* 0x30 */ \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
disNULL , disNULL , disNULL , disNULL , \
|
||||
dis##VU##_UPPER_FD_00, dis##VU##_UPPER_FD_01, dis##VU##_UPPER_FD_10, dis##VU##_UPPER_FD_11, \
|
||||
}; \
|
||||
\
|
||||
\
|
||||
MakeDisF(dis##VU##MicroUF, dis##VU##MicroU[code & 0x3f] DisFInterfaceN) \
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#define _disVUOpcodes(VU) \
|
||||
\
|
||||
/*****************/ \
|
||||
/* LOWER OPCODES */ \
|
||||
/*****************/ \
|
||||
\
|
||||
MakeDisF(dis##VU##MI_DIV, dName("DIV"); dCP232f(_Fs_, _Fsf_); dCP232f(_Ft_, _Ftf_);) \
|
||||
MakeDisF(dis##VU##MI_SQRT, dName("SQRT"); dCP232f(_Ft_, _Ftf_);) \
|
||||
MakeDisF(dis##VU##MI_RSQRT, dName("RSQRT"); dCP232f(_Fs_, _Fsf_); dCP232f(_Ft_, _Ftf_);) \
|
||||
MakeDisF(dis##VU##MI_IADDI, dName("IADDI"); dCP232i(_Ft_); dCP232i(_Fs_); dImm5();) \
|
||||
MakeDisF(dis##VU##MI_IADDIU, dName("IADDIU"); dCP232i(_Ft_); dCP232i(_Fs_); dImm15();) \
|
||||
MakeDisF(dis##VU##MI_IADD, dName("IADD"); dCP232i(_Fd_); dCP232i(_Fs_); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_IAND, dName("IAND"); dCP232i(_Fd_); dCP232i(_Fs_); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_IOR, dName("IOR"); dCP232i(_Fd_); dCP232i(_Fs_); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ISUB, dName("ISUB"); dCP232i(_Fd_); dCP232i(_Fs_); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ISUBIU, dName("ISUBIU"); dCP232i(_Ft_); dCP232i(_Fs_); dImm15();) \
|
||||
MakeDisF(dis##VU##MI_MOVE, if (_Fs_ == 0 && _Ft_ == 0) { dNameU("NOP"); } else { dNameU("MOVE"); dCP2128f(_Ft_); dCP2128f(_Fs_); }) \
|
||||
MakeDisF(dis##VU##MI_MFIR, dNameU("MFIR"); dCP2128f(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_MTIR, dNameU("MTIR"); dCP232i(_Ft_); dCP232f(_Fs_, _Fsf_);) \
|
||||
MakeDisF(dis##VU##MI_MR32, dNameU("MR32"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_LQ, dNameU("LQ"); dCP2128f(_Ft_); dCP232i(_Fs_); dImm11();) \
|
||||
MakeDisF(dis##VU##MI_LQD, dNameU("LQD"); dCP2128f(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_LQI, dNameU("LQI"); dCP2128f(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_SQ, dNameU("SQ"); dCP2128f(_Fs_); dCP232i(_Ft_); dImm11(); ) \
|
||||
MakeDisF(dis##VU##MI_SQD, dNameU("SQD"); dCP2128f(_Fs_); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SQI, dNameU("SQI"); dCP2128f(_Fs_); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ILW, dNameU("ILW"); dCP232i(_Ft_); dImm11(); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ISW, dNameU("ISW"); dCP232i(_Ft_); dImm11(); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ILWR, dNameU("ILWR"); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ISWR, dNameU("ISWR"); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_LOI, dName("LOI"); ) \
|
||||
MakeDisF(dis##VU##MI_RINIT, dNameU("RINIT"); dCP232i(REG_R); dCP232f(_Fs_, _Fsf_);) \
|
||||
MakeDisF(dis##VU##MI_RGET, dNameU("RGET"); dCP232i(REG_R); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_RNEXT, dNameU("RNEXT"); dCP232i(REG_R); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_RXOR, dNameU("RXOR"); dCP232i(REG_R); dCP232f(_Fs_, _Fsf_);) \
|
||||
MakeDisF(dis##VU##MI_WAITQ, dName("WAITQ"); ) \
|
||||
MakeDisF(dis##VU##MI_FSAND, dName("FSAND"); dCP232i(_Ft_); dCP232i(REG_STATUS_FLAG); sprintf(ostr, "%s %.3x,", ostr, code&0xfff); ) \
|
||||
MakeDisF(dis##VU##MI_FSEQ, dName("FSEQ"); dCP232i(_Ft_); dCP232i(REG_STATUS_FLAG); sprintf(ostr, "%s %.3x,", ostr, code&0xfff);) \
|
||||
MakeDisF(dis##VU##MI_FSOR, dName("FSOR"); dCP232i(_Ft_); dCP232i(REG_STATUS_FLAG); sprintf(ostr, "%s %.3x,", ostr, code&0xfff);) \
|
||||
MakeDisF(dis##VU##MI_FSSET, dName("FSSET"); dCP232i(REG_STATUS_FLAG);) \
|
||||
MakeDisF(dis##VU##MI_FMAND, dName("FMAND"); dCP232i(_Ft_); dCP232i(REG_MAC_FLAG); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_FMEQ, dName("FMEQ"); dCP232i(_Ft_); dCP232i(REG_MAC_FLAG); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_FMOR, dName("FMOR"); dCP232i(_Ft_); dCP232i(REG_MAC_FLAG); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_FCAND, dName("FCAND"); dCP232i(1); sprintf(ostr, "%s %8.8x,", ostr, code&0xffffff); ) \
|
||||
MakeDisF(dis##VU##MI_FCEQ, dName("FCEQ"); dCP232i(1); dCP232i(REG_CLIP_FLAG);) \
|
||||
MakeDisF(dis##VU##MI_FCOR, dName("FCOR"); dCP232i(1); dCP232i(REG_CLIP_FLAG);) \
|
||||
MakeDisF(dis##VU##MI_FCSET, dName("FCSET"); dCP232i(REG_CLIP_FLAG); sprintf(ostr, "%s %.6x,", ostr, code&0xffffff); ) \
|
||||
MakeDisF(dis##VU##MI_FCGET, dName("FCGET"); dCP232i(_Ft_); dCP232i(REG_CLIP_FLAG);) \
|
||||
MakeDisF(dis##VU##MI_IBEQ, dName("IBEQ"); dImm11(); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_IBGEZ, dName("IBEZ"); dImm11(); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_IBGTZ, dName("IBGTZ"); dImm11(); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_IBLEZ, dName("IBLEZ"); dImm11(); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_IBLTZ, dName("IBLTZ"); dImm11(); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_IBNE, dName("IBNE"); dImm11(); dCP232i(_Ft_); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_B, dName("B"); dImm11();) \
|
||||
MakeDisF(dis##VU##MI_BAL, dName("BAL"); dImm11(); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_JR, dName("JR"); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_JALR, dName("JALR"); dCP232i(_Ft_); dCP232i(_Fs_); ) \
|
||||
MakeDisF(dis##VU##MI_MFP, dNameU("MFP"); dCP2128f(_Ft_); dCP232i(REG_P);) \
|
||||
MakeDisF(dis##VU##MI_WAITP, dName("WAITP"); ) \
|
||||
MakeDisF(dis##VU##MI_ESADD, dName("ESADD"); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ERSADD, dName("ERSADD"); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ELENG, dName("ELENG"); dCP2128f(_Fs_); ) \
|
||||
MakeDisF(dis##VU##MI_ERLENG, dName("ERLENG"); dCP2128f(_Fs_); ) \
|
||||
MakeDisF(dis##VU##MI_EATANxy, dName("EATANxy"); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_EATANxz, dName("EATANxz"); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ESUM, dName("ESUM"); dCP232i(_Fs_); ) \
|
||||
MakeDisF(dis##VU##MI_ERCPR, dName("ERCPR"); dCP232f(_Fs_, _Fsf_); ) \
|
||||
MakeDisF(dis##VU##MI_ESQRT, dName("ESQRT"); dCP232f(_Fs_, _Fsf_); ) \
|
||||
MakeDisF(dis##VU##MI_ERSQRT, dName("ERSQRT"); dCP232f(_Fs_, _Fsf_); ) \
|
||||
MakeDisF(dis##VU##MI_ESIN, dName("ESIN"); dCP232f(_Fs_, _Fsf_); ) \
|
||||
MakeDisF(dis##VU##MI_EATAN, dName("EATAN"); dCP232f(_Fs_, _Fsf_); ) \
|
||||
MakeDisF(dis##VU##MI_EEXP, dName("EEXP"); dCP232f(_Fs_, _Fsf_); ) \
|
||||
MakeDisF(dis##VU##MI_XITOP, dName("XITOP"); dCP232i(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_XGKICK, dName("XGKICK"); dCP232i(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_XTOP, dName("XTOP"); dCP232i(_Ft_);) \
|
||||
\
|
||||
\
|
||||
/*****************/ \
|
||||
/* UPPER OPCODES */ \
|
||||
/*****************/ \
|
||||
\
|
||||
MakeDisF(dis##VU##MI_ABS, dNameU("ABS"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ADD, dNameU("ADD"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDi, dNameU("ADDi"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_ADDq, dNameU("ADDq"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_ADDx, dNameU("ADDx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDy, dNameU("ADDy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDz, dNameU("ADDz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDw, dNameU("ADDw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDA, dNameU("ADDA"); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDAi, dNameU("ADDAi"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_ADDAq, dNameU("ADDAq"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_ADDAx, dNameU("ADDAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDAy, dNameU("ADDAy"); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDAz, dNameU("ADDAz"); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_ADDAw, dNameU("ADDAw"); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUB, dNameU("SUB"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBi, dNameU("SUBi"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_SUBq, dNameU("SUBq"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_SUBx, dNameU("SUBx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBy, dNameU("SUBy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBz, dNameU("SUBz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBw, dNameU("SUBw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBA, dNameU("SUBA"); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBAi, dNameU("SUBAi"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_SUBAq, dNameU("SUBAq"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_SUBAx, dNameU("SUBAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBAy, dNameU("SUBAy"); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBAz, dNameU("SUBAz"); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_SUBAw, dNameU("SUBAw"); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MUL, dNameU("MUL"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULi, dNameU("MULi"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MULq, dNameU("MULq"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_MULx, dNameU("MULx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULy, dNameU("MULy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULz, dNameU("MULz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULw, dNameU("MULw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULA, dNameU("MULA"); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULAi, dNameU("MULAi"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MULAq, dNameU("MULAq"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_MULAx, dNameU("MULAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULAy, dNameU("MULAy"); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULAz, dNameU("MULAz"); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MULAw, dNameU("MULAw"); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADD, dNameU("MADD"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDi, dNameU("MADDi"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MADDq, dNameU("MADDq"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_MADDx, dNameU("MADDx"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDy, dNameU("MADDy"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDz, dNameU("MADDz"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDw, dNameU("MADDw"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDA, dNameU("MADDA"); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDAi, dNameU("MADDAi"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MADDAq, dNameU("MADDAq"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_MADDAx, dNameU("MADDAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDAy, dNameU("MADDAy"); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDAz, dNameU("MADDAz"); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MADDAw, dNameU("MADDAw"); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUB, dNameU("MSUB"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBi, dNameU("MSUBi"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MSUBq, dNameU("MSUBq"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_MSUBx, dNameU("MSUBx"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBy, dNameU("MSUBy"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBz, dNameU("MSUBz"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBw, dNameU("MSUBw"); dCP2128f(_Fd_); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBA, dNameU("MSUBA"); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBAi, dNameU("MSUBAi"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MSUBAq, dNameU("MSUBAq"); dCP2ACCf(); dCP2128f(_Fs_); dCP232iF(REG_Q);) \
|
||||
MakeDisF(dis##VU##MI_MSUBAx, dNameU("MSUBAx"); dCP2ACCf(); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBAy, dNameU("MSUBAy"); dCP2ACCf(); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBAz, dNameU("MSUBAz"); dCP2ACCf(); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MSUBAw, dNameU("MSUBAw"); dCP2ACCf(); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MAX, dNameU("MAX"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MAXi, dNameU("MAXi"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MAXx, dNameU("MAXx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MAXy, dNameU("MAXy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MAXz, dNameU("MAXz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MAXw, dNameU("MAXw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MINI, dNameU("MINI"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MINIi, dNameU("MINIi"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232iF(REG_I);) \
|
||||
MakeDisF(dis##VU##MI_MINIx, dNameU("MINIx"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232x(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MINIy, dNameU("MINIy"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232y(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MINIz, dNameU("MINIz"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232z(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_MINIw, dNameU("MINIw"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_OPMULA, dNameU("OPMULA"); dCP2ACCf(); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_OPMSUB, dNameU("OPMSUB"); dCP2128f(_Fd_); dCP2128f(_Fs_); dCP2128f(_Ft_);) \
|
||||
MakeDisF(dis##VU##MI_NOP, dName("NOP");) \
|
||||
MakeDisF(dis##VU##MI_FTOI0, dNameU("FTOI0"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_FTOI4, dNameU("FTOI4"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_FTOI12, dNameU("FTOI12"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_FTOI15, dNameU("FTOI15"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ITOF0, dNameU("ITOF0"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ITOF4, dNameU("ITOF4"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ITOF12, dNameU("ITOF12"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_ITOF15, dNameU("ITOF15"); dCP2128f(_Ft_); dCP2128f(_Fs_);) \
|
||||
MakeDisF(dis##VU##MI_CLIP, dNameU("CLIP"); dCP2128f(_Fs_); dCP232w(_Ft_);) \
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
INCLUDES = -I@srcdir@/../
|
||||
noinst_LIBRARIES = libDebugTools.a
|
||||
|
||||
libDebugTools_a_SOURCES = \
|
||||
cpuopsDebug.c Debug.h.bak DisR3000asm.c DisVU0Micro.c DisVUops.h \
|
||||
cpuopsDebug.h DisASM.h DisR5900asm.c DisVU1Micro.c \
|
||||
Debug.h DisR3000A.c DisR5900.c DisVUmicro.h
|
File diff suppressed because it is too large
Load Diff
|
@ -1,456 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
void UpdateR5900op();
|
||||
extern void (*LT_OpcodePrintTable[64])();
|
||||
extern void (*LT_SpecialPrintTable[64])();
|
||||
extern void (*LT_REGIMMPrintTable[32])();
|
||||
extern void (*LT_MMIPrintTable[64])();
|
||||
extern void (*LT_MMI0PrintTable[32])();
|
||||
extern void (*LT_MMI1PrintTable[32])();
|
||||
extern void (*LT_MMI2PrintTable[32])();
|
||||
extern void (*LT_MMI3PrintTable[32])();
|
||||
extern void (*LT_COP0PrintTable[32])();
|
||||
extern void (*LT_COP0BC0PrintTable[32])();
|
||||
extern void (*LT_COP0C0PrintTable[64])();
|
||||
extern void (*LT_COP1PrintTable[32])();
|
||||
extern void (*LT_COP1BC1PrintTable[32])();
|
||||
extern void (*LT_COP1SPrintTable[64])();
|
||||
extern void (*LT_COP1WPrintTable[64])();
|
||||
extern void (*LT_COP2PrintTable[32])();
|
||||
extern void (*LT_COP2BC2PrintTable[32])();
|
||||
extern void (*LT_COP2SPECIAL1PrintTable[64])();
|
||||
extern void (*LT_COP2SPECIAL2PrintTable[128])();
|
||||
// **********************Standard Opcodes**************************
|
||||
int L_ADD=0;
|
||||
int L_ADDI=0;
|
||||
int L_ADDIU=0;
|
||||
int L_ADDU=0;
|
||||
int L_AND=0;
|
||||
int L_ANDI=0;
|
||||
int L_BEQ=0;
|
||||
int L_BEQL=0;
|
||||
int L_BGEZ=0;
|
||||
int L_BGEZAL=0;
|
||||
int L_BGEZALL=0;
|
||||
int L_BGEZL=0;
|
||||
int L_BGTZ=0;
|
||||
int L_BGTZL=0;
|
||||
int L_BLEZ=0;
|
||||
int L_BLEZL=0;
|
||||
int L_BLTZ=0;
|
||||
int L_BLTZAL=0;
|
||||
int L_BLTZALL=0;
|
||||
int L_BLTZL=0;
|
||||
int L_BNE=0;
|
||||
int L_BNEL=0;
|
||||
int L_BREAK=0;
|
||||
int L_CACHE=0;
|
||||
int L_DADD=0;
|
||||
int L_DADDI=0;
|
||||
int L_DADDIU=0;
|
||||
int L_DADDU=0;
|
||||
int L_DIV=0;
|
||||
int L_DIVU=0;
|
||||
int L_DSLL=0;
|
||||
int L_DSLL32=0;
|
||||
int L_DSLLV=0;
|
||||
int L_DSRA=0;
|
||||
int L_DSRA32=0;
|
||||
int L_DSRAV=0;
|
||||
int L_DSRL=0;
|
||||
int L_DSRL32=0;
|
||||
int L_DSRLV=0;
|
||||
int L_DSUB=0;
|
||||
int L_DSUBU=0;
|
||||
int L_J=0;
|
||||
int L_JAL=0;
|
||||
int L_JALR=0;
|
||||
int L_JR=0;
|
||||
int L_LB=0;
|
||||
int L_LBU=0;
|
||||
int L_LD=0;
|
||||
int L_LDL=0;
|
||||
int L_LDR=0;
|
||||
int L_LH=0;
|
||||
int L_LHU=0;
|
||||
int L_LQ=0;
|
||||
int L_LQC2=0;
|
||||
int L_LUI=0;
|
||||
int L_LW=0;
|
||||
int L_LWC1=0;
|
||||
int L_LWL=0;
|
||||
int L_LWR=0;
|
||||
int L_LWU=0;
|
||||
int L_MFHI=0;
|
||||
int L_MFLO=0;
|
||||
int L_MFSA=0;
|
||||
int L_MOVN=0;
|
||||
int L_MOVZ=0;
|
||||
int L_MTHI=0;
|
||||
int L_MTLO=0;
|
||||
int L_MTSA=0;
|
||||
int L_MTSAB=0;
|
||||
int L_MTSAH=0;
|
||||
int L_MULT=0;
|
||||
int L_MULTU=0;
|
||||
int L_NOR=0;
|
||||
int L_OR=0;
|
||||
int L_ORI=0;
|
||||
int L_PREF=0;
|
||||
int L_SB=0;
|
||||
int L_SD=0;
|
||||
int L_SDL=0;
|
||||
int L_SDR=0;
|
||||
int L_SH=0;
|
||||
int L_SLL=0;
|
||||
int L_SLLV=0;
|
||||
int L_SLT=0;
|
||||
int L_SLTI=0;
|
||||
int L_SLTIU=0;
|
||||
int L_SLTU=0;
|
||||
int L_SQ=0;
|
||||
int L_SQC2=0;
|
||||
int L_SRA=0;
|
||||
int L_SRAV=0;
|
||||
int L_SRL=0;
|
||||
int L_SRLV=0;
|
||||
int L_SUB=0;
|
||||
int L_SUBU=0;
|
||||
int L_SW=0;
|
||||
int L_SWC1=0;
|
||||
int L_SWL=0;
|
||||
int L_SWR=0;
|
||||
int L_SYNC=0;
|
||||
int L_SYSCALL=0;
|
||||
int L_TEQ=0;
|
||||
int L_TEQI=0;
|
||||
int L_TGE=0;
|
||||
int L_TGEI=0;
|
||||
int L_TGEIU=0;
|
||||
int L_TGEU=0;
|
||||
int L_TLT=0;
|
||||
int L_TLTI=0;
|
||||
int L_TLTIU=0;
|
||||
int L_TLTU=0;
|
||||
int L_TNE=0;
|
||||
int L_TNEI=0;
|
||||
int L_XOR=0;
|
||||
int L_XORI=0;
|
||||
|
||||
|
||||
|
||||
|
||||
//*****************MMI OPCODES*********************************
|
||||
int L_MADD=0;
|
||||
int L_MADDU=0;
|
||||
int L_PLZCW=0;
|
||||
int L_MADD1=0;
|
||||
int L_MADDU1=0;
|
||||
int L_MFHI1=0;
|
||||
int L_MTHI1=0;
|
||||
int L_MFLO1=0;
|
||||
int L_MTLO1=0;
|
||||
int L_MULT1=0;
|
||||
int L_MULTU1=0;
|
||||
int L_DIV1=0;
|
||||
int L_DIVU1=0;
|
||||
int L_PMFHL=0;
|
||||
int L_PMTHL=0;
|
||||
int L_PSLLH=0;
|
||||
int L_PSRLH=0;
|
||||
int L_PSRAH=0;
|
||||
int L_PSLLW=0;
|
||||
int L_PSRLW=0;
|
||||
int L_PSRAW=0;
|
||||
//*****************END OF MMI OPCODES**************************
|
||||
//*************************MMI0 OPCODES************************
|
||||
|
||||
int L_PADDW=0;
|
||||
int L_PSUBW=0;
|
||||
int L_PCGTW=0;
|
||||
int L_PMAXW=0;
|
||||
int L_PADDH=0;
|
||||
int L_PSUBH=0;
|
||||
int L_PCGTH=0;
|
||||
int L_PMAXH=0;
|
||||
int L_PADDB=0;
|
||||
int L_PSUBB=0;
|
||||
int L_PCGTB=0;
|
||||
int L_PADDSW=0;
|
||||
int L_PSUBSW=0;
|
||||
int L_PEXTLW=0;
|
||||
int L_PPACW=0;
|
||||
int L_PADDSH=0;
|
||||
int L_PSUBSH=0;
|
||||
int L_PEXTLH=0;
|
||||
int L_PPACH=0;
|
||||
int L_PADDSB=0;
|
||||
int L_PSUBSB=0;
|
||||
int L_PEXTLB=0;
|
||||
int L_PPACB=0;
|
||||
int L_PEXT5=0;
|
||||
int L_PPAC5=0;
|
||||
//***END OF MMI0 OPCODES******************************************
|
||||
//**********MMI1 OPCODES**************************************
|
||||
int L_PABSW=0;
|
||||
int L_PCEQW=0;
|
||||
int L_PMINW=0;
|
||||
int L_PADSBH=0;
|
||||
int L_PABSH=0;
|
||||
int L_PCEQH=0;
|
||||
int L_PMINH=0;
|
||||
int L_PCEQB=0;
|
||||
int L_PADDUW=0;
|
||||
int L_PSUBUW=0;
|
||||
int L_PEXTUW=0;
|
||||
int L_PADDUH=0;
|
||||
int L_PSUBUH=0;
|
||||
int L_PEXTUH=0;
|
||||
int L_PADDUB=0;
|
||||
int L_PSUBUB=0;
|
||||
int L_PEXTUB=0;
|
||||
int L_QFSRV=0;
|
||||
//********END OF MMI1 OPCODES***********************************
|
||||
//*********MMI2 OPCODES***************************************
|
||||
int L_PMADDW=0;
|
||||
int L_PSLLVW=0;
|
||||
int L_PSRLVW=0;
|
||||
int L_PMSUBW=0;
|
||||
int L_PMFHI=0;
|
||||
int L_PMFLO=0;
|
||||
int L_PINTH=0;
|
||||
int L_PMULTW=0;
|
||||
int L_PDIVW=0;
|
||||
int L_PCPYLD=0;
|
||||
int L_PMADDH=0;
|
||||
int L_PHMADH=0;
|
||||
int L_PAND=0;
|
||||
int L_PXOR=0;
|
||||
int L_PMSUBH=0;
|
||||
int L_PHMSBH=0;
|
||||
int L_PEXEH=0;
|
||||
int L_PREVH=0;
|
||||
int L_PMULTH=0;
|
||||
int L_PDIVBW=0;
|
||||
int L_PEXEW=0;
|
||||
int L_PROT3W=0;
|
||||
//*****END OF MMI2 OPCODES***********************************
|
||||
//*************************MMI3 OPCODES************************
|
||||
int L_PMADDUW=0;
|
||||
int L_PSRAVW=0;
|
||||
int L_PMTHI=0;
|
||||
int L_PMTLO=0;
|
||||
int L_PINTEH=0;
|
||||
int L_PMULTUW=0;
|
||||
int L_PDIVUW=0;
|
||||
int L_PCPYUD=0;
|
||||
int L_POR=0;
|
||||
int L_PNOR=0;
|
||||
int L_PEXCH=0;
|
||||
int L_PCPYH=0;
|
||||
int L_PEXCW=0;
|
||||
//**********************END OF MMI3 OPCODES********************
|
||||
//****************************************************************************
|
||||
//** COP0 **
|
||||
//****************************************************************************
|
||||
int L_MFC0=0;
|
||||
int L_MTC0=0;
|
||||
int L_BC0F=0;
|
||||
int L_BC0T=0;
|
||||
int L_BC0FL=0;
|
||||
int L_BC0TL=0;
|
||||
int L_TLBR=0;
|
||||
int L_TLBWI=0;
|
||||
int L_TLBWR=0;
|
||||
int L_TLBP=0;
|
||||
int L_ERET=0;
|
||||
int L_DI=0;
|
||||
int L_EI=0;
|
||||
//****************************************************************************
|
||||
//** END OF COP0 **
|
||||
//****************************************************************************
|
||||
//****************************************************************************
|
||||
//** COP1 - Floating Point Unit (FPU) **
|
||||
//****************************************************************************
|
||||
int L_MFC1=0;
|
||||
int L_CFC1=0;
|
||||
int L_MTC1=0;
|
||||
int L_CTC1=0;
|
||||
int L_BC1F=0;
|
||||
int L_BC1T=0;
|
||||
int L_BC1FL=0;
|
||||
int L_BC1TL=0;
|
||||
int L_ADD_S=0;
|
||||
int L_SUB_S=0;
|
||||
int L_MUL_S=0;
|
||||
int L_DIV_S=0;
|
||||
int L_SQRT_S=0;
|
||||
int L_ABS_S=0;
|
||||
int L_MOV_S=0;
|
||||
int L_NEG_S=0;
|
||||
int L_RSQRT_S=0;
|
||||
int L_ADDA_S=0;
|
||||
int L_SUBA_S=0;
|
||||
int L_MULA_S=0;
|
||||
int L_MADD_S=0;
|
||||
int L_MSUB_S=0;
|
||||
int L_MADDA_S=0;
|
||||
int L_MSUBA_S=0;
|
||||
int L_CVT_W=0;
|
||||
int L_MAX_S=0;
|
||||
int L_MIN_S=0;
|
||||
int L_C_F=0;
|
||||
int L_C_EQ=0;
|
||||
int L_C_LT=0;
|
||||
int L_C_LE=0;
|
||||
int L_CVT_S=0;
|
||||
//****************************************************************************
|
||||
//** END OF COP1 **
|
||||
//****************************************************************************
|
||||
//****************************************************************************
|
||||
//** COP2 - (VU0) **
|
||||
//****************************************************************************
|
||||
int L_QMFC2=0;
|
||||
int L_CFC2=0;
|
||||
int L_QMTC2=0;
|
||||
int L_CTC2=0;
|
||||
int L_BC2F=0;
|
||||
int L_BC2T=0;
|
||||
int L_BC2FL=0;
|
||||
int L_BC2TL=0;
|
||||
int L_VADDx=0;
|
||||
int L_VADDy=0;
|
||||
int L_VADDz=0;
|
||||
int L_VADDw=0;
|
||||
int L_VSUBx=0;
|
||||
int L_VSUBy=0;
|
||||
int L_VSUBz=0;
|
||||
int L_VSUBw=0;
|
||||
int L_VMADDx=0;
|
||||
int L_VMADDy=0;
|
||||
int L_VMADDz=0;
|
||||
int L_VMADDw=0;
|
||||
int L_VMSUBx=0;
|
||||
int L_VMSUBy=0;
|
||||
int L_VMSUBz=0;
|
||||
int L_VMSUBw=0;
|
||||
int L_VMAXx=0;
|
||||
int L_VMAXy=0;
|
||||
int L_VMAXz=0;
|
||||
int L_VMAXw=0;
|
||||
int L_VMINIx=0;
|
||||
int L_VMINIy=0;
|
||||
int L_VMINIz=0;
|
||||
int L_VMINIw=0;
|
||||
int L_VMULx=0;
|
||||
int L_VMULy=0;
|
||||
int L_VMULz=0;
|
||||
int L_VMULw=0;
|
||||
int L_VMULq=0;
|
||||
int L_VMAXi=0;
|
||||
int L_VMULi=0;
|
||||
int L_VMINIi=0;
|
||||
int L_VADDq=0;
|
||||
int L_VMADDq=0;
|
||||
int L_VADDi=0;
|
||||
int L_VMADDi=0;
|
||||
int L_VSUBq=0;
|
||||
int L_VMSUBq=0;
|
||||
int L_VSUBi=0;
|
||||
int L_VMSUBi=0;
|
||||
int L_VADD=0;
|
||||
int L_VMADD=0;
|
||||
int L_VMUL=0;
|
||||
int L_VMAX=0;
|
||||
int L_VSUB=0;
|
||||
int L_VMSUB=0;
|
||||
int L_VOPMSUB=0;
|
||||
int L_VMINI=0;
|
||||
int L_VIADD=0;
|
||||
int L_VISUB=0;
|
||||
int L_VIADDI=0;
|
||||
int L_VIAND=0;
|
||||
int L_VIOR=0;
|
||||
int L_VCALLMS=0;
|
||||
int L_VCALLMSR=0;
|
||||
int L_VADDAx=0;
|
||||
int L_VADDAy=0;
|
||||
int L_VADDAz=0;
|
||||
int L_VADDAw=0;
|
||||
int L_VSUBAx=0;
|
||||
int L_VSUBAy=0;
|
||||
int L_VSUBAz=0;
|
||||
int L_VSUBAw=0;
|
||||
int L_VMADDAx=0;
|
||||
int L_VMADDAy=0;
|
||||
int L_VMADDAz=0;
|
||||
int L_VMADDAw=0;
|
||||
int L_VMSUBAx=0;
|
||||
int L_VMSUBAy=0;
|
||||
int L_VMSUBAz=0;
|
||||
int L_VMSUBAw=0;
|
||||
int L_VITOF0=0;
|
||||
int L_VITOF4=0;
|
||||
int L_VITOF12=0;
|
||||
int L_VITOF15=0;
|
||||
int L_VFTOI0=0;
|
||||
int L_VFTOI4=0;
|
||||
int L_VFTOI12=0;
|
||||
int L_VFTOI15=0;
|
||||
int L_VMULAx=0;
|
||||
int L_VMULAy=0;
|
||||
int L_VMULAz=0;
|
||||
int L_VMULAw=0;
|
||||
int L_VMULAq=0;
|
||||
int L_VABS=0;
|
||||
int L_VMULAi=0;
|
||||
int L_VCLIPw=0;
|
||||
int L_VADDAq=0;
|
||||
int L_VMADDAq=0;
|
||||
int L_VADDAi=0;
|
||||
int L_VMADDAi=0;
|
||||
int L_VSUBAq=0;
|
||||
int L_VMSUBAq=0;
|
||||
int L_VSUBAi=0;
|
||||
int L_VMSUBAi=0;
|
||||
int L_VADDA=0;
|
||||
int L_VMADDA=0;
|
||||
int L_VMULA=0;
|
||||
int L_VSUBA=0;
|
||||
int L_VMSUBA=0;
|
||||
int L_VOPMULA=0;
|
||||
int L_VNOP=0;
|
||||
int L_VMOVE=0;
|
||||
int L_VMR32=0;
|
||||
int L_VLQI=0;
|
||||
int L_VSQI=0;
|
||||
int L_VLQD=0;
|
||||
int L_VSQD=0;
|
||||
int L_VDIV=0;
|
||||
int L_VSQRT=0;
|
||||
int L_VRSQRT=0;
|
||||
int L_VWAITQ=0;
|
||||
int L_VMTIR=0;
|
||||
int L_VMFIR=0;
|
||||
int L_VILWR=0;
|
||||
int L_VISWR=0;
|
||||
int L_VRNEXT=0;
|
||||
int L_VRGET=0;
|
||||
int L_VRINIT=0;
|
||||
int L_VRXOR=0;
|
|
@ -1,322 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
//============================================
|
||||
//=== Audio XA decoding
|
||||
//=== Kazzuya
|
||||
//============================================
|
||||
//=== Modified by linuzappz
|
||||
//============================================
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Decode_XA.h"
|
||||
|
||||
#ifdef __WIN32__
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
|
||||
typedef unsigned char U8;
|
||||
typedef unsigned short U16;
|
||||
typedef unsigned long U32;
|
||||
|
||||
#define NOT(_X_) (!(_X_))
|
||||
#define CLAMP(_X_,_MI_,_MA_) {if(_X_<_MI_)_X_=_MI_;if(_X_>_MA_)_X_=_MA_;}
|
||||
|
||||
//============================================
|
||||
//=== ADPCM DECODING ROUTINES
|
||||
//============================================
|
||||
|
||||
static double K0[4] = {
|
||||
0.0,
|
||||
0.9375,
|
||||
1.796875,
|
||||
1.53125
|
||||
};
|
||||
|
||||
static double K1[4] = {
|
||||
0.0,
|
||||
0.0,
|
||||
-0.8125,
|
||||
-0.859375
|
||||
};
|
||||
|
||||
#define BLKSIZ 28 /* block size (32 - 4 nibbles) */
|
||||
|
||||
//===========================================
|
||||
void ADPCM_InitDecode( ADPCM_Decode_t *decp )
|
||||
{
|
||||
decp->y0 = 0;
|
||||
decp->y1 = 0;
|
||||
}
|
||||
|
||||
//===========================================
|
||||
#define SH 4
|
||||
#define SHC 10
|
||||
|
||||
#define IK0(fid) ((int)((-K0[fid]) * (1<<SHC)))
|
||||
#define IK1(fid) ((int)((-K1[fid]) * (1<<SHC)))
|
||||
|
||||
void ADPCM_DecodeBlock16( ADPCM_Decode_t *decp, U8 filter_range, const void *vblockp, short *destp, int inc ) {
|
||||
int i;
|
||||
int range, filterid;
|
||||
long fy0, fy1;
|
||||
const U16 *blockp;
|
||||
|
||||
blockp = (const unsigned short *)vblockp;
|
||||
filterid = (filter_range >> 4) & 0x0f;
|
||||
range = (filter_range >> 0) & 0x0f;
|
||||
|
||||
fy0 = decp->y0;
|
||||
fy1 = decp->y1;
|
||||
|
||||
for (i = BLKSIZ/4; i; --i) {
|
||||
long y;
|
||||
long x0, x1, x2, x3;
|
||||
|
||||
y = *blockp++;
|
||||
x3 = (short)( y & 0xf000) >> range; x3 <<= SH;
|
||||
x2 = (short)((y << 4) & 0xf000) >> range; x2 <<= SH;
|
||||
x1 = (short)((y << 8) & 0xf000) >> range; x1 <<= SH;
|
||||
x0 = (short)((y << 12) & 0xf000) >> range; x0 <<= SH;
|
||||
|
||||
x0 -= (IK0(filterid) * fy0 + (IK1(filterid) * fy1)) >> SHC; fy1 = fy0; fy0 = x0;
|
||||
x1 -= (IK0(filterid) * fy0 + (IK1(filterid) * fy1)) >> SHC; fy1 = fy0; fy0 = x1;
|
||||
x2 -= (IK0(filterid) * fy0 + (IK1(filterid) * fy1)) >> SHC; fy1 = fy0; fy0 = x2;
|
||||
x3 -= (IK0(filterid) * fy0 + (IK1(filterid) * fy1)) >> SHC; fy1 = fy0; fy0 = x3;
|
||||
|
||||
CLAMP( x0, -32768<<SH, 32767<<SH ); *destp = x0 >> SH; destp += inc;
|
||||
CLAMP( x1, -32768<<SH, 32767<<SH ); *destp = x1 >> SH; destp += inc;
|
||||
CLAMP( x2, -32768<<SH, 32767<<SH ); *destp = x2 >> SH; destp += inc;
|
||||
CLAMP( x3, -32768<<SH, 32767<<SH ); *destp = x3 >> SH; destp += inc;
|
||||
}
|
||||
decp->y0 = fy0;
|
||||
decp->y1 = fy1;
|
||||
}
|
||||
|
||||
static int headtable[4] = {0,2,8,10};
|
||||
|
||||
//===========================================
|
||||
static void xa_decode_data( xa_decode_t *xdp, unsigned char *srcp ) {
|
||||
const U8 *sound_groupsp;
|
||||
const U8 *sound_datap, *sound_datap2;
|
||||
int i, j, k, nbits;
|
||||
U16 data[4096], *datap;
|
||||
short *destp;
|
||||
|
||||
destp = xdp->pcm;
|
||||
nbits = xdp->nbits == 4 ? 4 : 2;
|
||||
|
||||
if (xdp->stereo) { // stereo
|
||||
for (j=0; j < 18; j++) {
|
||||
sound_groupsp = srcp + j * 128; // sound groups header
|
||||
sound_datap = sound_groupsp + 16; // sound data just after the header
|
||||
|
||||
for (i=0; i < nbits; i++) {
|
||||
datap = data;
|
||||
sound_datap2 = sound_datap + i;
|
||||
if ((xdp->nbits == 8) && (xdp->freq == 37800)) { // level A
|
||||
for (k=0; k < 14; k++, sound_datap2 += 8) {
|
||||
*(datap++) = (U16)sound_datap2[0] |
|
||||
(U16)(sound_datap2[4] << 8);
|
||||
}
|
||||
} else { // level B/C
|
||||
for (k=0; k < 7; k++, sound_datap2 += 16) {
|
||||
*(datap++) = (U16)(sound_datap2[ 0] & 0x0f) |
|
||||
((U16)(sound_datap2[ 4] & 0x0f) << 4) |
|
||||
((U16)(sound_datap2[ 8] & 0x0f) << 8) |
|
||||
((U16)(sound_datap2[12] & 0x0f) << 12);
|
||||
}
|
||||
}
|
||||
ADPCM_DecodeBlock16( &xdp->left, sound_groupsp[headtable[i]+0], data,
|
||||
destp+0, 2 );
|
||||
|
||||
datap = data;
|
||||
sound_datap2 = sound_datap + i;
|
||||
if ((xdp->nbits == 8) && (xdp->freq == 37800)) { // level A
|
||||
for (k=0; k < 14; k++, sound_datap2 += 8) {
|
||||
*(datap++) = (U16)sound_datap2[0] |
|
||||
(U16)(sound_datap2[4] << 8);
|
||||
}
|
||||
} else { // level B/C
|
||||
for (k=0; k < 7; k++, sound_datap2 += 16) {
|
||||
*(datap++) = (U16)(sound_datap2[ 0] >> 4) |
|
||||
((U16)(sound_datap2[ 4] >> 4) << 4) |
|
||||
((U16)(sound_datap2[ 8] >> 4) << 8) |
|
||||
((U16)(sound_datap2[12] >> 4) << 12);
|
||||
}
|
||||
}
|
||||
ADPCM_DecodeBlock16( &xdp->right, sound_groupsp[headtable[i]+1], data,
|
||||
destp+1, 2 );
|
||||
|
||||
destp += 28*2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // mono
|
||||
for (j=0; j < 18; j++) {
|
||||
sound_groupsp = srcp + j * 128; // sound groups header
|
||||
sound_datap = sound_groupsp + 16; // sound data just after the header
|
||||
|
||||
for (i=0; i < nbits; i++) {
|
||||
datap = data;
|
||||
sound_datap2 = sound_datap + i;
|
||||
if ((xdp->nbits == 8) && (xdp->freq == 37800)) { // level A
|
||||
for (k=0; k < 14; k++, sound_datap2 += 8) {
|
||||
*(datap++) = (U16)sound_datap2[0] |
|
||||
(U16)(sound_datap2[4] << 8);
|
||||
}
|
||||
} else { // level B/C
|
||||
for (k=0; k < 7; k++, sound_datap2 += 16) {
|
||||
*(datap++) = (U16)(sound_datap2[ 0] & 0x0f) |
|
||||
((U16)(sound_datap2[ 4] & 0x0f) << 4) |
|
||||
((U16)(sound_datap2[ 8] & 0x0f) << 8) |
|
||||
((U16)(sound_datap2[12] & 0x0f) << 12);
|
||||
}
|
||||
}
|
||||
ADPCM_DecodeBlock16( &xdp->left, sound_groupsp[headtable[i]+0], data,
|
||||
destp, 1 );
|
||||
|
||||
destp += 28;
|
||||
|
||||
datap = data;
|
||||
sound_datap2 = sound_datap + i;
|
||||
if ((xdp->nbits == 8) && (xdp->freq == 37800)) { // level A
|
||||
for (k=0; k < 14; k++, sound_datap2 += 8) {
|
||||
*(datap++) = (U16)sound_datap2[0] |
|
||||
(U16)(sound_datap2[4] << 8);
|
||||
}
|
||||
} else { // level B/C
|
||||
for (k=0; k < 7; k++, sound_datap2 += 16) {
|
||||
*(datap++) = (U16)(sound_datap2[ 0] >> 4) |
|
||||
((U16)(sound_datap2[ 4] >> 4) << 4) |
|
||||
((U16)(sound_datap2[ 8] >> 4) << 8) |
|
||||
((U16)(sound_datap2[12] >> 4) << 12);
|
||||
}
|
||||
}
|
||||
ADPCM_DecodeBlock16( &xdp->left, sound_groupsp[headtable[i]+1], data,
|
||||
destp, 1 );
|
||||
|
||||
destp += 28;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================================
|
||||
//=== XA SPECIFIC ROUTINES
|
||||
//============================================
|
||||
typedef struct {
|
||||
U8 filenum;
|
||||
U8 channum;
|
||||
U8 submode;
|
||||
U8 coding;
|
||||
|
||||
U8 filenum2;
|
||||
U8 channum2;
|
||||
U8 submode2;
|
||||
U8 coding2;
|
||||
} xa_subheader_t;
|
||||
|
||||
#define SUB_SUB_EOF (1<<7) // end of file
|
||||
#define SUB_SUB_RT (1<<6) // real-time sector
|
||||
#define SUB_SUB_FORM (1<<5) // 0 form1 1 form2
|
||||
#define SUB_SUB_TRIGGER (1<<4) // used for interrupt
|
||||
#define SUB_SUB_DATA (1<<3) // contains data
|
||||
#define SUB_SUB_AUDIO (1<<2) // contains audio
|
||||
#define SUB_SUB_VIDEO (1<<1) // contains video
|
||||
#define SUB_SUB_EOR (1<<0) // end of record
|
||||
|
||||
#define AUDIO_CODING_GET_STEREO(_X_) ( (_X_) & 3)
|
||||
#define AUDIO_CODING_GET_FREQ(_X_) (((_X_) >> 2) & 3)
|
||||
#define AUDIO_CODING_GET_BPS(_X_) (((_X_) >> 4) & 3)
|
||||
#define AUDIO_CODING_GET_EMPHASIS(_X_) (((_X_) >> 6) & 1)
|
||||
|
||||
#define SUB_UNKNOWN 0
|
||||
#define SUB_VIDEO 1
|
||||
#define SUB_AUDIO 2
|
||||
|
||||
//============================================
|
||||
static int parse_xa_audio_sector( xa_decode_t *xdp,
|
||||
xa_subheader_t *subheadp,
|
||||
unsigned char *sectorp,
|
||||
int is_first_sector ) {
|
||||
if ( is_first_sector ) {
|
||||
switch ( AUDIO_CODING_GET_FREQ(subheadp->coding) ) {
|
||||
case 0: xdp->freq = 37800; break;
|
||||
case 1: xdp->freq = 18900; break;
|
||||
default: xdp->freq = 0; break;
|
||||
}
|
||||
switch ( AUDIO_CODING_GET_BPS(subheadp->coding) ) {
|
||||
case 0: xdp->nbits = 4; break;
|
||||
case 1: xdp->nbits = 8; break;
|
||||
default: xdp->nbits = 0; break;
|
||||
}
|
||||
switch ( AUDIO_CODING_GET_STEREO(subheadp->coding) ) {
|
||||
case 0: xdp->stereo = 0; break;
|
||||
case 1: xdp->stereo = 1; break;
|
||||
default: xdp->stereo = 0; break;
|
||||
}
|
||||
|
||||
if ( xdp->freq == 0 )
|
||||
return -1;
|
||||
|
||||
ADPCM_InitDecode( &xdp->left );
|
||||
ADPCM_InitDecode( &xdp->right );
|
||||
|
||||
xdp->nsamples = 18 * 28 * 8;
|
||||
if (xdp->stereo == 1) xdp->nsamples /= 2;
|
||||
}
|
||||
xa_decode_data( xdp, sectorp );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
//=== THIS IS WHAT YOU HAVE TO CALL
|
||||
//=== xdp - structure were all important data are returned
|
||||
//=== sectorp - data in input
|
||||
//=== pcmp - data in output
|
||||
//=== is_first_sector - 1 if it's the 1st sector of the stream
|
||||
//=== - 0 for any other successive sector
|
||||
//=== return -1 if error
|
||||
//================================================================
|
||||
long xa_decode_sector( xa_decode_t *xdp,
|
||||
unsigned char *sectorp, int is_first_sector ) {
|
||||
if (parse_xa_audio_sector(xdp, (xa_subheader_t *)sectorp, sectorp + sizeof(xa_subheader_t), is_first_sector))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EXAMPLE:
|
||||
"nsamples" is the number of 16 bit samples
|
||||
every sample is 2 bytes in mono and 4 bytes in stereo
|
||||
|
||||
xa_decode_t xa;
|
||||
|
||||
sectorp = read_first_sector();
|
||||
xa_decode_sector( &xa, sectorp, 1 );
|
||||
play_wave( xa.pcm, xa.freq, xa.nsamples );
|
||||
|
||||
while ( --n_sectors )
|
||||
{
|
||||
sectorp = read_next_sector();
|
||||
xa_decode_sector( &xa, sectorp, 0 );
|
||||
play_wave( xa.pcm, xa.freq, xa.nsamples );
|
||||
}
|
||||
*/
|
|
@ -1,43 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
//============================================
|
||||
//=== Audio XA decoding
|
||||
//=== Kazzuya
|
||||
//============================================
|
||||
|
||||
#ifndef DECODEXA_H
|
||||
#define DECODEXA_H
|
||||
|
||||
typedef struct {
|
||||
long y0, y1;
|
||||
} ADPCM_Decode_t;
|
||||
|
||||
typedef struct {
|
||||
int freq;
|
||||
int nbits;
|
||||
int stereo;
|
||||
int nsamples;
|
||||
ADPCM_Decode_t left, right;
|
||||
short pcm[16384];
|
||||
} xa_decode_t;
|
||||
|
||||
long xa_decode_sector( xa_decode_t *xdp,
|
||||
unsigned char *sectorp,
|
||||
int is_first_sector );
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,342 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
{\rtf1\ansi\ansicpg1253\deff0\deflang1032{\fonttbl{\f0\froman\fprq2\fcharset161{\*\fname Times New Roman;}Times New Roman Greek;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fcharset161{\*\fname Arial;}Arial Greek;}}
|
||||
{\colortbl ;\red0\green0\blue255;}
|
||||
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\b\f0\fs44 PCSX2 0.9.4 FAQ\par
|
||||
\par
|
||||
\b0\fs28 In this document we will try to answer the most common questions our end users have. This is mostly a copy/paste from the Emuforums thread created by CKemu with some updates and corrections.\par
|
||||
\b\fs44\par
|
||||
\par
|
||||
\par
|
||||
Can I 'Play' Games?\b0\par
|
||||
\fs28 \par
|
||||
If by 'playing' a game, you mean: at full speed with sound, perfect graphics, etc, then \b NO\b0 . Come back next year.\par
|
||||
\par
|
||||
Since this release (PCSX2 0.9.4) compatibility has increased greatly. Many games will now go 'in-game' or at least to some form of menu. Whilst games may get 'in-game', they will not run at 'playable' speeds, due to the complex nature of PS2 emulation, and the lack of modern hardware that is powerful enough to emulate such a console.\par
|
||||
\par
|
||||
Speed has recently increased significantly, for near 'fullspeed' games, we recommend you examine the {\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/95668-post-your-pcsx2-0-9-4-screenshots-here.html"}}{\fldrslt{\cf1\ul screenshots thread}}}\cf0\ulnone\f0\fs28 for speeds.\par
|
||||
\par
|
||||
\b\fs44 Is game 'X' Working?\b0\fs28\par
|
||||
\par
|
||||
Before posting this, check the {\field{\*\fldinst{HYPERLINK "http://www.pcsx2.net/compat.php?p=1&c=$&s1=1&s2=1&s3=1&s4=1&s5=1" }}{\fldrslt{\cf1\ul compatibility list}}}\cf0\ulnone\f0\fs28 you will be able to see how far your game goes, if you can't get it as far as we can, check your configuration against the {\field{\*\fldinst{HYPERLINK "http://www.pcsx2.net/guide.php" }}{\fldrslt{\cf1\ul Configuration Guide}}}\cf0\ulnone\f0\fs28 , if you still have no luck, you may post the question. If your game is not in the compatibility list then I\rquote m afraid you are on your own, we cannot guarantee it working either way so it is impossible to tell if we can help you at all.\par
|
||||
\par
|
||||
\b\fs44 Does PCSX2 play PlayStation 1 (PSOne / PSX / PS1) Games?\b0\fs28\par
|
||||
\par
|
||||
\b No\b0 , simple as that. PCSX2's primary goal is to emulate the PS2, which would eventually include PlayStation 1 games, however at this time the key focus is to make PlayStation 2 games 'run' with a high degree of compatibility, including support for such features as USB device support (EyeToy, Special Controllers), DEV9 (Network, HDD) etc.\par
|
||||
\par
|
||||
If you wish to play PlayStation 1 games, there are extremely compatible, fast and stable emulators already in existance, and I recommend:\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://psxemulator.gazaxian.com/" }}{\fldrslt{\cf1\ul pSX}}}\cf0\ulnone\f0\fs28 - New emulator, with a growing level of compatibility and is very simple to use.\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://epsxe.com/" }}{\fldrslt{\cf1\ul ePSXe}}}\cf0\ulnone\f0\fs28 - The famous and widely supported PS1 emulator, use this if you love features, and plugins!\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://batard.psxfanatics.com/" }}{\fldrslt{\cf1\ul PSXeven}}}\cf0\ulnone\f0\fs28 - Created by Xeven, supports the PSEmu Pro plugin system, and often has increased compatibilty over ePSXe with some specific games.\par
|
||||
\par
|
||||
\par
|
||||
\b\fs44 My game worked in 0.9.2 but not in 0.9.4 why?\b0\fs28\par
|
||||
\par
|
||||
Due to changes in the emulator some games may not work as well as they did in the previous release, as you will find with most emulation projects, you fix one game, you break another somewhere. So the best solution to this is, play your game on the version it worked best for you.\par
|
||||
\par
|
||||
\b\fs44 PCSX2 doesn't work on my Athlon XP (or other non SSE2 chips)\b0\fs28\par
|
||||
\par
|
||||
Due to the nature of the VM (pcsx2.exe), which heavily uses SSE2, this version of the emulator will \b NOT\b0 work for you, however the TLB (pcsx2t.exe) build should work for you. Note when using a \b non\b0 SSE2 cpu to run PCSX2, make sure you select the \b non\b0 SSE2 versions of the plugins.\par
|
||||
\par
|
||||
\par
|
||||
\b\fs44 ZeroGS looks REALLY ugly!! - What gives?\par
|
||||
\b0\fs28 \par
|
||||
\par
|
||||
ZeroGS renders to native PS2 resolution, that\rquote s it's default render target, when you set the window size to say 1024x768, ZeroGS still renders to native PS2 resolution, but stretches that resolution to fit the window size. What you are used to is setting your window size to x*y and the target resolution also changes accordingly.\par
|
||||
\par
|
||||
The so called 'AA' ZeroGS uses, isn't actually anti aliasing, it simply ups the render target size, so you end up with a higher resolution image, thus increasing it's quality (albeit blocky).\par
|
||||
\par
|
||||
So you're thinking, well what gives? To be honest, you do, the forum user, so many people whine about speed (oh no my aging rig..or general abuse thrown at the mods / developers), it was decided that in order to maintain speed, the render target and window resolution would remain unlinked, despite the obvious fuglyness of it.\par
|
||||
\par
|
||||
\b\fs44 Where is the BIOS?\par
|
||||
\b0\fs28 \par
|
||||
It is Illegal to ask for a BIOS, as the BIOS is copyright of SONY. If you wish to use a REAL BIOS with PCSX2, you can dump it from your own PS2 (there are guides {\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/83608-rfs-guide-dumping-your-ps2-bios-over-lan.html" }}{\fldrslt{\cf1\ul here}}}\cf0\ulnone\f0\fs28 and {\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/84994-guide-dump-bios-through-usb.html" }}{\fldrslt{\cf1\ul here}}}\cf0\ulnone\f0\fs28 . Or find it by yourself.\par
|
||||
\par
|
||||
\b\fs44 No SCPH10,000 Support?!\par
|
||||
\b0\fs28 \par
|
||||
The SCPH10,000 BIOS doesn't have all the libraries many games need to load, thus for better results, use a more modern BIOS version.\par
|
||||
\par
|
||||
\b\fs44 Do I need ROM1, ROM2, EROM?\par
|
||||
\b0\fs28 \par
|
||||
If the console is warning you about not having these files, do not panic, all you need is the main ROM0 (the 4,096kb main BIOS file). You can dump the ROM1, ROM2, EROM from your own PS2 console, again guides and tools are on the internet, use {\field{\*\fldinst{HYPERLINK "http://www.google.com" }}{\fldrslt{\cf1\ul Google}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
\b\fs44 Is PCSX2 finally using the new .p2b BIOS format?\par
|
||||
\par
|
||||
\b0\fs28 Unfortunately, florin the team member responsible for this feature got held back and it did not make it in the release. Nevertheless, you can extract the contents of your .p2b BIOS file using 7zip, so you are still able to use your own complete BIOS files\par
|
||||
\par
|
||||
\par
|
||||
\b\fs44 Where can I get games?\b0\fs28\par
|
||||
\par
|
||||
From your local computer game shop, where else?\par
|
||||
\par
|
||||
This forum does not support warez or piracy, helping someone get links to such files, asking for such files, or linking to illegal material will be warned then banned if the violation is repeated. There are \b MANY\b0 great games out there, and you owe it to the talented creators to buy their games, and many you can get very cheaply, in platinum editions or second hand.\par
|
||||
\par
|
||||
\b\fs44 Can I be a betatester?\b0\fs28\par
|
||||
\par
|
||||
Ask this and the answer will always be \b NO\b0 . Keep asking it and you'll find yourself with a big fat ban.\par
|
||||
\par
|
||||
\b\fs44 What are the system requirements?\b0\fs28\par
|
||||
\par
|
||||
We recommend the following:\par
|
||||
\par
|
||||
\b Minimal Specs:\par
|
||||
\b0 AMD XP/64 or Intel Pentium 4 (VM Built will not work with [B]non[/B] SSE2 CPU's)\par
|
||||
512MB of RAM\par
|
||||
Pixel Shader 1.4 supporting card (GSdx Graphics Plugin Only)\par
|
||||
\par
|
||||
\b Recommended Specs:\b0 (For reasonable performance in many games, but not all)\par
|
||||
AMD64 X2 or Intel Conroe E6600+ (Multi Threading is supported in PCSX2)\par
|
||||
512-1024MB of RAM (more RAM allows for VM mode to be stable)\par
|
||||
Pixel Shader 2.0 supporting card (recommended GeForce 6600-8800 or equivalent ATi card)\par
|
||||
\par
|
||||
\b Possible Ideal Specs:\b0\par
|
||||
64bit OS such as Vista or winXP64, to allow for future support of 64bit recompilers.\par
|
||||
Future AMD or Intel Quad Core maybe needed, but currently the support of 4 threads is not handled by PCSX2, and the effect of threading out EE / VU is not yet known.\par
|
||||
We don't forsee you requiring a GPU more powerful than the current generation of cards, up to and including the nVidia GeForce 8800.\par
|
||||
\par
|
||||
A more in-depth guide to system specifications can be found {\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/84457-will-emulator-run-fast-my-computer.html" }}{\fldrslt{\cf1\ul here}}}\cf0\ulnone\f0\fs28 .\par
|
||||
\par
|
||||
\b\fs44 How do I compile the SVN source?\par
|
||||
\b0\fs28 \par
|
||||
We do not support SVN builds on this forum. Only official builds are permitted to be discussed. This is mainly to stop confusion, people 'handing out' betas, n00b questions when dealing with errors, as it's hard to keep track of multiple 0.x.x versions.\par
|
||||
\par
|
||||
Besides, if you need to ask that question, then trust me, you don't want to be bothered. It's very very hard.\par
|
||||
\par
|
||||
\b\fs44 What is going on with PCSX2?\par
|
||||
\b0\fs28\par
|
||||
\i Why aren't we getting lots of info, or is PCSX2 dead?\i0\par
|
||||
\pard\fi-360\li720\tx720\lang2057\f1\'b7\tab\lang1032\f0 When something 'special' happens, one of the beta-testers will post shots and information.\par
|
||||
\pard\lang2057\f1\'b7\tab\lang1032\f0 When something super-dupa mega super hyper turbo mega mega happens, shots will be posted like \i super mega\i0 lightning fast on the main {\field{\*\fldinst{HYPERLINK "http://www.pcsx2.net/"}}{\fldrslt{\cf1\ul news page}}}\cf0\ulnone\f0\fs28 .\par
|
||||
\lang2057\f1\'b7\tab\lang1032\f0 If no shots are being posted, assume that the progress is slow but steady, and whilst stuff is happening, it doesn't result in anything that you'd be able to see (eg techy nerd stuff).\par
|
||||
\lang2057\f1\'b7\tab\lang1032\f0 If nothing is being posted whatsoever, assume that \b A:\b0 The developers have lives (yeah I didn't believe that either), \b B:\b0 The developers are taking a rest.\par
|
||||
\lang2057\f1\'b7\tab\lang1032\f0 What if \b SHOCK HORROR\b0 no news has been posted for ages???!!!!!! Assume any of the above or most of the team was killed.\par
|
||||
\lang2057\f1\'b7\tab\lang1032\f0 What if I have programming knowledge, and could understand the technical changes being made? Well then go browse to the SVN, and aquire the \b changelog.txt\b0 .\par
|
||||
\par
|
||||
\b\fs44 When will the next version be released?\par
|
||||
\b0\fs28 \par
|
||||
The authors are writing this in there spare time. If they knew, they would inform you, normally a release is made when significant progress and a big difference in 'output' is shown, eg, when you the end user will be able to see more stuff running.\par
|
||||
\par
|
||||
\b\fs44 Why bother making releases when it is not finished?\b0\fs28\par
|
||||
\par
|
||||
In a nutshell, it keeps the "Gimme the next release \b NOW!\b0 " crowd from getting too annoying. More importantly it alls folks to see how things are progressing first hand.\par
|
||||
\par
|
||||
\b\fs44 How do I make a patch?\par
|
||||
\b0\fs28 \par
|
||||
Making a patch will \b not\b0 make a game 'playable' but may allow you further into it. Patches can be used to skip videos that don't play, or other simple bugs, they will not make '3D' perfect or make sound super duppa!\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://www.pcsx2.net/nachbrenner/" }}{\fldrslt{\cf1\ul Nachbrenner's Site for making Patches}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://www.ngemu.com/forums/showthread.php?t=62837" }}{\fldrslt{\cf1\ul Simple Guide for Video Skip Patches}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
\b\fs44 My Sprites have black borders!\b0\fs28\par
|
||||
\par
|
||||
This happens when you have \b Linear Texture Filtering\b0 (LTF) turned on in GSdx, to solve this, turn off LTF. This is most often the cause of black squares or borders around sprites in 2D and 2.5D fighting games.\par
|
||||
\par
|
||||
\b\fs44 Every Game I run crashes the emulator instantly!\par
|
||||
\b0\fs28 \par
|
||||
This is often caused by people having the \b NLOOP0\b0 hack enabled in the GS plugin (ZeroGS KOSMOS / GSdx), and using the Run>Execute menu. By using Run>Execute the emulator first boots the BIOS, which will crash when you have NLOOP0 enabled. Simply use File>RunCD menu to avoid crashes, and this is the recommended option for anygame.\par
|
||||
\par
|
||||
If you wish to run the BIOS, simply \b DISABLE\b0 NLOOP0 in your GS plugin first!\par
|
||||
\par
|
||||
\b\fs44 Useful Links\par
|
||||
\b0\fs28 \par
|
||||
BIOS Guides:\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://www.ngemu.com/forums/showthread.php?t=65015" }}{\fldrslt{\cf1\ul CKemu's guide to using the PS2 BIOS}}}\cf0\ulnone\f0\fs28 \par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/84994-guide-dump-bios-through-usb.html" }}{\fldrslt{\cf1\ul RealOne's Guide to USB BIOS Dumping}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/83608-rfs-guide-dumping-your-ps2-bios-over-lan.html" }}{\fldrslt{\cf1\ul Reichfuher's guide to dumping your Playstation 2 BIOS}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
Error/Problem Guides:\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/67512-common-problems-solutions-guide.html" \\\\l "post912874" }}{\fldrslt{\cf1\ul Refraction's guide to common problems and errors.}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/84457-will-emulator-run-fast-my-computer.html" }}{\fldrslt{\cf1\ul Will the emulator run fast on my computer?}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/70174-why-pcsx2-slow.html" }}{\fldrslt{\cf1\ul Why is PCSX2 Slow?}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
Memory Card Guides:\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://www.ngemu.com/forums/showthread.php?t=64482" }}{\fldrslt{\cf1\ul Convert GameFAQ saves to PCSX2 memorycard}}}\cf0\ulnone\f0\fs28 {\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/69844-load-us-ntsc-final-fantasy-x-gamesaves-any-ffx-version.html" }}{\fldrslt{\cf1\ul Load US memcard saves on any region version of FFX and FFX-2}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
Plugins/Patch Guides:\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://www.ngemu.com/forums/showthread.php?t=62837" }}{\fldrslt{\cf1\ul Guide to making patches for PCSX2}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/1065199-post74.html" }}{\fldrslt{\cf1\ul TwinPad Keyboard Plugin Latest Version}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/ps2-plugin-questions-troubleshooting/87274-lilypad-new-pad-plugin-lame-name.html" }}{\fldrslt{\cf1\ul Lilypad plugin}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/ps2-plugin-questions-troubleshooting/94273-megapad-plugin.html" }}{\fldrslt{\cf1\ul MegaPad plugin}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
Reviews:\par
|
||||
\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/76251-pcsx2-review-cpu-power-does-matter.html" }}{\fldrslt{\cf1\ul PCSX2 Review Part 1: CPU Power Matters}}}\cf0\ulnone\f0\fs28\par
|
||||
{\field{\*\fldinst{HYPERLINK "http://forums.ngemu.com/pcsx2-official-forum/80417-pcsx2-review-part2-gpu-power-also-matter.html" }}{\fldrslt{\cf1\ul PCSX2 Review Part 2: GPU Power Also Matters}}}\cf0\ulnone\f0\fs28\par
|
||||
\par
|
||||
\par
|
||||
\f2\fs20\par
|
||||
}
|
||||
|