Shop OBEX P1 Docs P2 Docs Learn Events
Is there a way to form a list of free cog space ? — Parallax Forums

Is there a way to form a list of free cog space ?

Toby SeckshundToby Seckshund Posts: 2,027
edited 2010-05-16 15:21 in Propeller 1
I wonder if there is a way to get a definitive list of the free cog longs. Up until now the only way I have used is to crash into the end (496) and then try and get some back afterwards.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point

Comments

  • BaggersBaggers Posts: 3,019
    edited 2010-05-14 07:25
    Toby, you can make a loop of creating new cogs ( keeping a list of COG id numbers ), and when you get one that doesn't create, you then know how many are free, and you can then release those in the list.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • BradCBradC Posts: 2,601
    edited 2010-05-14 07:27
    Toby Seckshund said...
    I wonder if there is a way to get a definitive list of the free cog longs. Up until now the only way I have used is to crash into the end (496) and then try and get some back afterwards.

    The list window in bst tells you the space remaining after every FIT statement. (Thank heater for that one)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Are you suggesting coconuts migrate?"
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-05-14 13:32
    Thanks for the replies folks.

    Brad
    you will have to try and educate the stupid here, which bit is that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • KyeKye Posts: 2,200
    edited 2010-05-14 14:25
    You can count the remaining bytes.

    When you click on a DAT section the compilier tells you how many bytes you have left. Add the res longs to that and you have your count.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • pjvpjv Posts: 1,903
    edited 2010-05-14 15:53
    Toby;

    If you put a bogus LONG 0 as the last line in your program, then clicking on that line, the prop tool tells you (at the very bottom of the page) the COG location that line resides in, and hence you know you have $1FF minus that number remaining.

    P.S. Actually I just tried the slightly improved following:

    Label your "fit" statement with a name (I used End), and then do a compile (press F8). Then when your mouse is clicked on that End label, the total cog space consumed is indicated in hex, as well as the size of the current DAT block.

    Cheers,

    Peter (pjv)

    Post Edited (pjv) : 5/14/2010 4:57:09 PM GMT
  • BaggersBaggers Posts: 3,019
    edited 2010-05-14 19:43
    oops, I misread that lol, ignore my reply, my bad, thought you asked how many cogs were remaining.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-05-14 20:36
    Not a problem Baggers, it did make me look back at what I did ask though smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • BradCBradC Posts: 2,601
    edited 2010-05-16 15:21
    Toby Seckshund said...
    Thanks for the replies folks.

    Brad
    you will have to try and educate the stupid here, which bit is that?

    Go "View->Compiler Listing" then put the window in the background somewhere.

    Next time you compile you'll get a neat little listing of your program in that window. Somewhere near the bottom of your cog objects you'll see something like this :

    03E4(0107)             | b_ptr         res       1
    03E4(0108)             | b_len         res       1
    03E4(0109)             |               fit       496
    03E4(0109)             | There are 231 ($0E7) Longs left in the cog    
    
    



    Of course you need to have the fit directive there for it to work.

    If you use the Propeller Tool, you can always do as the lads said above. I used to do that myself before heater asked for something a bit neater.
    (you can still use the Propeller Tool method in bst too of course).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Are you suggesting coconuts migrate?"
Sign In or Register to comment.