CS401 Assignment 1 Solution Fall 2017

CS401 Assignment 1 Solution

Question Statement: 1 [15 Marks]

You will write a program to find the maximum number and the minimum number from array of fifteen numbers given below. You will store the maximum number in AX and Minimum number in BX register.

You will use the array given below,

First and the last number in the array will be from your VU id

(First two digits of your VU id after degree code), 50, 30, 24, 19, 2, 5, 6, 40, 8, 23, 16, 17, 28, (Last two digits of your VU id)

For example, If your VU id is bc123456789 you will use array as

12, 50, 30, 24, 19, 2, 5, 6, 40, 8, 23, 16, 17, 28, 89

Explain each instruction of program in comments and also provide/paste a snapshot of your assembled and debugged program result which will be run in AFD (A Full-Screen Debugger) window showing the executed code and final result i.e. value in AX.

You will submit code and two screenshots in a word file.

The first screenshot will contain the command to compile the code

The second screenshot will contain the final values in AX and BX

Note 1: You will use conditional jumps to solve the above problem. Marks will not be awarded for using any other approach.

Note 2: keep the name of assembly file according to your VU id, i.e. if your VU id is BC123456789, you will keep the 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 numbers array, files names in the screenshots will not be according to your VU id you will get zero marks.

Note 4: Marking distribution (Code: 5 marks & Snapshots: 10 marks)

 

Assignment solution for CS401 Assignment 1 Fall 2017

[org 0x0100] 
jmp start
num: dw 12h, 50h, 30h, 24h, 19h, 2h, 5h, 6h, 40h, 8h, 23h, 16h, 17h, 28h, 89h

start: mov bx, [num] 
mov ax, [num] 
mov si,2 

abc: cmp [num+si], bx 
jnc skip 
mov bx,[num+si] 

skip: add si,2 
cmp si,30 
jnz abc 

mov si,2

xyz: cmp ax,[num+si] 
jnc skip1 
mov ax,[num+si] 

skip1: add si,2 
cmp si,30 
jnz xyz 

 mov ax, 0x4c00 
int 0x21

 

 

Other Assignments Solution:

 

assignment solution cs401cs401, cs401 assignmentcs401 assignment 1cs401 assignment 1 solutioncs401 assignment 1 solution 2017cs401 assignment 2017cs401 assignment solutioncs401 assignment solution 2017

 

One thought on “CS401 Assignment 1 Solution Fall 2017

  • November 13, 2017 at 9:04 pm
    Permalink

    bro can you give me screen shot of cs401 assignmnent..i will be very grateful to u

    Reply

Leave a Reply

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

%d bloggers like this: