Neveles

Untitled

Dec 18th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DOSSEG
  2. .MODEL TINY
  3. .STACK 100h
  4. .DATA
  5. inputFile DB 'input.txt',0
  6. outputFile DB 'output.txt',0
  7. text DB 2000 DUP('$')
  8. ;message DB 10,13,'I fucking hate ASSembler! Godawful stinky crap! How is it even possible to create such a disgusting and filthy piece of shit?! What kind of moron you should be to even imagine how all these meaningless push and pops can work?! Nonsense!',10,13,'$'
  9. .CODE
  10. .386
  11. ; basic shit
  12. mov ax, @Data
  13. mov ds, ax
  14. mov es, ax
  15.  
  16. ; creating new file
  17. mov ah, 3Ch
  18. mov cx, 0
  19. lea dx, outputFile
  20. int 21h
  21.  
  22. ; opening file
  23. mov ah, 3Dh
  24. mov al, 0
  25. lea dx, inputFile
  26. int 21h
  27. jc error_no_file
  28.    
  29. mov si, ax         
  30.  
  31. ; reading
  32. lea dx, text
  33.  
  34. reading_file:
  35.  mov ax, 3F00h
  36.  mov bx, si
  37.  mov cx, 1
  38.  int 21h
  39.  inc dx
  40.  cmp ax, 1
  41.  je reading_file
  42.  
  43. ; show string
  44. ;mov ah, 9
  45. ;lea dx, text
  46. ;int 21h
  47.  
  48. ; main part
  49. mov dx, 0 ;
  50. mov bx, OFFSET text
  51.  
  52. iter:
  53.  cmp dx, 0 ;
  54.  je met ;
  55.  add bx, 1
  56.  met: ;
  57.   mov dx, 1 ;
  58.  mov al, [bx]  
  59.  cmp al, 40h    
  60.  jbe nextword      
  61.  cmp al, 4Dh  
  62.  jbe print        
  63.  cmp al, 60h  
  64.  jbe nextword
  65.  cmp al, 6Dh      
  66.  jbe print
  67.  
  68.  jmp nextword
  69.  
  70. print:
  71.  mov ah, 2
  72.  mov dl, al
  73.  int 21h
  74.  cmp al, 20h  
  75.  jz iter
  76.  mov ah, 21h
  77.  
  78. znaki:      
  79.  cmp [bx + 1], ah
  80.  jz printprobel
  81.  add ah, 1
  82.  cmp ah, 30h
  83.  jbe znaki
  84.  add bx, 1
  85.  mov al, [bx]
  86.  cmp al, 13
  87.  jz cancel
  88.  jmp print
  89.  
  90. nextword:
  91.  cmp al, 20h
  92.  jz iter
  93.  add bx, 1
  94.  mov al, [bx]
  95.  cmp al, 13
  96.  jz cancel
  97.  jmp nextword
  98.  
  99. printprobel:
  100.  mov ah, 2
  101.  mov dl, 20h
  102.  int 21h
  103.  jmp iter
  104.  
  105. cancel:
  106.  mov ah, 2
  107.  mov dl, 10
  108.  int 21h
  109.  mov ah, 4ch
  110.  int 21h
  111.  
  112. error_no_file:  
  113.  mov dl, 1
  114.  mov ah, 2
  115.  int 21h
  116.  mov ah, 4ch
  117.  int 21h
  118.  
  119. END
Add Comment
Please, Sign In to add comment