BIOS

I want to start programming which would require knowledge of BIOS.
Please tell me where to start reading for bios
Thanks in advance

Whoa whoa WHOA! *handbrake*

What do you mean "requires knowledge of BIOS"? Do you mean that it requires knowledge of some low-level programming language? That it requires knowledge of the BIOS of your system? Or...

-Albatross
I think he means he wants to write real-mode code using the BIOS to

You could write bootsector programs. For example, you could write a bootsector program (this would have to be in x86 assembly language) to load another program from the disk. The second program has to be a flat binary starting at origin 0, and also has to be written in x86 assembly AFAIK (unless you use objcopy). This one, however, doesn't have a 512-byte limit on it -- you can implement a filesystem driver (ext2 and ReiserFS are good) and implement loading of executable files (ELF is reasonably well documented apparently). Then you can write a third program (or "stage") in C or even C++ -- just load it into memory somewhere and you basically have a 3-stage bootloader.
Iwant to consider BIOS interrupts in my program. How can it be done??
Well, you can't "consider" BIOS interrupts in 32-bit code. You'll have to write real mode code. When an operating system switches to protected mode they have to load an IDT (Interrupt Descriptor Table) which overwrites the interrupt vectors placed by the BIOS. You won't be able to call BIOS interrupts any more. If you call an interrupt vector that does not exist, you'll get a triple fault and the CPU will likely reset.

To write real mode code you either need to write your code in assembly language or find a 16-bit C compiler. I believe DJGPP will help you: http://www.delorie.com/djgpp/16bit/

There's not a C++ compiler there so you'll have to write C code.

As for BIOS interrupts, you'll have to do something like this:
1
2
3
4
void interrupt(unsigned int number)
{
        asm("int %0", ::"r"(number));
}
This brings back memories of the old DOS days...
Writing bootsectors is quite fun. Another thing you can do is install FreeDOS on an emulator and write programs to steal control of the system... kinda like Loadlin.
Topic archived. No new replies allowed.