PDA

View Full Version : "Graphics_Demo" stack space?



Rayman
07-03-2009, 07:58 AM
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

Rayman
07-03-2009, 07:59 AM
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

BradC
07-03-2009, 08:07 AM
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!

Rayman
07-03-2009, 05:58 PM
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

BradC
07-03-2009, 06:03 PM
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!

Rayman
07-03-2009, 06:13 PM
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

BradC
07-03-2009, 08:18 PM
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!