I have a university assignment and I have been given this data:
.data
a: .word 10
e: .word 3, 2, 1, 0
c: .word -1
d: .byte -1,0,0,0
The question is: What's the value $4 is holding if we implement the code ... and why:
la $10,d
addi $10,$10,-12
lw $4,0($10)
I wanted to check the answer before answering theoretically and when I ran the code:
.data
a: .word 10
e: .word 3, 2, 1, 0
c: .word -1
d: .byte -1, 0, 0, 0
.text
.globl main
main:
la $10,d
addi $10,$10,-12
lw $4,0($10)
li $v0,1
move $a0,$4
syscall
li $v0,10
syscall
QtSpim says the output is 1 but I thought the output should be -1. I proceeded to check with chatgpt first and it confirmed my answer:
Do any of you have any idea whether me/chatgpt are wrong or there is something going wrong with QtSpim?