delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/06/05/03:31:45

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Honiewelle <honiewelle AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Flat memory access
Date: Thu, 5 Jun 2008 00:25:59 -0700 (PDT)
Organization: http://groups.google.com
Lines: 64
Message-ID: <aff31121-32d9-4352-9519-d0b1d49a186b@i18g2000prn.googlegroups.com>
References: <1df56ce7-2c42-4092-b71b-2c0b988c535e AT d19g2000prm DOT googlegroups DOT com>
<ae6d11b5-6353-40d5-be59-775b7ad531bc AT q27g2000prf DOT googlegroups DOT com>
<g26f8j$b7m$1 AT aioe DOT org>
NNTP-Posting-Host: 58.185.89.6
Mime-Version: 1.0
X-Trace: posting.google.com 1212650759 24506 127.0.0.1 (5 Jun 2008 07:25:59 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Thu, 5 Jun 2008 07:25:59 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: i18g2000prn.googlegroups.com; posting-host=58.185.89.6;
posting-account=aex66goAAAChGIzur3np6V2SxBId_WZm
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9)
Gecko/2008051206 Firefox/3.0,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 singnetproxy:8080 (squid/2.6.STABLE5)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m557U2sm002651
Reply-To: djgpp AT delorie DOT com

On Jun 5, 12:16 am, "Rod Pemberton" <do_not_h DOT  DOT  DOT  AT nohavenot DOT cmm> wrote:
> "Honiewelle" <honiewe DOT  DOT  DOT  AT gmail DOT com> wrote in message
>
> news:ae6d11b5-6353-40d5-be59-775b7ad531bc AT q27g2000prf DOT googlegroups DOT com...
>
>
>
> > oops sorry, I forgot to include the line for declaring variable value,
> > here's the corrected code:
>
> > /* code starts here */
>
> > #include <stdio.h>
> > #include <pc.h>
> > #include <dpmi.h>
> > #include <sys/farptr.h>
> > #include <go32.h>
>
> > int main (void)
> > {
>
> >     FILE *fp;
> >     __dpmi_meminfo mi;
> >     int selector;
> >     int ctr;
> >     int value;
>
> >     mi.address = (0xEC080000); // PCI Base Address register
> >     mi.size    = 1024;
>
> >     __dpmi_physical_address_mapping (&mi);
> >     selector = __dpmi_allocate_ldt_descriptors (1);
> >     __dpmi_set_segment_base_address (selector, mi.address);
> >     __dpmi_set_segment_limit (selector, mi.size - 1);
>
> >     fp=fopen("bar5.txt","wb");
>
> >     for (ctr=1;ctr<=1024;ctr++)
> >     {
> >         value = _farpeekb(_dos_ds, ctr-1);
>
> Don't you want your selector: 'selector' instead of '_dos_ds' ?  _dos_ds is
> another selector for below 1Mb.
>
> >         putc(value,fp);
> >     }
>
> >     fclose(fp);
>
> >     return 0;
>
> > }
>
> > /* code ends here */
>
> Rod Pemberton


Thanks Rod, I'll try what you said... by the way, did someone here
already
have experience accessing memory space i/o in djgpp?

-Honiewelle

- Raw text -


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