Lettura registri causa e EPC

mfc0 $k0, $13 # read the cause register in k0
mfc0 $a1, $14 # read EPC in a1

Estrazione della causa

srl $a0, $k0, 2 # a0 contains the bits 2:31
andi $a0, $a0, 0x1f # and between the bits 2:31 and 000...011111 => cause

Controllo

Se l'eccezione รจ un interrupt (causa = 0), termino

beq $a0, $zero, dopo # if(causa == 0) do nothing

Stampa eccezione

jal print_exception # a0 has the cause and a1 the EPC