V22.0201.002, Machine Organization I
Fall 1997

NOTES ON KEYBOARD

This supplements the notes in chap.12 of textbook.


INTRODUCTION


KEYBOARD INTERRUPT FUNCTIONS

SUMMARY OF INT 16h FUNCTIONS
Function Number (in reg AH) Actions
fcn=00h: wait for keypress and read char OUTPUT: AH=scan code, AL=ascii character or 0 in non-ascii.
Program is halted until a key with scancode is pressed.
fcn=01h: get keyboard status OUTPUT:
  • ZF=0 if a key is pressed, even CTRL-BREAK
  • AX=0 if no scan code available
  • AH:AL=scan code:ascii char (as in fcn=00)
NOTE: data is not removed from buffer. CTRL-BREAK places a zero word in the keyboard buffer and registers a keypress.
fcn=02h: read keyboard flags OUTPUT: AL=BIOS keyboard flags (in BIOS area 40:17)
  • AL[7]=insert is active
  • AL[6]=caps-lock is active
  • AL[5]=num-lock is active
  • AL[4]=scroll-lock is active
  • AL[3]=ALT key is pressed
  • AL[2]=CTRL key is pressed
  • AL[1]=left shift key is pressed
  • AL[0]=right shift key is pressed
fcn=03h: set keyboard typematic rate INPUT: AL=set rate, BH=repeat delay, BL=typematic rate.
OUTPUT: none.
See helppc for details.
fcn=05: keyboard buffer write Available on AT, PS/2 with extended keyboard support.


GO TO THE TOP