Date: Tue, 15 Jul 1997 12:31:38 -0700 (PDT) Message-Id: <199707151931.MAA08025@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: kwe1 AT flash DOT net From: Nate Eldredge Subject: Re: HELP! DJGPP Program Crashes Cc: djgpp AT delorie DOT com Precedence: bulk >I'd like to what causes the abnormal crashes in my programs... Whenever I >seem to use a certain function too much it bombs to DOS (see below). I know >where the problem is, I just don't know why it occurs... Some more details would be nice. What sort of error message does it get? Try using `symify' on the traceback and posting it here. >What are the >limits, if any, imposed on DJGPP code, other than normal errors (my progs >compile fine, they just don't run fine...)? DJGPP runs your programs in protected mode. This means that: - They are not normally allowed to touch memory outside their area. The exceptions to this are the farptr functions and nearptr_enable. - Dereferences of null or invalid pointers are caught and result in an error message with traceback. Also: - The stack is, by default, 256K in size. This can be changed with `stubedit'. > When I deal with a certain >pointer too much it does the same (for some reason, it only will be dealt >with three times in the main () function... you can declare it, but if you >touch it.....) Are you sure your pointer is valid? >And BTW, does DJGPP have >options for changing memory models, or does it all compile into medium? I'm not sure what you mean. DJGPP programs are 32-bit and run with a flat memory model- all data selectors (ds, es, ss) are the same. > >void setpal(int num, byte red, byte gre, byte blu) >{ > outportb(0x3C8, num); > outportb(0x3C9, red); > outportb(0x3C9, gre); > outportb(0x3C9, blu); >} I see no problem with your function, assuming `byte' is typedef'ed to `unsigned char'. How deeply is it nested when you call it? It looks to me like you're used to a real-mode compiler. DJGPP may take a bit of getting used to in this case. Nate Eldredge eldredge AT ap DOT net