Vote count:
0
Is there any way to store 2.5 as a string and then convert it into binary ieee format in MIPS??
I am done with the before decimal part. using the following code:
.data
promt: .asciiz "Enter decimal number:" output: .asciiz "The number in binary is:" .text .globl main main: la $a0, promt #put address of the string in $a0 li $v0,4 syscall
li $v0, 5 # code for input
syscall
move $t0,$v0
addi $t2, $0,2 #making $t2 '2'
addi$sp, $sp, -32 #makinf stack
addi $t5, $zero, 0
loop: div $t0,$t2 mflo $t0 # mov from hi mfhi $t1 #mov from low sw $t1, 0($sp) #copy $s1 to stack addi $sp, $sp, 4 addi $t5, $t5, 1 bgtz $t0, loop # if s0 greater than zero than
addi $sp, $sp, -4
printing: li $v0,1 lw $a0, 0($sp) syscall addi $sp, $sp, -4 addi $t5, $t5, -1 bgtz $t5, printing addi $sp, $sp, 32 li $v0, 10 syscall
But stuck in after decimal part i.e: fractional one.
Thanks!
p.s: I am using qtspim
asked 54 secs ago
Aucun commentaire:
Enregistrer un commentaire