Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 256
- .data
- string db 100,?,100 dup (?)
- .code
- assume ds:@data, es:@data
- start:
- mov ax, @data
- mov ds, ax
- mov es, ax
- mov ah,0Ah
- lea dx,string
- int 21h
- push dx
- mov ah,2
- mov dl,0Ah
- int 21h
- pop di
- inc di
- xor ax,ax
- xor cx,cx
- xor dx,dx
- mov cl,[di]
- mov dl,cl
- inc di
- mov bx,di
- push di
- mov al,' '
- m1:
- inc cx
- repne scasb
- inc ah
- push di
- sub di,bx
- cmp dx,di
- jle short m2
- mov dx,di
- m2:
- pop di
- test cx,cx
- jz short m3
- mov bx,di
- loop m1
- m3:
- pop si
- dec dx
- mov bl,[si-1]
- lea di,str1
- mov cl,ah
- m4:
- push cx
- mov cx,dx
- rep movsb
- mov [di],al
- inc di
- mov cl,bl
- xchg di,si
- repne scasb
- xchg si,di
- pop cx
- loop m4
- mov byte ptr [di-1],'$'
- mov ah,9
- lea dx,str1
- int 21h
- mov ah,0
- int 16h
- ret
- str1:
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement