cs401 2nd assigmnet help plz

Assignments ,Quiz, Solved GDB

Moderator: abdulsaboor

cs401 2nd assigmnet help plz

Postby sameea » Sat Apr 28, 2012 12:11 pm

Total Marks: 20

Due Date: 30 April, 2012

Question no. 1:

(a) Assemble the following instructions and show the changes in given Accumulator register and flags after each instruction execution. (Marks 5)

MOV AL, 8Bh ; CF = ?, SF = ?, PF = ?, ZF = ?

ADD AL, 22h ; CF = ?, SF = ?, PF = ?, ZF = ?

AND Al, 1000101b ; CF = ?, SF = ?, PF = ?, ZF = ?

OR Al, 9Ah ; CF = ?, SF = ?, PF = ?, ZF = ?

XOR AL, 10101011b ; CF = ?, SF = ?, PF = ?, ZF = ?

TEST AL, 2 ; CF = ?, SF = ?, PF = ?, ZF = ?

CMP AL, 58 ; CF = ?, SF = ?, PF =?, ZF = ?

ADC AL, 11110000b ; CF = ?, SF = ?, PF = ?, ZF = ?

SHR AL,2 ; CF = ?, SF = ?, PF = ?, ZF = ?

Question no. 1 (b): (Marks 5)

Write a subroutine that can calculate the sum of an array and also save the result into DX.
( Array’s length is 20)

Question no. 2

Write an assembly language code to calculate the factorial of “7” using a subroutine and also attach the final snapshot of your AFD window.
sameea
Visitor
Visitor
 
Posts: 30
Joined: Tue Oct 25, 2011 10:47 am

Re: cs401 2nd assigmnet help plz

Postby sameea » Sun Apr 29, 2012 10:10 am

Question no. 1:

(a) Assemble the following instructions and show the changes in given Accumulator register and flags after each instruction execution. (Marks 5)
Answer:
MOV AL, 8Bh ; CF = 0, SF = 0, PF = 0, ZF = 0

ADD AL, 22h ; CF = 0, SF = 0, PF = 0, ZF = 0

AND Al, 1000101b ; CF = 0, SF = 1, PF = 0, ZF = 0

OR Al, 9Ah ; CF = 0, SF = 0, PF = 1, ZF = 0

XOR AL, 10101011b ; CF = 0, SF = 1, PF = 1, ZF = 0

TEST AL, 2 ; CF = 0, SF = 0, PF = 0, ZF = 0

CMP AL, 58 ; CF = 0, SF = 0, PF = 1, ZF = 1

ADC AL, 11110000b ; CF = 1, SF = 1, PF = 1, ZF = 0

SHR AL,2 ; CF = 1, SF = 0, PF = 0, ZF = 0


plz guys last question ma help karo de koi
sameea
Visitor
Visitor
 
Posts: 30
Joined: Tue Oct 25, 2011 10:47 am


Return to VU STUDENTS FORUM

Who is online

Users browsing this forum: No registered users and 1 guest
cron