Date: Thu, 28 Jun 2001 21:04:41 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Ravi DOT M AT smartm DOT com Message-Id: <2427-Thu28Jun2001210440+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <200106281344.QAA14266@is.elta.co.il> (Ravi.M@smartm.com) Subject: Re: help References: <200106281344 DOT QAA14266 AT is DOT elta DOT co DOT il> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk [Please keep this discussion on the news group.] > From: Ravi DOT M AT smartm DOT com > Date: Thu, 28 Jun 2001 19:16:57 -0700 > > this is the program i want to debug. What exactly is the problem? Which parts of the program don't work, and how do they fail? I can't debug a program from far away without even knowing how does it fail, can I? Also, what command-line arguments did you try to pass to the program? > offset=dos_mem_init(addr,size); /* initialises the memory and returns the offset */ > > for(i=0;i { > _farpokel(gselector,i,'a'); /* write something to the allocated space */ This is not entirely correct: you go all the way to the last byte of the allocated memory region, but write a full 32-bit dword (i.e., 4 bytes) there. This means that the last 3 iterations through the loop will certainly GPFault, because they exceed the limit of the descriptor created for accessing this memory region. The same problem exists in dos_read_from_mem. If you want to read and write single bytes, use _farpokeb and _farpeekb, not _farpokel and _farpeekl.