Name: Anonymous 2011-06-28 19:45
xor ebx, ebx //Start the cycle counter at 0
mov ecx, 3 //Put 3 into ecx for multiplication
Parity:
cmp eax, 1 //Are we done yet?
je Done //If so, go to the end
mov edx, eax //edx = eax
and edx, 1 //Get parity bit
cmp edx, 0 //Is it even?
je ParEven //If so, skip straight to that part
//eax is odd here
mul ecx //treble eax (ecx is just 3)
add eax, 1 //and +1
add ebx, 1 //increment cycle counter
//eax is now even, so flow straight into even handler
ParEven:
shr eax, 1 //divide by two
add ebx, 1 //increment cycle counter
jmp Parity //time to test parity againhttp://everything2.com/title/Hailstone+number+sequence