Implement each design given below. Assume that value is stored as a doubleword i
ID: 3826827 • Letter: I
Question
Implement each design given below. Assume that value is stored as a doubleword in memory, number is in EAX, and count is in ECX. (a) if value 1000 then add number*count to value; end if; (b) if value < 1000 then add 10*count to value; else value := 800; subtract 1 from count; end if; Students may use a calculator, the textbook and their notes for these questions. 1. Implement each design given below. Assume that value is stored as a doubleword in memory number is in EAX, and count is in ECX. if values 1000 then add number count to value; end if,Explanation / Answer
.MODEL FLAT
.STACK 4096
.DATA
number DWORD 1000
.CODE
main PROC
mov ecx, 0 ; x := 0
mov eax, 1 ; twoToX := 1
whileLE: cmp eax, number ; twoToX <= number?
jnle endWhileLE ; exit if not
body: add eax, eax ; multiply twoToX by 2
inc ecx ; add 1 to x
jmp whileLE ;
go check condition again endWhileLE:
dec ecx ; subtract 1 from x
mov eax, 0 ; exit with return code 0 ret
main EN DP
END
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.