Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DOSSEG
- .MODEL TINY
- .STACK 100h
- .DATA
- testFilename DB 'input.txt',0
- buffer DB 1000 DUP('$')
- 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,'$'
- .CODE
- mov ax, @Data
- mov ds, ax
- mov es, ax
- ; opening file
- mov ah, 3Dh
- mov al, 0 ; read-only
- lea dx, testFilename
- ;int 21h;
- ;jc error_no_file
- mov si, ax
- mov ax, 3F00h
- mov bx, si
- mov cx, 1
- lea dx, buffer
- ;int 21h
- ;cmp ax, 1
- ;jne print_results
- mov al, [buffer]
- ; reading
- reading_file:
- mov ax, 3F00h
- mov bx, si
- mov cx, 1
- lea dx, buffer
- int 21h
- inc buffer
- cmp ax, 1
- je reading_file
- ; main part
- mov bx, OFFSET buffer
- add bx, 1
- iter:
- add bx, 1
- mov al, [bx]
- cmp al, 40h
- jbe nextword
- cmp al, 4Dh
- jbe print
- cmp al, 60h
- jbe nextword
- cmp al, 6Dh
- jbe print
- jmp nextword
- print:
- mov ah, 2
- mov dl, al
- int 21h
- cmp al, 20h
- jz iter
- mov ah, 21h
- znaki:
- cmp [bx + 1], ah
- jz printprobel
- add ah, 1
- cmp ah, 30h
- jbe znaki
- add bx, 1
- mov al, [bx]
- cmp al, 13
- jz cancel
- jmp print
- nextword:
- cmp al, 20h
- jz iter
- add bx, 1
- mov al, [bx]
- cmp al, 13
- jz cancel
- jmp nextword
- printprobel:
- mov ah, 2
- mov dl, 20h
- int 21h
- jmp iter
- cancel:
- mov ah, 2
- mov dl, 10
- int 21h
- mov ah, 4ch
- int 21h
- END
Add Comment
Please, Sign In to add comment