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.
I am using bochs for testing my OS work, to keep my PC safe. I am having an issue with the bochs BIOS. I am trying to set the color of a character when I display it with a BIOS interrupt. It always shows as the default light grey on black. My code:
Bochs doesn't support color attributes under text mode. That's not a big issue from my point of view. I'm not quite sure about the newer releases, you may want to check it to be sure.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
kendfrey wrote:Is there a way to get color or not?
Try the latest version of Bochs. If it still doesn't help, there are other emulators that do support color attributes. IIRC, Microsoft Virtual PC does.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
I doubt there will be a newer version, since I downloaded it last week. If I feel a dire need for color, I will look into another emulator. Otherwise, bochs seems to be working great. Thanks for your help!
kendfrey wrote:I doubt there will be a newer version, since I downloaded it last week. If I feel a dire need for color, I will look into another emulator. Otherwise, bochs seems to be working great.
It really does work great. You can still try other emulators to see how well your code runs under them.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Writing directly to video memory works for color. I got both background and foreground colors. I couldn't get 'bright' background colors, because that bit makes the character blink.
Bochs doesn't support color attributes under text mode.
Incorrect. The interrupt he is using is wrong -- its not for colored text output. The color attribute in that interrupt service is for graphics modes only. Try INT 0x10 function 9 - it works in Bochs.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
kendfrey wrote:Writing directly to video memory works for color. I got both background and foreground colors. I couldn't get 'bright' background colors, because that bit makes the character blink.
It's normal behaviour. You can try to change this directly through "attribute controller" or you can use function 10h, subfunction 3.
If you have seen bad English in my words, tell me what's wrong, please.
Bochs doesn't support color attributes under text mode.
Incorrect. The interrupt he is using is wrong -- its not for colored text output. The color attribute in that interrupt service is for graphics modes only. Try INT 0x10 function 9 - it works in Bochs.
This document claims that the color attributes doesn't work under Bochs. It features the example code of Teletype Output, so any statement it makes about text color must be wrong. You see it's not a surprise to find broken tutorials over the net.
Anyway, thanks for the correction.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !