|
|
|
|
|
|
Make "demo2c.elf" work.
Posted on 2005-08-26 00:00:00 |
|
I decided to add a parameter to the tick function (which is the number of cycles executed) to be able to support the case of skipping a whole execution quota to abort a dead loop. I haven't seen much of this stuff yet, mainly because I haven't played with any demos that use interrupts. This ticking function setup shouldn't have any trouble handling these cases, if there's any.
Now, a counter is decremented by the number of ticks when the tick function is executed, and when this counter underflows, it will set the v-blank bit in the CSR and set the counter to another value. Once the counter underflows again, the v-blank bit is reset and another value will be loaded in the counter, etc. The display buffer is also swapped when the system enters the v-blank state. I don't have the real values for these counters right now though. The cycle number needed for rendering a line would be something along the lines of the CPU frequency of the EmotionEngine divided by the number of frames by second, divided by the number of lines in the current display mode. Then we'd need to know the number of active scanlines the system renders and the number of scanlines the system blanks. Anyways, I just used fake values for these now and the result is what we would expect: we can see each frame of the scroll down animation. The counters just affect the speed of this animation. The required v-blank stuff is mostly complete for now. I'm just wondering what's the effect of writing 0x8 into the CSR, because the program writes this value into this register before the loop that waits for the end of the v-blank. Maybe it resets a possibly active v-blank flag? I'll have to check that later. I've also moved some of the stuff from the OpenGL GS handler to the base GS handler (like writing and reading to the private GS registers). That's just to make the stuff cleaner in the source code. The emulator has a lot of trouble running in "release" mode right now... And the screen updating is still screwed up for the previous demo. I'll have to investigate these next. |