Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
questions about PCSX2
This probably should have been in the developer forum but I couldn't create a new thread in that forum for some reason :\
Anyways, Im a newbie programmer but I had couple questions about PCSX2. The first question is how does the coding for EE/VU emulation work in general? Does Sony provide the authors with a list of instructions that they have to emulate for each of the units? How do they figure out what the instructions are that they have to emulate for the PS2?
From what I've read in the blogs about dynamic recompilation, PCSX2 translates a block of PS2 instructions into x86 instructions. Im guessing PCSX2 uses C++, so how do you get C++ to generate code during run-time and run it? I don't get how you can create code to run dynamically and then run it.
Thanks a lot if you guys answer it =) I'd really like to get more experience programming and it'd be really awesome if I could contribute to PCSX!

Sponsored links

You have 2 questions here essentially, first one being how do we know what to emulate, secondly how do the recompilers work.

In answer to the first question, we have scrambled together documents from other peoples findings and through findings of our own on what the instructions are and what they do, there is a lot of information out there which is pretty accurate, so we have a pretty general idea of the instructions the system uses, plus some explination on how each of the units work. From this we can develop a codebase, test it, find out what we are doing wrong from what games are trying to do.

In answer to the second question, the initial pass of any recompiler isnt greatly dissimilar from an interpreter, however, instead of processing the data, we tell it what to do with the data in assembly, which is a code that x86 machines can understand.

for example the PS2 wants to do DADD rd rs rt (add rs to rt and save it in rd)
we would do

move rs to rd
add rt to rd

(in asm of course)

This is then stored in a memory "block" which can be called again and again if the game tries to reuse this data. Setting up this instruction is probably the longest and slowest part of this process, which is still quicker than an interpreter, but can then be processed very quickly afterwards (only needing 2 instructions rather than the 5 or so to set it up). Have a read on our blogs on what dynamic recompilers do and how they process the data to give a wider account on what happens Smile
[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
yea those were exactly what I was looking for. Super clear explanation Biggrin thanks!
my question is for developers pcsx2.
Pcsx2 supports ssse3, sse4, why you do not implemented support for AMD instructions like sse4.a or older sse3?
Pcsx2 with sse2 work great but, maybe work better with sse4.a on AMD platforms?
(sorry for my bad english)
Phenom X4 9650
2GB DD2 800MHz DC
Galaxy GeForce 9600GSO

Because the AMD instruction sets are not useful for the code PCSX2 needs to run.
[Image: newsig.jpg]
(02-08-2011, 08:49 PM)Bositman Wrote: Because the AMD instruction sets are not useful for the code PCSX2 needs to run.
i understand .. thank you for repply..

Phenom X4 9650
2GB DD2 800MHz DC
Galaxy GeForce 9600GSO

Intel also has SSE3, it's just the instruction set that has nothing useful, not only AMD Tongue2

If it's any consolation, next generations of AMD CPUs should have SSE4.1 too ;p
Core i5 3570k -- Geforce GTX 670  --  Windows 7 x64

Users browsing this thread: 1 Guest(s)