# **Loop指令**
Loop 标号
![](https://img.kancloud.cn/75/02/750264f4378544c2a4adbda34db39806_816x379.png)
```
assume cs:code
code segment
mov ax,2
mov cx,11
s:add ax,ax
loop s
mov ax,4c00H
int 21H
code ends
end
```
![](https://img.kancloud.cn/b6/6c/b66c064eacfe16d54a072433513d8208_669x296.png)
![](https://img.kancloud.cn/03/ae/03ae00a32e3ed2ddcd205b8021c7e07e_641x402.png)
![](https://img.kancloud.cn/b2/66/b2660f0e72bb9c5356deb5155267377f_630x385.png)
![](https://img.kancloud.cn/0f/e2/0fe26b14bae124814ca47b1fb644122f_594x323.png)
![](https://img.kancloud.cn/fb/97/fb97d306c00b97cb1c28f7e769ab3744_638x242.png)
**编程2^12**
```
assume cs:code
code segment
mov ax,2
mov cx,11
s:add ax,ax
loop s
mov ax,4c00H
int 21H
code ends
end
```
过程:
![](https://img.kancloud.cn/21/56/21560e6758a89d637bdb838ad45c1a07_1871x973.png)
**计算123x236,结果存储在ax中**
方法:用加法实现乘法,将123连加236次
```
assume cs:code
code segment
mov ax,0
mov cx,236
s:add ax,123
loop s
mov ax,4c00H
int 21H
code ends
end
```
**计算ffff:0006字节单元中的数乘以3,结果存储在dx中**
分析:将ffff:0006从内存中取出连加3次
![](https://img.kancloud.cn/d9/40/d94049e4bec4aeafdf0dcae0e325439a_1841x992.png)
```
assume cs:code
code segment
mov ax,0ffffH
mov ds,ax
mov bx,6
#//(ax)=((ds)816+(bx))注意审题取出的是字节,所以这里将偏移地址的值ds:[bx]放到高八位中
mov al,[bx]
#//注意第八位初始可能是其他值,这里需要重置为0
mov ah,0
#//注意这里
mov dx,0
mov cx,3
s:add dx,ax
loop s
mov ax,4c00H
int 21H
code ends
end
```