Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- .model small
- .stack 100h
- .data
- str db 80 dup
- .code
- mov ax,@data
- mov ds,ax
- main proc
- mov si,0
- mov di,0
- mov ah,1
- int 21h
- mov str[si],al
- input:
- mov ah,1
- int 21h
- inc si
- cmp al,0dh
- je newline
- mov di,0
- jmp compare
- compare:
- cmp str[di],al
- jg swap
- cmp di,si
- je new
- swap:
- mov bl,str[di]
- mov str[di],al
- mov al,bl
- inc di
- jmp compare
- new:
- mov str[si],al
- jmp input
- newline:
- mov di,0
- mov ah,2
- mov dl,0dh
- int 21h
- mov dl,0ah
- int 21h
- output:
- mov dl,str[di]
- int 21h
- inc di
- cmp di,si
- je end
- jmp output
- end:
- mov ah,4ch
- int 21h
- main endp
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement