[Solved] I can't read from video memory.
Posted: Fri Apr 22, 2022 10:22 am
I have my os with custom bootloader. When I try to read from video memory (0xb8000) in vga 80x25 mode, it will not work.
Main function:
On the screen, there isn't any text, but if I remove these two lines, everything is normal.
I'm testing it in Qemu.
I'm sorry for my bad english.
Main function:
Code: Select all
char string[] = "hello world";
write_string(0x1F, string, 0);
[b] char first_char = get_one_char(0);
char second_char = get_one_char(2)[/b]
Code: Select all
void write_string(int color, char *string, int offset)
{
int i = 0;
while(string[i] != 0){
write_char(color, string[i], offset);
i++;
offset +=2;
}
}
char get_one_char(int offset){
volatile char *vid = (volatile char *) 0xb8000;
return vid[offset];
}
I'm testing it in Qemu.
I'm sorry for my bad english.