``````mov eax,'ZYXW'
``````

Now there are 3 problems.
in Hexa W=57,X=58,Y=59,Z=5a

Debugger shows this as 1515804759 in Decimal. that is when 5958595a taken as a whole.

why doesn't it show 87888990 like when they are take separately?

1. Why is it shown as 5a,59,58,57 rather than 57,58........ ? (because W=57 which comes first)

2. and why is it 5A after the 59 in hex? (I know that 10 is A,11 is B etc..... but not this)

Debugger shows this as 1515804759 in Decimal. that is when 5958595a taken as a whole.
why doesn't it show 87888990 like when they are take separately?

Because eax is being interpreted as an integer value instead of an array, so all four bytes are a single entity totaling …

## All 2 Replies

Debugger shows this as 1515804759 in Decimal. that is when 5958595a taken as a whole.
why doesn't it show 87888990 like when they are take separately?

Because eax is being interpreted as an integer value instead of an array, so all four bytes are a single entity totaling to 1515804759 rather than separate entities {87,88,89,90}.

Why is it shown as 5a,59,58,57 rather than 57,58........ ? (because W=57 which comes first)

Endianness

and why is it 5A after the 59 in hex? (I know that 10 is A,11 is B etc..... but not this)

Um...what? You know that A comes after 9, so how is 5a after 59 confusing? The rules of the positional numbering system don't change just because there are more significant digits present. The jump to 60 doesn't happen until after F, because hexadecimal has 16 distinct values per digit place: 59, 5a, 5b, 5c, 5d, 5e, 5f, 60.

It seems like you're stuck in a decimal mindset. The only reason 10 comes after 9 in decimal is because there aren't are only ten values that can be represented by a single digit: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. If you add more values, the need for 10 is delayed. If you remove values (such as in octal or binary) then the need for 10 is accelerated. If you think about 10 being the value that happens when you run out of unique single digits, all of the bases seem obvious:

Binary: 0, 1, 10
Ternary: 0, 1, 2, 10
Quaternary: 0, 1, 2, 3, 10
Quinary: 0, 1, 2, 3, 4, 10
Senary: 0, 1, 2, 3, 4, 5, 10
Septenary: 0, 1, 2, 3, 4, 5, 6, 10
Octal: 0, 1, 2, 3, 4, 5, 6, 7, 10
Nonary: 0, 1, 2, 3, 4, 5, 6, 7, 8, 10
Decimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

After 0 through 9 are exhausted, other characters are used to fill in the gaps. The latin alphabet is most common, so starting with undecimal you'll see letters:

Undecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, 10
Duodecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, 10
Tridecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, 10
Tetradecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, 10
Pentadecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, 10
Hexadecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, 10

All very regular and intuitive, provided you drop the meaning of 10 being strictly for the decimal value that comes after 9. ;)

great thanks !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.