السلام عليكم ورحمة الله وبركاااته ..
السؤااال هو أن نجعل المستخدم يدخل 3 أرقم ..
في البداية يجب أن نتأكد من هذه الأرقام إذا كانت كل هذه الأرقام تساوي صفر يجب أن يخرج من البرنامج
وإذا لا ....يحسب معدل هذه الأرقاام
هذه محاااولتي .....بس في خطأ ؟؟
أتمنى مسااااااااااااااااااااااااااااااعدتكم يا أخواااااااااااااني لأني مبتدأه في الأسمبلي .. ونستخدم برنامج pcspim
.data string_1:.asciiz"calculate the average of three numbers :\n" string_2:.asciiz"Enter the first number:\n" string_3:.asciiz"Enter the second number:\n" string_4:.asciiz"Enter the THIRD number :\n" string_5:.asciiz"the average number is :\n" string_6:.asciiz"please change your input :\n" .text main: la $a0,string_1 li $v0,4 syscall la $a0,string_2 li $v0,4 syscall #get the first number from the user and place it in $t0 li $v0, 5 #load syscall read_int into v0 syscall #call the system move $t0, $v0 # move the content of v0, which is the first number to t0 la $a0,string_3 li $v0,4 syscall #get the second number from the user and place it in $t1 li $v0, 5 #load syscall read_int into v0 syscall #call the system move $t1, $v0 # move the content of v0, which is the second number to t1 la $a0,string_4 li $v0,4 syscall #get the second number from the user and place it in $t1 li $v0, 5 #load syscall read_int into v0 syscall #call the system move $t2, $v0 # move the content of v0, which is the second number to t1 move $a0,$t0 move $a1,$t1 move $a2,$t2 jal eqzero # call to the eqzero procedure jal avrge # call to the avrge procedure move $v1,$s1 la $a0,string_5 li $v0,4 syscall move $a0,$v1 li $v0,1 syscall jal exist # here we will see if all numbers =0 exist ... if not ... go to the average procedure eqzero: beq $a0 , $a1 , label_1 jr $ra label1: beq $a0 , $a2,label_2 jr $ra label_2: beq $a0 , $0,label_3 jr $ra label_3: la $a0,string_6 li $v0,4 syscall jal exist avrge: add $s0,$a0,$a1 add $s0, $s0,$a2 div $s1,$s0,3 jr $ra exist: li $v0,10 syscall
