1

.byte var1在我的.data细分中创建了一个。现在我想将我的 var1 的内容存储到 $t1 中。为此,我应该使用lb讲师还是la讲师。老实说,我无法弄清楚两者之间的区别。提前致谢。这是我的尝试:

.data

var1: .byte '/'

.text

main:
   lb $t2,var1  #I want to t2 stores '/' character.

还有一个问题:当我写的时候beq $t1,$t2,它是比较两个地址,还是这两个地址的内容?

4

1 回答 1

3
  1. lb will load the 8 bit value from var1 into $t2. la is a sudo-instruction that will load the full 32 bit address of the data in memory into $t2 (assuming you are using 32-bit architecture). See here for more details on MIPS instructions.

  2. Beq compares the two values of $t1 and $t2. If these are memory addresses, it will compare the addresses, not the data at those addresses.

于 2013-11-03T11:44:26.340 回答