Phoinix, the free Gameboy emulator for PalmOSby Bodo Wenzel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
About skipping framesBecause the request for frame skipping comes often I sat down some hours and reflected on it. Here are my thoughts, and HJ is investigating Liberty in more detail. Additionally there is a quick'n'dirty test version of Phoinix which was only distributed via the mailing list for developers, so get your subscription ;-) On this page: - Some theory - Some real life values Some theory:OK, let's start. There's a lot of mathematics in here, but nothing more than the four basic arithmetical operations and solving equations. If you can't follow, write it down yourself and try to fill in the missing steps. Here are the symbols used:
We can surely assume that the time to emulate the machine code a Gameboy executes in one frame Temulate is fixed, independent of rendering and showing the frame. Similarly, the time needed to render and show the frame Trender is fixed, too. The values both vary with the game used, depending on the actual machine code, but while running it is assumed to be nearly constant. So the total time for an actual run Ttotal is:
The first thing we see is that even if we set the frame skip to infinite, we can't be faster than:
Secondly, after inserting the transformed formula of the ratio e we have:
We calculate the ratio of accelaration a(f) for a frame skip factor f compared to the non-skipping run by:
Now let's see how fast we can be with some theoretical values for the frame skip factor f and the emulation ratio e. As the formula clearly shows, there is no proportional relationship between the frame skip factor and the emulation acceleration:
If we transform the equation for the accelaration ratio a(f), we can calculate the emulation ratio e if a(f) is given:
Some real life values:Now that we know how to calculate things, let's take a look at some real life values. All times are taken on my old Palm III with no overclocking, comparable to 12 MHz due to its wait states.
Hm, the competitor shouldn't stand aside :-D
So my assumptions about realistic emulation ratios e were quite right: depending on the machine code to execute it's a 0.2 to 1.5 range. With these values, I made some curves and their asymptotes at a(infinite):
How do you read this diagram? OK, let's assume the game has an emulation rate e = 0.7, meaning that Trender is 70% of Temulate. This is the dark green curve. First you're careful and choose a frame skip factor of f = 2. Put your finger on the "2" at the horizontal axis and move up to the dark green curve. Then you go left to the vertical axis and find... a = 1.25! This says that the game will be accelerated to 125%, 25% more than before. The frame rate is getting down a bit, calculated by 125% / 2 = 63%, quite acceptable. Now you plan to accelerate a lot, and you choose a frame skip factor of f = 5. This time you'll find a = 1.50! The game will be accelerated to 150%, 50% more than without frame skipping. But the frame rate is getting down much more, despite the acceleration. Just calculate 150% / 5 = 30%: only three tenth of the non-skipping frame rate! The decision is yours ;-) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
palm.gb_emu@gmx.de |