newcoleco Posted September 3, 2009 Author Share Posted September 3, 2009 I had a quick look to the source code yesterday. I noticed at that point in time you converted your C code to ASM . I suppose it is to obtain a better framerate , i'm curious to know how much it has been improved? Well, my first engine was in C and the framerate was about 15 frames per second, and with assembler it's 30 frames per second. It may sounds like twice the speed, but it's 3 times the speed. Let me explain : one cycle is dedicated to put the result on screen, the result starts with getting level data from vram, erasing a collectable item if taken, generating the visual with paralax, animated patterns for the green plateforms, update ghost position and player look based on the action. So, in C, without the paralax I had a reasonable result of 20 frames per second, but if I include the paralax, the ghosts and animated patterns it was not possible to keep a reasonable speed. So I then opted for partial assembler, but I had a conflict problem by using a sound command when an NMI occurs creating a ram corruption, so I had to put everything in assembled and even avoid using the default starting sound command to be sure. Let's recap... FOR EACH FRAME : 1 cycle show result on screen, all other cycles getting level data from vram and generate the result with paralax and everything. In assembler I was able to squeeze everything in 2 cycles (30 FPS), in C it was about 4 to 5 cycles (15-12 FPS). Using both Assembler and C I had a reassonable 3 cycles (20 FPS), but had random crashes because of the sound routine conflict. Quote Link to comment Share on other sites More sharing options...
youki Posted September 3, 2009 Share Posted September 3, 2009 Thanks for the details. I guess what you mean by "cycle" is VSync. I think i will go for ASM (at least for critical part) too on my new project. Quote Link to comment Share on other sites More sharing options...
newcoleco Posted September 3, 2009 Author Share Posted September 3, 2009 Thanks for the details. I guess what you mean by "cycle" is VSync. I think i will go for ASM (at least for critical part) too on my new project. Well, you may call it Vsync the moment of interrupt, I'm talking about a cycle, a period of time between two interruptions... which is not exactly the same thing but very related. There is a window of time right after the nmi very crucial that did allow me to do the output at once. In a video, I did show that the output slightly outside this window gives a strange result (because I was updating the sounds first in my first versions of the game). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.