In: Computer Science
Write assembly code for the following machine code. Assume that the segment is placed starting at location 80000. Create labels for jump and branch instructions. Indicate the actual memory addresses represented by such labels.
0010 1010 0000 1000 0000 0000 0000 1010
0001 0001 0000 0000 0000 0000 0000 0010
0000 0010 0001 0001 1000 0000 0010 0000
0000 1000 0000 0000 0100 1110 0010 0101
0000 0010 0001 0010 1000 0000 0010 0000
(1)0x2a08000a
SLTI
$s0 $t0
immediate
001010 10000 01000
0000000000001010
SLTI $t0, $s0, 10
(2)0x11000002
BEQ $t0
$zero offset
000100 01000 00000
0000000000000010
BEQ $t0 $zero 0x0002
(3)0x02118020
opcode $s0
$s1
$s0 shamt ADD
000000 10000 10001
10000 00000 100000
ADD $s0 $s0 $s1
(4)0x08004e25
J target
000010 00000000000100111000100101
(5)0x02128020
opcode $s0
$s2
$s0 shamt
ADD
000000 10000 10010
10000 00000 100000
ADD $s0 $s0 $s2
Assembly
Program
Loop:
SLTI $t0, $s0, 10
BEQ $t0, $zero, Exit
ADD $s0, $s0, $s1
J Loop
Exit:
ADD $s0 $s0 $s2