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 ran into this problem in the past but dont know how I solved it nor what the actual problem is. I have this test code that I suspect should simply output the character 'a' using the bios interrupt 0x10 function 0xe running in real mode:
The problem is, nothing at all happens. No character is displayed. No crashes/warnings from bochs. It gets to the cli+hlt combo at the end as well. While might not be relevant, hardware interrupts are enabled. I also know other interrupts work fine (I tested int 0x10 function 0 to set video modes--worked fine.) I also know this interrupt should work fine (Have been able to use it in this project just fine before.) I can also see the cursor visually on screen so I would suspect the bios to display the character where the cursor is. I also know this does not happen just in bochs, but Virtual PC to.
Does anyone know what can cause this? Thanks for any possible answers
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
StephanVanSchaik wrote:Your nullify ebx, thereby you nullify bl, which holds the foreground color.
It does not matter what value I put in bl, it still seems to do nothing
If I take a snapshot of the bochs window, there is no character in the output file (snapshot.txt) either so I am thinking its a little more then a color problem...
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
You sure bl doesn't matter? Because it should be 0x7 for normal gray-on-black. When bl is zero it SHOULD display nothing (black on black). Does it at least move the cursor?
Is there any memory writing going on before you're trying to print the character? The only other thing I can think of is the BIOS isn't being called due to a corrupted IVT.
Also, in Bochs bl does nothing, at least not in my version. Socks uses xor bx, bx but I haven't had a chance to test on RHW, so I don't know if that's standard behavior.
Firestryke31 wrote:Is there any memory writing going on before you're trying to print the character? The only other thing I can think of is the BIOS isn't being called due to a corrupted IVT.
Technically yes (the new boot code program) however not in the program the problem is happening in. However, technically the problem also occurs in the boot code so it is a possibility. I assumed it was fine do to the bochs debugger, single stepping, it seems to be fine. Ill take a look though...
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}