Branching and Looping
jav284a. Assume for each part of this problem that the EAX register contains 00 00 00 4F and the doubleword referenced by value contains FF FF FF 38. Determine whether each of the conditional jump statements causes a jump to dest.
#1
cmp eax, 04fh |
je dest |
#2
add eax, 200 |
js dest |
b. This problem gives a design with an if structure and some assumptions about how the variables are stored in an assembly language program.
Give a fragment of 80x86 assembly code that implements the design. The assembly language code should flow the same as the design.
design:
if count > value
then
count: = 0;
end if;
c. This problem contains a design with a while loop. Assume that sum references a doubleword in the data segment and that count is in the ECX register. Give a fragment of 80x86 assembly code that implements the design.
sum := 0;
count : = 1;
while (sum < 1000) loop
add count to sum;
add 1 to count;
end while;