delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/24/16:00:57

Date: Fri, 24 Sep 1999 22:45:21 -0500 (GMT)
From: Anuj Bhatia <bhatia AT giasdla DOT vsnl DOT net DOT in>
X-Sender: bhatia AT giasdla
To: djgpp AT delorie DOT com
Subject: Re: farptr problem
In-Reply-To: <Pine.SOL.4.05.9909222039190.17368-100000@giasdla>
Message-ID: <Pine.SOL.4.05.9909242241281.13986-100000@giasdla>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


On Wed, 22 Sep 1999, Anuj Bhatia wrote:

> 
> Hi
> 
> I'm trying to read the VESA OEM String from my program. I have read the
> faq and an article on www.delorie.com. I have followed all the 
> instructions. My problem is that whenever I use the _farpeekb function in
> a loop I always get a string of ASCII 1's. However when I use the
> dosmemget function the results are correct. I am using _dos_ds as the
> selector for the farpeekb function. (I have read that the dosmemget
> function also uses _dos_ds internally). I do convert the far ptr returned
> by the VESA driver to a linear offset. (I use the same offset for farpeekb
> and dosmemget). Why doesn't farpeekb work?
> 
> Thanks in advance
> 
> Anuj
> 
> 

I was about to post my code when I found out the problem. I had not
written the loop using farpeekb correctly, I had written:

while(s[j++] = farpeekb(_dos_ds,off++) != 0) 
	;

The precedence of = is lower than that of != so the result of the
comparison was being asigned to s.

Sorry about the goof up

Anuj

- Raw text -


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