Emuforums.com

Go Back   Emuforums.com > PSX Emulation > PCSX Discussion
About Us Register FAQ Members List Calendar Mark Forums Read

Login to remove all ads!
Reply
 
LinkBack Thread Tools Display Modes
Old October 16th, 2003   #1 (permalink)
Emu author
 
Join Date: Oct 2003
Posts: 67
PCSX Development

As I am sure you all know, Linuzappz posted about a month ago to PCSX.net that he's given up on maintaining the project in favour of being able to work on PCSX2. I contacted him via IRC and he approved of letting me work on the project.

Apparently he has also added two other programmers, yokota and imrtechnology, to the sourceforge.net account, but I haven't been able to get in contact with them yet.

I have recently uploaded the PCSX 1.6 development tarball into an arch archive (http://www.flame.org/~jivera/projects.html) and made the appropriate bug fixes for MinGW to compile. I have a few ideas I would like to get integrated into the code, but just noticed today that this bulletin board is still active and though I would first ask if anyone else has made efforts to reformalize the development process so our work doesn't need to be redundant.

Thank you,
-jivera
jivera is offline   Reply With Quote
Old October 17th, 2003   #2 (permalink)
Emu author
 
zenogais's Avatar
 
Join Date: Aug 2003
Location: Victorville(Near Los Angeles or LA for those who are on the DL)
Posts: 839
Re: PCSX Development

I've actually been looking over the source code, and if you wouldn't mind I would like to recommend a few improvements that you might make to PCSX. There are a few more optimizations that can be done to the recompiler to increase its speed even more, here's a list of possible ideas:
  • Caching of pre-compiled x86 code so that when loops are being processed the code doesn't have to be repeatedly regenerated.
  • You could also consider using circular buffers for loop-processing so that when a jump instruction is executed to previous code that has already been recompiled it will be immediately available in this recompiled form, this may take some r3000a binary analysis though.
  • Just a note, keeping track of these would require a 2D array that is written/read from based on the memory location of the translated instruction. This way you can check to see if you have already compiled the code at that location thus avoiding recompiling it again if it is not necessary.

These are just some thoughts from looking through the source code. Best of luck to you, and hope you make PCSX better than it already is.

-zenogais
__________________
-----------------
Emu Tinkerer and C++ Programmer
zenogais is offline   Reply With Quote
Old October 17th, 2003   #3 (permalink)
A BIG BAD BATARD™
 
Xeven's Avatar
 
Join Date: Sep 2001
Posts: 5,517
Re: PCSX Development

Quote:
instruction is executed to previous code that has already been recompiled it will be immediately available in this recompiled form
that's one of the major precepts of binary translation or "recompilation" in the first place. Otherwise, you'd have to translate each "block" everytime it is accessed, which will make your "recompiler" much slower than the interpreter. So in short, it's already there.
__________________
Xeven is offline   Reply With Quote
Old October 17th, 2003   #4 (permalink)
Emu author
 
zenogais's Avatar
 
Join Date: Aug 2003
Location: Victorville(Near Los Angeles or LA for those who are on the DL)
Posts: 839
Re: PCSX Development

Quote:
Originally Posted by Xeven
that's one of the major precepts of binary translation or "recompilation" in the first place. Otherwise, you'd have to translate each "block" everytime it is accessed, which will make your "recompiler" much slower than the interpreter. So in short, it's already there.
Sorry, Thanks Xeven. I'm still a "newbie" for the most part to dynarec, thanks for the info.
__________________
-----------------
Emu Tinkerer and C++ Programmer
zenogais is offline   Reply With Quote
Old October 17th, 2003   #5 (permalink)
I Need a Weapon
 
FLaRe85's Avatar
 
Join Date: Oct 2001
Location: Omaha, NE
Posts: 4,300
Re: PCSX Development

I have a fairly simple suggestion. It'd be great to finally have some sort of command-line support in PCSX.
__________________
.: Flaretech.Net :: Flaretech.Biz Web Hosting :: H3 Stats :: My Blog :.



.: Macbook Pro 17" :: 2.33 GHz Intel Core 2 Duo :: 2 GB 667 MHz DDR2 :: ATI Radeon X1600 :.
.: AMD Athlon X2 4400+ @ 2.42 GHz :: OCZ 2 GB Platinum DDR400 :: eVGA NVIDIA GeForce 7800 GT :.
.: Home Server :: 2.41 GHz AMD Opteron 180 :: 4 GB DDR400 :: Windows Server 2008 Standard RC0 :.
FLaRe85 is offline   Reply With Quote
Old October 17th, 2003   #6 (permalink)
Emu author
 
Join Date: Oct 2003
Posts: 67
Re: PCSX Development

ShADoWFLaRe85: I have a fairly simple suggestion. It'd be great to finally have some sort of command-line support in PCSX.

Can you be a little more specific with regard to what command-line options you would like to see? I believe I saw commented out code that would deal with command line stuff, but I haven't touched it yet.

Most of the features I'm interested in adding include better debugging (memory viewer, instruction stepper, breakpoints, etc.), but I'll try to add any requested features that are within my coding abilities.

zenogais, I took a look at your NeoPSX website and under progress research is listed as 100% -- what research have you done? I have found a document named "Everything You Have Always Wanted to Know about the Playstation But Were Afraid to Ask" and it does a good job at explaining the PSX, but leaves a lot out.

Possibly our projects can benefit from some cross pollination of code (for example, I can see if there are any PCSX-specific dependencies in the XA and mdec decoding routines that can be eliminated so they colud be used as library routines).

-jivera
jivera is offline   Reply With Quote
Old October 17th, 2003   #7 (permalink)
I Need a Weapon
 
FLaRe85's Avatar
 
Join Date: Oct 2001
Location: Omaha, NE
Posts: 4,300
Re: PCSX Development

Quote:
Originally Posted by jivera
Can you be a little more specific with regard to what command-line options you would like to see? I believe I saw commented out code that would deal with command line stuff, but I haven't touched it yet.
Sure. I think it'd be beneficial, especially for frontends, if you could perform basic launching options from the command-line that would otherwise only be accessible from the file menu. For example, 'pcsx.exe -loadbin c:\path\to\iso.bin' would auto-start an iso and 'pcsx.exe -runcd' would immediately launch the game in the CD-ROM drive at the time. I'm actually borrowing the syntax of those commands from ePSXe and PSXeven, respectively, but I'm sure you get the idea.
__________________
.: Flaretech.Net :: Flaretech.Biz Web Hosting :: H3 Stats :: My Blog :.



.: Macbook Pro 17" :: 2.33 GHz Intel Core 2 Duo :: 2 GB 667 MHz DDR2 :: ATI Radeon X1600 :.
.: AMD Athlon X2 4400+ @ 2.42 GHz :: OCZ 2 GB Platinum DDR400 :: eVGA NVIDIA GeForce 7800 GT :.
.: Home Server :: 2.41 GHz AMD Opteron 180 :: 4 GB DDR400 :: Windows Server 2008 Standard RC0 :.
FLaRe85 is offline   Reply With Quote
Old October 17th, 2003   #8 (permalink)
Emu author
 
Join Date: Oct 2003
Posts: 67
Re: PCSX Development

ShADoWFLaRe85: Sure. I think it'd be beneficial, especially for frontends, if you could perform basic launching options from the command-line that would otherwise only be accessible from the file menu. For example, 'pcsx.exe -loadbin c:\path\to\iso.bin' would auto-start an iso and 'pcsx.exe -runcd' would immediately launch the game in the CD-ROM drive at the time. I'm actually borrowing the syntax of those commands from ePSXe and PSXeven, respectively, but I'm sure you get the idea.

Okay, those sound like fair requests. Right now I'm trying to find a way to profile the dynamic recompiler, but it so far seems I can only do that for the interpreter -- I probably need to figure out what special code gcc inserts when given the -pg flag so I can do the same inside the dynarec code.

I had to reinstall Windows a few weeks ago and lost all the plugins I had for PCSX. I downloaded some zip file with dozens of different plugins, but now cannot seem to find it (and not having a working joypad plugin kinda makes things difficult). If anyone knows where I can find that plugin collection again, I would appreciate it.

-jivera
jivera is offline   Reply With Quote
Old October 17th, 2003   #9 (permalink)
I Need a Weapon
 
FLaRe85's Avatar
 
Join Date: Oct 2001
Location: Omaha, NE
Posts: 4,300
Re: PCSX Development

Quote:
Originally Posted by jivera
ShADoWFLaRe85: Sure. I think it'd be beneficial, especially for frontends, if you could perform basic launching options from the command-line that would otherwise only be accessible from the file menu. For example, 'pcsx.exe -loadbin c:\path\to\iso.bin' would auto-start an iso and 'pcsx.exe -runcd' would immediately launch the game in the CD-ROM drive at the time. I'm actually borrowing the syntax of those commands from ePSXe and PSXeven, respectively, but I'm sure you get the idea.

Okay, those sound like fair requests. Right now I'm trying to find a way to profile the dynamic recompiler, but it so far seems I can only do that for the interpreter -- I probably need to figure out what special code gcc inserts when given the -pg flag so I can do the same inside the dynarec code.

I had to reinstall Windows a few weeks ago and lost all the plugins I had for PCSX. I downloaded some zip file with dozens of different plugins, but now cannot seem to find it (and not having a working joypad plugin kinda makes things difficult). If anyone knows where I can find that plugin collection again, I would appreciate it.

-jivera
Great
You could download Aldo's plugin pack at http://aldostools.mysite4now.com/psemu/plugins.zip
__________________
.: Flaretech.Net :: Flaretech.Biz Web Hosting :: H3 Stats :: My Blog :.



.: Macbook Pro 17" :: 2.33 GHz Intel Core 2 Duo :: 2 GB 667 MHz DDR2 :: ATI Radeon X1600 :.
.: AMD Athlon X2 4400+ @ 2.42 GHz :: OCZ 2 GB Platinum DDR400 :: eVGA NVIDIA GeForce 7800 GT :.
.: Home Server :: 2.41 GHz AMD Opteron 180 :: 4 GB DDR400 :: Windows Server 2008 Standard RC0 :.
FLaRe85 is offline   Reply With Quote
Old October 17th, 2003   #10 (permalink)
Emu author
 
Join Date: Oct 2003
Posts: 67
Re: PCSX Development

Okay, I just wrote some (very fragile) proof of concept code and implemented the -runcd command line argument, so it shouldn't be difficult to write the rest of the code. Windows and Linux (or ANSI C rather) use different idioms for passing command line arguments (Windows has a single string, while Linux/ANSI C breaks the string at space boundaries).

When I get out of class and back to my appartment I will try to finish this code and possibly upload a build so people can test it out.

-jivera
jivera is offline   Reply With Quote
Old October 17th, 2003   #11 (permalink)
PCSX2ベータテスター
 
Seta-San's Avatar
 
Join Date: Dec 2001
Location: Nebraska
Posts: 1,390
Re: PCSX Development

damned be the evil command line shadowflare. even bill can see it's dead.
__________________
Seta-San is offline   Reply With Quote
Old October 17th, 2003   #12 (permalink)
Banned
 
Andrew Hruska's Avatar
 
Join Date: Mar 2003
Location: somewhere
Posts: 1,121
Re: PCSX Development

Quote:
Originally Posted by Seta-San
damned be the evil command line shadowflare. even bill can see it's dead.
Oh, so you hate the CLI? DIE, DIE! Rot! hehe.
Andrew Hruska is offline   Reply With Quote
Old October 17th, 2003   #13 (permalink)
I Need a Weapon
 
FLaRe85's Avatar
 
Join Date: Oct 2001
Location: Omaha, NE
Posts: 4,300
Re: PCSX Development

Quote:
Originally Posted by Seta-San
damned be the evil command line shadowflare. even bill can see it's dead.
You try writing a useful frontend-like application without a command line.

They're more helpful than they seem.
__________________
.: Flaretech.Net :: Flaretech.Biz Web Hosting :: H3 Stats :: My Blog :.



.: Macbook Pro 17" :: 2.33 GHz Intel Core 2 Duo :: 2 GB 667 MHz DDR2 :: ATI Radeon X1600 :.
.: AMD Athlon X2 4400+ @ 2.42 GHz :: OCZ 2 GB Platinum DDR400 :: eVGA NVIDIA GeForce 7800 GT :.
.: Home Server :: 2.41 GHz AMD Opteron 180 :: 4 GB DDR400 :: Windows Server 2008 Standard RC0 :.
FLaRe85 is offline   Reply With Quote
Old October 18th, 2003   #14 (permalink)
Emu author
 
zenogais's Avatar
 
Join Date: Aug 2003
Location: Victorville(Near Los Angeles or LA for those who are on the DL)
Posts: 839
Re: PCSX Development

Quote:
Originally Posted by jivera
ShADoWFLaRe85: [b]
zenogais, I took a look at your NeoPSX website and under progress research is listed as 100% -- what research have you done? I have found a document named "Everything You Have Always Wanted to Know about the Playstation But Were Afraid to Ask" and it does a good job at explaining the PSX, but leaves a lot out.

Possibly our projects can benefit from some cross pollination of code (for example, I can see if there are any PCSX-specific dependencies in the XA and mdec decoding routines that can be eliminated so they colud be used as library routines).

-jivera
I'd be glad to help out PCSX. I wouldn't say I'm exactly the best person to talk to, but I'll answer what I can. As for the research, most of my research has been through reading PSX Hardware docs, looking through some source code, looking at some PSX binaries, and thats about it. Here's a few docs, besides the one you listed, I read just to help me out with programming an emulator as well as Playstation specific stuff:

1964 Recompiling Engine Doc

Aemulor Recompiler Docs

Padua Playstation Resource

PSX Hardware Docs

R3000A Hardware Docs

Also right now for NeoPSX I'm working on the dynarec, I have about half the PSX instructions coded, and I'm also working on doing optimizations with this code such as some of the ones I mentioned earlier. Hope this helps, just email me if you have any more questions/comments.

Sincerely,
zenogais
__________________
-----------------
Emu Tinkerer and C++ Programmer

Last edited by zenogais; October 18th, 2003 at 00:42.
zenogais is offline   Reply With Quote
Old October 18th, 2003   #15 (permalink)
King of Pain
 
M.I.K.e7's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 482
Re: PCSX Development

Quote:
Originally Posted by zenogais
There are a few more optimizations that can be done to the recompiler to increase its speed even more
I have to admit that it's been a while since I took the last look at the PCSX source, but most current dynarecs have a lot of design flaws, most often direct translation (ie. translated code is gernerated directly after the instruction has been decoded) and especially on x86 the lack of actual register allocation, no matter if static or dynamic.

Quote:
Originally Posted by zenogais
Caching of pre-compiled x86 code so that when loops are being processed the code doesn't have to be repeatedly regenerated.
As Xeven already said, it is the basic idea to put generated code in the translation cache, otherwise the dynarec would be slower than an interpreter.
The introduction to Embra shows quite well how it works:
http://www-flash.stanford.edu/Embra/bin.trans.html
But in the example at the top you can also see bad register allocation...

My wish list mainly consists of PowerMac compatibility, and I'd be even willing to do the PowerPC dynarec...
Unfortunately I know more about the processor in my new PowerMac than the API of MacOS X...
__________________
The crownless again shall be King
M.I.K.e7 is offline   Reply With Quote
Old October 18th, 2003   #16 (permalink)
King of Pain
 
M.I.K.e7's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 482
Re: PCSX Development

Quote:
Originally Posted by zenogais
As for the research, most of my research has been through reading PSX Hardware docs, looking through some source code, looking at some PSX binaries, and thats about it. Here's a few docs, besides the one you listed, I read just to help me out with programming an emulator as well as Playstation specific stuff:
1964 Recompiling Engine Doc
1964 probably isn't the most ideal example either, but I guess that might be just due to the fact that emulating a 64-bit CPU on x86 one runs out of registers pretty fast...

Here are some other interesting documents:
The DR Emulator
Just a short article about the 68K dynarec that was included in MacOS when the switched to the PowerPC. It's written by Eric Traut, who is probably the only dynarec celebrity, since he also was responsible for the dynarecs in Virtual Gamestation and Virtual PC.

Shade
This documentation describes a fast SPARC simulator and a lot of ideas are interesting for dynarecs as well.

Quote:
Originally Posted by zenogais
Now I know from where you got the circular buffer idea that you mentioned earlier :-)
There also have been two university projects dealing with ARM emulation via dynarec:
ARMphetamine and Tarmac.
Especially the report on the latter project is highly recommended.

I once wrote a thread hear about dynamic recompilation, but it was a mostly a combination of well-known facts with a little bit of my own ideas thrown in. If you want to take a look anyway:
Dynamic Recompilation - An Introduction

Quote:
Originally Posted by zenogais
You shouldn't forget the PSX documentation by Joshua Walker!

Quote:
Originally Posted by zenogais
Also right now for NeoPSX I'm working on the dynarec, I have about half the PSX instructions coded, and I'm also working on doing optimizations with this code such as some of the ones I mentioned earlier.
I tried the link in your profile but it doesn't seem to work...

Unfortunately Dynarec.com is no more since Neil Bradley shut off the server, otherwise I could have provided much more information.
But the dynarec mailing list migrated to Yahoo, if you are interested in more discussion about dynamic recompilation:
Dynarec Group

I guess that's enough for now...
__________________
The crownless again shall be King
M.I.K.e7 is offline   Reply With Quote
Old October 18th, 2003   #17 (permalink)
Emu author
 
Join Date: Oct 2003
Posts: 67
Re: PCSX Development

M.I.K.e7: You shouldn't forget the PSX documentation by Joshua Walker!

That would be the "Everything You Ever Wanted to Know About The Playstation but were Afraid to Ask" paper that I referenced.

-jivera
jivera is offline   Reply With Quote
Old October 18th, 2003   #18 (permalink)
Emu author
 
zenogais's Avatar
 
Join Date: Aug 2003
Location: Victorville(Near Los Angeles or LA for those who are on the DL)
Posts: 839
Re: PCSX Development

Thanks M.I.K.e7 for the awesome docs. Gotta read up
__________________
-----------------
Emu Tinkerer and C++ Programmer
zenogais is offline   Reply With Quote
Old October 18th, 2003   #19 (permalink)
King of Pain
 
M.I.K.e7's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 482
Re: PCSX Development

Quote:
Originally Posted by jivera
M.I.K.e7: You shouldn't forget the PSX documentation by Joshua Walker!
That would be the "Everything You Ever Wanted to Know About The Playstation but were Afraid to Ask" paper that I referenced.
Yes, it is the same indeed. Sorry, I must have overlooked that you already mentioned it.
__________________
The crownless again shall be King
M.I.K.e7 is offline   Reply With Quote
Old October 19th, 2003   #20 (permalink)
Emu author
 
Join Date: Oct 2003
Posts: 67
Re: PCSX Development