I am trying to get my feet wet with embedded system by creating a little assembler for my ATmega microcontroller.
I got stuck on something so basic that I'm ashamed to ask (I'm quite new to this all), but here it goes anyway:
If I take an opcode, like for example (a simple one) 'RET', which is:
| 1001 | 0101 | 0000 | 1000 |
and if I simply convert this to hexadecimal, I get: 0x9508
but what I should have got (according to the output of avr-as) is: 0x0895
For some, probably obvious, reason the two bytes are swapped. I cannot explain why, can somebody else please?
Thank you in advance.