Learning Assembly - Part 2: Registers/Flags

So today, we get to talk about registers! Registers are a neat thing in x86/x64, but most of them nowadays are for general purposes and more or less have no proper specific function outside of particular use cases.

To start off things, 16 general purpose registers are available, along with way more than I'd care to count, so I'm going to Google (52) subregisters.

The main registers to remember at all times are listed in this neat little table for you below!

Sigh, I had to make a table in another app and screenshot it here because the blogger apparently doesn't have a way to make a table... So enjoy my MS art. Sorry, I work in cyber and never quite learned in high school how to paint or correctly write, for that matter. Enjoy the chicken scratch.

Please do remember that 32bit (x86) has everything of the equivalent. Aka EAX, ECX, EDX, etc...

Also, not only is the naming convention the same for the most part, but you can actually use them backward compatible, meaning you don't have to utilize all 64 bits, you can still use 32, 16, or even 8 bits. EAX, for instance, can be broken down into AX for 16 bits and AL/AH for 8 bits.

So, that means RAX (8bytes) > EAX (4bytes) > AX (2bytes) > AL or AH (1byte)

And fuck, I forgot to talk about data types.

So, here is a quick recap on data types for you!

1 byte = 8 bits

1 bit = 0 or 1

word = 2 bytes

dword = 4 bytes (32 bit)

Anyway, apologies for that. I'll try not to let you down again. If I do, and I 100% will my bad.

The purpose of these registers.

RAX = the accumulator

RBX = base

RSI = source index

RDI = destination index

RBP = stack base pointer

RSP = stack pointer

RIP = instruction pointer

Segment Registers

x64 has a total of 6 segment registers, which are CS, SS, DS, ES, FS, and GS.

RFLAGS/EFLAGS The main RFLAGS

WIP its 3 AM and I'm tired.

Last updated