delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/21/01:31:31

From: "Mark Figura" <nospam AT please DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using a memory buffer in VGA mode 13h
Date: Thu, 20 Aug 1998 23:20:15 -0400
Organization: "SNET dial access service"
Lines: 66
Message-ID: <6riout$b8q@news1.snet.net>
References: <01bdc2bb$36b2c3c0$2856f482 AT s-64584>
NNTP-Posting-Host: sttn-sh4-port195.snet.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello!

Don't know what the problem is really.  It seems to me that the structure
"size_t" isn't being declared or something.  Either that or there's no comma
before it in the function decleration for
dosmemput().

Here's the dec...
void dosmemput(const void *_buffer, size_t _length, unsigned long _offset);

So that's where the size_t thing comes from anyway.

But, there is a better way of doing this.  The easiest way is to do this...

#include <sys/nearptr.h>

char d_buffer; // the buffer you're gonna copy to the screen
// draw stuff into that ^^^ before you call "buffer_to_video"

void buffer_to_video()
{
    unsigned char *dest, *src; // makes it more readable.  not really needed

    __djgpp_nearptr_enable();
// ^^ this allows you do do stuff without using assembly
    dest=(unsigned char *)__djgpp_conventional_base+0xA0000;
// ^^ set dest to be 0xA0000 (video memory)
    src=(unsigned char *)d_buffer;
    memcpy(dest,src,64000);
    __djgpp_nearptr_disable();
// ^^ make sure you do that, or your program's more likely to take down the
system if it crashes!
}

This should also be faster than dosmemput().  (In general, the dos functions
are slow).

You can also do it in assembly, but that's more complicated, and it's only a
little bit faster.

BTW, this will work with 320x200x256.  It won't work with higher
resolutions.  For that, you'll need to switch memory banks and other more
complicated stuff.  There's a couple good tutorials for that kind of thing
at the docs section at www.delorie.com.

If that doesn't work, then I probably typo'd.  Let me know and I'll try
again... :)

Good luck!
Mark

>Hya, I just started learning graphic and I just run into a problem. Using
>the guide to VGA mode 13h at:
>http://www.delorie.com/djgpp/doc/ug/graphics/vga.html
>using a memory buffer to store a picture before I draw it on te screen I
>got some errors. The code snippet is on the above address, didn't won't to
>paste it here. Compiling using DJGPP like this:
>C:\>djgpp\gcc -c -Wall graphic.c -lm
>I got the following error:
>c:/djgpp/include/sys/movedata.h:22 parse error before `size_t'
>(actually there was 12 of these on different lines but anyway).
>
>What did I do wrong?
>


- Raw text -


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