XXXXX
XXXXX

Reputation: 21

Mips assembly, .data section

I want to get the address of the global value declared at .data. la instruction is not recognized? How else to perform that

.data
word1:  .word 0
word2:  .word 0
.text
    .globl __start
    __start:
    la $v0,word1 --> here I receive a syntax error.

I want to store byte in word1, and another byte in word2

I can't obtain the address

Upvotes: 0

Views: 963

Answers (1)

Variable Length Coder
Variable Length Coder

Reputation: 8116

la is not a real MIPS instruction, it is a convenient assembler macro. It is usually broken down into lui and ori or addi. On systems where the linkage is more complicated than a flat layout known at static linking time, your assembler may be unable to implement it. To access your data segment you may need to dereference a global pointer (GP) or do an indirect load.

Upvotes: 1

Related Questions