![]() |
| ||
| MIPS help 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 |
| All times are GMT -4. The time now is 6:32 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC