0% found this document useful (0 votes)
34 views5 pages

Due Date: Thursday, August 6, 2020: Spring 2020 CS:401 Assembly Language Total Marks: 20

This document outlines the details of an Assembly Language assignment for CS:401 due on August 6, 2020 with a total of 20 marks. It includes the code for a keyboard interrupt service routine that will print the letters "SAMAD" to the top left of the screen when the 'N' key is pressed and replace it with spaces when the 'N' key is released. The code saves the original interrupt service routine, installs the new keyboard interrupt routine, gets a keystroke using BIOS, and exits the program.

Uploaded by

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

Due Date: Thursday, August 6, 2020: Spring 2020 CS:401 Assembly Language Total Marks: 20

This document outlines the details of an Assembly Language assignment for CS:401 due on August 6, 2020 with a total of 20 marks. It includes the code for a keyboard interrupt service routine that will print the letters "SAMAD" to the top left of the screen when the 'N' key is pressed and replace it with spaces when the 'N' key is released. The code saves the original interrupt service routine, installs the new keyboard interrupt routine, gets a keystroke using BIOS, and exits the program.

Uploaded by

Rana Hamza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Spring 2020 CS:401 Assembly Language

Total Marks: 20

Due Date: Thursday, August 6, 2020


STUDENT ID : BC170403596

[org 0x0100]
jmp start
oldisr: dd 0 ; space for saving old isrkeyboardinterrupt service routine
kbisr:
push ax
push es
mov ax, 0xb800
mov es, ax ;point es to video memory
in al, 0x60 ;read a char from keyboard port
cmp al, 0x31 ;is to hold the key in N
jnenextcmp ;no, try next comparison
mov byte [es:0],'S' ;yes, print ABCD at top left
mov byte [es:2],'A'
mov byte [es:4],'M'
mov byte [es:6],'A'
mov byte [es:8],'D'
jmp nomatch ;leave interrupt routine
nextcmp:
cmp al, 0xB1 ; is the key n is release
jnenomatch ; no, leave interrupt routine
mov byte [es:0],'' ; yes, print space at top left
mov byte [es:2],''
mov byte [es:4],''
mov byte [es:6],''
mov byte [es:8],''
nomatch:
pop es
pop ax
jmp far [cs:oldisr] ;call the original ISR
start:
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

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

mov ax, 0x4c00 ; terminate program


int 0x21

Screen Shot:1
Screen Shot:2
Screen Shot:3
Screen Shot:4

You might also like