简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM