www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/09/08:09:13

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro buffer help
Date: Fri, 7 Feb 1997 20:22:12 +0000
Organization: None
Distribution: world
Message-ID: <jmurOQA074+yEwnj@talula.demon.co.uk>
References: <855265408 DOT 12289 DOT 0 AT slicksoft DOT demon DOT co DOT uk>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

steve wilcox writes:
>hi can someone tell me a fast way to copy the contents of
>buffer array ( byte buffer[w*h]; ) direct to the display ?
>i am using allegro 2.1 

In VGA 320x200 mode, dosmemput(buffer, w*h, 0xA0000) will do the trick. 

If you are using an SVGA mode, you need to deal with bank switching,
which can most easily be done by just calling the Allegro blit()
function. To do this you will need to make your buffer into an Allegro
bitmap, but that's easily done. Instead of malloc() or whatever you
currently use to create this buffer, call:

    BITMAP *buffer_bmp = create_bitmap(w, h);
    byte *buffer = buffer_bmp->line[0];

Then you can write to your buffer with whatever code you are currently
using, and copy it to the screen with:

    blit(buffer_bmp, screen, 0, 0, 0, 0, w, h);

If you don't want to use my bitmap struct, it's pretty easy to write
your own blit function. Try something like:

    int y;
    unsigned long addr;

    for (y=0; y<h; y++) {
        addr = bmp_write_line(screen, y);
        movedata(_my_ds(), buffer[y*w], screen->seg, addr, w);
    }


/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


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