PDA

View Full Version : Help me understand what happened - memory and Mac SE




Mu0n
Apr 9, 2005, 02:49 PM
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?



GeeYouEye
Apr 16, 2005, 12:55 AM
... Why are you programming for a Mac SE?

RacerX
Apr 16, 2005, 05:41 AM
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 (http://developer.apple.com/tools/debuggers/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.

Mu0n
Apr 17, 2005, 06:29 PM
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.

RacerX
Apr 17, 2005, 06:44 PM
Now, if I knew everything I needed to know to check for that kind of stuff...

Maybe this (http://www.shawcomputing.net/racerx/macsbug.pdf) can help a little.