saeedrobot
جمعه 18 بهمن 1387, 12:50 عصر
--------------------------------------------------------------------------------
سلام دوستان " برنامه درخواست پسورد از کاربر "
دننباله سورس برنامه ای میگردم که کدی (شامل فقط عدد) 4رقمی از کاربر درخواست کند.بعدازدریافت انرا با کدی که ابتدا برایش تعریف شده مقایسه کند( اگر این مقایسه به صورت کارکتر به کارکتر انجام شود بهتر است ) اگر درست بود کاری مثل چاپ پیغام" پسورد درست است " انجام دهد. اگر برای ورودی و خروجی از وقفه استفاده شود بهتر است.
فکر کنم کد پیش فرض که برای سیستم تعریف شده را باید در یک string قرار دادولی هر کاری کردم نتونستم تعریف کنم
stack segment stack ; define stack
dw 200h dup(?)
stack ends
data segment ; define var
op1 dw ?
op2 dw ?
a dw '12'
b dw '34'
message db 'Enter password','$'
ok db 'Your oassword is ok','$'
not db 'your password is not right','$'
data ends
code segment
assume cs:code , ds:data , ss:stack
start:
mov ax,seg data
mov ds,ax
mov ah,09h
lea dx,message
int 21h
mov ah,02h ;set start cuser position
mov dh,10
mov dl,30
int 10h
f1:
mov ah,10h ;read a character
int 16h
cmp al,30h
jl f1
cmp al,39h
jg f1
mov ah,0eh
int 10h
mov dl,al
s1: mov ah,10h ;read a character
int 16h
cmp al,30h
jl s1
cmp al,39h
jg s1
mov ah,0eh
int 10h
mov dh,al
mov op1,dx
t1: mov ah,10h ;read a character
int 16h
cmp al,30h
jl t1
cmp al,39h
jg t1
mov ah,0eh
int 10h
mov cl,al
h1: mov ah,10h ;read a character
int 16h
cmp al,30h
jl h1
cmp al,39h
jg h1
mov ah,0eh
int 10h
mov ch,al
mov op2,cx
if_1 :
cmp a,dx ;comparing for result
jne start3
cmp b,cx
jne start3
start2:
mov ah,09h
lea dx,ok
int 21h
start3:
mov ah,09h
lea dx,not
int 21h
quit:
mov al,0
mov ah,4ch
int 21h
code ends
end start
end start
سلام دوستان " برنامه درخواست پسورد از کاربر "
دننباله سورس برنامه ای میگردم که کدی (شامل فقط عدد) 4رقمی از کاربر درخواست کند.بعدازدریافت انرا با کدی که ابتدا برایش تعریف شده مقایسه کند( اگر این مقایسه به صورت کارکتر به کارکتر انجام شود بهتر است ) اگر درست بود کاری مثل چاپ پیغام" پسورد درست است " انجام دهد. اگر برای ورودی و خروجی از وقفه استفاده شود بهتر است.
فکر کنم کد پیش فرض که برای سیستم تعریف شده را باید در یک string قرار دادولی هر کاری کردم نتونستم تعریف کنم
stack segment stack ; define stack
dw 200h dup(?)
stack ends
data segment ; define var
op1 dw ?
op2 dw ?
a dw '12'
b dw '34'
message db 'Enter password','$'
ok db 'Your oassword is ok','$'
not db 'your password is not right','$'
data ends
code segment
assume cs:code , ds:data , ss:stack
start:
mov ax,seg data
mov ds,ax
mov ah,09h
lea dx,message
int 21h
mov ah,02h ;set start cuser position
mov dh,10
mov dl,30
int 10h
f1:
mov ah,10h ;read a character
int 16h
cmp al,30h
jl f1
cmp al,39h
jg f1
mov ah,0eh
int 10h
mov dl,al
s1: mov ah,10h ;read a character
int 16h
cmp al,30h
jl s1
cmp al,39h
jg s1
mov ah,0eh
int 10h
mov dh,al
mov op1,dx
t1: mov ah,10h ;read a character
int 16h
cmp al,30h
jl t1
cmp al,39h
jg t1
mov ah,0eh
int 10h
mov cl,al
h1: mov ah,10h ;read a character
int 16h
cmp al,30h
jl h1
cmp al,39h
jg h1
mov ah,0eh
int 10h
mov ch,al
mov op2,cx
if_1 :
cmp a,dx ;comparing for result
jne start3
cmp b,cx
jne start3
start2:
mov ah,09h
lea dx,ok
int 21h
start3:
mov ah,09h
lea dx,not
int 21h
quit:
mov al,0
mov ah,4ch
int 21h
code ends
end start
end start