added cx register for loop counting