The document discusses interrupt processing and how it allows a microprocessor to execute other software while waiting for input from an I/O device like a keyboard. It then summarizes various INT instructions used for keyboard input/output like INT 21h and INT 16h, providing details on specific functions accessed through different register values.
2. Interrupts are particularly useful when interfacing I/O devices that provide or
require data at relatively low data transfer rates .
If the person using the keyboard typed one character per second. The software of
the Processors waited an entire second between each key stroke for the person to
type another key .
This process was such a tremendous waste of time that designers developed another
process, Interrupt processing to handle this situation.
Interrupt processing allows the microprocessor to execute other software
while the keyboard operator is thinking about what key to type next.
03/17/18 2
3. DOS and BI OS
I nt errupt s
DOS and BIOS interrupts are used to perform some very
useful functions, such as displaying data to the monitor,
reading data from keyboard, etc.
They are used by identifying the interrupt option type,
which is the value stored in register AH and providing,
whatever extra information that the specific option requires.
03/17/18 3
4. I NT 21h
I ns t ruct i on
Hence this INT instructions used for Keyboard.(INT
21 h-DOS Interrupt)
The int 21 h instructions are used to interrupt through
the Keyboard, Files, Directives.
Depending on the value that is moved to the ‘ah’ the
operations will be done.
03/17/18 4
5. INT 21h / AH=1 - read character from standard input, with echo,
result is stored in AL.
if there is no character in the keyboard buffer, the function waits until any key is
pressed.
example:
mov ah, 1
int 21h
INT 21h / AH=7 - character input without echo to AL.
example: mov ah, 7
int 21h
03/17/18 5
6. INT 21h / AH=0Ah - input of a string to DS:DX,
Example:
mov ax,@data
mov ds,ax
mov ah,0Ah
int 21h
INT 21h/AH=0Bh - checks keyboard status.returns FFH to AL if character is
available.Otherwise returns 00H to AL.
INT 21h/0Ch- this clear keyboard buffer and invoke function. Loads required
function in AL.
mov ah,0ch //request keyboard function
mov al,function //required function
int 21h03/17/18 6
7. INT 21h / 6h :direct console input or output.
INT 21h/0Eh :Select default drive
INT 21h/19h :Get current default drive
INT 21h/25h :Set interrupt vector
INT 21h/35h :Get interrupt Vector
INT 21h/39h :Make directory
INT 21h/3Ah :Remove directory
INT 21h/3Bh :Set current directory
03/17/18 7
8. INT 21h/3Ch;create or truncate file
INT 21h/3Dh;Open Existing file
INT 21h/3Eh;Close file
INT 21h/3Fh;Read from File
INT 21h/40h;Write to file
INT 21h/41h;Delete File
INT 21h/42h;Set current File Position
INT 21h/47h;Get current Directory
INT 21h/4Ch;return control to the operating system(STOP
PROGRAM)
INT 21h/56h; rename file/move file03/17/18 8
9. INT 16h is the basic BIOS keyboard operation
used extensively by software developers and provides the
following services according to a function code that you
load in AH.
INT 16h/03h: set typematic Repeat rate
INT 16h/05h: Keyboard write.
INT 16h/10h: Read keyboard Character
INT 16h/11h: Determine whether character is present or not
I NT 16h I ns t ruct i on
03/17/18 9
10. 03/17/18 10
INT 16h/03h : set typematic Repeat rate
MOV AH,03H ; SETS TYPEMATIC REPEAT RATE
MOV AL,05H ;REQUIRED SUBFUNCTION
MOV BH,REPEAT –DELAY ;DELAY BEFOR E START(0=1/4 SEC.
,1=1/2 SEC- DEFAULT. ,2=3/4 SEC. ,3=1
SEC.)
MOV BL,REPEAT- RATE SPEED OF REPEATION (0– FASTEST
THROUGH 31-- SLOWEST)
INT 16h/05h: Keyboard write
Loading ASCII character to CH and its scan code to CL.
Allows to enter characters to the buffer until it is full.
If full, operation sets Carry flag and AL to 1
11. 03/17/18 11
INT 16h/10h: Read keyboard Character
If a character is pressed ,then it delivered to the AL and its scan code to AH.
If a extended key scan code is delivered to AH and the value 00H to AL
If a extended duplicate key scan code is delivered to AH and the value E0H
to AL
MOV AH,10H ;REQUEST FOR BIOS KEYBOARD INPUT.
INT 16H ;CALLING INTERRUPT SERVICE
CMP AL,00H ; EXTENDED FUNCTION KEY ??
JE ;YES.EXIT
CMP AL,E0H ; EXTENDED FUNCTION KEY ??
JE ;YES.EXIT
12. 03/17/18 12
INT 16h/11h: Determine whether character is present or not
If the character is present in the buffer , clears ZERO flag and delivered it to
AL and its scan code to AH and still character is remained in the buffer.
If the character is not present in the buffer , sets ZERO flag.
INT 16h/12h: Return Keyboard Status.
Delivers keyboard status byte from BIOS DATA AREA 1 at location 40 :
17H to AL & byte from 40 : 18 H to AH.
Key pressed Status Bit
Caps lock 6
Num lock 5
Scroll lock 4
Right ALT 3
Right CTRL 2
Left ALT 1
Left CTRL 0
13. How t he Keyboard
WorksKeyboard controller chip sends an 8-
bit scan code to the keyboard serial
input port
Interrupt triggered, INT 9h routine
executes
Scan code and ASCII code inserted
into keyboard typeahead buffer
03/17/18 13