Answer from cs61c-aw (wing hin kao 16500429) for Question 4
memory-mapped I/O is a method that the processor is able to address the device and to supply one or more command e=words. This method can be used to transmit dara by writing or reading to select addresses.

loop:
li $t5, 2
li $t6, 3
la $t0, 0xffff0000
lw $t1, 0($t0)
beq $t1, $t5, loop
beq $t1, $t6, read
j exception  #the least two significand bits not equal                    
             #10 or 11

read: 
la $t0, 0xffff0004
lw $t1, 0($t0)
add $v0, $0, $t1
