Not Yet Answered # multiplication in assembly mips

Discussion Starter inxs_vf MacGyver Orca 9

0

i've already done half of it:

#read the numbers

li $v0, 6

syscall

mfc1 $s0, $f0

li $v0, 6

syscall

mfc1 $s1, $f0

#remove the exponents from both numbers and saving them in a0 and a1

.data

maskex: 0x7F800000

.text

xtractex: lw $t0, maskex

and $a0, $s0, $t0

and $a1, $s1, $t0

srl $a0, $a0, 23

srl $a1, $a1, 23

#remove the fraction

.data

maskma: 0x007FFFFF

.text

xtractma: lw $t1, maskma

and $a2, $s0, $t1

and $a3, $s1, $t1

#mask for the hidden bit

.data

maskhb: 0x00800000

.text

xtracthb: lw $t2, maskhb

or $a2, $a2, $t2

or $a3, $a3, $t3

#calculation of the exponent

add $t4, $a0, $a1

subi $t4, $t4, 127

-- what do you think?

0

I'm confused, are you trying to simply multiply or use exponents? If it is just multiplication you can just use the mult instruction in MIPS, it looks like this mult $s1, $s2. To get the integer use the mflo and mfhi instructions, which look like so mflo $s1, mfhi $s2. Since it is 32-bit multiplication the result is placed in two registers to mimic a 64-bit register.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

the function that I created to find the ...

Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.

This is the result of previous question answered :

code for the listbox - datagridview interaction

At the top of the code ...

Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.

btn_addline :

`Private Sub btn_addline_Click(ByVal ...`