delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/26/05:06:15

Message-ID: <D1FB30BBA491D1118E6D006097BCAE391BE9FC@Probe-nt-2a.Probe.co.uk>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: SVGA line/copy/swap in ASM
Date: Thu, 26 Mar 1998 10:05:51 -0000
MIME-Version: 1.0

Gautier writes:
> I'm looking for code in assembler (GNAT/DJGPP format) to 

Why must it be asm? Sure, that can be the fastest way of doing the
actual drawing functions, but for the mode set and VESA interface 
routines it is a million times easier to use C.

> 1) Draw a line in a memory area (linear addressing, 1 byte per pixel)

A memory buffer can be declared as a normal C array, so you can just
use the standard C array indexing syntax to draw onto it.

> 2) Copy a buffer from a memory area to VESA video memory
>    with VESA 1.2 bank switching or using VESA 2.0 frame buffer
>    ( Is it faster when 2.0 is emulated ? How to get the address
>    of frame buffer ? )

VESA 2.0 can never be "emulated": either it is supported, or it is not.

Yes, linear framebuffer modes are usually much faster than banked
access. The address can be obtained from the VESA mode information
strucure, but you need to use several DPMI routines to map it into
your address space.

See the VESA spec (on x2ftp or www.scitechsoft.com) for details of
the VESA API, and the djgpp FAQ for information about how to do the
DPMI memory mapping, or refer to http://www.delorie.com/djgpp/doc/ug/.

> 3) Swap the display between 2 video memory areas without moving 
>    images ( Is it possible ? Is there a reliable method to determine 
>    whether swapping is supported and has enough video memory ? )

This is possible, assuming that the card has enough memory (you
can check this by looking at the VESA information structures), but
you should be warned that many VESA drivers have nasty bugs in their
implementation of the scrolling routines, so this can't be trusted
to work on every card.

I don't know of any references other than the VESA spec, but it might
also be useful to look at the vesa_scroll() function from Allegro
(in the file vesa.c).

	Shawn Hargreaves.

- Raw text -


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