www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS401 Assignment 02 Fall 2020 Solution Due Date December 14, 2020

Q. Write an assembly language program to compare the first and last two digits of your VUID. For example, if the VUID is BC123456789, then the first and last two digits are 12 and 89 respectively.
While comparing, if the first two digits are less than the last two digits, then subtract the first value from the second otherwise perform their addition. At the end, store the result (subtraction or addition) in memory.
Note:
Make it sure to use your own VUID otherwise zero marks will be awarded. Moreover, you must store the first and last two digits in memory separately.

Views: 2334

### Replies to This Discussion

Share the Assignment Questions & Discuss Here....

# CS 401 Assignment No 2 Solution file plus necessary links. for all windows 10/8/7

CS 401 Assignment No 2 Solution file plus necessary links.

full procedure lazmi dakh lain full marks k lia.

Dosbox Download link.

https://www.dosbox.com/download.php?main=1

AsmSoft Download.(NASM included ha)

https://vulms.vu.edu.pk/CourseResources/OpenFile.aspx?File=AssmSoft...

DosBox Code type:

mount n: your drive name:\Folder name
n:
nasm saved filename.asm -o filename.com -L filename.Lst
afd filename.com

### CS 401 Assignment No 1 Complete code

CS401 Assembly language.

1. Assembly language program code.

[org 0x0100]

mov ax,[VerbX]

mov bx,[VerbY]

cmp ax,bx

jl dg

add ax,bx

mov cx,ax

dg:

sub bx,ax

mov cx,bx

mov ax,0x4c00

int 0x21

VerbX: dw aap ki ID k first two digits h                        ;           Aap ki apni Vu ID

VerbY: dw aap ki ID k two last digits h

# Cs-401 Assignment No.2 solution with links

This is the solution of Cs-401 Assignment no. 2 With download links.

;Assignment 2 solution Fall 2020

;Program to compare first two digit number with the last two digit number

;VU-ID=**************

[org 0x0100]                   ; offset

jmp start                      ; jump to start label

first2digit: dw  **               ;declare and initialize variable with first two digit

last2digit: dw  **              ;declare and initialize variable with last two digit

result: dw 0                   ;variable to store the result and initialize with 0

start:

mov ax, 0                ; initialize ax register to zero

mov bx, 0                ; initialize bx register to zero

mov ax, [first2digit]    ; load the first two digit in ax register

mov bx, [last2digit]     ; load the last two digit in ax register

cmp ax, bx                    ;comparing the first two with last two

jnge subt                     ; jump subt label if destination is not equal and greater

; than source otherwise

add ax, bx                      ;add both first and last two digit numbers

mov [result], ax                ;store the addition into the variable result

jmp exit                        ;uncondition jum to label exit

subt: sub bx, ax                ; subtract the first two digit from the last two digit

; number

mov [result], bx          ; store the subtraction into the variable result

jmp exit                  ; uncondition jump to label exit

exit:

mov ax, 0x4c00          ;terminate the progrma

int 0x21

CS401 Assignment No.2 fall 2020
;Program to compare first two digit number with the last two digit number
;VU-ID=**************

[org 0x0100] ; offset
jmp start ; jump to start label

first2digit: dw ** ;declare and initialize variable with first two digit
last2digit: dw ** ;declare and initialize variable with last two digit
result: dw 0 ;variable to store the result and initialize with 0

start:
mov ax, 0 ; initialize ax register to zero
mov bx, 0 ; initialize bx register to zero
mov ax, [first2digit] ; load the first two digit in ax register
mov bx, [last2digit] ; load the last two digit in ax register

cmp ax, bx ;comparing the first two with last two
jnge subt ; jump subt label if destination is not equal and greater
; than source otherwise

add ax, bx ;add both first and last two digit numbers
mov [result], ax ;store the addition into the variable result
jmp exit ;uncondition jum to label exit

subt: sub bx, ax ; subtract the first two digit from the last two digit
; number
mov [result], bx ; store the subtraction into the variable result
jmp exit ; uncondition jump to label exit

exit:
mov ax, 0x4c00 ;terminate the progrma
int 0x21

CS401 assignment no 02 solution fall 2020

#cs401assignment2solutionfall2020 #cs401assignment2solution2020
CS401 Assignment 2 Solution Fall 2020 | CS401 Assignment Solution 2020

1

2

3

## Latest Activity

2 hours ago
7 hours ago
Hamza( Graphic Designer) and Mehreen Tasneem are now friends
7 hours ago
Minahil khalid left a comment for ☞De Veloper☜♨
10 hours ago
Aijaz khan updated their profile
13 hours ago
Aijaz khan joined + M.Tariq Malik's group

### CS202 Fundamentals of Front End Development

13 hours ago
Ribqa, Muhammad Rizwan Ansari, Muhammad Imran and 3 more joined Virtual University of Pakistan
13 hours ago
13 hours ago

© 2022   Created by + M.Tariq Malik.   Powered by