السلام عليكم
في احد المواضيع طلب احد الاعضاء حلا للسؤال التالي
اقتباسWrite a program to compute sum of odd integers: 1+3+….+N
The final sum should be stored in memory
لقد حالوت حل السؤال (افترضت ان N تساوي 50 عشري)وقمت بكتابة البرنامج التالي
mystack SEGMENT STACK ;Stack ensures loading SS by DOS DB 512 DUP (?) ;reserves 512K for stack mystack ENDS mydata SEGMENT N DW 32H ;32h equles 50 decimal SUM DW (?) mydata ENDS myprog SEGMENT ASSUME CS:myprog,DS:mydata Main PROC START: ;Get The Party Started!! mov cx,1 ;start counting from 1 mov SUM,1 ;start adding from 1 mov ax,N ;store the value of N addition: ;here the addition begins inc cx ;increase cx inc cx ;2 inc,to get an odd number add SUM,cx ;move the result to SUM cmp cx,N ;compare value in cx with N jne addition ;if equale:end,otherwise jumpe to addition Main ENDP myprog ENDS END START
في الواقع الstack & data segments
اقتبستهم من احد اكواد البرامج المرفقة باحد الكتب وعدلت عليهم بما يناسبني...
لكن الكود الرئيسي للبرنامج من عملي الشخصي
المشكلة هي بعد عمل assembling & linking والحصول على ملف
exe ظهرت المشكلة التالية عند محاولت تشغيله
فالرجاء ممن لديه الحل ان يدلني علي وانا شاكر لكم
واعتذر عن كثرة ازعاجي لكم بالاسئلة هنا وهناك
تحياتي
