MIPS- "Dropped off Bottom"?

0

I am a beginner in MIPS and I need to write a code that will draw a box on the bitmap display using 4 loops for each side of the box, the box should have the marquee effect and have a 5 ms delay. And it should have keyboard funtionality (w,a,s and d keys should move box around) This is the code, but I keep getting --Program is finished running (dropped off bottom) -- and I don't know how to fix it.

        .data
# colors

.eqv RED 0x00FF0000

.eqv GREEN 0x0000FF00

.eqv BLUE 0x000000FF

.eqv WHITE 0x00FFFFFF

.eqv YELLOW 0x00FFFF00

.eqv CYAN 0x0000FFFF

.eqv MAGENTA 0x00FF00FF

.data

colors: .word MAGENTA, CYAN, YELLOW, BLUE, GREEN, RED,WHITE
.text
li $s1, 80 #y1 = x position of the tail
li $s2, 5 #y1 = y position of the tail

li $t3, 0x10008000 #t3 = first Pixel of the screen


li $t0,0 #Load index 0
loop1:
mul $t2,$s2,256 #get y index
add $t1,$t0,$s1 #load center address
mul $t1,$t1,4
add $t1,$t1,$t2
addu $t1, $t3, $t1 # adds xy to the first pixel ( t3 )
mul $a2,$t0,4 #get addresss of color
lw $a2,colors($a2)
sw $a2, ($t1) # put the color red ($a2) in $t0
add $t0,$t0,1 #i++
li $a0,50 #delay of mili seconds
li $v0,32
syscall
blt $t0,7,loop1

li $t0,0 #Load index 0
loop2:
add $t2,$s2,7 #get next line
mul $t2,$t2,256 #get y index
add $t1,$t0,$s1 #load center address
mul $t1,$t1,4
add $t1,$t1,$t2
addu $t1, $t3, $t1 # adds xy to the first pixel ( t3 )
mul $a2,$t0,4 #get addresss of color
lw $a2,colors($a2)
sw $a2, ($t1) # put the color red ($a2) in $t0
add $t0,$t0,1 #i++
li $a0,50 #delay of mili seconds
li $v0,32
syscall
blt $t0,7,loop2

li $t0,0 #Load index 0
loop3:
add $t2,$s2,$t0 #get next line
mul $t2,$t2,256 #get y index
mul $t1,$s1,4
add $t1,$t1,$t2 #load x y
addu $t1, $t3, $t1 # adds xy to the first pixel ( t3 )
mul $a2,$t0,4 #get addresss of color
lw $a2,colors($a2)
sw $a2, ($t1) # put the color red ($a2) in $t0
add $t0,$t0,1 #i++
li $a0,50 #delay of mili seconds
li $v0,32
syscall
blt $t0,7,loop3


li $t0,0 #Load index 0
loop4:
add $t2,$s2,$t0 #get next line
mul $t2,$t2,256 #get y index
add $t1,$s1,7 #get next line
mul $t1,$t1,4
add $t1,$t1,$t2 #load x y
addu $t1, $t3, $t1 # adds xy to the first pixel ( t3 )
mul $a2,$t0,4 #get addresss of color
lw $a2,colors($a2)
sw $a2, ($t1) # put the color red ($a2) in $t0
add $t0,$t0,1 #i++

li $a0,50 #delay of mili seconds
li $v0,32
syscall
blt $t0,8,loop4

li $v0, 10
mips
asked on Stack Overflow Oct 9, 2020 by I AM LUNA

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0