Friday, August 16, 2013

AMP Program no.2



BIOS INT 16:
   Function 00h : read keyboard input

 To issue this interrupt, register AH must be loaded with 00H
  
If a key with ascii value is present then its ascii value is returned in the AL register

 If a key whose ASCII value is not present then 0 is returned in the AL register and its scan code is returned in AH register.

The character to the key is not echoed(displayed) on the display

We notice that when we press key ‘a’, 1E61 is returned in AX, but when we press ctrl – a, the value returned is 1E01. Hence when key ‘a’ is pressed, with the help of scan code µp understands that key ‘a’ is pressed, but its ASCII code is returned after it checks the status of control keys.

Function 02h : return flag status of control(shift) keys

The interrupt is useful for determining which control keys( insert, caps lock, num lock, scroll lock, alt, ctrl , left shift, right shift ) have been pressed or in other words to return the flag status of control keys.

 To use this interrupt, AH must be loaded with 02H

 In the AL register the current status of the key pressed is present, in the form of a bit mask
           1000 0000b - INS key is active.
           0100 0000b - CAPS LOCK key is active.
           0010 0000b - NUM LOCK key is active.
           0001 0000b - SCROLL LOCK key is active.
           0000 1000b - ALT key is pressed down.
           0000 0100b - CTRL key is pressed down.
           00000010b - LEFT SHIFT key is pressed down.
           00000001b - RIGHT SHIFT key is pressed down.

No comments:

Post a Comment