开发者

Displaying data using BIOS in C

Is there any way to print data using bios in c. I know in assembly you can use int 0x10, but is there any equivale开发者_如何学Cnt for C?


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜