I\'m having trouble understanding registers in x86 Assembly, I know that EAX is the full 32 bits, AX is the lower 16 bits, and then AH and AL the higher and lower 8 bits of
As suggested by Peter Cordes, I would imagine the data as hexadecimal values:
RR RR RR RR EE EE HH LL
| | || ||
| | || AL
| | AH |
| | |___|
| | AX |
| |_________|
| EAX |
|_____________________|
RAX
...where RAX
is the 64-bit register which exists in x86-64
.
So if you had AH = 0x12
and AL = 0x34
, like this:
00 00 00 00 00 00 12 34
| | || ||
| | || AL
| | AH |
| | |___|
| | AX |
| |_________|
| EAX |
|_____________________|
RAX
...then you had AX = 0x1234
and EAX = 0x00001234
etc.
Note that, as shown in this chart, AH
is the only "weird" register here which is not aligned with the lower bits. The others (AL
, AX
, EAX
, RAX
for 64-bit) are just different sizes but all aligned on the right. (For example, the two bytes marked EE EE
in the chart don't have a register name on their own.)