'How is the keyboard interrupts always accessible at port 60?

I am in the process of learning about operating systems and bootloaders. I have found that, to read keyboard keypresses, one can use the in assembly mnemonic with port 60. This works even when writing low-level assembly programs running on a modern machine.

I was reading this article on the topic, in order to better understand this snippet:

keyhandler:
   in al, 0x60   ; get key data
   mov bl, al   ; save it
   mov byte [port60], al
 
   in al, 0x61   ; keybrd control
   mov ah, al
   or al, 0x80   ; disable bit 7
   out 0x61, al   ; send it back
   xchg ah, al   ; get original
   out 0x61, al   ; send that back
 
   mov al, 0x20   ; End of Interrupt
   out 0x20, al   ;
 
   and bl, 0x80   ; key released
   jnz done   ; don't repeat
 
   mov ax, [port60]
   mov  word [reg16], ax
   call printreg16

How does the machine know to route a keyboard plugged into, for example, an arbitrary USB connector to port 60 so it is accessible for the programmer?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source