Menu

How does the Compiler handle page boundaries.

Mauried
2010-07-04
2013-05-30
  • Mauried

    Mauried - 2010-07-04

    Just a small observation using a 16F88 and a program that needs a fair amount of space, more than will fit in one page.
    When compiled, the compiler leaves a large gap at the page boundary.
    For example, the code that goes in the bottom page finishes at 06EE, there is a gap till 0876
    where the rest of the code goes.
    The program comprises a main block plus several subroutines.
    Is there any way to get the Compiler to use more of the available space, ie would using less subroutines help,
    or putting all the subroutines first, so the main prog goes in the 2nd page.
    Is there any way to tell the compiler where to put the various parts of a prog, memory wise.

     
  • Hugh Considine

    Hugh Considine - 2010-07-04

    GCBASIC always puts the main routine, interrupt handler, and any startup routines into page 0.

    It then sorts the remaining subroutines in order of largest to smallest, and allocates them to a page one by one starting with the biggest. Once they've all been placed, it recalculates their size (page selection statements make them grow/shrink), and checks if they still fit. If they don't, then it tries placing them again. It will do this a few times, and if it can't make them fit after about 20 attempts it stops trying and shows an error message.

    At the moment there's no way to force it to put certain subroutines into certain banks, but it's something I'll look at doing - it could be quite helpful!

     
  • Mauried

    Mauried - 2010-07-04

    OK, .
    Makes more sense now.
    Where does the compiler put string variables.
    For example, if the program has a lot of string variable assigments like
    variable = "Long String".
    Ive noticed that they seem to jump around a bit from either the end of page 0
    to the end of page 1 , but havnt figured out exactly what causes it.
    Does it make life easier for the compiler if all subroutines are kept very small.
    Thanks

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.