Hello everyone, I am new in assembly programming for MIPS and I was given a project to write a program that converts any decimal bumber from 0 to 511 into octal and return the result with 3 digits in reverse i.e. 170 for the decimal 57, 026 for 400 and so on. I was given the following code to work with which converts decimal number 30 to binary. Can anyone please help? Thanks in advance

addi $9, $0, 30
addi $10, $0, 5
addi $2, $0, 1
L1:
and $4, $9, $2
syscall
srl $9, $9, 1
addi $10, $10 -1
bne $10, $0, L1

Nevermind, I've had a revelation and found it myself. But for any of you that might have the same question I put the code here. Note that this is for decimal number 400 which is mentioned in the first string of the code.
Thanks again to those of you that read the post.

addi $9, $0, 400
addi $10, $0, 3
addi $2, $0, 1
L1:
div $5, $9, 8
rem $4, $9, 8
syscall
move $9, $5
addi $10, $10 -1
bne $10, $0, L1
Be a part of the DaniWeb community

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