Advertisement
Guest User

Untitled

a guest
May 5th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small  
  2. .stack 256
  3. .data
  4. string db 100,?,100 dup (?)
  5. .code
  6. assume ds:@data, es:@data
  7. start:
  8. mov ax, @data
  9. mov ds, ax
  10. mov es, ax
  11. mov ah,0Ah
  12. lea dx,string
  13. int 21h
  14. push dx
  15. mov ah,2
  16. mov dl,0Ah
  17. int 21h
  18. pop di
  19. inc di
  20. xor ax,ax
  21. xor cx,cx
  22. xor dx,dx
  23. mov cl,[di]
  24. mov dl,cl
  25. inc di
  26. mov bx,di
  27. push di
  28. mov al,' '
  29. m1:
  30. inc cx
  31. repne scasb
  32. inc ah
  33. push di
  34. sub di,bx
  35. cmp dx,di
  36. jle short m2
  37. mov dx,di
  38. m2:
  39. pop di
  40. test cx,cx
  41. jz short m3
  42. mov bx,di
  43. loop m1
  44. m3:
  45. pop si
  46. dec dx
  47. mov bl,[si-1]
  48. lea di,str1
  49. mov cl,ah
  50. m4:
  51. push cx
  52. mov cx,dx
  53. rep movsb
  54. mov [di],al
  55. inc di
  56. mov cl,bl
  57. xchg di,si
  58. repne scasb
  59. xchg si,di
  60. pop cx
  61. loop m4
  62. mov byte ptr [di-1],'$'
  63. mov ah,9
  64. lea dx,str1
  65. int 21h
  66. mov ah,0
  67. int 16h
  68. ret
  69. str1:
  70. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement