What is Assembly Language
Low-level language that writes instructions processors can understand
Introduction
A processr can only process binary data or 1's and 0's. By using assembly we can write human-readable machine instructions. Assembly language is also referred to as machine code.
Machine code is often represented as Shellcode
. A hex representation of machine code bytes and shellcode can be converted back into its assembly language form and can also be loaded directly into memory as binary instructions for execution.
High-level vs. Low-level
Different processors understand different machine instructions. High level languages like C make it possible to write easy to understand code that can work on any proccessor. When high level code is compiled its translated into assembly instructions for the processor its being compiled for. Languages like Python, PHP, JS are usually not compiled but utilize pre-built libraries which are written and compiled in languages like C or C++.
Compiling process
In python we write a simple hello world program:
print("Hello world")
The same program in C
#include <stdio.h>
int main() {
printf("Hello World!\n");
return 0;
}
In assembly language this looks like
mov rax, 1
mov rdi, 1
mov rsi, message
mov rdx, 12
syscall
mov rax, 60
mov rdi, 0
syscall
And finally in binary
01001000 11000111 11000000 00000001
01001000 11000111 11000111 00000001
01001000 10001011 00110100 00100101
01001000 11000111 11000010 00001101
00001111 00000101
01001000 11000111 11000000 00111100
01001000 11000111 11000111 00000000
00001111 00000101
Last updated
Was this helpful?