使用 C 语言的 BIOS 显示数据

发布于 2024-09-11 01:06:44 字数 61 浏览 1 评论 0原文

有没有办法在c中使用bios打印数据?我知道在汇编中您可以使用 int 0x10,但是 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪之魂 2024-09-18 01:06:44

这取决于操作系统是否已经在运行。
如果是,则取决于正在运行的操作系统。但通常,如果使用 C,则应该有 C 标准库可用。因此,请使用 printf() 和/或 stdout...

如果没有可用的操作系统,则取决于 CPU 模式。

如果CPU运行在实模式,则使用10h BIOS中断。
您甚至可以在 C 语言中执行此操作。大多数 C 编译器允许内联汇编。
例如,对于 GCC,请使用 __asm 关键字。

如果您处于 32 位保护模式,则需要手动管理视频,因为 BIOS 中断不再可用。

在这种情况下,打印数据只是写入包含视频缓冲区的内存区域。您需要知道您处于哪种视频模式,以便您可以以正确的格式写入数据,以及内存缓冲区的内存地址是什么。
在这种情况下,只需声明一个指向内存区域的 char 指针,然后写入字符...

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文