Neveles

Untitled

Dec 14th, 2019
144
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. testFilename DB 'input.txt',0
  6. buffer DB 1000 DUP('$')
  7. Message DB 13,10,'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!',13,10,'$'
  8. .CODE
  9. mov ax, @Data
  10. mov ds, ax
  11. mov es, ax
  12.  
  13. ; opening file
  14. mov ah, 3Dh
  15. mov al, 0 ; read-only
  16. lea dx, testFilename
  17. ;int 21h;
  18. ;jc error_no_file
  19.    
  20. mov si, ax         
  21.  
  22. mov ax, 3F00h
  23. mov bx, si         
  24. mov cx, 1          
  25. lea dx, buffer     
  26. ;int 21h  
  27. ;cmp ax, 1         
  28. ;jne print_results
  29.                
  30. mov al, [buffer]
  31.  
  32. ; reading
  33. reading_file:
  34.  mov ax, 3F00h
  35.  mov bx, si
  36.  mov cx, 1
  37.  lea dx, buffer
  38.  int 21h
  39.  inc buffer
  40.  cmp ax, 1
  41.  je reading_file
  42.  
  43. ; main part
  44. mov bx, OFFSET buffer
  45. add bx, 1
  46.  
  47. iter:
  48.  add bx, 1
  49.  mov al, [bx]
  50.  cmp al, 40h    
  51.  jbe nextword    
  52.  cmp al, 4Dh  
  53.  jbe print        
  54.  cmp al, 60h  
  55.  jbe nextword
  56.  cmp al, 6Dh      
  57.  jbe print
  58.  jmp nextword
  59.  
  60. print:
  61.  mov ah, 2
  62.  mov dl, al
  63.  int 21h
  64.  cmp al, 20h  
  65.  jz iter
  66.  mov ah, 21h
  67.  
  68. znaki:      
  69.  cmp [bx + 1], ah
  70.  jz printprobel
  71.  add ah, 1
  72.  cmp ah, 30h
  73.  jbe znaki
  74.  add bx, 1
  75.  mov al, [bx]
  76.  cmp al, 13
  77.  jz cancel
  78.  jmp print
  79.  
  80. nextword:
  81.  cmp al, 20h
  82.  jz iter
  83.  add bx, 1
  84.  mov al, [bx]
  85.  cmp al, 13
  86.  jz cancel
  87.  jmp nextword
  88.  
  89. printprobel:
  90.  mov ah, 2
  91.  mov dl, 20h
  92.  int 21h
  93.  jmp iter
  94.  
  95. cancel:
  96.  mov ah, 2
  97.  mov dl, 10
  98.  int 21h
  99.  mov ah, 4ch
  100.  int 21h
  101.  
  102. END
Add Comment
Please, Sign In to add comment