Shop OBEX P1 Docs P2 Docs Learn Events
Size of dat section — Parallax Forums

Size of dat section

KyeKye Posts: 2,200
edited 2013-03-17 12:06 in Propeller 1
Never had to do this before... but, is there a good way to do this?

Comments

  • Mike GMike G Posts: 2,702
    edited 2013-03-17 11:08
    I use a label at the start and a label at the end.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-03-17 11:15
    It all depends upon what you mean by "size." The hub size will be different from the cog size if there are res pseudo-ops. In any event, the labels at start and end will give you the hub size from Spin (and the cog size from PASM, unless you have multiple orgs).

    -Phil
  • KyeKye Posts: 2,200
    edited 2013-03-17 11:24
    So...

    return (@end - @start)
  • KyeKye Posts: 2,200
    edited 2013-03-17 11:27
    Wait...

    What about:

    return constant(@end - @start)
  • KyeKye Posts: 2,200
    edited 2013-03-17 11:34
    Or...

    CON
    DAT_LENGTH = (end - start)

    This doesn't seem to compile. But, would be cool if it did.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-03-17 12:01
    Kye wrote: »
    Wait...

    What about:

    return (@end - @start)

    Plus 3 4. Assuming start and end are longs.

    Edit: Phil's right, you'd add four.
  • Mike GMike G Posts: 2,702
    edited 2013-03-17 12:05
    Duane, a pointer is always a long regardless of the type.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-03-17 12:06
    return (@end - @start) will give you the hub size of the DAT section in bytes, assuming end is the label of the long after the last long in the DAT section. If it's the label of the last long, just add four.

    -Phil
Sign In or Register to comment.