0

Hello and how are you?
I am trying to fix the nested loop called the clock to go from 0:0:0 to 12:59:59 but I am keep getting infinite loops of 0:0:0 on mars/mips

Here is what I have:

.data

str2: .asciiz ":"
space: .asciiz "\n"
.text
main:
li $t0, 0
li $t1, 0
li $t2, 0

hour:
bgt $t0, 12, exit
bgt $t2, 59, minutes
minutes:
bgt $t1, 59, hour
seconds:
bgt $t2, 59, minutes

li $v0, 1
move $a0, $t0
syscall

li $v0, 4
la $a0, str2 #The load and print of
syscall # String

li $v0, 1
move $a0, $t1
syscall

li $v0, 4
la $a0, str2, #load and print string
syscall

li $v0, 1
move $a0, $t2
syscall

addi $v0, $zero, 4
la $a0, space
syscall

b seconds
addu $t1, $t1, 1

exit:

Can someone tell me how to do this? Thanks.

2
Contributors
1
Reply
3
Views
1 Year
Discussion Span
Last Post by rubberman
0

Lovely! MIPS assembler. I would suggest writing it in C and then have the code compiled into assembler so you can see what a reasonable assembler encoding would be. FYI, I haven't messed with MIPS code for probably more years than you have been alive, so I don't remember much! I don't write much ARM or x86 assembler either unless I am working on some architecture-specific linux kernel code, and then as little as possible!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.