shahinparsa1328
چهارشنبه 07 اردیبهشت 1390, 12:38 عصر
stk segment
dw 32 dup(?)
stk ends
dts segment
max db 81
len db ?
str db 80 dup(?),'$'
txt db 0dh,0ah,'number of a`s and A`s are = ','$'
dts ends
procs segment
assume cs:procs,ds:dts
itoa proc far
mov di,offset txt
add di,001eh
mov ax,bx
xor bx,bx
mov bl,10
div bl
or al,30h
mov byte ptr[di],al
or ah,30h
mov byte ptr[di+1],ah
ret
itoa endp
procs ends
cds segment
assume cs:cds,ds:dts,ss:stk
main proc far
mov ax,datasg
mov ds,ax
mov es,ax
mov ah,0Ah
mov dx,offset max
int 21h
mov di,offset str
xor bx,bx
mov cl,len
mov ch,0
mov al,'a'
li1 :
repne scasb
jnz arezoo
inc bx
jmp li1
arezoo :
mov di,offset str
mov cl,len
mov ch,0
mov al,'A'
li2 :
repne scasb
jnz finish
inc bx
jmp li2
finish :
call itoa
mov ah,09
mov dx,offset txt
int 21h
mov ah,4ch
int 21h
ret
main endp
cds ends
end main
dw 32 dup(?)
stk ends
dts segment
max db 81
len db ?
str db 80 dup(?),'$'
txt db 0dh,0ah,'number of a`s and A`s are = ','$'
dts ends
procs segment
assume cs:procs,ds:dts
itoa proc far
mov di,offset txt
add di,001eh
mov ax,bx
xor bx,bx
mov bl,10
div bl
or al,30h
mov byte ptr[di],al
or ah,30h
mov byte ptr[di+1],ah
ret
itoa endp
procs ends
cds segment
assume cs:cds,ds:dts,ss:stk
main proc far
mov ax,datasg
mov ds,ax
mov es,ax
mov ah,0Ah
mov dx,offset max
int 21h
mov di,offset str
xor bx,bx
mov cl,len
mov ch,0
mov al,'a'
li1 :
repne scasb
jnz arezoo
inc bx
jmp li1
arezoo :
mov di,offset str
mov cl,len
mov ch,0
mov al,'A'
li2 :
repne scasb
jnz finish
inc bx
jmp li2
finish :
call itoa
mov ah,09
mov dx,offset txt
int 21h
mov ah,4ch
int 21h
ret
main endp
cds ends
end main