jump to navigation

Floating point multiplication in MIPS April 14, 2009

Posted by aghus in Assembly Language, Bebas, IT, Ngoprek.
add a comment

This assembly language improve upon multiplication of integer number in previous posting, to floating point multiplication. This program still use same algorithm for multiplication as hand scratch on primary school. :-)

.data
str1: .asciiz “Enter 1st number :\n”
str2: .asciiz “Enter 2nd number :\n”
str3: .asciiz “Content of FP register : “
str4: .asciiz “The result : “
(lagi…)

Multiplication of integer number April 5, 2009

Posted by aghus in Assembly Language, IT, Ngoprek.
1 comment so far

This MIPS assembly code implements simple algorithm for multiplication.

#—– processing multiplication algorithm

addi $t0, $zero, 0 #prepare for product
addi $t7, $zero, 0
addi $t8, $zero, 0

addi $t7, $s4, 0 #prepare for multiplicand
addi $t8, $s5, 0 #prepare for multiplier

addi $s7, $zero, 1 #intialize for repetition
addi $t9, $zero, 16

(lagi…)

Floating Point Addition in MIPS Januari 20, 2009

Posted by aghus in Assembly Language, Bebas, Free - Gratis Download ?, IT, Ngoprek.
3 comments

Addition is a simple process for human. Entry the numbers in calculator or computer, then we’ll get the result. But sometime we should to know how it works. In MIPS processor, this is assembly language that shows the process. How bits go walk  in registers, then appear result in output peripheral. You can use MARS tool from here

# Floating point addition demonstration for 2 positive numbers ———–
# ver.1 :-)

.data
str1: .asciiz “Enter 1st number :\n”
str2: .asciiz “Enter 2nd number :\n”
str3: .asciiz “Content of FP register : “
str4: .asciiz “The result : “
newline : .asciiz “\n”

.text

main :
#————————- human interaction —————————————
la $a0, str1          # show string in screen
jal show
jal rflo
jal movfl
mov.s $f20,$f12     # data from reading float, then saved in $f20
jal pflo
jal nline
la $a0, str3          # show string in screen
jal show
mfc1 $s0,$f20                     # move raw data $s0=$f20
move $a0,$s0
jal print_bin
jal nline

(lagi…)