How to load memory address without using pseudo-instructions?

后端 未结 3 1353
北海茫月
北海茫月 2020-12-19 13:11

I\'m trying to learn MIPS assembly language by myself using MARS simulator.

For didactic reasons I\'m limiting myself to not using pseudo-instructio

3条回答
  •  误落风尘
    2020-12-19 13:24

    Your ori instructions needs still another operand to work and as far as I looked over your code, "mem" is no existing label. Try this one:

    .data 0x10000000 #or choose any other location
            #pointer section
            .word arr
            #...
    
            #pointed section
    arr:    .byte #...  only as tip, you can separate multiple values with comma
                  #behind .byte so that you don't need multiple .byte directives 
            #...
    
    .text
            #...
            lui $s0, 0x1000
            lw $t0, 0($s0)           #get the value of "arr"
            #...
    

    If it doesn't work, MARS likely won't be able to get label content without pseudo instructions.

提交回复
热议问题