Mail Archives: djgpp/2001/06/28/15:28:58
[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<offset;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.
- Raw text -