0

Hey Guys,

I'm extremely new to the coding in Assembly language MIPS - currently I'm using QtSpim. And I was wondering how I can go about multiplying two numbers that I input and display that number, as well as, find an average of numbers and displaying that.

Any info would be really appreciated - thanks

2
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by Harley_Quinn
0

I don't know about MIPS Assembly, but in SPARC Assembly move the two registers or numbers into %o0 and %o1 and call .mul
The result will be returned in %o0, move %o0 to %o1 you can then call printf after you have set a string into %o0.

String: acsiz "%d\n"

Example:

mov 3, %o0
mov 2, %o1

call .mul
nop

mov %o0, %o1
set String, %o0

call printf, 2
nop

ret
restore

You would need to add some more code above to make it work, like a .golbal , .section and a save. Hope this helps.

The average of the two numbers uses add and div methods in the same way.

Edited by T-Dogg3030

0

Hey thanks for the help!

But how would I go about doing the average? I guess it would work more or less the same way - add x numbers and then call div(?)??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.