- Mastering Assembly Programming
- Alexey Lyashko
- 153字
- 2021-08-20 10:23:26
Counter
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, 0x12345
mov cl, 5
shl eax, cl
This would result in the register EAX being shifted 5 bits to the left (having the value of 0x2468a0 as a result).
推薦閱讀
- Java程序設(shè)計(jì)與開發(fā)
- Progressive Web Apps with React
- Oracle Database In-Memory(架構(gòu)與實(shí)踐)
- C語(yǔ)言程序設(shè)計(jì)實(shí)訓(xùn)教程
- INSTANT Sencha Touch
- Instant QlikView 11 Application Development
- 微信小程序開發(fā)解析
- R Data Analysis Cookbook(Second Edition)
- UVM實(shí)戰(zhàn)
- Scala for Machine Learning(Second Edition)
- iPhone應(yīng)用開發(fā)從入門到精通
- C++編程兵書
- Emotional Intelligence for IT Professionals
- Training Systems Using Python Statistical Modeling
- Go語(yǔ)言從入門到精通