www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/15/06:03:28

To: davis AT amy DOT tch DOT harvard DOT edu ("John E. Davis")
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: seeking advice
Date: Thu, 15 Dec 94 08:35:30 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>

>    I am writing a program that accesses a frame grabber.  Currently this
> program is written in BCC but I would like to port it to DJGPP.   I would
>    Although the frame grabber buffer consists of 512x512 bytes, only 512
> bytes of it are actually available at a time starting at memory address
> 0xd4000000.
>    unsigned char read_from_fg (int x, int y)
>    {
>         /* make row y available */
> 	tmp = fg_buf[0x400 + y];
> 	return fg_buf[x];
>    }

If you only access the data one character at a time, you should use
_farpeekb() function defined on <sys/farptr.h>.  When you compile with
optimization, it generates inline assembly code of a few assembly
instructions.  No DPMI and/or mode switching is involved, so this
should be about as efficient as the BCC code.

If you want to move large parts of the 512-byte frame at once, then
you could use the dosmemget() function which also doesn't involve a
mode switch.  If your grabber supports 32-bit moves (i.e., sits on
some kind of local bus, or EISA), you should use movedata() which
moves by double-words.

- Raw text -


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