#37653 - philip - Mon Mar 14, 2005 8:29 pm
Hi,
I've written this simple little driving game where you go around picking up items and delivering them to somewhere else. Trouble is, it's much slower than I think it should be on real hardware. I've removed all the trig and floating point maths, but it still won't run at 60 frames a second.
You can find the code at: http://www.vertex.ukfsn.org/pickup/v12/main.c
The support files can be found here: http://www.vertex.ukfsn.org/pickup/pickup_src.zip (The "main.c" above should be used instead of the one in this archive)
I think that maybe I'm not handing off between the mainloop and vertical blank interrupt correctly, or it could be I'm just too slow. Does HAM have a large overhead?
I've posted this previously on the HAM forum, and somebody suggested it seemed to be using a lot of divides. In fact, most of the divides involve only constant terms. I have confirmed these are being calculated at compile time and are present in the intermediate assembly code as pre-calculated literal terms. There is only one actual divide per frame, plus a lot of bit shifts.
If anybody could tell me what was wrong here, I'd be eternally grateful!
I've written this simple little driving game where you go around picking up items and delivering them to somewhere else. Trouble is, it's much slower than I think it should be on real hardware. I've removed all the trig and floating point maths, but it still won't run at 60 frames a second.
You can find the code at: http://www.vertex.ukfsn.org/pickup/v12/main.c
The support files can be found here: http://www.vertex.ukfsn.org/pickup/pickup_src.zip (The "main.c" above should be used instead of the one in this archive)
I think that maybe I'm not handing off between the mainloop and vertical blank interrupt correctly, or it could be I'm just too slow. Does HAM have a large overhead?
I've posted this previously on the HAM forum, and somebody suggested it seemed to be using a lot of divides. In fact, most of the divides involve only constant terms. I have confirmed these are being calculated at compile time and are present in the intermediate assembly code as pre-calculated literal terms. There is only one actual divide per frame, plus a lot of bit shifts.
If anybody could tell me what was wrong here, I'd be eternally grateful!