So in this case, where do we put the subs then?
Based on what criteria do we arrange the subs?
---------------------------------
So in this case, where do we put the subs then?
Based on what criteria do we arrange the subs?
---------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Hi Sayzer. Well, now there is no official directive as to where is better placed a sub. According to old practice, on top. But this does not affect in any way the execution.
I only pointed out that if one has 5 sub's for example, and have different sizes, rearranging the order of them is affecting the final code size. I think is because a bigger sub might fall between two pages while others won't.
After a little experimenting you can find that your code might reduce up to 20% or more! Also if you change your variables to be placed on BANK0 also may help. Especially if there are arrays in the program. I had a program reduced from 7540 bytes to 6200 using the above!
Ioannis
Hi, Sayzer
You meet here The big Basic Programmer's lack of project definition ...
Basic enables you lots of jumps and come back ... But the first thing is to write a neat logical organigram ...
Like It was to be done with "old dinausaurs " programming langages like Fortran ...
So, the thing to do is put the job in a correct order to have the minimum GOTOs and GOSUBs ...
No so easy ... when the project grows more and more !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Just a note: what I described at #13 has nothing to do with GOTO's. Just the order of the sub's. If this is going on top of the other has an immediate impact on code size produced.
Ioannis
Hi Ioannis,acetronics,
I knew aerostar had a reason, now I know why. I learned something again today! Thanks,
JS
edit
FORTRAN ? Now we're talkin OLD I remember studying my dad's fortran manuals in 1968? I think Dr. Peabody used that to program the wayback machine!
Originally Posted by Acetronics
I always thought that programming structure addresses a programmer who is looking at the code from outside. So that when you write a code, another programmer from outside can understand your coding and logic relatively easier.
If you write a code that is mixed all over, a new comer will not understand the logic flow.
But, despite all, now, I learn that the structure also has a direct effect on the code size.
I just made some tests, moved the subs around in a code.
The code size indeed drops.
---------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I know what I will suggest is not much of a help, but generally the big sub's is better to be placed on top of each memory page. If you cannot find how long a sub may take, then compile it in a new program file, after compilation check the length and move the sub to a better position at the final program.
Then the rest of the page can be filled with a smaller sub.
If anyone has a better suggestion, please, one step forward.
Ioannis
Bookmarks