برنامه های برنامه نویسی اسمبلی از تمام تمرینات فصل 6

stacksg segment stack
db 32 dup("stack----")
stacksg ends
codesg segment para 'code'
main proc far
assume ss:stacksg ,cs:codesg
push ds
push 0
mov ax,0
mov bx,0
mov cx,0
p1: inc ax
inc bx
inc cx
jmp p1
ret
main endp
codesg ends
end main

//////////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a string:',"$"
msg2 db 'yos entered this string:',"$"
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 10h
mov dx,offset msg2
mov ah,9h
int 21h
lea bx,buffer
mov cl,0
p1: mov dl,[bx]
mov ah,2h
int 21h
inc bx
inc cl
cmp cl,len
jnz p1
mov ax,4c00h
int 21h
main endp
codesg ends
end main

/////////////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a string:',"$"
msg2 db 'inverse string is:',"$"
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 10h
mov dx,offset msg2
mov ah,9h
int 21h
lea bx,buffer
mov cl,0
p1: mov dl,[bx]
mov ah,2h
int 21h
inc bx
inc cl
cmp cl,len
jnz p1
mov ax,4c00h
int 21h
main endp
codesg ends
end main

//////////////////////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a string:',"$"
msg2 db 'result string is:',"$"
msg3 db 'enter source characeter:',"$"
msg4 db 'enter tardet cgaracter:',"$"
ch1 db ?
ch2 db ?
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
int 21h
mov ah,2h
mov dh,10
mov dl,30
mov bh,0
int 10h
lea dx, msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 10h
mov dx,offset msg2
mov ah,9h
int 21h
lea bx,buffer
mov ch,0
mov cl,len
sub cl,1
add bx,cx
mov cl,0
p1: mov dl,[bx]
mov ah,2h
int 21h
inc cl
dec bx
cmp cl,len
jnz p1
mov ax,4c00h
int 21h
main endp
codesg ends
end main

////////////////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a string:',"$"
msg2 db 'enter a character:',"$"
msg3 db '<<character exist>>',"$"
msg4 db '<<character not exist>>',"$"
char db ?
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 10h
lea dx, msg2
mov ah,9h
int 21h
mov ah,1h
int 21h
mov char,al
mov ah,2h
mov dh,14
mov dl,30
mov bh,0
int 10h
mov ah,0
lea bx,buffer
mov cl,len
next: mov dl,[bx]
cmp char,dl
jne p2
lea dx,msg3
mov ah,9h
int 21h
jmp p3
p2: inc bx
loop next
lea dx,msg4
mov ah,9h
int 21h
p3: mov ax,4c00h
int 21h
main endp
codesg ends
end main

////////////////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a string:',"$"
msg2 db 'the result string is:',"$"
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
lea bx,buffer
mov cl,len
mov ch,0
next: mov ah,[bx]
cmp ah,41h
jb p1
cmp ah,4ah
ja p1
xor ah,00100000h
mov [bx],ah
inc bx
loop next
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 10h
mov ah,0
lea dx,buffer
mov ah,9h
int 21h
mov ax,4c00h
int 21h
main endp
codesg ends
end main

///////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a namber:',"$"
msg2 db 'the log of this namber is:',"$"
count db 0
sign dw ?
string db 6 dup(''),"$"
sign1 db ?
number dw ?
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
lea bx,buffer
while_blank:cmp byte ptr[bx],'2'
jne end_while_blank
inc bx
jmp while_blank
end_while_blank:
mov sign,1
cmp byte ptr[bx],'+'
je skip_sign
cmp byte ptr[bx],'-'

mov sign,-1
skip_sign: inc bx
save_sgpn: mov ax,0
mov count,0
while_digit:cmp byte ptr[bx],'0'
jl end_while_digit
cmp byte ptr [bx],'9'
jp end_while_digit
mov cx,10
mul cx
mov cl,[bx]
and cx,000fh
add ax,cx
inc count
inc bx
jmp while_digit
end_while_digit:
imul sign
mov number,ax
mov cx,0
mov ax,1
cmp ax,number
jnle end_while
add ax,ax
inc cx

end_while:dec cx
mov ax,cx
lea bx,string
add bx,5
mov sign,9'
cmp ax,0
jpe setup
mov sign1,'_'
neg ax
setup: mov cx,10
divloop: mov dx,0
div cx
add dl,30h
mov [bx],dl
dec bx
cmp ax,0
jne divloop
mov cl,sign1
mov [bx],cl
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 10h
lea dx,msg2
mov ah,9h
int 21h
lea dx,string
mov ax,9h
int 21h
mov ax,4c00h
int 21h
main endp
codesg ends
end main

///////////////////////////////////////////////////////////

datasg segment para 'code'
msg db 'the result is:',"$"
sign dw ?
string db 6 dup(''),"$"
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,0
mov al,0
mov bl,0
mov cx,5
p1: inc al
inc bl
loop p1
add al,bl
lea bx,string
add bx,5
mov sign,'5'
cmp ax,0
jge setup
mov sign,'-'
neg ax
setup: mov cx,10
divloop: mov dx,0
div cx
add dl,30h
dec bx
cmp ax,0
jne divloop
mov cx, sign
mov [bx],cl
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg
mov ah,9h
int 21h
lea dx,string
mov ax,9h
int 21h
mov ax,4c00h
int 21h
main endp
codesg ends
end main

///////////////////////////////////////////////////////////

datasg segment para 'code'
msg1 db 'enter a namber:',"$"
msg2 db 'the log of this namber is:',"$"
count db 0
sign dw ?
string db 6 dup(''),"$"
sign1 db ?
strlist label byte
max db 20
len db ?
buffer db 20 dup('')
dolar db '$'
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg ,cs:codesg
mov ax,datasg
mov ds,ax
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
mov ah,2h
mov dh,10
mov dl,30
mov dh,0
int 10h
lea dx,msg1
mov ah,9h
int 21h
mov ah,0ah
lea dx,strlist
int 21h
lea bx,buffer
while_blank:cmp byte ptr[bx],'2'
jne end_while_blank
inc bx
jmp while_blank
end_while_blank:
mov sign,1
cmp byte ptr[bx],'+'
je skip_sign
cmp byte ptr[bx],'-'

mov sign,-1
skip_sign: inc bx
save_sgpn: mov ax,0
mov count,0
while_digit:cmp byte ptr[bx],'0'
jl end_while_digit
cmp byte ptr [bx],'9'
jp end_while_digit
mov cx,10
mul cx
mov cl,[bx]
and cx,000fh
add ax,cx
inc count
inc bx
jmp while_digit
end_while_digit:
imul sign
lea bx,string+3
mov cx,4
forloop: mov dx,ax
and dx,00fh
if_1: cmp dx,9
jnle else_1
then_1: or dx,30h
jmp SHORT endif_1
else_1: add dx,'A'-10
endif_1:
mov byte ptr[bx],dl
dec bx
shr ax,4
loop forloop
mov ah,2h
mov dh,12
mov dl,30
mov bh,0
int 21h
lea dx,msg2
mov ah,9h
int 21h
lea dx,string
mov ax,9h
int 21h
mov ax,4c00h
int 21h
main endp
codesg ends
end main

2 نظر

  1. VaniaVaniasays:

    My brother recommended I might like this web site. He was once entirely right. This post truly made my day. You can not imagine just how a lot time I had spent for this info! Thanks!

  2. ThouttypouckyThouttypouckysays:

    http://thoroughbred.one/moneybookers-review/3321 moneybookers review http://nonincrusting.one/mamma-mia-niagara-falls-casino/769 mamma mia niagara falls casino http://essayistic.one/nordicbet-bonus-villkor/4418 nordicbet bonus villkor http://dynamited.one/jackpotjoy-app/2524 jackpotjoy app http://revisionism.one/spilleautomat-evolution/1983 spilleautomat Evolution http://pragmaticality.one/koping-casinon-pa-natet/968 Koping casinon pa natet http://phoenicia.one/spelautomater-arabian-nights/603 spelautomater Arabian Nights http://nonaccelerative.one/casino-stockholm-roulette/3885 casino stockholm roulette http://nontimbered.one/blackjack-online-sverige/660 blackjack online sverige