We run code from adress 8002000 to 80020028 and the question is what is inside register $18 at when we are at the end. I think there might be 0x0E but I am really not sure how i got to this answer anymore. Anyone can explain?
And if we start at 80020000 and follow the instructions as written can an exception occur? If yes when can it occur?
8001FFF8 NOP
8001FFFC NOP
80020000 LUI $16, 0x8002
80020004 ADDIU $16, $16, 0x30
80020008 ADDI $17, $00, 0x3
8002000c SLL $17, $17, 0x2
80020010 LW $18, 0x4 ($16)
80020014 LW $19, 0x0 ($16)
80020018 SW $18, 0x8 ($16)
8002001C NOP
80020020 ADD $18, $18, $17
80020024 NOP
80020028 NOP
8002002C NOP
80020030 ???
80020034 SRL $00, $00, 0
80020038 SRA $00, $00, 0
8002003C SLLV $00, $00, $00
80020040 NOP
80020044 NOP
$16 = 0x80020030
$17 = 12 ( 3 << 2 )
$18 = 0x2 ( load value from 80020034 which disassembled is srl $0,$0,0 -> 0x2 )
$19 = ??? ( value under 0x80020030 not known )
store under 0x80020038 (0x2)
$18 = 0xE ( 0x2 + 12 )
$18 = 0xE ( nops don’t change anything )
Exception in this code is possible ( I could miss something ):