/ / dziesiętny na ósemkowy przy użyciu mipsów - montaż, mipsy, mips32, mars-simulator, mars

dziesiętny na ósemkowy przy użyciu mipsów - montaż, mipsy, mips32, mars-simulator, mars

Jaki jest najprostszy sposób konwersji liczby dziesiętnej na ósemkową w zespole mips?

Wiem, że do konwersji ósemkowej na dziesiętną zrobiłem co następuje:

$t1 is the register with the octal number
div $t2,$t1,10
mul $t2,$t2,2
sub $t1,$t1,$t2

Jak zrobić przeciwny program?

Odpowiedzi:

0 dla odpowiedzi № 1

Napisałem to w ten sposób:

    #the octal number is $t2
li $t6,0 #remainder
li $t7,0 #final octal number
li $t8,1 #placeInNumber
octalToDecimalLoop:
rem $t6,$t2,8
div $t2,$t2,8
mul $t6,$t6,$t8
add $t7,$t7,$t6
mul $t8,$t8,10
bnez $t2,octalToDecimalLoop