need help with text in pmode

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
thoover

need help with text in pmode

Post by thoover »

ok, i checked the OSFAQ and followed all instruction and did the osdever sample c. and it just put weird symbles on all of my computers.

;==P and then the pi symble is what was displayed when it was supose to be "Hello Booting....Done"
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Re:need help with text in pmode

Post by Kevin McGuire »

What compiler and linker options did you use, and what does a small code snipplet of the printing routines look like?

It sounds like the "Hello Booting.. Done" string is being stored in what is called the data section of the ELF32. The linker normaly gets told where the text, data, and other sections will be so it creates hard links instead of using position independant code that would instead create a relative link such as a relative to the current EIP. If the data section is instead loaded somewhere else you can end up with that problem. This is also just one of many possible problems, but it is the first I would check.

A possible solution could be to use a linker script such as in this post.
http://www.mega-tokyo.com/forum/index.p ... adid=10144
thoover

Re:need help with text in pmode

Post by thoover »

im using FASM, and DJGPP with link.ld. FASM is just for the int 10h and boot code. DJGPP for the K_PRINT functin and K_MAIN function.
GLneo

Re:need help with text in pmode

Post by GLneo »

can we see your code? ;)
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Re:need help with text in pmode

Post by Kevin McGuire »

http://www.mega-tokyo.com/osfaq/How%20d ... %20my%20OS

Make the kernel print the address of the string you are trying to display. Check that with the kernel image. See if it is trying to load something outside of the kernel image or from the wrong place.

Use objdump or whatever program you have to dump out the sections and find where the string is stored and use that to debug it.
thoover

Re:need help with text in pmode

Post by thoover »

here is my code:

Code: Select all

K_main()
{
???k_print(0x07, ?Hello Booting....Done?);
???for(;;);
}
k_print(int colour, char *string)
{
       char *video=(char*)0xB8000;
       while(*string!=0)
       {
             *video=*string;
              string++;
              video++;
              *video=colour;
               video++;
        }
}
all i added was k_main
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Re:need help with text in pmode

Post by Kevin McGuire »

Check the linker script, or how you specify the physical address of the data section.

If you use an a-out kludge check the address fields of the Multiboot header.
http://www.gnu.org/software/grub/manual ... cification

Try writting some code to do a binary search in memory for the string, then write a routine to print the address pointed to by "Hello Booting..Done", see if they match up or do not.

char *str = "Hello Booting..Done";
k_printnum((unsigned int)str);
Find 'h' 'e' 'l' 'l' 'o' in memory, print address.
Post Reply