I'm writing a simple version of the message digest algorithm. In our version we get a string, translated to its decimal value. We need to tackle 8 characters per loop. I'm having problems with the implementation of the loop. I have a DD which stores the size of the array, and I'm using LOOP for the looping. What I want to do is give ECX the value of the size/8 (because I work with 8 chars at a time), so if I have an array composed of 80 chars I want ECX to start at 10. I tried to do

MOV ECX, size

but it's not working. The second problem is getting the next batch of chars. I'm using ESI (because the other registries are not available) which starts at 0. Here's an example of how I'm getting to the chars.

MOV AX, [array+ESI*8]

Which I think should start at array +0, array +8 etc. However I'm not sure this is the case. I'm doing INC ESI at the end of the loop but I'm not sure if this changes the value of ESI from 0 to 1 to 2 etc.

I figured it out:

MOV ECX, [size]

Dividing by 8, which is 2^3 and thus removing the last 3 bits. As for the ESI incremental, it works like I thought it would.