Hi all,
I've been rewriting some C functions into assembler for speed optimisation. So far it's looking almost 2x faster, but I've hit a problem.
For ease of code and speed, I've been using directly accessed variables to pass data from C to asm, however I don't know how to keep them on the same data page (so you get the code accessing the wrong location if you're not careful).
Loading the data page pointer every time a variable is accessed kills off any speed advantage of direct variables - I might as well use a structure and increment/reload the offset pointer.
If there a simple way of forcing a bank of variables to be in the same page (either in C or assembler)? Loading the DP once at the start of the function would be ideal.
Also, is there any way of declaring a structure in C and then accessing the variables directly in assembler (i.e. mov ACC,cart.apples?) The particular assembler block only ever reads one structure, so it can directly read variables as they'll never change location.
Any advice or literature suggestion are, greatly appreciated (and sorry if this has all been asked before).
John
edit: I should add, it's a C2811 Ti DSP and the variables are all declared in C and accessed by the assembler using .global tags.