Question

1. Assume there are three memory locations named h hand area, translate the following expression into...

1. Assume there are three memory locations named h hand area, translate the following expression into MIPS assembly language. No Floating point.

Area= 1/2 b. h

2. Show the assembly statement that allocates a word in the data segment named area with an initial value of 10.

3. What are the contents of register $t0, $t1, and $t2?

.data
str:    .asciiz   "ab"

.text
main:   la $t0, str
li    $t1, 0
loop: lb $t2, ($t0)
beqz   $t2, eloop
addi $t1, $t1, 1
addi $t0, $t0, 1
b   loop
eloop: nop

Homework Answers

Answer #1

1.

.data
h: .word 10
b: .word 5
area: .word

.text
.globl main
main:
   la $t1, h
   lw $t1, ($t1)
   la $t2, b
   lw $t2, ($t2)
   mult $t1, $t2
   mflo $t1
   srl $t1, $t1, 1
   la $t2, area
   sw $t1, ($t2)
   li $v0, 10
   syscall

2.

#assembly statement that allocates a word in the data segment named area with an initial value of 10.

area: .word 10

3.

$t0 = 268500994

$t1 = 2

$t2 = 0

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions