Provide Latest Complete **CS401 Assignment 2 Solution Fall 2021**. Easy to See Step by Step CS401 Assignment No 2 Solution Fall 2021 and Download Solution File Below.

## CS401 ASSIGNMENT 2 SOLUTION FALL 2021

Total Marks: 20

Due Date: 22 Dec 2021

Uploading Instruction:

Submit assignment only in .doc or Docx format

If you want the correct perfect solution with our student id just WhatsApp 03162965677

Important Note:

The main assembly code should call a subroutine that performs Task 1, then another subroutine would be called to calculate Task 2. After performing Task 2, it should call a subroutine to calculate Task 3. When the Task 3 is completed then the control should go to the subroutine of Task 2, then Task 1 and at end to the point where we initiate subroutine calling.

Arithmetic series is a sequence of numbers in which each differs from the preceding one by a constant quantity. For example, the arithmetic series of ‘9’ can be calculated as follows:

9+8+7+6+5+4+3+2+1 = 45

Question

Write an assembly language program to perform the following tasks:

Task 1 - Find the largest digit in your VUID.

Task 2 - Add the largest value to each index value and write it back at the respective index of the VUID. For example, if the numbers in VUID are 030400789, then after task 2, the VUID should become 91291399161718.

Task 3 - Find the arithmetic series of the largest digit found in task 1 and store it in the “dx” register as shown in the sample screenshot.

Solution:

Part 1:

1. Assembly language program.

[org 0x0100]

jmp start

array_nums: dw 2,0,0,2,5,0,4,1,7

**
**

findbigNum:

mov ax, [array_nums + bx]

mov cx, 9

maxvalue:

cmp ax,[array_nums + bx]

jge maxloop

mov ax, [array_nums + bx]

maxloop:

add bx, 2

loop maxvalue

mov bx, 0

call asum

ret

asum:

loopArray:

add [array_nums + bx], ax

add bx, 2

cmp bx, 18

jb loopArray

mov bx, ax

call revadd

ret

revadd:

la:

add dx, ax

sub bx, 1

sub ax, 1

cmp bx, 1

jge la

ret

start:

mov bx, 0

mov cx, 9

call findbigNum

mov ax, 0x4c00 ; terminate program

int 0x21

Part 2:

Screenshot of AFD debugger showing the arithmetic series of the largest digit and the complete VUID in memory.

Showing the arithmetic series of the largest digit is 1C

7+6+5+4+3+2+1=28=1C

For using command to show complete VU ID in memory

m2 ds:103

**
**

VU ID in Memory is

09 07 07 09 0C 07 0B 08 0E

If you want to complete an assignment with your id just WhatsApp us

We will help you perfectly

Every assignment is changed due to a unique Student ID so Don’t Copy

That is a truly perfect step-by-step idea solution to get help easily.

PLEASE NOTE:

Don't copy-paste the same answer.

Make sure you can make some changes to your solution file before submitting copy paste solution will be marked zero.

If you found any mistake then correct yourself and inform me.

Before submitting an assignment check your assignment requirement file.

If you need some help and question about file and solutions.

Share with fellows

## 0 Comments