زبان اسمبلی-این برنامه یک رشته را دریافت کرده و کاراکتر بزرگترین کد اسکی و کوچکترین کد اسکی را نمایش
;-*-*-*-*-*-*-*-*-*-* STACK SEGMENT *-*-*-*-*-*-*-*-*-*-*-*-*
stacksg segment para stack 'stack'
dw 32 dup('?')
stacksg ends
;-*-*-*-*-*-*-*-*-*-* DATA SEGMENT *-*-*-*-*-*-*-*-*-*-*-*-*
datasg segment para 'data'
msg1 db "Enter a string : ",'$'
msg2 db "Maximum of aski code : ",'$'
msg3 db "Minimum of aski code : ",'$'
msg4 db "Made by REZA AKHLAGHY & MOHAMMAD SHERAFAT",'$'
msg5 db "_+_+_+_+_+_+_This program found max & min Asci code of character _+_+_+_+_+_+_",'$'
strlist label byte
max db 10
len db ?
input_string db 10 dup(' ')
maximum db ?
minimum db ?
datasg ends
;-*-*-*-*-*-*-*-*-*-* CODE SEGMENT *-*-*-*-*-*-*-*-*-*-*-*-*
codesg segment para 'code'
main proc far
assume cs:codesg,ds:datasg,es:codesg
mov ax,datasg
mov ds,ax
;-*-*-*-*-*-*-*-*-*-* Clear Screen *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 6h
mov al, 25 ;number of rows
mov ch, 0
mov cl, 0
mov dh, 24 ;row
mov dl, 79 ;column
mov bh, 15 ;attribute
int 10h
;-*-*-*-*-*-*-*-*-*-* cursor move *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 2h ;request set cursor
mov dh, 3 ;row
mov dl, 1 ;column
mov bh, 0 ;page number
int 10h
;-*-*-*-*-*-*-*-*-*-* print msg5 *-*-*-*-*-*-*-*-*-*-*-*-*
lea dx,msg5
mov al,0
mov ah,09h
int 21h
;-*-*-*-*-*-*-*-*-*-* cursor move *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 2h ;request set cursor
mov dh, 7 ;row
mov dl, 18 ;column
mov bh, 0 ;page number
int 10h
;-*-*-*-*-*-*-*-*-*-* print msg4 *-*-*-*-*-*-*-*-*-*-*-*-*
lea dx,msg4
mov al,0
mov bh,14h
mov ah,09h
int 21h
;-*-*-*-*-*-*-*-*-*-* cursor move *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 2h ;request set cursor
mov dh, 10 ;row
mov dl, 30 ;column
mov bh, 0 ;page number
int 10h
;-*-*-*-*-*-*-*-*-*-* print message1 *-*-*-*-*-*-*-*-*-*-*-*-*
lea dx, msg1
mov ah, 9h
int 21h
;-*-*-*-*-*-*-*-*-*-* read string *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 0ah
lea dx, strlist
int 21h
;-*-*-*-*-*-*-*-*-*-* Main Opration *-*-*-*-*-*-*-*-*-*-*-*-*
lea bx,input_string
mov cl,0
mov al,[bx];MAXIMUM
mov ah,[bx];MINIMUM
start_of_loop:
cmp cl,len
je end_of_program
cmp [bx],ah
jg next_case
mov ah,[bx]
next_case:
cmp [bx],al
jl next_index
mov al,[bx]
next_index:
inc cl
inc bx
mov maximum,al
mov minimum,ah
jmp start_of_loop
end_of_program:
;-*-*-*-*-*-*-*-*-*-* Clear Screen *-*-*-*-*-*-*-*-*-*-*-*-*
mov ax,0600h
mov bh,15
mov cx,0000
mov dx,184fh
int 10h
;-*-*-*-*-*-*-*-*-*-* mov curcer *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah,2h
mov dh,10
mov dl,30
mov bh,0
int 10h
;-*-*-*-*-*-*-*-*-*-* print msg2 *-*-*-*-*-*-*-*-*-*-*-*-*
lea dx,msg2
mov al,0
mov ah,09h
int 21h
;-*-*-*-*-*-*-*-*-*-* print MAXIMUM *-*-*-*-*-*-*-*-*-*-*-*-*
mov dl,maximum
mov ah,2h
int 21h
;-*-*-*-*-*-*-*-*-*-* move curcer *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah,2h
mov dh,11
mov dl,30
mov bh,0
int 10h
;-*-*-*-*-*-*-*-*-*-* print msg3 *-*-*-*-*-*-*-*-*-*-*-*-*
lea dx,msg3
mov al,0
mov ah,09h
int 21h
;-*-*-*-*-*-*-*-*-*-* print MINIMUM *-*-*-*-*-*-*-*-*-*-*-*-*
mov dl,minimum
mov ah,2h
int 21h
;-*-*-*-*-*-*-*-*-*-* cursor move *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 2h ;request set cursor
mov dh, 20 ;row
mov dl, 18 ;column
mov bh, 0 ;page number
int 10h
;-*-*-*-*-*-*-*-*-*-* print msg4 *-*-*-*-*-*-*-*-*-*-*-*-*
lea dx,msg4
mov al,0
mov bh,14h
mov ah,09h
int 21h
;-*-*-*-*-*-*-*-*-*-* cursor move *-*-*-*-*-*-*-*-*-*-*-*-*
mov ah, 2h ;request set cursor
mov dh, 25 ;row
mov dl, 30 ;column
mov bh, 0 ;page number
int 10h
;-*-*-*-*-*-*-*-*-*-* close program *-*-*-*-*-*-*-*-*-*-*-*-*
mov ax,4c00h
int 21h
main endp
codesg ends
end main