Neveles

Untitled

Dec 14th, 2019
151
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. ; reading
  23. lea dx, buffer
  24.  
  25. reading_file:
  26.  mov ax, 3F00h
  27.  mov bx, si
  28.  mov cx, 1
  29.  int 21h
  30.  inc dx
  31.  cmp ax, 1
  32.  ;je reading_file
  33.  
  34. ; main part
  35. mov bx, OFFSET buffer
  36. add bx, 1
  37.  
  38. iter:
  39.  add bx, 1
  40.  mov al, [bx]
  41.  cmp al, 40h    
  42.  jbe nextword    
  43.  cmp al, 4Dh  
  44.  jbe print        
  45.  cmp al, 60h  
  46.  jbe nextword
  47.  cmp al, 6Dh      
  48.  jbe print
  49.  jmp nextword
  50.  
  51. print:
  52.  mov ah, 2
  53.  mov dl, al
  54.  int 21h
  55.  cmp al, 20h  
  56.  jz iter
  57.  mov ah, 21h
  58.  
  59. znaki:      
  60.  cmp [bx + 1], ah
  61.  jz printprobel
  62.  add ah, 1
  63.  cmp ah, 30h
  64.  jbe znaki
  65.  add bx, 1
  66.  mov al, [bx]
  67.  cmp al, 13
  68.  jz cancel
  69.  jmp print
  70.  
  71. nextword:
  72.  cmp al, 20h
  73.  jz iter
  74.  add bx, 1
  75.  mov al, [bx]
  76.  cmp al, 13
  77.  jz cancel
  78.  jmp nextword
  79.  
  80. printprobel:
  81.  mov ah, 2
  82.  mov dl, 20h
  83.  int 21h
  84.  jmp iter
  85.  
  86. cancel:
  87.  mov ah, 2
  88.  mov dl, 10
  89.  int 21h
  90.  mov ah, 4ch
  91.  int 21h
  92.  
  93. error_no_file:  
  94.  mov dl,1
  95.  mov ah, 2
  96.  int 21h
  97.  
  98. END
Add Comment
Please, Sign In to add comment