problem with printing string ! [SOLVED]
Posted: Sat Nov 18, 2017 12:13 pm
EDIT: the mistake was in the makefile
Hi all,
I'm following Blundell's guide to write a simple OS.
The bootsector works as a charm. In the kernel I can clear the screen and print characters individually, but when I want to print a string I get only the letter "A" !!
I'm working under WIN and using nasm, mingw and bochs .
Many thanks in advance.
Hi all,
I'm following Blundell's guide to write a simple OS.
The bootsector works as a charm. In the kernel I can clear the screen and print characters individually, but when I want to print a string I get only the letter "A" !!
I'm working under WIN and using nasm, mingw and bochs .
Code: Select all
void kmain(void)
{
const char *str = "Hello world!";
char *vidmem = (char*)0xb8000;
unsigned int i = 0;
unsigned int j = 0;
// clear screen OK
while(j < 80 * 25 * 2) {
vidmem[j] = ' ';
vidmem[j+1] = 0x07;
j = j + 2;
}
// print a character OK
j=0;
vidmem[j] = 'A';
vidmem[j+1] = 0x07;
// print a string : this part don't work !!!!
j = 0;
while(str[j] != '\0') {
vidmem[i] = str[j];
vidmem[i+1] = 0x07;
++j;
i = i + 2;
}
return;
}