Assignment No. 3

Graded
Semester Spring 2018
Computer Architecture and Assembly Language
Programming– CS401

Question: 1                      [15 Marks]

You are required to write a TSR program that will print total number of characters in your name (including
spaces within complete name) on top left corner of screen once you will press first letter of your name from
keyboard.

Example:
For example let’s say your name is Muhammad Usman Jan, and your VUID is bc123456789

You will write code for TSR such a way that if you will press “m” (first letter of your name in lower case) ,
18 will printed on top left corner of screen .

You will submit code and a screen shot in word file.

Screenshot will contain the command to compile the code, Same screen shot will contain number of
characters printed on screen after pressing first letter of your name.

Note 1:  You will use DOSBOX only to compile and execute your code.

Note 2: keep name of assembly file according to your VU id , i.e. if your VU id is BC123456789 , you will
keep name of the assembly code file as 23456789.asm i.e. you will use last 8 digits of your id for the code
file name.

Note 3: If the code or files names in the screen shot will not be according to your own VU id you will get zero
marks.

Note 4: No marks will be given if code will not be both correct & complete in all aspects.

Note 5: You will use your complete name which you have in VU-LMS account.

Note 6: Scan codes are given at the end in Figure 1, on page 3

Note 7: No marks will be given, if above instructions will not be followed exactly.


Total Marks: 15

Due Date: 31/07/2018


                                                     <<<CODE>>>



[org 0x0100]
jmp start
oldisr: dd 0  ; space for saving old isr

; keyboard interrupt service routine

kbisr:
push ax
push es
mov ax, 0xb800
mov es, ax  ; point es to video memory
in al, 0x60   ; read a character from keyboard port
cmp al, 0x11  ; has the 'w' key pressed 
jne nomatch  ; no, go to nomatch

mov byte [es:0], '1'  ; yes, print 1 
mov byte [es:2], '5'  ; yes print 0 
jmp exit   ; leave interrupt routine

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

mov al, 0x20
out 0x20, al  ; sent EOI to PIC
pop es
pop ax
iret   ; return from interrupt

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 interrupt

mov dx, start  ; end of resident portion
add dx, 15   ; round up to next para
mov cl, 4
shr dx, cl   ; number of paras

mov ax, 0x3100  ; terminate and stay residant
int 0x21

2 Comments

Don't Forget To Join My FB Group VU Vicky
THANK YOU :)

  1. same aesy hi write kia dosbox me lekin error aaraha hai plz help

    ReplyDelete
  2. Viky Bhai apne name ke liye code Kia modifications karain gye...
    i.e Umer farooq

    ReplyDelete

Post a Comment

Don't Forget To Join My FB Group VU Vicky
THANK YOU :)

Previous Post Next Post