(Solved) : Written Masm Need Help Fixing Code Adding Comments Code Bellow Instructions Q42754873 . . .

written in MASM, i need help fixing my code and adding comments.Code bellow and instructions.

SECTION .data msg dbHello, 0 key db -2, 4, 1, 0, -3, 5, 2, -4,-4, 6 SECTIO .code main proc mov ecx, LENGTHOF key mov edx, O

6. Greatest Common Divisor (GCD) The greatest common divisor (GCD) of two integers is the largest integer that will evenly di

SECTION .data msg db”Hello”, 0 key db -2, 4, 1, 0, -3, 5, 2, -4,-4, 6 SECTIO .code main proc mov ecx, LENGTHOF key mov edx, OFFSET msg top: mov esi, OFFSET key cmp [ebx), esi mov ebx, 0 jl Shift Left ShiftLeft: mov cl, [esi] SHL edx, cl add esi, TYPE key cmp [ebx], esi cmp [ebx], esi inc edx jg ShiftRight je NoShift Ll top ShiftRight: mov cl, [esi] SHR edx, cl NoShift: add esi, TYPE key add esi, TYPE key Ll top Ll top invoke ExitProcess, 0 main endp call Write String end main 6. Greatest Common Divisor (GCD) The greatest common divisor (GCD) of two integers is the largest integer that will evenly divide both integers. The GCD algorithm involves integer division in a loop, described by the following C++ code: int GCD(int x, int y) // absolute value x = abs(x); y = abs(y); do C int n = x 8 Y; X = Y; y = n; } while (y > 0); return x; Implement this function in assembly language and write a test program that calls the function several times, passing it different values. Display all results on the screen. Show transcribed image text SECTION .data msg db”Hello”, 0 key db -2, 4, 1, 0, -3, 5, 2, -4,-4, 6 SECTIO .code main proc mov ecx, LENGTHOF key mov edx, OFFSET msg top: mov esi, OFFSET key cmp [ebx), esi mov ebx, 0 jl Shift Left ShiftLeft: mov cl, [esi] SHL edx, cl add esi, TYPE key cmp [ebx], esi cmp [ebx], esi inc edx jg ShiftRight je NoShift Ll top ShiftRight: mov cl, [esi] SHR edx, cl NoShift: add esi, TYPE key add esi, TYPE key Ll top Ll top invoke ExitProcess, 0 main endp call Write String end main
6. Greatest Common Divisor (GCD) The greatest common divisor (GCD) of two integers is the largest integer that will evenly divide both integers. The GCD algorithm involves integer division in a loop, described by the following C++ code: int GCD(int x, int y) // absolute value x = abs(x); y = abs(y); do C int n = x 8 Y; X = Y; y = n; } while (y > 0); return x; Implement this function in assembly language and write a test program that calls the function several times, passing it different values. Display all results on the screen.

Expert Answer


Answer to written in MASM, i need help fixing my code and adding comments. Code bellow and instructions….

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?