Cheers, so I am a little confused with the whole endianess things, and as I thought I had it figured out I cam across an example and completely lost it. So the code is as follows:
.text
.globl __start
__start:
lw $t7, stringInWordForm
sw $t7, string
Exit: li $v0, 10 # terminate
syscall
#################################################
# #
# data segment #
# #
#################################################
.data
string: .asciiz "abcd"
stringInWordForm: .word 0x44434241
I start by saving the base address of the string into $s0. So I got the following thing:
0x10000 0x10001 0x10002 0x10003
- - - -
| a | b | c | d |
Then I load what is hold at position stringInWordForm into register $t7. Using QtSpim, after the load I am shown that what is actually inside the register is (as expected)
$t7 = 0x44434241 # in hexadecimal form, in decimal there are stored: D C B A
However, after I store the word, I see that what has been saved is A B C D. My thought process/assumptions are as follows:
most sig byte least sig byte
$t7 = | 44 | 43 | 42 | 41 |
-----------------------------------------
0x10000 0x10001 0x10002 0x10003
- - - -
| a | b | c | d |
So since we have a big endian approach, we first store the MOST significant byte of the register FIRST (in the lowest position), so I would expect:
0x10000 0x10001 0x10002 0x10003
- - - -
(44) (43) (42) (41)
| D | C | B | A |
What am I thinking wrong here?