; kb.asm PUBLIC _keyboardPressed PUBLIC _keyboardHandler .386 .model flat,c .DATA _keyboardPressed db 0 .CODE _keyboardHandler: cli push eax push ebx in al, 0x60 mov bl, al ; acknowledge keyboard in al, 0x61 mov ah, al or al, 0x80 out 0x61, al xchg ah, al out 0x61, al and bl,0x80 jne _keyboardHandler_notKeydown mov [_keyboardPressed], 1 _keyboardHandler_notKeydown: ; acknowledge interrupt mov al, 0x20 out 0x20, al pop ebx pop eax sti iretd ; needed for 32 bit protected mode