cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/2003/05/22/13:15:10

From: rogers AT westmont DOT edu (wfrogers)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: trouble accessing dos high memory
Date: 22 May 2003 10:09:18 -0700
Organization: http://groups.google.com/
Lines: 93
Message-ID: <89ce6cc3.0305220909.5c397728@posting.google.com>
References: <89ce6cc3 DOT 0305211425 DOT 5aa187a6 AT posting DOT google DOT com> <bai9bg$mk2$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: 63.147.59.36
X-Trace: posting.google.com 1053623358 25875 127.0.0.1 (22 May 2003 17:09:18 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 22 May 2003 17:09:18 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote in message news:<bai9bg$mk2$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>...
> wfrogers <rogers AT westmont DOT edu> wrote:
> > I am trying to access 0xD000 using a simple C program compiled with
> > DJGPP and am getting
> 
> *How* are you accessing it?  You should have no problems at all doing
> this with the farptr functions or _dosmemget/put.

Thanks for your reply.  By the way, the subject header I originally
included ought to have read "upper" memory, since the D page is within
the 1MB dos conventional memory.

I'll copy below the code in its two versions, one to read from video
memory (which works) and the same code modified to read from
the D page (in which data from the acquisition card is stored in
4-byte words), which doesn't work.  The symptom is that data read from
memory and written to screen bears little or no resemblence to the
data that should be stored there from the acquisition card, and
changing the offset to look at different portions of that page doesn't
change the output dumped to screen. In the video memory example,
changing the offset successfully reads different portions of the
screen and correctly writes their ascii code values to the standard
output.

***** First example, reading from video memory *****

#include <go32.h>
#include <sys/farptr.h>
#include <string.h>

int main() {

        int i, length, Y, X;
        printf("Offset:");
        scanf("%i", Y);

        X = 10;

        long buffer[X+10];
        for(i = 0; i <= X+10; i++){
                buffer[i] = 0;
        }

        length = X;
	_farsetsel(_dos_ds);
        for(i = 0; i < length; i++) {
                buffer[i] = _farnspeekb( 0xB800*16+Y+i);
	}


        for  (i = 0; i < (length); i++) {
                printf("\n%8li", buffer[i]);
	}
	return 0;
}

***** Second example, reading from D-page memory *****
.
#include <go32.h>
#include <sys/farptr.h>
#include <string.h>

int main() {

        int i, length, Y, X;
        printf("Offset:");
        scanf("%i", Y);

        X = 10;

        long buffer[X+10];
        for(i = 0; i <= X+10; i++){
                buffer[i] = 0;
        }

        length = X;
	_farsetsel(_dos_ds);
        for(i = 0; i < length; i++) {
                buffer[i] = _farnspeekl( 0xD000L*16+Y+i);
	}


        for  (i = 0; i < (length); i++) {
                printf("\n%8li", buffer[i]);
	}
	return 0;
}

Thanks!  WFR

p.s. the same symptoms occur in the second example if we use
_farnspeekb, and/or if we specify the memory segment without the L
qualifier.

- Raw text -


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