0% found this document useful (0 votes)
10 views2 pages

EXP02

Uploaded by

Ansari Zaid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

EXP02

Uploaded by

Ansari Zaid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EXPERIMENT NO.

02

----------------------------------Program to read status of keyboard------------------------------;

ASSAMBLE: TASM kbstat OR MASM kbstat;;


BUILD: TLINK kbstat OR LINK kbstat;;
RUN:kbstat

.model small ;Macro to Display Messages


disp macro msg
push ax
push bx
mov ah,09h ;Function to dispaly string on screen
mov dx,offset msg
int 21h
pop bx
pop ax
endm
.data
cr
equ 0dh
lf
equ 0ah
msg db 'Status of Keys on Keyboard$',cr,lf
msg1 db cr,lf,'INSERT Keys is ON $',cr,lf
msg2 db cr,lf,'INSERT Keys is OFF $',cr,lf
msg3 db cr,lf ,'CAPS LOCK KEY ON$',cr,lf
msg4 db cr,lf,'CAPS LOCK KEY OFF$',cr,lf
msg5 db cr,lf,'NUM LOCK ON$',cr,lf
msg6 db cr,lf,'NUM LOCK OFF$',cr,lf
msg7 db cr,lf,'SCROLL LOCK ON$',cr,lf
msg8 db cr,lf,'SCROLL LOCK OFF$',cr,lf
msg9 db cr,lf,'ALT KEY IS PRESSED$',cr,lf
msg10 db cr,lf,'CTRL KEY IS PRESSED$',cr,lf
msg11 db cr,lf,'LEFT SHIFT KEY IS PRESSED$',cr,lf
msg12 db cr,lf,'RIGHT SHIFT KEY IS PRESSED$',cr,lf
.Code
mov ax,@data
mov ds,ax
mov ah,02h ;function to read keyboard
int 16h ;status disp msg
rcl al,1 ;check status of insert key
jnc dn
disp msg1
jmp ab
dn:
disp msg2
ab:
rcl al,1;check caps lock key
jnc dn1
disp msg3
jmp ab1
dn1:
1
EXPERIMENT NO.02

disp msg4
ab1:
rcl al ,1 ;check num lock key
jnc dn2 disp msg5
jmp ab2
dn2:
disp msg6
ab2:
rcl al,1 ;check scroll lock key
jnc dn3
disp msg7
jmp ab3
dn3:
disp msg8
ab3:
rcl al,1 ;check ALT key
jnc dn4
disp msg9
dn4:
rcl al ,1 ;check ctrl key
jnc dn5
disp msg10 ;check left shift key
dn5:
rcl al ,1
jnc dn6
disp msg11
dn6:
rcl al ,1 ;check right shift key
jnc dn7
disp msg12
dn7:
mov ah,4ch ;exit to dos
int 21h
ends ;segment end
end ;program end

You might also like