www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/16/21:05:17

Date: Tue, 16 Sep 1997 18:03:53 -0700 (PDT)
Message-Id: <199709170103.SAA26420@adit.ap.net>
Mime-Version: 1.0
To: moure AT sercomtel DOT com DOT br, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Memory address, protected mode, real mode... Arghhhhhhhhhh!

At 02:23  9/16/1997 -0300, Alessandro Moure wrote:
>Hi. I have a MCA (multichannel analyzer) board in my computer
>(gamma-ray spectroscopy) and this board has a TSR wich puts its data
>available at 0xD000 (L) address. I sweep the channels of the MCA board
>with 0xD000 + counter.
>	The TSR is 16 bit and I am using DJGPP. The main problem is: How can I
>get the data?
>	I tried:
>1	add = __dpmi_segment_to_descriptor(0xD000 + counter);
>2	data = _farpeekl(add,0);
>3	__dpmi_free_ldt_descriptor(add);
>	Ok. It won't work cause add in line 2 isn't a dos segment, ETC., then I
>tried:
>1	add = 0xD000;
>2	data = _farpeekl(_dos_ds, add*16+counter);
>	Results:
>	In the first code I can get only the first value of each segment, ie,
>0,8,16, etc. I can't read all channels one by one.
>	In the second code, I can get only trash.
>	What am I doing wrong?
Strange. Your second code should definitely work. You do have add and data
declared as int or long, right? I assume counter is an offset into the
0xD000 segment. This would be even simpler:

unsigned long data;
data = _farpeekl(_dos_ds, 0xD0000 + counter);

Maybe try this:
sel = __dpmi_segment_to_descriptor(0xD000);
data = _farpeekl(sel,counter);

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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