From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: 'FAR' under DJGPP Date: Sat, 02 May 1998 13:39:51 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 63 Message-ID: <354B5A67.4235@cs.com> References: <354a2ab1 DOT 4002764 AT news DOT unisys DOT com DOT br> NNTP-Posting-Host: ppp135.cs.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Bruno Barberi Gnecco wrote: > > I'd like to output a file generated by TheDraw. It's documentation says to use: > > #include > #include > #include "file.h" // this is the file containing data > int main () { > void far *screen; > int offset = -162; t > int x; > for (x=0; x (long) screen = 0xB8000000+x*160+offset; > memcpy (screen,&IMAGEDATA[x*IMAGEDATA_WIDTH*2],IMAGEDATA_WIDTH*2); > } > } > > But DJGPP doesn't accept the FAR keyword. How do I do? That's because DJGPP applications run in protected mode, where the methodology for accessing video memory (or any absolute hardware address) is completely different. A full explanation is lengthy, but you can find out for yourself by reading chapters 10, 17, and 18 of the DJGPP Frequently Asked Questions list (v2/faq210b.zip from SimTel or online at http://www.delorie.com/djgpp/v2faq/). There are also some tutorials available; see the DJGPP User's Guide (http://www.delorie.com/djgpp/doc/ug/) and Brennan's DJGPP2+Games Resources (http://www.rt66.com/~brennan/djgpp/). Just for kicks, I'll correct the above code for you using one of the three methods described in FAQ chapter 18.4: #include #include #include "file.h" // this is the file containing data int main( void ) { int offset = -162; int x; for ( x = 0; x < IMAGEDATA_DEPTH; x++ ) dosmemput( &IMAGEDATA[x * IMAGEDATA_WIDTH * 2], IMAGEDATA_WIDTH * 2, 0xb8000 + x * 160 + offset ); return 0; } I _think_ this will work. I can't test it because I don't have your header file. It's not quite as fast as using near pointers but it's safer. hth -- John M. Aldrich, aka Fighteer I UIN# 7406319 -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------