Exercise 5: Loopy Cube Roots

Using the online GCC/GAS assembler (as for the previous exercise), write an assembly program which computes integer cube roots using the general-purpose 32-bit registers. When it is an even cube, the answer is simple: the cube root of 27 is 3. For numbers that are in between, compute the largest cube root: the cube root of 70 is 4 (since 43 = 64). Assume the number is positive and is in %ecx. Compute the cube root into %ebx. Do this by looping from 0 up to a value N such that where N3 <= %ecx and (N+1)3 > %ecx. As for the previous exercise, use the debugger to show that your code computes the correct result. Submit a PDF of screen shots showing the results for 729, 728, and 99. Be sure to include your program listing in at least one of the screen shots, and be sure the input value (in %ecx) is visible in each screen shot.

You may work with other students on this assignment, but each must turn in screen shots of their own code.