Thanks guys, I did not have a code space problem I just wanted to
check that as I was switching banks that there could be a way to keep
the byte alignment and hence speed.
It come from programming on Mac/PC's where it can make big differences
Thanks for al your input it was great to have more insight, I learnt even more
which is fab and one important thing inspect the ASM file ;-)
Thanks
Mark
It's not nescessarilly a code-space 'problem'. Sometimes in one sequence, PICBasic squeezes a variable (which just happens to be frequently used) into Bank Zero, and you get a tight code-space compilation. You add a couple of variables later, recompile, and now this variable might no longer be in Bank Zero, but is pushed into Bank 1, and suddenly your program code usage is heaps bigger.
Naturally you jump to the conclusion that shuffling the variables in different sequences varies the code-space used... but it's not the variables themselves, but how they are subsequently accessed that changes the amount of bytes compiled.
So going back to your original thread starter... yes, there IS a speed and memory advantage... the advantage is in getting your most frequently used variables stored into Bank Zero - it makes a BIG difference if you're optimising for performance and code-space.
Melanie, thanks for your input in this one and your right
my code does run faster, I moved all of my frequently accessed vars into
bank0 and hypresto its speed is improved.
Thanks again for your valuable input.
Mark
Bookmarks