VUSuperior Chat Room

Wednesday, 2 July 2014

Computer Architecture and Assembly Language Programming (CS401) Assignment No. 3(Non-Graded)

Please carefully read the following instructions before attempting assignment.

Rules for Marking

It should be clear that your assignment would not get any credit if:



The assignment is submitted after the due date.
The submitted assignment does not open or file is corrupt.
Strict action will be taken if submitted solution is copied from any other student or from the internet.




1)      You should concern recommended books to clarify your concepts as handouts are not sufficient.

2)      You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, zip, rar, bmp etc will not be accepted.



Note: 

No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.



For any query, feel free to email at:

cs401@vu.edu.pk



Question Statement:

An assembly program is given for printing three different strings on screen with the help of BIOS video services. Students are required to add the missing code in order to perform the following operations.

After running the code in command prompt, subsequent keystrokes should result in:

Clear screen --------------------------------------------------------------------------------------------1st keystroke
Display ID (yellow on black background) on screen’s top ---------------------------------2nd keystroke
Display Name (red on white background) on screen’s middle line ---------------------3rd keystroke
Display University Name (blue on yellow background) at the bottom of screen -- 4th  keystroke




 [org 0x100]

jmp start

ID:                                          : Data label for Student’ ID

Name:                                  ; Data label for Student’s name

University Name:            ; Data label for University’s name



clrscr:                                    push es

                                                push ax

                                                push cx

                                                push di

                                                mov ax, 0xb800

                                                mov es, ax

                                                xor di, di

                                                mov ax, 0x0720

                                                mov cx, 2000

                                                cld

                                                rep stosw

                                                pop di

                                                pop cx

                                                pop ax

                                                pop es

                                                ret



printstr:                               push bp

                                                mov bp, sp

                                                push es

                                                push ax

                                                push cx

                                                push si

                                                push di

                                                push ds

                                                mov ax, [bp+4]

                                                push ax

                                                call strlen

                                                cmp ax, 0

                                                jz exit

                                                mov cx, ax

                                                mov ax, 0xb800

                                                mov es, ax

                                                mov al, 80

                                                mul byte [bp+8]

                                                add ax, [bp+10]

                                                shl ax, 1

                                                mov di,ax

                                                mov si, [bp+4]

                                                mov ah, [bp+6]

                                                cld

                                                nextchar: lodsb

                                                stosw

                                                loop nextchar

                                                exit: pop di

                                                pop si

                                                pop cx

                                                pop ax

                                                pop es

                                                pop bp

                                                ret 8



strlen:                                   push bp

                                                mov bp,sp

                                                push es

                                                push cx

                                                push di

                                                les di, [bp+4]

                                                mov cx, 0xffff

                                                xor al, al

                                                repne scasb

                                                mov ax, 0xffff

                                                sub ax, cx

                                                dec ax

                                                pop di

                                                pop cx

                                                pop es

                                                pop bp

                                                ret 4



start:                    

Code required from students





Best of luck!

0 comments:

Post a Comment