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.
#include "io/io.h"
#include "misc/ops.h"
#include "misc/startup_test.h"
void kmain(void* mbd, unsigned int magic)
{
if(magic != 0x2BADB002)
{
put_string("Invalid Magic Number. Maybe you should get a wizard next time!\n");
k_hang();
}
clear_screen();
k_startup_test();
put_string("Hello People,\n\nThis is a test.\n\nSee if you can pass it.\n\nYou failed.\n\n");
}
What is the value of 'colour' when it writes it to display?
Does it ever get changed?
What happens if you just write a single character to display with attribute 0x07?
Are their any changes if running on real hardware or other environments?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
You are not incrementing the pointer to video-RAM before you write the cursor, so you end up overwriting the attribute byte with an underscore, which happens to encode white on purple.
DLBuunk wrote:You are not incrementing the pointer to video-RAM before you write the cursor, so you end up overwriting the attribute byte with an underscore, which happens to encode white on purple.
Thanks, I'll try that tomorrow when I get to that computer.
MDM wrote:0xF0 (not 0x0F aka 0xF) is black on white, however, it sounds like you've got some form of other problem. Have you tried reading whats in 0xB8000?
It's supposed to be white on black, but thanks anyway.
Ah, excuse my blunder of reading. Black on white is impossible, closest you can get is black on grey (the background color is 3 bits, the fourth bit is the special attribute which doesn't turn grey into white).
MDM wrote:Ah, excuse my blunder of reading. Black on white is impossible, closest you can get is black on grey (the background color is 3 bits, the fourth bit is the special attribute which doesn't turn grey into white).
DLBuunk wrote:You are not incrementing the pointer to video-RAM before you write the cursor, so you end up overwriting the attribute byte with an underscore, which happens to encode white on purple.
Thanks, I'll try that tomorrow when I get to that computer.
Cheers.
Thanks, that worked. Also changed it so it calls move_cursor in the write_char function. Next I'm gonna make the White-On-Black wrapper functions macros to increase speed and decrease size.