Assembly Language in Computer Architecture YASH PAL, February 27, 2026February 27, 2026 Assembly Language in Computer Architecture – Assembly language is a low-level programming language, and a programming language is defined by a set of rules. The programs written in assembly language are compiled by an assembler. Every assembler has its own assembly language, which is designed for one specific computer architecture. The basic unit of an assembly language program is a line of code. Assembly Language mainly consists of mnemonic processor instructions or data, and other statements or instructions. It is produced with the help of compiling the high-level language source code like C, C++. Assembly Language, which helps in fine-tuning the program. An assembly program can be divided into three sections – The data section The bss section The text section The data Section: The data section is used for declaring initialized data or constants. This data does not change at runtime. You can declare various constant values, file names, or buffer sizes, etc., in this section. The syntax for declaring a data section is – section.data The bss Section: The bss section is used for declaring variables. The syntax for declaring bss section is – section.bss The text section: The text section is used for keeping the actual code. This section must begin with the declaration global_start, which tells the kernel where the program execution bagine The syntax for declaring a text section is – section.text global_start _start: Comments Assembly language comment begins with a semicolon (;). It may contain any printable character, including blank. It can appear on a line by itself, like – This program displays a message on screen or, on the same line along with an instruction, like – add eax, ebx ; adds ebx to eax Rules of the Assembly Language: Each line of an assembly language program is arranged in three columns called fields. The fields specify the following information. The label field may be empty, or it may specify a symbolic address. A symbolic address consists of one, two, or three, but not more than three alphanumeric characters. The first character must be a letter, the next two may be letters or numerals. The symbol can be chosen arbitrarily by the programmer. A symbolic address in the label field is terminated by a comma so that it will be recognized as a label by the assembler. The instruction field specifies a machine instruction or a pseudo-instruction. The instruction field in an assembly language program may specify one of the following instructions: A memory-reference instruction (MRI) A register-reference or input-output instruction (non-MRI) A pseudo instruction with or without an operand The comment field may be empty, or it may include a comment. A line of code may or may not have a comment, but if it has, it must be preceded by a slash for the assembler to recognize the beginning of a comment field. Comments are useful for explaining the program and are helpful in understanding the step-by-step procedure taken by the program. Comments are inserted for explanatory purposes only and are neglected during the binary translation process. Advantages of Assembly Language: It allows complex jobs to run in a simpler way. It is memory-efficient, as it requires less memory. It is faster in speed, as its execution time is shorter. It is mainly hardware-oriented. It requires less instruction to get the result. It is used for critical jobs. It is not required to keep track of memory locations. It is a low-level embedded system. It is most suitable for writing interrupt service routines and other memory-resident programs. Disadvantage of Assembly Language It takes a lot of time and effort to write the code for the same. It is very complex and difficult to understand. The syntax is difficult to remember. It has a lack of portability of the program between different computer architectures. It needs more size or memory of the computer to run the long programs written in Assembly Language. Let’s take an example to Write a assambly language program to subtract two numbers. ORG 100/Origin of the program is location 100LDA SUB/Load subtrahend to ACCMA/Complement ACINC/Increment ACADD MIN/Add minued to ACSTA DIF/Store differenceHLT/Halt computerMIN,DEC 83/MinuendSUB,DEC-23/SubtrahendDIF,HEX0/Difference stored hereEND/End of symbolic programAssembly Language Program to Subtract Two Numbers Let’s take another example to write the assembly programs to print “Hello world” in Windows. Open the notepad. Write below code global _main extern _printf section .text _main: push message call _printf add esp, 4 ret message: db 'Hello, World!', 10, 0 Save the file with any name, for example, XYZ.asm; the extension should be “.asm”. The above file needs to be compiled with the help of an assembler, which is NASM (Netwide Assembler). Run the command nasm -f win32 XYZ.asm After this, Nasm creates one object file that contains machine code, but not the executable code that is XYZ.obj To create the executable file for windows Minimal GNU is used, which provides the GCC compiler. Run the command gcc -o XYZ.exe XYZ.obj Execute the executable file now, “XYZ” It will show the output as “Hello, world”. Computer System Architecture engineering subjects Computer System Architecture