From: Neil Goldberg Newsgroups: comp.os.msdos.djgpp Subject: Re: calling a pointer Date: Mon, 09 Aug 1999 12:58:04 +0100 Organization: The MITRE Corporation Lines: 35 Message-ID: <37AEC24C.F58@mitre.org> References: <37ADD81B DOT 4840 AT iquest DOT net> NNTP-Posting-Host: mm58842-pc.mitre.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: top.mitre.org 934217747 16612 128.29.96.60 (9 Aug 1999 16:55:47 GMT) X-Complaints-To: usenet AT news DOT mitre DOT org NNTP-Posting-Date: 9 Aug 1999 16:55:47 GMT X-Mailer: Mozilla 3.04 (WinNT; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Mike Nansgar wrote: > > I am writing VESA VBE 2.0 routines using a combination of DJGPP and > NASM. It seems as if my code (which calls the NEAR p-mode code) half > works; it does set the page because when I write to the video, it sets > the right pixels. But immediately after setting them it crashes with a > GPF at my 'rep stosd' instruction! The same 'rep stosd' works perfectly > when used with the set bank interrupt. Any help would be greatly > appreciated. Thanks in advance! > > /* My DJGPP Pointer (the VESAPMInfo struct has the right data): */ > > void *VESA_PMPgFn = (void *)((char *)VESAPMInfo + > VESAPMInfo->SetWindow); > > ;My NASM v0.98 Routine (Inputs: DX - the page number): > > [EXTERN _VESA_PMPgFn] > VESA_SetBank: > xor BX,BX > call [_VESA_PMPgFn] > ret > > Mike Nansgar > mnansgar AT hotmail DOT com The pointer to the setwindow function is an absolute address. If you are making the call in near mode, you need to factor in the offset of your program's base address so that you are referencing memory from a base of 0, and not your program. Try *adding* __djgpp_convetional_base to VESA_PMPgFn to get the function pointer you really need. moogla