Question
Q3: Assume that sum , count and number references a doubleword in the data segment and that count is in the ECX register. Give a
Q3: Assume that sum , count and number references a doubleword in the data segment and that count is in the ECX register. Give a fragment of 80x86 code that implements the design. (20 points)
a) sum := 0;
count := 1;
while (sum < 1000) loop
add count to sum;
add 1 to count;
end while;
b) sum := 0;
count := 100;
while (sum < 1000) or (count ? 0) loop
add count to sum;
subtract 1 from count;
end while;
c) count := 1;
repeat
input number;
if number is positive
output Number is Positive
else
output Number is Negative
end if
add 1 to count;
until (count = 10);
d) count := 30;
sum := 50;
repeat
subtract count from sum;
add 3 to count;
until (count > 50) and (sum ? 600);
e) sum := 1000;
for count := 100 downto 50 loop
subtract 2*count from sum;
end for;
Q4 Programming question :(20 points)
Write an assembly program (Data and Code) that read two numbers compare them and output the largest number, you can assume any length for those numbers. Your program needs to be documented, includes welcome and goodbye message. You need to provide the code and the output of the program
Q5 Programming question :(20 points)
Write an assembly program (Data and Code) that swap two numbers, you can assume those numbers and output them after swapping, you can assume any length for those numbers. Your program needs to be documented, includes welcome and goodbye message. You need to provide the code and the output of the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started