Professional Documents
Culture Documents
ascending order
1. MOV SI, 500: set the value of SI to 500.
2. MOV CL, [SI]: load data from offset SI to register CL.
3. DEC CL: decrease value of register CL BY 1.
4. MOV SI, 500: set the value of SI to 500.
5. MOV CH, [SI]: load data from offset SI to register CH.
6. DEC CH: decrease value of register CH BY 1.
7. INC SI: increase value of SI BY 1.
8. MOV AL, [SI]: load value from offset SI to register AL.
9. INC SI: increase value of SI BY 1.
10. CMP AL, [SI]: compares value of register AL and [SI] (AL-[SI]).
11. JC 41C: jump to address 41C if carry generated.
12. XCHG AL, [SI]: exchange the contents of register AL and SI.
13. DEC SI: decrease value of SI by 1.
14. XCHG AL, [SI]: exchange the contents of register AL and SI.
15. INC SI: increase value of SI by 1.
16. DEC CH: decrease value of register CH by 1.
17. JNZ 40F: jump to address 40F if zero flat reset.
18. DEC CL: decrease value of register CL by 1.
19. JNZ 407: jump to address 407 if zero flat reset.
20. HLT: stop.
Method 2(easy)
mov si,500
mov cl,[500]
l:
mov al,[si]
inc si
cmp al,[si]
jnc 41c
xchg al,[si]
dec si
xchg al,[si]
inc si
dec cl
jnz l
hlt
str1 db 'string_reverse\'
strlen1 dw $-str1
data ends
code segment
Begin:
mov ds,ax;
mov es,ax
add cx, -2
lea si,str1
lea di, strrev
add si,-2
L1:
mov al,[si]
mov [di],al
dec si
inc di
loop L1
mov al,[si]
mov [di],al
inc di
mov [di], dl
print:
lea dx,strrev
int 21h
exit:
mov ax,4c00h
int 21h
code ends
end Begin
Dfasdsadasdas
data segment
a dw 1,2,3,4,5,6,7,8,9,10
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov cl,10
lea bx,a
mov ax,00
l1: add ax, word ptr[bx]
add bx,02
dec cl
cmp cl,00
jnz l1
mov ah,4ch
int 21h
code ends
end start