At the end, you should perform an arithmetic RC shift, that means : preserve the sign.
Ex. When shifting 1110 to the right, you should get 1111. So, now the remainder is 1111 (-1). Because the remainder is negative, add to it the dividend one last time to get 0001. A friend of mine asked me about this problem precisely, and I went through the whole C++ implementation of this weird kind of division. I had the same problem, but I eventually fixed it. In the tutorial I have been given, this last step was left out, so I figured it out by myself.
The same problem would have arisen had you been performing the division of 00100100 (36) by 00000110 (6).
Your steps would have resulted in the remainder being 01111010 which is obtained by an incorrect RC shift of
11110101. Following my correction of the described algorithm, shifting 11110101 results in 11111010 (-6), and by
adding the dividend (because the remainder is negative at the end), we eventually get remainder 00000000 (0) which is correct.
As a conclusion :
1. When shifting to the right at the end, perform an arithmetic RC shift. (preserve the sign)
2. If the remainder is negative at the end, add the dividend to the remainder and you will get the correct result.
Greetings from Skopje !
http://kolokviumska.blogspot.com/