Digital icon indicating copy to clipboard operation
Digital copied to clipboard

Little vs Big Endian with 8 bits memory.

Open d-teif opened this issue 4 years ago • 2 comments

with intel hex file :0400000072746E4563 :0400040075207A6584

If data are 32 bits (big endian) memory load correctly that mean 0x72746E4563 and 75207A6584. Your change work perfectly

If data are 8 bits (and big endian) memory load incorrectly that mean 0x72,0x74,0x6E,0x45,0x63... According hex file 0x63 is for lower memory and is 0x72 for highter memory

Thank

d-teif avatar Oct 19 '21 15:10 d-teif

In such a case, when loading a file, it must be specified how many bytes should make up a data word, because if you map bytes to bytes, endiness makes no sense otherwise.

hneemann avatar Oct 24 '21 11:10 hneemann

Just to give you more details

.data msg : .asciiz "Entrez chaine:\n" msg2 : .asciiz "Chaine lue:\n"

is translate in hex file :0400000072746E4563 => 'r',t','n','E' :0400040063207A6596 etc....

Data are 8 bits, but as it is big endian string char are reversed.

A simple solution is inverting (not) two LSB bits of address Capture d’écran 2021-10-25 à 10 48 44

d-teif avatar Oct 25 '21 08:10 d-teif