Hey Everyone, I am Vikram Salunke welcome to the x86 Assembly course.
So, in this course we are going to focus on 32-bit systems because there are still plenty of 32-bit system available and it will be easier for us to move onto the 64-bit systems.



These topics we are going to cover. We will start with the numbering system then Computer organization and architectures.
Then we will look at the architecture for 32-bit systems on Intel processors, then we will look at basics of C programming, then we will convert C code to the other assembly language.
Then we will move onto the registers, memory. We will understand how the stack works, then different instructions on x86 32-bit assembly language.
Then we will write our own assembly code on Windows and as well Linux formats.

Numbering System

We will start with Numbering System.
First numbering system is Decimal system, then Binary System and last one is which we are going to look at is hexadecimal system.

Decimal System

decimal numbering system

In decimal system, the value for digit is 0-9, so the base is 10 here.
What do you mean by base? base is a maximum number of symbols that can be assigned to a single digit that means to a single digit we can assign 10 different types of symbols from 0-9
156 is a example of decimal system.

Binary System

binary numbering system

next we will look at the binary system.
In the binary system digit value is either 0 or 1. That means the base is 2 here so, this is a example of a binary system computers systems generally operate using binary logic they just know 0 or 1

Hexadecimal System

hexadecimal numbering system

Next we will look at the hexadecimal system.
In the hexadecimal system the digit value is 0123456789ABCDEF so base is 16 that means we can assign 16 different symbols to a single digit.
Example is AB12 and this can be represented as 0xAB12.
why we need a hexadecimal system? because it's really simple to convert hexadecimal number to it's binary equivalent and vice versa.

Conversion Table

binary to hexadecimal conversion table

this is a conversion table for hexadecimal to binary.
So it start from 0 to F as we can see 0 will convert to 0000 1 and is convert to 0001 till F will convert to 1111.

Binary to Hexadecimal Conversion

binary to hexadecimal conversion table

Now, we will look at how to convert a binary number to a hexadecimal number.
This is a binary number, we will first group the 4 bits and then we will look at the table and then we will convert a 4 binary bits to it's hexadecimal equivalent.
1100 is C
0011 is 3
1111 is F
0101 is 5

Hexadecimal to Binary Conversion

hexadecimal to binary conversion table

we will look at how to convert hexadecimal number to binary equivalent.
We will look at the table once again
9 belongs to 1001
A belongs to 1010
3 will convert to 0011
F will convert to 1111
This is how we can convert a binary number to hexadecimal number and hexadecimal number to binary number.

Data Types

binary number

we will move onto Data Types.
The first data type is bit it's either 0 or 1
second one is Byte, 8 bits equal to 1 Byte
similarly, 16 bits is 1 Word
32 bits is DoubleWord
64 bits is QuadWord
and 128 bits is DoubleQuadWord.

Data Types

This is binary number.
The rightmost bit number at the 0th position is known as the Least Significant Bit (LSB).
Leftmost bit is known as the Most Significant Bit (MSB)

Computer Organization and Architecture

computer organization and architecture

Now, we will move onto the Computer Organization and Architecture.
Most important part in computer organization and architecture is CPU. CPU is a brain of a computer another part is Input Devices such as a Keyboard, Mouse, Scanner etc.
Then comes Main Memory known as the RAM
then comes the Output Devices such as Monitor and Printer etc.
and last one is Auxiliary Storage Disk Drives such as Hard Disk Drives HDD etc.

system bus

These all parts are connected by System Bus.



Now we will look at the CPU.
The first part of CPU is known as the Control Unit. Control Unit is responsible for to retrieving and decoding instructions as well as retrieving and storing data into the main memory.
Next one is known as the Execution Unit. It is responsible for execution of an instruction.
Next one is known as the Registers. The registers are the internal memory locations so we can use them as a variables.
The last one are flags. Flag indicates different events when executing a instructions


Now we will look at the Registers.
What is a register? register is a small memory storage built into processor it is a volatile memory.
x86-32 system has 32 bit registers
x86-64 systems has 64 bit registers.

Intel Architecture 32-bit (IA-32)

Intel Architecture 32-bit IA-32

Now we will look at Intel Architecture 32-bit known as IA-32.
There are General Purpose Registers, Segment Registers, Flags, EIP, Floating Point Unit Registers, MMX Registers, and XMM Registers.
By the time we will only focus on General Purpose Registers and EIP other registers we will see when we need them.

General Purpose Registers

General Purpose Registers

So, first we will start with General Purpose Registers.
EAX register is used to store function return value
EBX stores base pointer to the data section
ECX is a counter for a String and Loop operation
EDX is a I/O pointer

General Purpose Registers

ESI is a source pointer for string operations
EDI is a destination pointer for string operations
ESP is a Stack Pointer
and EBP is a stack frame base pointer
I know it is sounding little bit confusing, but soon we are going to see them in action, then you will understand them clearly.


Next we will look at EIP. EIP stores the pointer to the next instruction to execute known as the instruction pointer.

General Purpose Registers

As I said earlier in 32-bit systems all general purpose registers are 32-bit.
EAX is 32-bit
EBX is 32-bit
ECX is 32-bit
EDX is 32-bit
We can access lower Word of EAX using AX as well as we can access the lower Byte of AX using AL or we can access higher Byte of AX using AH.
Similarly we can access the lower Word of EBX using BX as well as lower byte of BX using BL and the higher byte of a BX using BH.
Also similar for ECX and EDX.

General Purpose Registers

So, ESP, EBP, ESI, EDI are also 32-bit
and we can access lower Word of ESP using SP
we can access lower Word of of EBP using BP
we can access lower Word of ESI using SI
and we can access lower Word of EDI using DI


EIP is also 32-bit and we can access it's lower word using IP

If you want to join our in person class then please click here we are doing trainings in some upcoming InfoSec conferences.
And if you have any doubts, any questions then you can tweet me @vikramsalunke20
We are uploading daily new videos on YouTube click here to subscribe.
If you want to solve the exercises on this topic those are below. Solve the exercises and check your understandings. Thank you :)