static char hexdigits[16] = "0123456789ABCDEF";
可以翻译成:
.data
hexdigits: .byte '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
Or
.data
hexdigits: .ascii "0123456789ABCDEF"
我们可以使用以下方式访问元素
la $t0, hexdigits
lb $t1, 0($t0) # $t1 = hexdigits[0]
lb $t2, 1($t0) # $t2 = hexdigits[1]
您可以使用系统调用打印元素(如果您的模拟器支持它。大多数都支持)
la $t0, hexdigits # address of the first element
lb $a0, 10($t0) # hexdigits[10] (which is 'A')
li $v0, 11 # I will assume syscall 11 is printchar (most simulators support it)
syscall # issue a system call