Please tell me can we use any other register rather then CX with loop instruction like ....
.........................................
mov ax, 10 ; didn't use cx
again: any code here
loop again
.........................................
.........................................
mov ax, 10 ; didn't use cx
again: any code here
loop again
.........................................
Please tell me can we use any other register rather then CX with loop instruction like ....
.........................................
mov ax, 10 ; didn't use cx
again: any code here
loop again
.........................................
There was no reason to post a poll for this type of question.
The LOOP instruction, as defined in the Intel/AMD manuals, expects to use CL/CX/ECX/RCX for the respective LOOP instruction.
However, LOOP has a reputation for being slower than it should be. If you want to replicate LOOP-like functionality with relatively the same efficiency, look into using a DEC/JNZ combination... in which will be compatible with any of the General Purpose Registers.
Spook is right. You can use
or any register to replace eax.
test eax, eax
jnz again
or any register to replace eax.