⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 df.c

📁 Linux0.01设备驱动程序 最精简的linux代码 适合操作系统入门
💻 C
字号:
/* df.c */
#include <stdio.h>
#include <pc.h>

void detect_floppy_drives()
{
    unsigned char c;
    unsigned char a, b;
    char drive_type[][50] = {
                                "no floppy drive",
                                "360kb 5.25in floppy drive",
                                "1.2mb 5.25in floppy drive",
                                "720kb 3.5in",
                                "1.44mb 3.5in",
                                "2.88mb 3.5in" };

    outportb(0x70, 0x10);
    c = inportb(0x71);

    a = c >> 4;		// get the high nibble
    b = c & 0xF;	// get the low nibble by ANDing out the high nibble

    printf("Floppy drive A is an:\n");
    printf(drive_type[a]);
    printf("\nFloppy drive B is an:\n");
    printf(drive_type[b]);
    printf("\n");
};

int main()
{
    detect_floppy_drives();

    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -