www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/19/22:46:49

Message-ID: <36A13B53.D1A46262@bellsouth.net>
From: david bryant <aceone AT bellsouth DOT net>
X-Mailer: Mozilla 4.04 [en]C-bls40 (Win95; U)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Memory Access Problem
Lines: 38
Date: Wed, 20 Jan 1999 03:43:21 GMT
NNTP-Posting-Host: 209.214.5.111
NNTP-Posting-Date: Tue, 19 Jan 1999 22:43:21 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is my problem short and sweet.
This is my structure:

typedef struct sprite
                        {
                             int num_frames; // Hold number of sprite
frames
                             int sprite_width,sprite_height; // holds
sprite's width & height
                             char *background; // holds the scanned
background of sprite;
                             char *frames[MAX_FRAMES]; //  holds the
sprite frames
                        } sprite, *sprite_ptr;

I allocate memory to *background by the statement
background=(char *)malloc(sprite_width * sprite_height);
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.
Please help me out or give me a fast but readable blit engine to learn
from.
I'm not new to C programming. As far as 16 bit C is concerned, I'm an
ace.
Assembly ? No Problem!   DJGPP, I'm a wimp !
HELP !!!
Thanks in advance..... David Bryant ( aceone AT bellsouth DOT net)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019