当前位置:网站首页>Loop loop and CX

Loop loop and CX

2022-06-12 01:21:00 Poem water world


Example : Calculation 2 Of 12 Power

       
assume cs:code
code segment
start:
mov ax,2
mov cx,11
s: add ax,ax
loop s
mov ax,4c00h
int 21h
code ends
end start
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.

cx Program counter (countRegister Abbreviation ) perform loop When you cycle, you will first cx-1, And judge cx Is it equal to 0, be equal to 0 End cycle , Otherwise, execute the loop body


among mov ax,4c00h Indicates that the program returns dos, Will be in mov ah,4ch take ax The high order of is assigned to 4c That means return dos

int  yes interupt Short for interrupt

int 21h Express , interrupt , To carry out 4c Instructions , Indicates that the program ends with a return code .




原网站

版权声明
本文为[Poem water world]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203011403430667.html