10-29-2013, 10:02 PM
People who read the title will probably send me hate mail saying I shouldn't be a developer but a farmer, and I also know there is at least another similar thread.
I thing this can be an interesting reading for everyone. Pro who wants to answer and can spent some time here with me, and newbie who need to understand how emulator works.
However. Hi everyone, I'm Max, a newbie developer (maybe not so newbie in general, but I can't make any code different from C++ and Java, and i still have problems with triple pointers ).
I know that's not the developer section but I can't open new thread there (if someone can move this thread there it would me amazing ).
I'm introducing to the beautiful world of emulation.
I can't understand something, in particular the reason why static recompiler are off-limits due to the self modifing code.
But.
If self modifing code means I use lots of:
-address = 192
-JMP (address)
-...
-address ++
-JMP (address)
why can't I make this?:
1) create a virtual 'Ram' --> if PSX has 4Mb of ram (for example) I allocate 4 Mb on my windows computer.
2) i load the program in THAT part of the ram (operative system, game rom, whatever) starting at the first "dedicated" bit. Now the Windows Pc ram should be an exactly copy PSX ram.
3) Now "JMP (address)" shouldn't be a problem.
--> is the self-modifing code example right?
--> can i make what i describe in step 2?
--> is really the 'step 3 instruction' not a problem anymore?
And.
If it's not possible for reason 'xxx', can I make an hybrid recompiler that statically recompile for the Windows x86 client but has also a dynamic recompiler for JMPs?
So when you start the game, it loads the rom and a cache file, some part can be just execute because are recompiled, other are dynamicall recompiled.
And again.
Why use a static/dynamic recompiler to transform (eg) PSX assembly into x86 assembly? Is it difficoult to transform into an intermediate language (LLVM, C--, others | ok maybe not C-- but any sort of portable assembly just like LLVM) that can be later compiled for both x86 Windows and (eg) ARM Android?
I hope this was an interesting reading and thanks to anyone who will share his enormous knowledge .
-Max
I thing this can be an interesting reading for everyone. Pro who wants to answer and can spent some time here with me, and newbie who need to understand how emulator works.
However. Hi everyone, I'm Max, a newbie developer (maybe not so newbie in general, but I can't make any code different from C++ and Java, and i still have problems with triple pointers ).
I know that's not the developer section but I can't open new thread there (if someone can move this thread there it would me amazing ).
I'm introducing to the beautiful world of emulation.
I can't understand something, in particular the reason why static recompiler are off-limits due to the self modifing code.
But.
If self modifing code means I use lots of:
-address = 192
-JMP (address)
-...
-address ++
-JMP (address)
why can't I make this?:
1) create a virtual 'Ram' --> if PSX has 4Mb of ram (for example) I allocate 4 Mb on my windows computer.
2) i load the program in THAT part of the ram (operative system, game rom, whatever) starting at the first "dedicated" bit. Now the Windows Pc ram should be an exactly copy PSX ram.
3) Now "JMP (address)" shouldn't be a problem.
--> is the self-modifing code example right?
--> can i make what i describe in step 2?
--> is really the 'step 3 instruction' not a problem anymore?
And.
If it's not possible for reason 'xxx', can I make an hybrid recompiler that statically recompile for the Windows x86 client but has also a dynamic recompiler for JMPs?
So when you start the game, it loads the rom and a cache file, some part can be just execute because are recompiled, other are dynamicall recompiled.
And again.
Why use a static/dynamic recompiler to transform (eg) PSX assembly into x86 assembly? Is it difficoult to transform into an intermediate language (LLVM, C--, others | ok maybe not C-- but any sort of portable assembly just like LLVM) that can be later compiled for both x86 Windows and (eg) ARM Android?
I hope this was an interesting reading and thanks to anyone who will share his enormous knowledge .
-Max