Out of curiosity, what happens if you move getchar() to the beginning of the loop, prior to the instructions?