4_7.ASM
上传用户:xinbaokeji
上传日期:2022-07-05
资源大小:295k
文件大小:0k
源码类别:

汇编语言

开发平台:

Visual C++

  1. DATA SEGMENT
  2. BUF DW  3,-4,6,7,9,2,0,-8,-9,-10,20
  3. N = ($-BUF)/2
  4. DATA ENDS
  5. STACK SEGMENT STACK
  6. DB  200 DUP(0)
  7. STACK ENDS
  8. CODE SEGMENT
  9. ASSUME  CS:CODE,DS:DATA,SS:STACK
  10. START: MOV AX,DATA
  11. MOV DS,AX
  12. MOV CX,N
  13. DEC CX
  14. LOOP1: MOV DX,CX
  15. MOV BX,0
  16. LOOP2: MOV AX,BUF[BX]
  17. CMP AX,BUF[BX+2]
  18. JGE L
  19. XCHG AX,BUF[BX+2]
  20. MOV BUF[BX],AX
  21. L: ADD BX,2
  22. DEC CX
  23. JNE LOOP2
  24. MOV CX,DX
  25. LOOP LOOP1
  26. MOV AH,4CH
  27. INT 21H
  28. CODE ENDS
  29. END START