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: 2235

### 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.

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

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

;Assignment 2 solution Fall 2020

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

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

[org 0x0100]                   ; offset

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

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

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

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

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

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

4

5

## Latest Activity

Hira replied to Hira's discussion Pad603 gdb in the group PAD603 Governance, Democracy and Society
1 hour ago
Hira added a discussion to the group PAD603 Governance, Democracy and Society

1 hour ago
Hira left a comment for + M.Tariq Malik
1 hour ago
1 hour ago
Hira joined + M.Tariq Malik's group

### PAD603 Governance, Democracy and Society

1 hour ago
Hira and Junaid [MAF] joined + M.Tariq Malik's group

1 hour ago
1 hour ago
1 hour ago