data segment
buf db 100,101 dup(0)
buf1 db ‘qing shu ru’,13,10,'(ge shu zai 100 yi nei)=’,’$’
data ends
code segment
assume ds:data,cs:code
main:mov dx,data
mov ds,dx
lea dx,[buf1]
mov ah,9
int 21h
lea dx,[buf]
mov ah,10
int 21h
mov bh,0
mov bl,[buf+1]
lea SI,[buf+2]
lea di,[buf+1]
add di,bx
mov [buf+2+bx],’$’
mov ax,bx
mov bl,2
div bl
mov cl,al
mov ch,0
lab:
mov al,[di]
mov bl,[si]
mov [di],bl
mov [si],al
dec di
inc si
loop lab
mov ah,2
mov dl,10
int 21h
mov dl,13
int 21h
lea dx,[buf+2]
mov ah,9
int 21h
mov ax,4c00h
int 21h
code ends
end main
0 条评论。