Displaying data using BIOS in C

By : None
Source: Stackoverflow.com
Question!

Is there any way to print data using bios in c. I know in assembly you can use int 0x10, but is there any equivalent for C?

By : None


Answers

It depends whether an OS is already running or not.
If yes, it depends on the OS which is running. But usually, if using C, a C stdlib should be available. So use printf(), and/or stdout...

If no OS is available, then it depends on the CPU mode.

If the CPU is running in real mode, then use the 10h BIOS interrupt.
You can do it even in C. Most C compilers allows inline assembly.
For GCC, for instance, use the __asm keyword.

If you're in 32 bits protected mode, you need to manage video manually, as BIOS interrupts are no longer available.

In such a case, printing data is just writing into to memory area which contains the video buffer. The you need to know in which video mode you are, so you can write data in the correct format, and what's the memory address of the memory buffer.
In such a case, simply declares a char pointer to the memory area, and writes characters...

By : Macmade


This video can help you solving your question :)
By: admin