Make "demo2c.elf" work.
Posted on 2005-08-27 00:00:00
LIBC streams buffering is a bit wierd under MSVC++... In "Debug" mode it seems to have line buffering enabled, and in "Release" mode the buffering seems to be disabled. That's what was causing the log not to update in "Release" mode. Also, it seems that line buffering isn't supported in Win32, so I had to resort to make my homemade buffering and use the no-buffering mode on the stdout stream. It's working good now.

Another problem was that it was crashing when I was pausing the virtual machine. For optimization purposes, the address to the Sleep function was kept in ebx and this register wasn't properly saved by the recompiled code... So I simply added pushes and pops before calling the recompiled code and it fixed this problem.

Made the v-blank bit reset when you write 0x08 in the CSR. This allows us to use bigger values for the count-down counters. Using bigger values makes the emulator spend more time executing the code rather than swapping the video buffers, but slows down the animation speed.

Also added the SLTIU instruction. The demo can run completely now.

Next and final step for this development is to make the alpha blending (or testing) work.