Code to Microprocessor (1)
Code to Microprocessor (1)
microprocesso
How it process?
r
@nitinsxng
h
1: Source Code: High-level code
written by the developer.
The high-level, human-readable code
written by a developer in a programming
language (e.g., C, Python, Java). It uses
natural language-like syntax and
abstractions, making it easier to
understand, develop, and maintain. This
is the starting point of the compilation or
interpretation process.
@nitinsxng
h
2: Preprocessed Code: Handle
#include. Expands the header file.
The output of the preprocessing phase
in compilation, where directives like
#include, #define, and macros are
expanded. This step replaces header
files and macros with their actual
content, preparing the code for the
compilation phase.
@nitinsxng
h
Example:
int, main, (, ), {, int, x, =, 3, ,, y, =, 4, ;, int, z, =, x, *,
y, ;, printf, (, "Product: %d\n", z, ), ;, return, 0, ;, }
@nitinsxng
h
8: final binary file in hexadecimal:
7F 45 4C 46 02 01 01 00 ... ; ELF
Header
B8 03 00 00 00 ; mov eax, 3
BB 04 00 00 00 ; mov ebx, 4
0F AF C3 ; imul eax, ebx
50 ; push eax
68 00 01 40 00 ; push msg address
E8 xx xx xx xx ; call printf
83 C4 08 ; add esp, 8
31 C0 ; xor eax, eax
C3 ; ret
50 72 6F 64 75 63 74 3A ... ; "Product:
%d\0” @nitinsxng
h
9: Hexadecimal Breakdown and
Conversion to Binary
ELF Header
7F 45 4C 46 02 01 01 00 ...