Shop OBEX P1 Docs P2 Docs Learn Events
"Graphics_Demo" stack space? — Parallax Forums

"Graphics_Demo" stack space?

RaymanRayman Posts: 15,379
edited 2009-07-03 13:18 in Propeller 1
So I was taking a closer look at our "Graphics_Demo" and noticed something interesting...

The two buffers are $3000 each with one specified at an address of $5000 and the other at $2000.

But, the one at $5000 fills all memory including the·limit of $8000, with is normally used for stack space...

So, how does this program work without any stack space?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

Comments

  • RaymanRayman Posts: 15,379
    edited 2009-07-03 00:59
    PS: Why does this post have 2 views already when I just posted it!?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • BradCBradC Posts: 2,601
    edited 2009-07-03 01:07
    Rayman said...
    So I was taking a closer look at our "Graphics_Demo" and noticed something interesting...

    The two buffers are $3000 each with one specified at an address of $5000 and the other at $2000.



    But, the one at $5000 fills all memory including the limit of $8000, with is normally used for stack space...


    So, how does this program work without any stack space?

    Stack starts at $1BB4

    Object Address : 0010 : Object Name : Graphics_Demo
    Object Address : 03C4 : Object Name : tv
    Object Address : 083C : Object Name : graphics
    Object Address : 14C0 : Object Name : mouse
    
    Binary Image Information :
    PBASE : 0010
    VBASE : 17F4
    DBASE : 1BB4
    PCURR : 00DA
    DCURR : 1BE4
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Missed it by ->" "<- that much!
  • RaymanRayman Posts: 15,379
    edited 2009-07-03 10:58
    Never mind I didn't notice the "+ 100" somehow:

    _stack = ($3000 + $3000 + 100) >> 2 'accomodate display memory and stack

    Still, it's funny how the stack starts from the beginning of this space instead of the end...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • BradCBradC Posts: 2,601
    edited 2009-07-03 11:03
    Rayman said...
    Never mind I didn't notice the "+ 100" somehow:

    _stack = ($3000 + $3000 + 100) >> 2 'accomodate display memory and stack

    Still, it's funny how the stack starts from the beginning of this space instead of the end...

    Not really. The stack follows the variables always. The display buffers are not allocated as variables, but simply unallocated RAM that the code agrees on.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Missed it by ->" "<- that much!
  • RaymanRayman Posts: 15,379
    edited 2009-07-03 11:13
    Are you saying the stack starts immediately after the program? That's funny. I was thinking that the "Stack" keyword reserved space starting from $8000 backwards...

    But, the way you describe it makes more sense given the stack space address of $1BB4 that you found...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • BradCBradC Posts: 2,601
    edited 2009-07-03 13:18
    Rayman said...
    Are you saying the stack starts immediately after the program? That's funny. I was thinking that the "Stack" keyword reserved space starting from $8000 backwards...

    But, the way you describe it makes more sense given the stack space address of $1BB4 that you found...

    Not immediately after the program. Its like this

    - Header ($0-$F)
    - Program (PUB/PRI/DAT)
    - Variables (VAR)
    - Stack

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Missed it by ->" "<- that much!
Sign In or Register to comment.