Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://vk.com/evgenykravchenko0
- ___ ___ ___
- / /\ ___ / /\ / /\
- / /:/_ /__/\ / /:/_ / /:/_
- / /:/ /\ \ \:\ / /:/ /\ / /:/ /\
- / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_
- /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\
- \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/
- \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/
- \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/
- \ \::/ \__\::::/ \ \::/ \ \::/
- \__\/ ~~~~ \__\/ \__\/
- ___
- /__/\ ___ ___
- \ \:\ / /\ / /\
- \ \:\ / /:/ / /:/
- _____\__\:\ /__/::\ /__/::\
- /__/::::::::\ \__\/\:\__ \__\/\:\__
- \ \:\~~\~~\/ \ \:\/\ \ \:\/\
- \ \:\ ~~~ \__\::/ \__\::/
- \ \:\ /__/:/ /__/:/
- \ \:\ \__\/ \__\/
- \__\/
- ;## DATA SEGMENT ##
- DATASEG Segment
- enter_str db 'Enter string:$'
- invite db '> $'
- error_max db 'more then one maximum letters$'
- error_bln db 'blank string$'
- error_one db 'one letter$'
- string db 255, ?, 255 dup(?)
- letters db 26 dup(0)
- DATASEG Ends
- ;## /DATA SEGMENT ##
- ;## STACK SEGMENT ##
- STACKSEG Segment Stack
- db 100h dup(?)
- STACKSEG Ends
- ;## /STACK SEGMENT ##
- ;## CODE SEGMENT ##
- CODESEG Segment
- Assume CS:CODESEG, DS:DATASEG, SS:STACKSEG
- ;## Procedure`s And Macro`s ##
- ;## Vyvod pustoi stroki ##
- writeln macro
- push dx
- push ax
- mov ah,2
- mov dl,13
- int 21h
- mov dl,10
- int 21h
- pop ax
- pop dx
- endm
- ;## Vyvod stroki ##
- write macro string
- push ax
- push dx
- mov ah,09h
- mov dx,offset string
- int 21h
- pop dx
- pop ax
- endm
- ;## exit prog ##
- exit macro
- mov al,0
- mov ah,4Ch
- int 21h
- endm
- ;## Clear Screen ##
- clrscr macro
- push ax
- push bx
- push cx
- push dx
- mov ax,0600h
- mov bh,07h
- xor cx,cx
- mov dh,24
- mov dl,80
- int 10h
- mov ah,0fh
- int 10h
- mov dx,0101h
- mov ah,2
- int 10h
- pop dx
- pop cx
- pop bx
- pop ax
- endm
- ;## Readkey ##
- readkey macro registr
- push ax
- mov ah,10h
- int 16h
- mov registr,ax
- pop ax
- endm
- error_p_one:
- mov dx,offset error_one
- mov ah,09h
- int 21h
- jmp the_end
- error_p_bln:
- mov dx,offset error_bln
- mov ah,09h
- int 21h
- jmp the_end
- ;## /Procedure`s And Macro`s ##
- ;## Programm ##
- start:
- mov ax,DATASEG
- mov ds,ax
- ;-------------
- clrscr
- write enter_str
- writeln
- write invite
- mov ah,0Ah
- mov dx,offset string
- int 21h
- writeln
- xor ch,ch
- mov bx,2
- mov cl,string[1]
- cmp cx,1
- je error_p_one
- cmp cx,0
- je error_p_bln
- xor ah,ah
- find_repeat_letters:
- mov al,string[bx]
- inc bx
- cmp al,'a'
- jge low_registry
- sbb al,'A'
- inc al
- jmp skip_low_reg
- low_registry:
- sbb al,'a'
- skip_low_reg:
- mov si,ax
- inc letters[si]
- loop find_repeat_letters
- ;find max repeated letter
- xor di,di
- put_number:
- mov ah,letters[di]
- inc di
- cmp ah,0
- je put_number
- dec di
- mov bx,1
- mov cx,26
- find_max:
- ; cmp bx,di
- ; jne skip_dec
- ; dec cx
- ; inc bx
- ; skip_dec:
- mov al,letters[bx]
- ; cmp al,ah
- ; je error_p_max
- cmp al,ah
- jl skip_mov
- mov ah,al
- mov di,bx
- skip_mov:
- inc bx
- loop find_max
- mov ah,letters[di]
- mov cx,26
- xor bx,bx
- two_or_more_max:
- cmp bx,di
- jne skip_dec
- dec cx
- inc bx
- skip_dec:
- mov al,letters[bx]
- cmp al,ah
- je error_p_max
- inc bx
- loop two_or_more_max
- mov dx,di
- xchg dh,dl
- mov ah,02h
- mov bx,2
- ; xor ch,ch
- mov cl,string[1]
- print_new_string:
- mov dl,string[bx]
- inc bx
- add dh,'a'
- cmp dl,dh
- je skip_out
- sub dh,'a'
- add dh,'A'
- cmp dl,dh
- je skip_out
- int 21h
- skip_out:
- sub dh,'A'
- loop print_new_string
- jmp the_end
- error_p_max:
- mov dx,offset error_max
- mov ah,09h
- int 21h
- the_end:
- readkey ax
- writeln
- quit:
- exit
- CODESEG Ends
- ;## /CODE Segment ##
- End start
- ;## /Programm ##
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement