👨‍🏫 Tutorial Assembly Programming x86_64 Low Level Programming

PHC-jollibee

Forum Veteran
Good evening, mga ka Jollibee. I am back with a newly cooked guide with assembly programming.
I assume you are reading this in DARK MODE. Sakit sa mata yung white background HAHAHA :ROFLMAO:

Tools Needed
1. NASM
2. LINUX BOX
3. CODE EDITOR (VSCode, Vim, Nano) -> anything where you can write yung instructions because it does not require a fancy code editor.

A brief overview of assembly language:

Assembly Language is any You do not have permission to view the full content of this post. Log in or register now. with a very strong correspondence between the instructions in the language and the You do not have permission to view the full content of this post. Log in or register now. You do not have permission to view the full content of this post. Log in or register now. You do not have permission to view the full content of this post. Log in or register now..
In other words, assembly language corresponds with machine code like binary code to execute a program, so programmers created assembly language to prevent writing 1's and 0's, which is a very tedious task and prone to error "human error".

You do not have permission to view the full content of this post. Log in or register now.

Here is a simple diagram of the evolution of programming languages
1719328371593.webp


As you observe nowadays, usually sa mga baguhan, they most likely know PYTHON, JAVASCRIPT, RUST, and many more high-level languages which is good but to understand the inner functionality of your program, you NEED to learn Assembly Programming.


TUTORIAL TIME

So, ngayun let's dive into the basics of assembly language, and the architecture we will be using is NASM or Netwide Assembler. This will only work in a Linux box. If you want Windows as an OS, you can install Visual Studio and Irvine, which automatically install MASM (MASM is an alternative for NASM which is for Windows operating system siya). Now let's assume you have already installed those tools and you are ready to go.

In assembly, it uses mnemonic codes like mov, add, sub, div, and many more.

Example of Assembly Code
mov rax, 1
mov rdx, 2
add rax, rdx
ret

Explaination
You are moving the value 1 sa rax register (Registers will be discussed below)
tapos moving the value of 2 sa rdx na register
and lastly adding the value of rax and rdx and return the value
kung sa c++ or any languages you're just declaring 2 variables and adding their values, very simple.

Assembly also separates code into section.
1. .data - the purpose of this section is for declaring a constant value (Example: your helloword message)
2. .text - the purpose of this section is for keeping your actual code like _start which in _start duon mo ilalagay yung codes mo.
3. .bssi - the purpose of this section is for declaring a variables na initialized lang pero walang value
and many more sections (You can search on Google "Assembly Sections" for your reference)

NOTE: Walang issue kung paano ang sunod sunod nang section mo kase yung compiler na ang bahala mag fix niyan after compilng your code.


ASSEMBLY REGISTERS
The following registers mentioned are for only x64 architecture. You can refer to this website You do not have permission to view the full content of this post. Log in or register now.


1719330810826.webp



Now you have a little bit of understanding of how assembly code operates, lets create a hello world message using assembly
You can use this online editor You do not have permission to view the full content of this post. Log in or register now.

Pa react naman IDOLO para makuha mo yung code :love:
You do not have permission to view the full content of this post. Log in or register now.

CODE:

1719330148757.webp



CLICK THE RUN BUTTON

1719330245707.webp


RESULT:

1719330201638.webp




So you just learned the basics of ASSEMBLY Language don't forget to comment and critique the content if you have some suggestions comment below mga papi.

~adios
 
na miss ko yung ganitong tutorial. yung galing mismo sa author hindi galing lang sa google. hahaha. very appreciated yung ganito. salamat ts!
 

About this Thread

  • 25
    Replies
  • 2K
    Views
  • 18
    Participants
Last reply from:
m1k3y

Trending Topics

Online now

Members online
981
Guests online
1,475
Total visitors
2,456

Forum statistics

Threads
2,273,378
Posts
28,949,080
Members
1,235,723
Latest member
xberzerker
Back
Top