**Make changes before upload. I will not be responsible for your marks.**

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.

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

You
are supposed to submit your assignment in .doc or
docx
format.

Any other formats like scan images, PDF, zip, rar, ppt and bmp etc.
will not be accepted.

Labs
covered: 1- 4

Topics
covered: addressing modes, branching techniques, Conditional/unconditional
jumps, Bit manipulation and multiplication algorithm.

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). Hence refrain from uploading assignment in the
last hour of the deadline. It is recommended to upload your solution file at
least two days before its closing date.

If
you find any mistake or confusion in the assignment (Question statement),
please contact your instructor before the deadline. After the deadline, no
queries will be entertained in this regard.

For any query, feel free to email at cs401P@vu.edu.pk

Problem statement

You are
required to write the assembly language program that:

1.     
Finds the largest digit of your VUID

2.     
Finds the smallest digit of your VUID

3.     
Calculates the multiplication of largest digit
and smallest digit of your VUID and stores the result in memory

Note:
You must use your own VUID.

 

SOLUTION :

Code:

[org 0x0100]

jmp start

vuid: db 1,6,0,4,0,1,2,3,4

maxValue: db 0

minValue: db 0

result: db 0


start:

mov si, vuid

mov cx, 9


mov al, [si]

mov bl, al


findMin:

cmp bl, 0

je skipZeroMin

mov [minValue], bl

jmp foundMin


skipZeroMin:

inc si

mov al, [si]

mov bl, al

dec cx

jnz findMin


foundMin:

inc si

dec cx


findMax:

cmp bl, [si]

je skipZeroMax

jae notMax

mov bl, [si]


notMax:

skipZeroMax:

inc si

loop findMax


mov [maxValue], bl


mov al, [maxValue]

mov bl, [minValue]

imul bl

mov [result], al


mov ax, 0x4c00

int 0x21



****************************************************************************************************************************

****************************************************************************************************************************

Submission details:

Following are required in a single MS-Word
document.

a)     Assembly
language program

b)     Screenshot
showing the results (largest, smallest, multiplication) in memory window of AFD
(Sample attached below)


Facebook
Twitter
LinkedIn
WhatsApp

Leave a Reply

Your email address will not be published. Required fields are marked *