Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 1000h
- .data
- mess db 'file was opened',10,13,"$"
- file db 'C:\tasm\bin\duzh\test\privet.txt',0
- result1 db 'C:\tasm\bin\duzh\test\output.txt',0
- openfileerror db 'file did not open',10,13,"$"
- savefileerror db 'file did not save',10,13,"$"
- inputerror db 'You did not input symbol!',10,13,"$"
- mesge db 'Do you want try again?(y/n)',10,13,"$"
- outputerror db 'You don`t have text in memory',10,13,"$"
- result dw 0
- valuefirst dw 0
- valuesecond dw 0
- handle dw 0
- text dw 0
- first dw 0
- adress dw 0
- schet dw 0
- w db 10000 dup(0)
- .code
- .486
- extrn menu:near
- extrn choose:near
- extrn probel:near
- public process
- public inputstring
- public outputstring
- public open
- public close
- ;public inputerror
- public finish
- public start
- public input_error
- public cleardump
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- savefile_error proc
- mov dx, offset savefileerror
- mov ah, 09h
- int 21h
- jmp mes
- ret
- savefile_error endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- openfile_error proc
- mov dx, offset openfileerror
- mov ah, 09h
- int 21h
- jmp mes
- ret
- openfile_error endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- mes proc
- mov dx, offset mesge
- mov ah, 09h
- int 21h
- mov ah, 01h
- int 21h
- cmp al, 79h
- je start
- cmp al, 59h
- je start
- cmp al, 6eh
- je finish
- cmp al, 4eh
- je finish
- jne mes
- ret
- mes endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- output_error proc
- mov ax, 03h
- int 10h
- mov dx, offset outputerror
- mov ah, 09h
- int 21h
- call mes
- ret
- output_error endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- input_error proc
- mov ax, 03h
- int 10h
- mov dx, offset inputerror
- mov ah, 09h
- int 21h
- call mes
- ret
- input_error endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- savefile proc
- mov ah, 3ch
- mov dx, offset result1
- int 21h
- jc savefile_error
- mov result, ax
- mov bx, ax
- mov ah, 40h
- mov dx, offset w
- mov cx, schet
- int 21h
- mov ah, 3eh
- mov bx, result
- int 21h
- ret
- savefile endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- open_file proc
- mov ax, 3d20h
- mov dx, offset file
- int 21h
- jc openfile_error
- mov handle, ax
- mov bx, ax
- mov ah, 3fh
- mov cx, 800h
- mov dx, offset w
- int 21h
- inc ax
- mov schet, ax
- mov adress, ax
- xor ax, ax
- mov cx, schet
- mov ah, 3eh
- mov bx, handle
- int 21h
- ret
- open_file endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- roww proc
- cmp bx, 16
- jne rowww
- add di, 16
- xor bx, bx
- rowww:
- ret
- roww endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- derow proc
- cmp bx, 0
- jne deroww
- sub di, 16
- add bx, 15
- deroww:
- ret
- derow endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- input_star proc
- mov byte ptr w[bx][di], 2ah
- inc bx
- dec bp ;-bp
- dec cx ;-cx
- call roww
- ret
- input_star endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- input_hyphen proc
- mov byte ptr w[bx][di], 2dh
- inc bx
- sub bp, 2 ;-3bp
- sub cx, 2 ;-3cx
- call roww
- ret
- input_hyphen endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- input_hyphen1 proc
- mov byte ptr w[bx][di], 2dh
- inc bx
- dec bp ;-bp
- dec cx ;-cx
- call roww
- ret
- input_hyphen1 endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- check_symbol proc
- cmp ax, 30h
- je checkk
- cmp ax, 31h
- je checkk
- cmp ax, 32h
- je checkk
- cmp ax, 33h
- je checkk
- cmp ax, 34h
- je checkk
- cmp ax, 35h
- je checkk
- cmp ax, 36h
- je checkk
- cmp ax, 37h
- je checkk
- cmp ax, 38h
- je checkk
- cmp ax, 39h
- je checkk
- jmp symb_checked
- checkk:
- inc si
- jmp true
- symb_checked:
- xor si, si
- true:
- ret
- check_symbol endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- replace_4symbols proc
- call derow
- dec bx
- call derow
- dec bx
- call derow
- dec bx
- ; call derow
- ; dec bx
- call roww
- mov byte ptr w[bx][di], 78h
- inc bx
- call roww
- mov byte ptr w[bx][di], 78h
- inc bx
- call roww
- mov byte ptr w[bx][di], 78h
- inc bx
- call roww
- mov byte ptr w[bx][di], 78h
- inc bx
- jmp symbolschanged
- ret
- replace_4symbols endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- replace_symbol proc
- call roww
- mov byte ptr w[bx][di], 78h
- inc bx
- jmp symbolschanged
- ret
- replace_symbol endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- standart_input proc
- xor ax, ax
- xor bx, bx
- xor cx, cx
- xor dx, dx
- xor bp, bp
- mov di, schet
- mov cx, schet
- ret
- standart_input endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- standart_else proc
- xor ax, ax
- xor bx, bx
- xor cx, cx
- xor dx, dx
- xor di, di
- xor bp, bp
- mov cx, schet
- mov bp, schet
- ret
- standart_else endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- clear_register proc
- xor ax, ax
- xor bx, bx
- xor cx, cx
- xor dx, dx
- xor di, di
- xor si, si
- xor bp, bp
- ret
- clear_register endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- enterstring proc
- cren:
- call roww
- mov ah, 01h
- int 21h
- cmp al, 1ah
- je cren3
- mov byte ptr w[bx][di], al
- inc bx
- inc bp
- cmp al, 0dh
- je cren1
- jmp cren2
- cren1:
- mov ax, 03h
- int 10h
- call probel
- inc bp
- cren2:
- jmp cren
- cren3:
- mov byte ptr w[bx][di], 0dh
- inc bx
- ; dec bp
- add schet, bp
- ret
- enterstring endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- input_steck proc
- steck:
- call roww
- mov al, byte ptr w[bx][di]
- push ax
- xor ax, ax
- inc bx
- loop steck
- jmp root1
- ret
- input_steck endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- output_steck proc
- pop ax
- xor ax, ax
- steck1:
- pop ax
- mov byte ptr w[bx][di], al
- xor ax, ax
- inc bx
- call roww
- loop steck1
- jmp root2
- ret
- output_steck endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- input_steck1 proc
- steck2:
- call roww
- mov al, byte ptr w[bx][di]
- push ax
- xor ax, ax
- inc bx
- loop steck2
- jmp root3
- ret
- input_steck1 endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- output_string proc
- output:
- xor ax, ax
- xor dx, dx
- call roww
- cmp cx, 0
- je wasd
- jmp wasd1
- wasd:
- call output_error
- wasd1:
- mov dl, byte ptr w[bx][di]
- inc bx
- cmp dl, 0dh
- je sdvig
- mov ah, 02h
- int 21h
- jmp sdvig1
- sdvig:
- call probel
- sdvig1:
- loop output
- call probel
- call menu
- call choose
- ret
- output_string endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- Begin:
- mov ax, @data
- mov ds, ax
- call clear_register
- jmp start
- start:
- mov ax, 03h
- int 10h
- call menu
- call choose
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- inputstring:
- call standart_input
- call enterstring
- cmp bp, 0
- je input_error
- mov ax, 03h
- int 10h
- jmp start
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- outputstring:
- call standart_else
- call output_string
- jmp start
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- process:
- call standart_else
- cmp cx, 0
- je input_error
- call input_steck
- root1:
- call standart_else
- call output_steck
- root2:
- call standart_else
- call input_steck1
- root3:
- call standart_else
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- sort:
- pop ax
- sort_space:
- cmp ax, 20h
- je space
- sort_dote:
- cmp ax, 2eh
- je dote1
- call check_symbol
- cmp si, 4
- je replace_4symbols
- cmp si, 4
- ja replace_symbol
- mov byte ptr w[bx][di], al
- inc bx
- symbolschanged:
- call roww
- xor ax, ax
- loop sort
- mov schet, bp
- call clear_register
- mov cx, schet
- mov di, schet
- clean2:
- call roww
- mov byte ptr w[bx][di], 00h
- inc bx
- loop clean2
- jmp start
- space:
- xor si, si
- mov byte ptr w[bx][di], 20h
- inc bx
- call roww
- jmp check_space
- space_pop:
- dec cx ;-bp
- dec bp ;-cx
- check_space:
- xor ax, ax
- pop ax
- cmp ax, 20h
- je space_pop
- jne sort_dote
- dote1:
- xor si, si
- pop ax
- cmp ax, 2eh
- je dote2
- call input_star ;-bp ;-cx
- jmp sort_space
- dote2:
- pop ax
- cmp ax, 2eh
- je dote3
- call input_star ;-bp ;-cx
- call input_star ;-bp ;-cx
- jmp sort_space
- dote3:
- pop ax
- cmp ax, 2eh
- je dote4
- cmp ax, 2dh
- je dote31
- call input_hyphen
- jmp sort_space
- dote31:
- pop ax
- cmp ax, 2dh
- je dote32
- call input_hyphen
- call input_hyphen1
- jmp sort_space
- dote32:
- pop ax
- cmp ax, 2dh
- je dote33
- call input_hyphen
- call input_hyphen1
- call input_hyphen1
- jmp sort_space
- dote33:
- pop ax
- cmp ax, 2eh
- je dote331
- call input_hyphen
- call input_hyphen1
- call input_hyphen1
- call input_hyphen1
- jmp sort_space
- dote331:
- pop ax
- cmp ax, 2eh
- je dote332
- call input_hyphen
- call input_hyphen1
- call input_hyphen1
- call input_hyphen1
- call input_star
- jmp sort_space
- dote332:
- pop ax
- cmp ax, 2eh
- je dote333
- call input_hyphen
- call input_hyphen1
- call input_hyphen1
- call input_hyphen1
- call input_star
- call input_star
- jmp sort_space
- dote333:
- mov byte ptr w[bx][di], 53h
- inc bx
- call roww
- mov byte ptr w[bx][di], 4fh
- inc bx
- call roww
- mov byte ptr w[bx][di], 53h
- inc bx
- call roww
- sub cx, 6
- sub bp, 5
- jmp sort
- dote4:
- pop ax
- cmp ax, 2dh
- je dote41
- cmp ax, 2eh
- je dote5
- call input_hyphen
- call input_star
- jmp sort_space
- dote5:
- pop ax
- cmp ax, 2dh
- je dote51
- cmp ax, 2eh
- je dote6
- call input_hyphen
- call input_star
- call input_star
- jmp sort_space
- dote6:
- pop ax
- cmp ax, 2dh
- je dote61
- call input_hyphen
- call input_hyphen
- jmp sort
- dote41:
- call input_star
- jmp dote31
- dote51:
- call input_star
- call input_star
- jmp dote31
- dote61:
- call input_hyphen
- jmp dote31
- open:
- call standart_else
- call open_file
- jmp start
- close:
- call clear_register
- call savefile
- cleardump:
- call clear_register
- mov schet, 0
- mov adress, 0
- mov cx, 1000
- clearalldump:
- call roww
- mov byte ptr w[bx][di], 00h
- inc bx
- loop clearalldump
- jmp start
- finish:
- mov bx, schet
- mov ax, 4c00h
- int 21h
- end begin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement