Mail Archives: djgpp/1997/07/25/13:05:40
You wrote:
>Hello, I am trying to write directly to the video without using bios or
>dos. But
>everytime I try this following program, I get a SIGSEGV (which i am
>guessing means a segment violation?) I attempted to re declare vidptr as
>char far *vidptr but DJ does not recognize it. So, what am I doing wrong?
>
>int
>main (void)
>{
> char *vidptr = (char *) 0xB8000000;
>
> *vidptr = 'a'; /* Write a to screen. */
> *(vidptr + 1) = (char) 1; /* In blue. */
>
> return 0;
>}
DJGPP runs programs in protected mode. You can't access outside your
program's space with normal pointers. This is a feature.
The way to do what you want is probably like this:
int main(void)
{
short vid_sel;
vid_sel = __dpmi_segment_to_descriptor(0xB800); /* Make the selector */
if (vid_sel == -1) abort(); /* or bomb out some other way */
farpokeb(vid_sel,0,'a');
farpokeb(vid_sel,1, 1 );
return 0;
}
Nate Eldredge
eldredge AT ap DOT net
- Raw text -