Fermer2
CosmicRLe 27/04/2025 à 18:08
I am currently optimizing Sebastian Mihai''s homebrew Neo Geo game : Neo Thunder (http://sebastianmihai.com/neogeo-neo-thunder.html) My plan is to remove all the slowdown. I know it's not a great game but I am mainly doing this for the coding practice. It's actually been a really good learning experience so far on how to do things quickly.

I have a couple of questions :

1. I'm getting near the end of the optimization process now and I really want to use 16-bit (short) variables in the Neo Thunder C program. Since I figure these will be a little faster - all MOVE.L instructions etc can now become MOVE.W etc when compiled. Currently I use "int" for all variables. This denotes a 32 bit value in the dev kit .

However there is a problem because all the functions in the Dev Kit only accept 32 bit variables.

e.g. write_sprite_data(int x, int y, int xz, int yz, int clipping, int nb, const PTILEMAP tilemap);

Should I cast the short variables to int's when I call these functions, OR should I rewrite the "write_sprite" function to use 16 bit values (And if so, is this even a good idea?). Which would be faster (in terms of execution speed)?

I should say the new Neo Thunder code will run perfectly fine (fast enough) without doing this but the idea is to learn techniques I can use again in future projects

My Second Question :

2. In the "pitfalls.txt" file that came with the Dev Kit. : It says "When interfacing assembly routines, d2-d7/a2-a6 must be preserved." My question is - what are d2-d7 and a2-a6 actually used for? And does this mean that my compiled C code is slower than it should be - because it doesn't use *all* these preserved registers when it is compiled. Or I am I misunderstanding this?


Thank you for any help. Any answers will be very helpful!