Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DOSSEG
- .MODEL TINY
- .STACK 100h
- .DATA
- inputFile DB 'input.txt',0
- outputFile DB 'outputFile.txt',0
- error_file DB 'Cannot open file!',0,13,10
- text DB 1000 DUP('$')
- buff DB '2', '$'
- .CODE
- .386
- inFile macro str
- mov ah, 40h
- push bx
- mov bx, di
- mov cx, 1
- lea si, buff
- mov [si], str
- mov dx, si
- int 21h
- pop bx
- endm
- start:
- mov ax, @Data
- mov ds, ax
- mov es, ax
- ; otkritie fayla
- mov ah, 3Dh
- mov al, 0
- lea dx, inputFile
- int 21h
- jc error_no_file
- mov si, ax
- ; chtenie fayla
- lea dx, text
- reading_file:
- mov ah, 3Fh
- mov bx, si
- mov cx, 1
- int 21h
- inc dx
- cmp ax, 1
- je reading_file
- ; zakritie fayla
- mov ah, 3Eh
- mov bx, si
- int 21h
- ; sozdanie fayla
- mov al, 1h
- mov ah, 3Ch
- mov cx, 0
- lea dx, outputFile
- int 21h
- mov di, ax
- ; osnovnaya chast
- mov cx, 0
- mov bx, OFFSET text
- mov dx, bx
- main_iteration:
- cmp cx, 0
- je met
- add bx, 1
- met:
- mov cx, 1
- mov al, [bx]
- cmp al, 41h ; A
- je printword
- cmp al, 45h ; E
- je printword
- cmp al, 49h ; I
- je printword
- cmp al, 4Fh ; O
- je printword
- cmp al, 55h ; U
- je printword
- cmp al, 59h ; Y
- je printword
- cmp al, 61h ; a
- je printword
- cmp al, 65h ; e
- je printword
- cmp al, 69h ; i
- je printword
- cmp al, 6Fh ; o
- je printword
- cmp al, 75h ; u
- je printword
- cmp al, 79h ; y
- je printword
- jmp skipword
- printword:
- mov ah, 2
- mov dl, al
- int 21h
- inFile al
- cmp al, 20h
- jz main_iteration
- signs:
- cmp [bx + 1], ah
- jz printspace
- add ah, 1
- cmp ah, 30h
- jbe signs
- add bx, 1
- mov al, [bx]
- cmp al, 13
- jz quit
- jmp printword
- skipword:
- cmp al, 20h
- jz main_iteration
- add bx, 1
- mov al, [bx]
- cmp al, 13
- jz quit
- jmp skipword
- printspace:
- mov ah, 2
- mov dl, 20h
- int 21h
- inFile 20h
- jmp main_iteration
- quit:
- mov ah, 2
- mov dl, 10
- int 21h
- mov ah, 3Eh
- mov bx, di
- int 21h
- mov ah, 4ch
- int 21h
- error_no_file:
- lea dx, error_file
- mov ah, 9h
- int 21h
- mov ah, 4ch
- int 21h
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement