I’m trying to figure out what this program does, but I have a feeling MARS isn’t handling the .data directive correctly.
What is stored in the data segment if an assembly instruction is given under the .data directive? When I run this in MARS (MIPS assembler and runtime simulator) it simply stores a value of zero at 0x10010000 (where static data should be stored). I was expecting it to store the machine code for lui $r1, 0xFFC0 (i.e. 00111100000010011111111111000000).
.data
info: lui $r1, 0xFFC0
.text
.globl main
main:
la $s1, info
lw $a0, 0($s1)
jal process
sb $v0, 4($s1)
process:
lui $t1, 0xFFC0
and $v0, $a0, $t1
srl $v0,$v0,26
jr $ra
Thanks!
$r1is not a valid register name in MIPS. Changing the instruction tolui $1,0xffc0orlui $t1,0xffc0causes the machine code to be stored in the.datasection.