Mail Archives: djgpp/1994/09/22/20:57:46
(Sorry if this is a repeat, I think it disappeared into the
cyberspace void last time.)
What is the proper usage of the _farsetsel() function ?
Initially, I thought I could just load a segment, i.e.,
main()
{
_farsetsel(0xb800);
/* .... */
}
but that generates a General Protection Fault. So then I
tried the following program:
#include <stdio.h>
#include <go32.h>
#include <sys/farptr.h>
int main()
{
unsigned long i;
_farsetsel(_go32_conventional_mem_selector());
for (i = 0xb8000; i < 0xa0000; i++)
_farnspokew(i, 0x0700 | 65);
}
If the 'selector' points to the bottom of DOS memory, as returned
by _go32_conventional_mem_selector(), I should be able to put the
absolute address 0xb8000 in for the offset...
I expected the text screen to be filled with the letter 'A' when
run from an 80x25 text screen on a VGA monitor.
However, nothing happened, the program runs and finishes with no
discernible effect.
This is with DJGPP 1.12 / GCC 2.6.0 . I didn't try far pointers
with DJGPP 1.11 so I am not sure how they are supposed to work.
_farpeekb(0x40,0x4a) works just fine, returning the
screen width from the BIOS data area.
Any suggestions?
Gordon
- Raw text -