.text la $a0,msg1 li $v0,4 syscall li $v0,5 syscall move $t0,$v0 la $a0,msg2 li $v0,4 syscall li $v0,5 syscall move $t1,$v0 la $a0,msg3 li $v0,4 syscall li $v0,5 syscall move $t2,$v0 la $a0,msg4 li $v0,4 syscall li $v0,5 syscall move $t3,$v0 #Displaying messages move $s0, $t0 # max=A[0] main: li $t7,0 slti $t5,$t7,4 beq $t5,1,LOOP addi $t7,$t7,1 nop j end nop LOOP: bgt $t1,$s0,m m: move $s0,$t1 bgt $t2,$s0,m1 m1: move $s0,$t2 bgt $s0,$t3,m2 m2: move $s0,$t3 end: la $a0,Result li $v0,4 syscall li $v0,1 move $a0,$s0 syscall .data msg1: .asciiz "Enter number 1:" msg2: .asciiz "Enter number 2:" msg3: .asciiz "Enter number 3:" msg4: .asciiz "Enter number 4:"
1 Replies - 680 Views - Last Post: 19 March 2013 - 03:59 PM
#1
MIPS:finding the maximum number,problem/question...
Posted 18 March 2013 - 01:21 AM
Hello there, I am still very new to programming in general.. I have an MIPS assignment, the assignment is to write a program which will display the largest number of 4 entered numbers by the user... The code below is what I have tried so far, but I don't know how to generate a loop that will read all the entered numbers.. If anyone can help me just a little so I can make this code work as wanted, I will be more than grateful..thank you all!
Replies To: MIPS:finding the maximum number,problem/question...
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote



|