Mail Archives: djgpp/1997/05/13/09:34:27
| From:  | Shawn Hargreaves <shawn AT talula DOT demon DOT co DOT uk>
 | 
| To:  | djgpp AT delorie DOT com
 | 
| MMDF-Warning:  | Parse error in original version of preceding line at punt-1.mail.demon.net
 | 
| Subject:  | Re: ALLEGRO internals
 | 
| Date:  | Tue, 13 May 1997 09:16:20 +0100
 | 
| MIME-Version:  | 1.0
 | 
| Message-ID:  | <863528350.0521144.0@[194.129.18.166]>
 | 
Krystyna de Heras writes:
> I want to be able to write to the bitmap that ALLEGRO uses to blit to
> screen. Is there a inline asm way to do this? And can I draw to the
> bitmap even if it's target screen is a planar mode-x, in a similar way
> as a 13h-mode for example?
Read the section titled "video memory access" in allegro.txt.
Basically, for a mode 13h or VBE 2.0 linear framebuffer screen, you can do
something like:
   #include <sys/farptr.h>
   void linear_putpixel(BITMAP *bmp, int x, int y, int color)
   {
      _farpokeb(bmp->seg, (unsigned long)bmp->line[y]+x, color);
   }
For a banked SVGA screen (this will also work in linear modes), do:
   void banked_putpixel(BITMAP *b, int x, int y, int color)
   {
      unsigned long address = bmp_write_line(bmp, y);
      _farpokeb(bmp->seg, address+x, color);
   }
To use a planar mode-X screen, you'll have to also set the VGA plane
registers, eg:
   #include <pc.h>
   #include <sys/farptr.h>
   void modex_putpixel(BITMAP *b, int x, int y, int color)
   {
      outportw(0x3C4, (0x100<<(x&3))|2);
      _farpokeb(bmp->seg, (unsigned long)bmp->line[y]+(x>>2), color);
   }
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk
Beauty is a French phonetic corruption of a short cloth neck ornament
- Raw text -