What is Assembly Programming Language
What is Assembly Programming Language
Section – CCSN13
Name
Submitted to Girmay G.
What Is Assembly Programming Language?
Assembly language is a low-level programming language that is closely
related to machine code. It is specific to a particular computer architecture
and provides a human-readable representation of the machine instructions
that the computer's processor can execute directly.
How it works?
Assembly language works by providing a human- readable representation of
machine instructions that can be directly executed by a computer's
processor. Here's a simplified overview of how it works:
1
instruction from memory, performs the specified operation, and updates the
program counter to move to the next instruction. This process continues
until the program completes or encounters a branching instruction that
alters the program flow.
2
store program instructions, data variables, and other information needed by
the program.
section .text
global _start
_start:
3
mov ebx, 1 ; File descriptor for standard output
In this example, the code prints the message "Hello, World!" to the standard
output and then exits. Let's break it down:
4
.data
.text
.global _start
_start:
In this example, the code performs the same task as the previous example:
it prints the message "Hello, World!" to the standard output and then exits.
However, this code is written for the ARM architecture using the GAS
syntax.
5
The .text section contains the actual code instructions. The _start label
marks the entry point of the program.
The code uses ARM-specific instructions to set up the parameters for
the write system call. It loads the appropriate values into registers r0,
r1, r2, and r7. The swi 0 instruction triggers a software interrupt,
which transfers control to the kernel to perform the system call.
After printing the message, the code sets up the parameters for the
exit system call and calls it to terminate the program.
The above example is for ARM assembly language using the GNU Assembler
(GAS) syntax.
.data
.text
.globl main
main:
In this example, the code performs the same task as the previous examples:
it prints the message "Hello, World!" to the standard output and then exits.
6
However, this code is written for the MIPS architecture using the MARS
simulator.
The above example is for MIPS assembly language using the MARS
simulator.
7
trace program execution. This level of control is particularly useful for
diagnosing low-level issues and optimizing performance.
8
make complex algorithms and data manipulation more cumbersome to
implement and maintain.