Help me understand what happened - memory and Mac SE

Discussion in 'Mac Programming' started by Mu0n, Apr 9, 2005.

  1. macrumors newbie

    Joined:
    Jan 23, 2005
    Location:
    Montreal
    #1
    I've made a little program that stores the data of my sprite structure
    into a data file format. (all of the following in C)

    The problem occurs in another program that loads it back into memory
    and displays it. Since the data involved is no more than 2kb, I'm
    suprised to get stack collision with heap errors on a real Mac SE (with
    4 megs RAM). The error doesn't occur in the Basilisk II emulator for
    Pc, which emulates a Performa class mac (understandly, since I set it
    at 32 megs RAM). It also doesn't occur in mini-vMac for Pc, which
    emulates a Mac Plus with 4 megs RAM.

    The problem vanished on the real Mac SE once I removed the calls
    MaxApplZone() and 3 calls of MoreMasters().

    I want to understand how loading less than 2kb of data can produce such
    a mac bomb (Type 28 error).

    Specifics:
    the Sprite structure contains the following

    short numberFrames; (number of frames)
    Rect theRect; (bounding rect for the sprite)
    BitMapHandle buffh; (Handle to a bitmap that stores the background
    behind the sprite to be drawn; can remain NULL if I choose not to use
    that feature when the sprite is declared and assigned)
    BitMapHandle frames;
    BitMapHandle masks; (both point to an array (number of elements:
    numberFrames) of BitMaps. frames point to the actual b&w bitmaps that
    constitute the graphics, while masks are generated from frames during
    the assignment of the Sprite.

    What do you recommend I do? Do you think it would help if I call
    CompactMem in a few places in the function that loads the data from the
    file to the Sprite in memory?
     
  2. macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #2
    ... Why are you programming for a Mac SE?
     
  3. macrumors 65832

    Joined:
    Aug 2, 2004
    #3
    I'm not a programmer... but the first question that comes to mind is what System software are you using? And second, do you have MacsBug installed for that version?

    The reason for needing the System software version is that some versions need an earlier version of MacsBug to work. I have versions for 7, 8 and 9... and maybe 6 (I'd have to check). And there was a manual for MacsBug (I know I have a bound version, I may still have the PDF version too).

    Anyways, this may be the tool you need to solve this issue you're having.
     
  4. thread starter macrumors newbie

    Joined:
    Jan 23, 2005
    Location:
    Montreal
    #4
    GeeYouEye: For the heck of it. For the challenge of the speed limitation, for the goal of trying to prove that only the fundamentals of a good game matter, not the sophistication of the engine behind it. And because other guys do it for the C64 (check the forums at lemon64.com)

    RacerX: I have early enough versions of macsbug that work with 6.0.7 that I have on the SE. Now, if I knew everything I needed to know to check for that kind of stuff...

    But, since my original post, it has magically started working. I can't explain it. I have a love-hate relationship with compilers.
     
  5. macrumors 65832

    Joined:
    Aug 2, 2004
    #5
    Maybe this can help a little.
     

Share This Page