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 have this bootloader code, and I am not sure how to enable video mode. Can anyone please help me? I read something about adding system interrupt, but when I add that bootloader stops working.
I see you're using Multiboot to load your bootloader. Multiboot loads your binary in 32-bit mode, so BIOS interrupts aren't accessible. You could switch out of 32-bit mode and go back to 16-bit real mode. But if you're already using Multiboot, why are you writing a bootloader?
AppexX wrote:Can you explain to me how to go back to 16 bit mode?
Steps (assuming there's no paging):
Make sure your code is running below 0x00100000. I'd recommend using an area in the first 64 KiB of RAM as it makes diddling with segments simpler (e.g. all segment bases can be zero).
Disable IRQs if you have to. I'd recommend loading an IDT with "IDT limit = 0" to ensure you get predictable behaviour (triple fault) if an NMI occurs.
Load 16-bit protected mode segments into all segment registers (you need suitable code and data descriptors in your GDT for this)
Clear the "protected mode enable" bit in CR0
Do a little jump (recommended to clear the CPU's pipeline on old CPUs)
Load values suitable for real mode into all segment registers
Load an IVT that has "base = 0, limit = 256*4" so it's what the BIOS will expect
Enable IRQs
After this, you're in real mode.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
AppexX wrote:I have this bootloader code, and I am not sure how to enable video mode. Can anyone please help me? I read something about adding system interrupt, but when I add that bootloader stops working.