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.
Hello,
First of all, I am just making an simple OS for the heck of it.
So I stumbled upon the series of tutorials by JamesM, and I have compiled his 2nd tutorial (no code modifications)
Under bochs(2.3.7CVS) and qemu(.9.1) I get an odd distortion on the printing of Hello, world!
All characters with different colored backgrounds... I have an idea of what the problem is, but I am unsure of how to fix it.
I also have a hunch it may be because of my 64 bit architecture? I am using the appropriate compiler flags to compile to 32 bit
It's because each VGA character requires 2 bytes - a colour code and the character data. This means that the VGA is interpreting every other byte of "Hello World!" as a colour code.
I don't see what is wrong with it then... if the attribute has already been shifted over 8 bits shouldn't the OR combine them?
Sorry, my weakest point of programming is probably bitwise/bitshifting operations.
Is *location a pointer to a 16 bit wide integer? If you're only incrementing it by a single byte between each character, that could still have the effect you're seeing. Or perhaps c and attribute are only 8 bits wide and the shift isn't doing what you expect because of an overflow (you are using -Wall and -Werror, I assume? Also see Makefile for loads more warning switches).
I can assure you that the VGA works the same on 32 and 64 bit architectures.