Neveles

Untitled

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