Xref: news2.mv.net comp.os.msdos.djgpp:8004
From: Alex Demko <ademko AT mbnet DOT mb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: djgpp/allegro - help! - quick question
Date: Tue, 27 Aug 1996 22:16:12 -0500
Organization: Chaos Software
Lines: 32
Message-ID: <3223B9FC.5C79@mbnet.mb.ca>
Reply-To: ademko AT mbnet DOT mb DOT ca
NNTP-Posting-Host: cyber113.cyberspc.mb.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

�PALETTE *new_truepal()                      
�{                                                    
�  PALETTE *pal = (PALETTE *)malloc(sizeof(PALETTE));          
�  unsigned char r,g,b,i=0;                                  
�  for (r=0; r<6; r++)                                     
�   for (g=0; g<6; g++)                                     
�    for (b=0; b<6; b++)                                     
�     {                                                     
�     pal[i]->r=r*12;//causes GPF here                    
�     pal[i]->g=g*12;                               
�     pal[i]->b=b*12;                                 
�     pal[i]->filler=0;                             
�     i++;                                                
�     }                                                 
�  return pal;                                            
�}                                                   

After I use the above routine in my code, I get a GPF in the marked
area. It won't GPF the first time it hits the marked code area, but
it will interate the inner loop about 40 (actual number depends on
phase of the moons) times, then GPFs. Am I dereferencing the
array/struct wrong? Please help, this thing is killing me :)

The code compiled error free.

Thanks

-- 
====================================================================
Alex Demko (Alex_Demko AT mbnet DOT mb DOT ca) # Chaos Software Productions
Univ. of Manitoba Comp. Sci.        # Just released: Drip! (PC 386+)
C C++ Pascal Delphi Perl HTML Java  # http://www.mbnet.mb.ca/chaos