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.
• Use scan codes for capturing key presses instead of ASCII codes
• Use DOSBOX and run NASM on it. Complete tutorial is already provided to you on
Announcement page of this course.
• Zero marks will be awarded if you do not provide screenshots
Your assignment must be a single Word file (DOC or DOCX) with the following 4 items in it:
1) Complete code in assembly language
2) Screenshot of compilation step. When you save the ASM file keep in mind that file name
MUST be the last 6 digits of your Student ID. For example, if your Student ID is
BC123456789 then file name should be 456789.asm
3) Output screenshot when N key is pressed
4) Output screenshot when N key is released
Sample Output Screenshot when N key is pressed:--- BEST OF LUCK

Views: 1362

Replies to This Discussion

401 Dosbox mein error a raha 3rd line mein 
kindly koi resolve krwa day

koi b nhi ha jis k subject cs401 ho 
admin team kahn ha koi to bta dooo kuchh

isko closekr k rerun krein

[org 0x0100]
jmp Start
oldisr:dd 0 ; space for 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:2],'M'
moy byte [es:4],'A'
moy byte [es:6],'H'
moy byte [es:8],'A'
moy byte [es:10],'M'
jmp nomatch ;leave interrupt routine

cmp al, 0xB1 ; is the key n is release
jne nomatch ; no, leave interrupt routine
moy byte [es:2],'' ; yes, print space at top left
moy byte [es:4],''
moy byte [es:6],''
moy byte [es:8],''
moy byte [es:10],''

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

xor ax, ax
moy es, ax
moy ax, [es:9*4]
moy [oldisr], ax
moy ax, [es:9*4+2]
moy [oldisr+2], ax ;save segment of old routine
cli ; disable interrupts
moy word [es:9*4], kbisr ;store offset at n*4
moy [es:9*4+2],cs ;store segment at n*4+2

moy ah, 0
int 0x16

moy ax, 0x4c00
int 0x21


© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service