Date: Fri, 25 Jul 1997 10:04:56 -0700 (PDT) Message-Id: <199707251704.KAA26954@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: bminier AT aol DOT com From: Nate Eldredge Subject: Re: Direct video access. Cc: djgpp AT delorie DOT com Precedence: bulk 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