Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack
- .data
- crlf db 0Dh, 0Ah, '$'
- str1 db 30 dup(0), '$'
- str2 db 30,0,30 dup(0)
- counter dw 0
- .code
- start:
- mov ax,@data
- mov ds,ax
- mov es,ax
- lea si,str2+2
- lea di,str1
- mov ah,0Ah
- lea dx,str2
- int 21h
- lea dx,crlf
- mov ah,9
- int 21h
- mov cx,30
- xor ax,ax
- mov dx,di
- let:
- lodsb
- cmp al,0dh
- je if1
- cmp al,0
- je exit
- cmp al,' '
- je if1
- inc counter
- stosb
- loop let
- jmp exit
- if1:
- mov bx,si
- mov si,dx
- mov di,dx
- xor cx,cx
- mov cx,counter
- mov ah,cl
- while:
- lodsb
- stosb
- repne scasb
- cmp cx,0
- ja clear
- mov cx,counter
- sub di,cx
- dec counter
- loop while
- mov counter,0
- mov al,' '
- stosb
- mov si,bx
- mov dx,di
- jmp let
- clear:
- mov di,dx
- mov al,0
- mov cl,ah
- rep stosb
- mov counter,0
- mov di,dx
- mov si,bx
- mov dx,di
- jmp let
- exit:
- lea dx,str1
- mov ah,9h
- int 21h
- mov ah,4ch
- int 21h
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement