Skip to toolbar
500 viewsEducationVirtual University

CS401 Assignment No 3 2020 (Solution File)

Virtual University has announced Assignment No 3 For CS401 Computer Architecture and Assembly Language Programming.

Discuss – Share – Ask Questions related to CS401 Assignment No 3 here.


The Last date of CS401 Assignment is August 06, 2020


Write a Terminate and Stay Resident (TSR) program in assembly language that will hook
Keyboard Interrupt Service routine. When you press N key from keyboard, your name should
be printed on top right corner of the screen and when you release N key, the screen should
be cleared

admin Changed status to publish
Add a Comment

Here is the solution of CS401 Assignment No 3 Spring Semester 2020

Video tutorial is also given if you want to understand the complete concept behind the  Assignment of CS403 Spring Semester.


Solution File

Keep visiting us for more useful content. you can also share and submit your own information.

[org 0x0100]
       jmp start
       oldisr;dd 0                ; space for the purpose of saving old sir keyboardinterrupt service routine
push ax
push es
moy ax, 0xb800
moy es, ax
in al, 0x60
cmp al, 0x31
jne nextcmp
moy byte [es:150],''  
moy byte [es:152],''  
moy byte [es:154],''  
moy byte [es:156],''  
moy byte [es:158],  
jmp nomatch                                ;leave interrupt routine

cmp al, 0xB1                  ; is the key n is release
jne nomatch                   ; no, leave interrupt routine 
moy byte [es:150],''         ; yes, print space at top left
moy byte [es:152],''  
moy byte [es:154],''  
moy byte [es:156],''  
moy byte [es:158],

pop es
pop ax
jmp far [cs:oldisr]       ; call the original ISR

xor ax, ax
mov es, ax        ;point es to IVT base
mov ax, [es:9*4]
mov [oldisr], ax     ;save offset of old routine
mov ax, [es:9*4+2]
mov [oldisr+2], ax     ;save segment of old routine
cli            ; disable interrupts
mov word [es:9*4], kbisr   ;store offset at n*4
mov [es:9*4+2],cs         ;store segment at n*4+2
sti           ;enable interrupts

     mov ah, 0            ;service 0 - get keystroke 
     int 0x16             ;call BIOS keyboard service

     mov ax, 0x4c00                  ; terminate program
     int 0x21
admin Changed status to publish
Add a Comment
Write your answer.