944,028 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 3669
  • Assembly RSS
Oct 25th, 2005
0

MIPS help

Expand Post »
I need to input a list of numbers using mips.
Also, i need to use the list and implement this function:

function dbl(l){
if (L is empty list)
return empty list;

else {
L4 = dbl (L - first element);
Dou = 2 * first element in L;
return (list made by adding Dou to L4);
}

So far I have problems trying to enter in a list of numbers, this is what i have so far:
main:

li $s2,0
li $t1,0 #set to zero
li $s5, -999 #put in -999 to $s5
la $a0, input_int #to print "Please enter a list of integers, -999 to end"
li $v0, 4 #set $v0=4 to print a string
syscall


Loop:
move $t0, $zero #i=0(register $t0=0)

loop1:
sll $t1,$t0,2 #$t1=4*i
add $t2,$a0,$t1
li $v0,5 #to read integer set $v0=5
syscall #after 'syscall', integer read is in $v0
beq $v0,$s5,Double #if the number entered is -999 Exit
move $s0,$v0
sw $s0,0($t2)
addi $t0,$t0,1 #i=i+1
bne $s1,$s5,loop1
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
oneohthree is offline Offline
2 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Open browser
Next Thread in Assembly Forum Timeline: Calculator program returning random values





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC