P&H 4.1
0000 0000 0000 0000 0000 0010 0000 0000
P&H 4.2
1111 1111 1111 1111 1111 1100 0000 0001
P&H 4.4
-500
P&H 4.7
P&H 4.8
CAFEFACE
P&H 3.1
begin: addi $t0, $zero, 0 #$t0 initialization. We will store here the sum of odd numbers not grater than n addi $t1, $zero, 1 #$t1 initialization. We will store here succesive odd values loop: slt $t2, $a0, $t1 # for (sum=0, odd=1; n>=odd; odd+2) { bne $t2, $zero, finish addi $t1, $t1, 2 # sum += odd j loop # } finish: add $v0, $to, $zero # we copy the value in the output register
We are computing the sum of the odd numbers not greater than n. We store the result into $vo.
P&H 3.4
addi $t0,$t1,100
P&H 3.5
lui $t1, 0x003d ori $t1, 0x900 lw $t2, 44($t1) add $t2, $t2, $t0 sw $t2, 40($t1)
4,000,000 base 10 is 003d0900 base 16.