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:


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

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

li $v0, 1
move $a0, $t0

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

li $v0, 1
move $a0, $t1

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

li $v0, 1
move $a0, $t2

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

b seconds
addu $t1, $t1, 1


Can someone tell me how to do this? Thanks.

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.