From: Edward Hill Newsgroups: comp.os.msdos.djgpp Subject: Re: Memory Access Problem Date: Wed, 20 Jan 1999 16:17:08 -0800 Organization: Easams, Engineering Systems Lines: 39 Message-ID: <36A67204.5AF0@gec.nospam.com> References: <36A13B53 DOT D1A46262 AT bellsouth DOT net> NNTP-Posting-Host: pc02372.gmsws.gecm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01C-GECMMTL (Win95; I; 16bit) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com david bryant wrote: [sippety snip snip] > I allocate memory to *background by the statement > background=(char *)malloc(sprite_width * sprite_height); You shouldn't cast the return of malloc, it was orig used to silence compiler warning messages but since ANSI/ISO and the void * type it has become redundant and sometimes masks errors. Ok, make sure you have #include , I've forgotten this before and the cast will mask this. > A similar method is used to allocate memory for the sprite frames. > The problem is this : > When I read the background of the sprite from the virtual screen like > this EXAMPLE : source->background[x]=virtual_screen[(y<<6)+(y<<8)+x] > with my blit engine > and try to blit it back with the line EXAMPLE : > virtual_screen[(y<<6)+(y<<8)+x)=background[x], > and blit the virtual screen to video memory with the _dosmemputl() > function, I don't see my blit. > I've debugged and according to all my variable checking, the data is > going where it's supposed to go and the proper values are being > assigned. [chop] going where it's supposed to go? could you elabourate on this, is the background updated correctly with BACKGROUND = VIRT is the virtual screen updated correctly with VIRT = BACKGROUND what do you see when you blit to the vid mem? blank? garbage? the background? half a frame? perhaps if you included with this information some sample code, your blit function for a start and the relavent malloc sections for the background and sprite. Do you test the return of malloc? Ed Hill