| delorie.com/archives/browse.cgi | search |
| From: | "Mauro Da Ros" <daros AT elettra80 DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | **HELP** direct memory access... |
| Date: | Fri, 18 Dec 1998 10:03:38 +0100 |
| Organization: | ITnet S.p.A. is not responsible of the content of this article as posted by one of its customers. |
| Lines: | 63 |
| Message-ID: | <75d67p$d2o$1@news.IT.net> |
| NNTP-Posting-Host: | bori001.pn.itnet.it |
| Mime-Version: | 1.0 |
| X-Trace: | news.IT.net 913972281 13400 151.2.144.70 (18 Dec 1998 09:11:21 GMT) |
| X-Complaints-To: | news AT IT DOT net |
| NNTP-Posting-Date: | 18 Dec 1998 09:11:21 GMT |
| X-Newsreader: | Microsoft Outlook Express 4.72.3110.5 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Ciao
I have a numeric control with a static RAM beginning at 0xd0000.
So I wrote this functions :
#define RAMTAMPONE 0xd0000
external struct PAR par; // struct to store in SRAM
void Dmempoke ( int ofs , unsigned char c) {
_farsetsel (_dos_ds);
_farnspokeb ( RAMTAMPONE + (long) ofs, c);
}
unsigned char Dmempeek ( int ofs ) {
_farsetsel (_dos_ds);
return _farnspeekb ( RAMTAMPONE + (long) ofs);
}
void RWRam(bool write) { // write-read the parameter struct in SRAM
unsigned char *c;
c = (unsigned char*)∥
if (write) {
for (int i=0;i<sizeof(PAR);++i) {
Dmempoke (i,c[i]);
}
}
else {
for (int i=0;i<sizeof(PAR);++i) {
c[i] = Dmempeek (i);
}
}
}
PAR is the struct with my parameters to store in static ram.
The very strange thing is that if I make a simple test program
with
par.t1 = 10;
RWRam (true); // (write)
par.t1 = 0;
RWRam (false); // (read)
it works. If i enclose in my allegro application (780 K) it, it
DOESN'T WORK :((((
I think there are problems on that _dos_ds, but I don't know
WHAT to use !!!
Please help me... and please cc in email
Ciao
Mauro
daros AT elettra80 DOT com
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |