Ok in my first uni assignment i got a geometric progression program in mips. Problem is type i have to use is a_{n}=a * r^{n-1} and i have to make a program that show the first 6 numbers of this geometric progression with a1=3 and r=3.Numbers to be seen are 3,6,12,24,48,96 and the summary of these 6.Its beginners class so we dont use standard Assembly names. my problem is that i made a code which shows the numbers 3,12,24,48,96,192 and the sum.Can anyone help me so i can squize the number 6 in between?
li $3,1
li $8,3 #a1
li $9,2 #r
li $10,5 #counter
li $11,0 #summ
addi $2,$0,1
add $4,$0,$8
syscall
add $11,$11,$4
L1:
addi $3,$3,1
subi $6,$3,1
beq $6,1,Else
sllv $14,$9,$6
Else:
sllv $14,$9,$6
j Endif
Endif:
mul $14,$8,$14
add $4,$0,$14
addi $2,$0,1
syscall
add $11,$11,$4
addi $10,$10,-1
bne $10,$0,L1
addi $2,$0,1
move $4,$11
syscall