Shop OBEX P1 Docs P2 Docs Learn Events
Both a suggestion to Parallax, and a problem. — Parallax Forums

Both a suggestion to Parallax, and a problem.

PerryTachettPerryTachett Posts: 1
edited 2007-06-20 17:12 in Propeller 1
NOTE: I have since discovered that I was using up the memory with an inordinately long stack.


Hello,

Please post this question in the “Hydra” forum. Here is a link to our forums: http://forums.parallax.com/. If you have any more questions please feel free to e-mail us.

Regards,

Dave



Dave Andreae
Tech Support /Quality Control
PH. 916-624-8333
www.parallax.com
support@parallax.com
stampsinclass@parallax.com



Original Message
From: Peter [noparse][[/noparse]mailto:**********************]
Sent: Tuesday, June 12, 2007 12:06 PM
To: Support
Subject: Propeller Tool Suggestion



Dear Parallax,

I have recently bought the Hydra Game Development kit, and am quite happy with it. Although I have hit the ceiling of 32kb of RAM, I have found ways to work around it. However, when I made a spin object of more than 8kb (Or somewhere around there, I can't know for the following reason.) of size, the compiler complains about being some number of longs too long. So, I try Run- Compile Current- View Info, and it brings up the pane showing the actual binary of my object, when suddenly, after about half a second of showing that pane, it closes it saying: "Object exceeds runtime limit by X longs"! I know for sure (Or pretty sure...) that it is less than 32kb.

What do I do? Even if it turns out I am doing something really dumb [noparse][[/noparse]Which I was, as it turns out.], and it IS more than 32kb, please change the Propeller Tool so it will still complain about being to long, but not close the pane, so I can still see what I can cut out to make it small enough.

Thank you for your time, and other than that, I am quite content with the Hydra Game Development kit.

PS. If this is not the correct email address to send this email to, please forwards it.

Post Edited (PerryTachett) : 6/15/2007 4:06:04 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-15 16:12
    Yes, and it's hard to determine what the minimum stack requirement may be since that depends on the local variables declared and the complexity of expressions and on the dynamic pattern of method calls (who calls whom and when). There are some optimizing compilers that can do a worst case flow analysis of a program and give you this kind of information, but it's not really that useful since, on a memory limited processor like the Propeller, so many other factors come into play (like the size of your code and the global storage used, let alone the actual call patterns).

    In any event, it's way beyond the capability of the Propeller Tool's compiler to determine any kind of useful information on stack usage.

    You can set up a spare cog with a routine that will initialize the stack area to some unique pattern and watch how it is overwritten and even display an indicator of the worst case stack usage so far on some kind of attached display.
  • potatoheadpotatohead Posts: 10,255
    edited 2007-06-15 16:24
    I have found that doing some worst case planning, or coding in for specific cases, based on timing, number of elements in process, etc.. ; breaking tasks into discrete chunks, that are known, are all helpful where determining your stack size is concerned.

    In the context of a video game, known numbers of moving objects, size of assets, display buffer size, draw video on fly needs working ram, color lookup tables, and in game object data structures can all be known things. One very simple example is moving things. Let's say moving everything, every frame consumes too much RAM. One then can decide to only move some things, with the use case for that RAM consumption known.

    Stuffing assets into the EEPROM is a great idea too.

    You then work with known buffer sizes, and timing, all of which consume known stack sizes.

    In the game context, there really should be few unknown memory consumption issues.

    I recently spent some time authoring a game on the 2600. That thing has 128 bytes of RAM period. (OK, it can be expanded via the cart, but I was not going there for my game.) In the end, to make it all work nicely, two things happened.

    I literally used every bit of RAM. (to the literal binary bit)

    I knew the RAM consumption for every last use case on the machine, and that included stack required for subroutine call and return. (I ended up with only two levels at any one time. Call three and it crashes sooner or later!)

    It is a good idea to lay out your in-memory structures, pack data into bytes well, and have these be fixed to define the limits in your game.
  • CJCJ Posts: 470
    edited 2007-06-20 17:12
    sounds like you are using the standard graphics object, the one that takes up 24K for the display buffers

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
Sign In or Register to comment.