Advertisement
Temprory

Untitled

Dec 11th, 2019
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. .model small
  2. .stack
  3. .data
  4. crlf db 0Dh, 0Ah, '$'
  5. str1 db 30 dup(0), '$'
  6. str2 db 30,0,30 dup(0)
  7. counter dw 0
  8.  
  9. .code
  10. start:
  11. mov ax,@data
  12. mov ds,ax
  13. mov es,ax
  14.  
  15. lea si,str2+2
  16. lea di,str1
  17.  
  18. mov ah,0Ah
  19. lea dx,str2
  20. int 21h
  21.  
  22. lea dx,crlf
  23. mov ah,9
  24. int 21h
  25.  
  26. mov cx,30
  27. xor ax,ax
  28. mov dx,di
  29.  
  30. let:
  31. lodsb
  32. cmp al,0dh
  33. je if1
  34. cmp al,0
  35. je exit
  36. cmp al,' '
  37. je if1
  38. inc counter
  39. stosb
  40. loop let
  41. jmp exit
  42.  
  43. if1:
  44. mov bx,si
  45. mov si,dx
  46. mov di,dx
  47. xor cx,cx
  48. mov cx,counter
  49. mov ah,cl
  50. while:
  51. lodsb
  52. stosb
  53. repne scasb
  54. cmp cx,0
  55. ja clear
  56. mov cx,counter
  57. sub di,cx
  58. dec counter
  59. loop while
  60. mov counter,0
  61. mov al,' '
  62. stosb
  63. mov si,bx
  64. mov dx,di
  65. jmp let
  66.  
  67. clear:
  68. mov di,dx
  69. mov al,0
  70. mov cl,ah
  71. rep stosb
  72. mov counter,0
  73. mov di,dx
  74. mov si,bx
  75. mov dx,di
  76. jmp let
  77.  
  78. exit:
  79. lea dx,str1
  80. mov ah,9h
  81. int 21h
  82.  
  83. mov ah,4ch
  84. int 21h
  85.  
  86. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement