September 2017
Beginner to intermediate
290 pages
6h 58m
English
ECX register - also known as counter register. This register is used in loops as a loop iteration counter. It is first loaded with a number of iterations, and then decremented each time the loop instruction is executed until the value stored in ECX becomes zero, which instructs the processor to break out of the loop. We can compare this to the do{...}while() clause in C:
int ecx = 10; do { // do your stuff ecx--; }while(ecx > 0);
Another common usage of this register, actually the usage of its least significant part, CL, is in bitwise shift operations, where it contains the number of bits in which the source operand should be shifted. Consider the following code, for example:
mov eax, 0x12345mov cl, 5 shl eax, cl
This would result ...
Read now
Unlock full access