printing...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Ozguxxx

printing...

Post 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...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:printing...

Post 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);
Post Reply