Shop OBEX P1 Docs P2 Docs Learn Events
How do you read the object info screen? (how to proactively calculate PASM code size) - Page 2 — Parallax Forums

How do you read the object info screen? (how to proactively calculate PASM code size)

2»

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-07-09 12:26
    Dave,

    Don't you need a "long" between "cog_size" and "last_label"?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-09 12:43
    Dave Hein wrote:
    And if you want to print out the size of the cog program at run time you could do something like this: ...
    That includes the long taken up by cog_size (after applying Duane's correction). In my example above, only the actual code is measured. end is just a hub variable in that case.

    -Phil
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-09 13:08
    I forgot my code at home, so I can't test this out yet until I get back home ... why does
    end       long end-begin
    
    count the res variables? But not the way I was trying to do it yesterday?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-09 13:14
    The "@" notation refers only to hub addresses. res variables do not exist in the hub. In my example, the computation is done on cog addresses, which include the res variables.

    -Phil
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-09 14:04
    Ahhh , ok. I can't wait to get home and try it.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-07-09 15:40
    Duane Degn wrote: »
    Don't you need a "long" between "cog_size" and "last_label"?
    Yes the existing Spin compilers require a "long". My example was based on a hypothetical compiler that understands what I meant to write instead of what I wrote. :)
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-10 12:14
    Hello Phil, I cannot get this to work. I am seeing an unchanging value of "-2134281013" printed to the pst. My code is commented everywhere and a mess, but if you'd like I will post the entire object. Otherwise I have included a trimmed version with what I believe is the pertinent information below.

    Is this psuedocode or actual code?

    Here is what I have
    DAT
    
    
                            org     0
    
    camsim
    
    [i][lots and lots of pasm code here][/i]
    
    end
    
                           
                            wrlong  exit, pstPtr15
    
                            jmp     #restart
    
    [i][lots and lots of pasm variables here][/i]
    
                            fit     492
    exit                    long    exit-camsim
    

    turbosupra wrote: »
    I forgot my code at home, so I can't test this out yet until I get back home ... why does
    end       long end-begin
    
    count the res variables? But not the way I was trying to do it yesterday?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-10 12:26
    You'd better post your entire program. BTW, the example I gave was not meant to account for intervening Spin code, just a single DAT block.

    -Phil
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-10 12:47
    couch.gif

    I know my code is mediocre at best, so I'm just going to generally apologize for it ahead of time. In the pasm section, the camsim is at the beginning, the end/wrlong is at line 1408 and the fit/exit portion is at line 1700

    Also, am I taking up needless space below with cog ram for rpmPtr (for example) since it is commented out. Is the long it used to occupy used or is that static and the more 'dynamic' cog ram occurring after the static/par related variables?
    pinPtr                  long    84
    pinAddrPtr              long    88
    'rpmPtr                  long    92
    rpmAddrPtr              long    96
    'rotationalRatioPtr      long    100
    rotationalRatioAddrPtr  long    104
    


    And that is why I didn't want to post all of the code, it's too overwhelming
Sign In or Register to comment.