Date: Wed, 14 Dec 1994 15:42:14 -0500 From: davis AT amy DOT tch DOT harvard DOT edu ("John E. Davis") To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: seeking advice Hi, 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 like some advice concerning reading/writing to/from the framegrabber. I am very worried about the overhead of going into and out of protected mode or whatever it is that GO32 must do to make this possible. 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. Reading and writing to the frame grabber buffer position (x, y) using Borland's BCC is accomplished by two steps: 0. Declare a variable `fg_buf': unsigned char far *fg_buf = (unsigned char far *) 0xd4000000L; 1. Make the 512 bytes of row y accessable. This is accomplished by READING as follows: unsigned char tmp = fg_buf[0x400 + y]; This tells the frame grabber to make 512 bytes of row y available. 2. Now, access the 512 bytes as desired using: fg_buf[x] To make this more understandable, here is a function that returns the grayscale at position (x,y) of the framegrabber: unsigned char tmp; unsigned char far *fg_buf = (unsigned char far *) 0xd4000000L; unsigned char read_from_fg (int x, int y) { /* make row y available */ tmp = fg_buf[0x400 + y]; return fg_buf[x]; } The problem is how to do this in such a way that it works with DPMI and is efficient at the same time. I suspect that one would use the `move_data' functions along with the `_go32_conventional_mem_selector' function. It seems to me that every access to `fg_buf' would have to be replaced by a call to `move_data'. I make many of these calls per second (say 20). I am worried about the performace hit. Any suggestions would be appreciated. Thanks, --John E. Davis