Page 1 of 1

printing...

Posted: Sun Sep 15, 2002 1:49 pm
by Ozguxxx
Hey everybody... This will be a new silly question...

void write_string(int colour, char *string)
{
   char *video=(char*)0xB8000;
   while(*string!=0)
   {
      *video=*string;
      string++;
      video++;
      *video=colour;
      video++;
   }
}

I think this function should write text pointed by string onto first line of screen in text mode. But I could not make it run. Is this because DJGPP does not take 0xb8000 as a memory address but a pointer in with a garbage value in it? I am working in pmode, a20 is enabled, code is loaded at 0x5000. Any ideas are welcome. Thanx...

Re:printing...

Posted: Mon Sep 16, 2002 1:18 am
by Pype.Clicker
i think you must find a segment that is 0-based (or build one with DjGPP functions) and use it to print out. If you have no 0-based segment, then just get the base address of your current data segment and do

video = (void*) (0xb8000-segment.base);