首页 > 解决方案 > 装配 16h BIOS 调用不起作用

问题描述

char getchar() {
    char a;
    __asm {
            int 16h
            mov [a], AL
    }
    return a;
}

我试图从键盘获取用户输入,但不是等待按键,而是在不按键盘上的任何键的情况下返回奇怪的字符。

标签: cassemblyx86keyboardbios

解决方案


As mentioned here, 16H interrupt has several services and you have to select one of them using ah register.

function code for reading key press is 0 so you have to xor ah, ah(set ah to zero) before int 16h.


推荐阅读