roxen13
جمعه 26 آبان 1385, 19:28 عصر
من در ورود و چاپ اعداد مشکل دارم.
کد زیر را برای این کار نوشتم. ملی درست کار نمی کند. مپلا" عدد 12345 یا هر عدد دیگر را می گیرد و 15656 را چاپ می کند.
.model small
.stack 64
.data
msg1 db "please enter first num:",'$'
msg2 db "the num is:",'$'
str label byte
max db 20
len db ?
buffer db 20 dup(' ')
dolar db '$'
string db 6 dup(' '),'$'
.code
main proc far
mov ax,@data
mov ds,ax
;--------------
lea dx,msg1
mov ah,9h ;chape payam1
int 21h
;--------------
mov ah,0ah
lea dx,str ;khandane reshte
int 21h
;--------------
lea bx,buffer
mov ax,0
mov si,0 ; shomarande
l1: ;tabdile reshte be addad
cmp [bx],'$'
jz l2
mov cx,10
mul cx
mov cl,[bx]
and cx,000fh
add ax,cx
inc si
inc bx
jmp l1
l2:
lea bx,string
add bx,5
mov cx,10
l3:
mov dx,0
div cx
add dl,30h
mov [bx],dl
dec bx
cmp ax,0
jne l3
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 ah,9h
int 21h
MOV AH,00H
INT 16H
mov ax,4c00h
int 21h
main endp
end main
می شه لطفا" اشکال برنامه را بگید
کد زیر را برای این کار نوشتم. ملی درست کار نمی کند. مپلا" عدد 12345 یا هر عدد دیگر را می گیرد و 15656 را چاپ می کند.
.model small
.stack 64
.data
msg1 db "please enter first num:",'$'
msg2 db "the num is:",'$'
str label byte
max db 20
len db ?
buffer db 20 dup(' ')
dolar db '$'
string db 6 dup(' '),'$'
.code
main proc far
mov ax,@data
mov ds,ax
;--------------
lea dx,msg1
mov ah,9h ;chape payam1
int 21h
;--------------
mov ah,0ah
lea dx,str ;khandane reshte
int 21h
;--------------
lea bx,buffer
mov ax,0
mov si,0 ; shomarande
l1: ;tabdile reshte be addad
cmp [bx],'$'
jz l2
mov cx,10
mul cx
mov cl,[bx]
and cx,000fh
add ax,cx
inc si
inc bx
jmp l1
l2:
lea bx,string
add bx,5
mov cx,10
l3:
mov dx,0
div cx
add dl,30h
mov [bx],dl
dec bx
cmp ax,0
jne l3
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 ah,9h
int 21h
MOV AH,00H
INT 16H
mov ax,4c00h
int 21h
main endp
end main
می شه لطفا" اشکال برنامه را بگید