السلام عليكم
الحقيقه اني باعمل مشروع اسيمبلي عن المعامل المشترك الاعلي(Greatest Commom Divisor ) لازم يتقدم السبت الجاي ......
وبعد محاولات جهيده في البرنامج قدرت اعمل الكود ده ( وطبعا واضح انه معقد اوي)
بس للاسف مش عارف فين الغلطه
.model small .stack 100h .data counter dw ? prompt_1st db 13,10, ' Enter the first Number to get GCD for : ', '$' prompt_2nd db 13,10, ' Enter the second Number to get GCD for : ', '$' result db 13,10, ' The GCD for numbers entered is ', '$' error db 13,10, ' Invalid Character !!!' ,'$' .code MAIN PROC FAR mov ax,@data mov ds,ax lea dx,prompt_1st call puts call getn call fin_read_ax_version lea dx,prompt_2nd call getn call fin_read_cx_version again: mov dx,0 div cx mov ax,dx xchg ax,cx cmp cx,0 jne again lea dx, result call getn mov ax,4c00h int 21h getn: call pushall_exc_ax mov dx,1 mov cx,0 call getc cmp al,'0' jne newline mov dx,-1 call getc newline: push dx read_loop: cmp al,13 je fin_read cmp al,0 jb invalid cmp al,9 jg invalid sub al,'0' mov bl,al mov bh,0 mov ax,10 mul cx add bx,ax mov cx,bx call getc jmp read_loop invalid: lea dx,error call puts jmp read_loop fin_read: ret fin_read_ax_version: mov ax,cx pop dx cmp dx,1 je popall_exc_ax neg ax call popall_exc_aX ret fin_read_cx_version: pop dx cmp dx,1 je popall_exc_ax neg cx ret putn: call pushall_exc_aX mov counter,0 mov cx,10 cmp ax,0 jge call_digits neg ax push ax mov dl,'-' call putc pop ax call_digits: mov dx,0 div cx add dx,'0' push dx inc counter cmp ax,0 jne call_digits mov cx,counter disp_loop: pop dx call putc loop disp_loop call popall_exc_ax ret getc: call pushall_exc_ax mov ah,1h int 21h call popall_exc_ax ret putc: call pushall mov ah,2h int 21h call popall ret puts: call pushall mov ah,9h int 21h call popall ret pushall_exc_aX: push bx push cx push dx ret pushall: push ax call pushall_exc_aX ret popall_exc_aX: pop dx pop cx pop bx ret popall: call popall_exc_aX pop ax ret MAIN endp end MAIN
لذلك ارجو المساعده في اكتشاف الخطا واخباري بما يمكن عمله لتمام المشروع علي خير ....
ولي ملحوظه بسيطه اني فعلا والله لازم اقدم المشروع يوم السبت لذا ارجو المساعده بسرعهههههههه
وجزاكم الله خيرا مقدما