DEV Community

Mateusz Jasiński
Mateusz Jasiński

Posted on

Learn x86 Assembly with me

What's up.

Based off of my posts, I think it might be kind of strange to see an article like this

But yeah, I've decided to learn assembly

Also - Correct me if I'm wrong somewhere here or oversimplified a term. I'd be more than happy to read such comments and get my knowledge and understanding to the higher level

Why Assembly and why x86?

Starting with the second part - that's what my processors architecture is.

I don't have ARM processor, yet someone would tell me.

Just buy used computer or VPS with such access

I could, of course - Yet I would not like to spend too much money right now

I believe, that with some curiosity and time to search, I can dig information for free - This will be the challenge itself

I like challenges - so why not?

And why assembly? Simple answer...

Reverse Engineering

Just got into it - so Assembly might be fairly useful there, as not always everything can be found with C# or even C de-compiler

Where I'll be learning from?

I've found 2 decent sources

But, that's it for the talking - let's learn something

What does assembly code consist of

If we look at assembly code - it consists of sections

Some basic ones are

  1. .bss - In this section, we declare variables, that will be changed while execution
  2. .data - it stores constants, like strings or ints
  3. .text - contains the code itself. We need to also declare _start here
section.text
    global .start
_start:
Enter fullscreen mode Exit fullscreen mode

_start tells the kernel, where should it look for the beginning of the code.

In there, we can find mnemonics - Assembly instructions

In one line, there can only be one mnemonic

So, this

MOV TOTAL, 48 ADD TOTAL, 10
Enter fullscreen mode Exit fullscreen mode

Can never appear - so we need to write this in 2 separate lines

MOV TOTAL, 48 ; Move 48 to variable in memory called TOTAL
ADD TOTAL, 10
Enter fullscreen mode Exit fullscreen mode

As you see, I've also added ; to the end - that's comment in assembly

That's it, not to much yet still I hope it will expand very soon

What will I learn now?

Probably start reading about registers and other parts such as variables or conditional instructions

Right now, I'd like to thank you for reading - Share you expirance in comments. Maybe we as community can learn a very valuable lessons from you.

Also, feel free to share your sources - where have you been learning assembly from and that's it

See you next time

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)