I'm using the MARS simulator to explore the MIPS cpu. I have a simple assembly program:
.data
ascii1: .asciiz "8C@2"
I expect the value in the memory address for ascii1 to be 0x38434032 (the hex equivalent for the ascii bit pattern for "8C@2"). But it's not. Here's a screenshot of what MARS shows:
http://img442.imageshack.us/i/mars1.jpg/
Can someone explain why the value in 0x1001000 is not 0x38434032.
Best Answer
You have encountered the concept of Big-Endian and Little-Endian byte order.
You expect:
But got:
Note that the bytes are simply in reverse order:
Wikipedia explains it succinctly:
MIPS is generally Big Endian, while the processors you may be used to (such as Intel) are Little Endian.
Many processors allow you to set whether they are big endian or little endian in some configuration bits.