Hello!

I need to display "1" when pressing NumLock in the console. But the problem is that when I read characters with int 16h :

 mov ah,10h int 16h 

The program is waiting for a key press, and when I Numlock , the program continues to wait for key presses ...

How to make so that when pressing 1 it was deduced 1, and when pressing Numlock - 2?

Thank!

    1 answer 1

    The function 10h with interrupt int 16h checks for the presence of a character in the keyboard buffer, but the keys num lock, caps lock, scroll lock, ctrl, shift ... are not buffered in the keyboard buffer. In order to determine whether NumLock is pressed, you can use function 12h and interrupt 16h , it returns the keyboard state to the AL register.

     Бит Название клавиши 0 левый Ctrl 1 Левый Alt 2 Правый ctrl 3 Правый alt 4 ScrollLock 5 NumLock 6 Caps Lock 7 SysReq 
    • thanks .... and how to programmatically make the simplest delay of 10 ms? everywhere write about 86h int 15h, but for some reason it does not work for me. Here is a piece of code: mov ah, 09h mov dx, offset msg_1 int 21h; call delay mov cx, 0ffffh mov dx, 0ffffh mov ah, 86h int 15h mov ah, 09h mov dx, offset msg_1 int 21h theoretically the interval between the output of messages should be big, but there is no interval ... - maxteam
    • try smaller numbers to take xor cx, cx mov dx, 20000 Or see the debager, can the function return an error (do you need to look at the flags like)? - Fuzzz3r