x86 assembly int 16h flush键盘缓冲区

时间:2015-02-19 09:25:16

标签: assembly x86 bios

我正在编写适用于引导扇区的程序,并尝试使用BIOS中断16h 读取键盘输入,但我不知道如何刷新键盘缓冲区来读取 下一个关键输入。

    mov ax,0604h
    int 16h
    mov ah,11h
    int 16h
    cmp ah,1fh;for S
    jne nxt1
    mov [dest],00000000b
    nxt1:

2 个答案:

答案 0 :(得分:1)

你走在正确的轨道上。

虽然我不太确定你在寻找什么,但我有一个想法。

中断int 16h 00h不仅从键盘缓冲区读取,而且还删除从缓冲区读取的密钥,并将ASCII格式存储在AL中。这样,缓冲区就不会继续填充和填充。

更多信息here

答案 1 :(得分:0)

我认为你不需要用BIOS键盘输入来清理任何缓冲区。

以下程序接受任意数量的输入,并像文本编辑器一样将它们打印到屏幕上:

start:

    /* Read to al. */
    mov $0x00, %ah
    int $0x16

    /* Print al. */
    mov $0x0E, %ah
    int $0x10

    jmp start

带有完整构建模板on my GitHub的工作示例。