DIZNR INTERNATIONAL

System Programming: System Programming Tutorial-concept of assembly language-Assembler and it’s working with diagram

System-Programming-System-Programming-Tutorial-concept-of-assembly-language-Assembler-and-its-working-with-diagram

System-Programming-System-Programming-Tutorial-concept-of-assembly-language-Assembler-and-its-working-with-diagram

System Programming: System Programming Tutorial-concept of assembly language-Assembler and it’s working with diagram.

https://www.gyanodhan.com/video/7A1.%20Computer%20Science/System%20Programming/354.%20System%20Programming%20Tutorial%20-%20concept%20of%20assembly%20language%20%20%20Assembler%20and%20it%27s%20working%20with%20diagram.mp4

System Programming: Assembly Language and Assembler

1. Introduction to Assembly Language

Assembly Language is a low-level programming language that provides a direct mapping to a computer’s machine code. It is written using mnemonics instead of binary opcodes, making it easier for humans to read and write.

Features of Assembly Language

 Uses symbolic mnemonics (e.g., MOV, ADD, SUB).
 Provides direct hardware control.
 Faster execution compared to high-level languages.
 Requires an Assembler to convert it into machine code.

2. What is an Assembler?

An Assembler is a system program that translates assembly language into machine code (binary form) that a computer’s CPU can execute.

Assembler Functions:

  1. Converts mnemonics into opcodes (e.g., MOV A, B78H).
  2. Allocates memory for instructions and data.
  3. Handles labels and addresses (symbol table management).
  4. Detects syntax errors in the assembly code.

3. Working of an Assembler (With Diagram)

Step-by-Step Assembler Workflow:

  1. Input: Assembly Program

    • Programmer writes instructions using mnemonics.
    • Example code:
      assembly
      START: MOV A, B ; Move B into A
      ADD C ; Add C to A
      JMP END ; Jump to END
      END: HLT ; Stop execution
  2. Lexical Analysis

    • The assembler scans the program and extracts mnemonics, labels, and operands.
  3. Syntax Analysis

    • Checks for errors like invalid mnemonics or incorrect operand usage.
  4. Symbol Table Generation

    • Creates a table of labels and their corresponding addresses.
  5. Opcode Conversion

    • Converts mnemonics into machine code instructions.
  6. Address Resolution

    • Assigns memory addresses to instructions and data.
  7. Output: Machine Code (Object File)

    • Generates an executable binary code.

Diagram: Working of an Assembler

+-------------------------+
| Assembly Source Code |
+-----------+-------------+
|
v
+-------------------------+
| Lexical Analysis | ---> Extract mnemonics, labels, operands
+-------------------------+
|
v
+-------------------------+
| Syntax Analysis | ---> Check for syntax errors
+-------------------------+
|
v
+-------------------------+
| Symbol Table Creation | ---> Assign labels to memory addresses
+-------------------------+
|
v
+-------------------------+
| Opcode Conversion | ---> Convert mnemonics to machine code
+-------------------------+
|
v
+-------------------------+
| Output: Machine Code | ---> Final executable binary
+-------------------------+

4. Types of Assemblers

1. Single-Pass Assembler

2. Two-Pass Assembler

5. Conclusion

Would you like a real-world example of an assembly program and its machine code conversion?

System Programming: System Programming Tutorial-concept of assembly language-Assembler and it’s working with diagram

The Art of Assembly Language

Unit 1 What is System Programming?

Here’s a comprehensive tutorial on System Programming, focusing on the Concept of Assembly Language, Assembler, and its working with a diagram.


System Programming Tutorial – Assembly Language & Assembler


What is System Programming?

System Programming involves creating system software like compilers, assemblers, linkers, loaders, operating systems, etc., that manage and control computer hardware.


What is Assembly Language?

Assembly Language is a low-level programming language that uses mnemonics (symbols or short codes) to represent machine-level instructions.

Example:

asm
MOV A, B ; Move data from register B to register A
ADD A, C ; Add contents of C to A

Each instruction corresponds to a machine instruction understood by the CPU.


What is an Assembler?

An Assembler is a system program that converts assembly language code into machine code (binary).


Types of Assemblers:

  1. Single-pass assembler: Processes code once. Faster, but limited functionality.

  2. Two-pass assembler: Processes code twice. First pass builds the symbol table; second pass generates machine code.


Working of Assembler – Step-by-Step

Input:

Output:


Steps in Assembler Processing (Two-Pass Example)

Pass 1 – Analysis Phase:

Pass 2 – Synthesis Phase:


Diagram – Working of an Assembler

pgsql
+--------------------+
| Assembly Program | ← Input (.asm)
+--------------------+
|
v
+--------------------+
| Pass 1 |
| (Symbol Table + |
| Address Info) |
+--------------------+
|
+--------------------+
| Pass 2 |
| (Code Generation) |
+--------------------+
|
v
+--------------------+
| Machine Code | ← Output (.obj/.bin)
+--------------------+

Symbol Table Example

Label Address
LOOP 1003
END 1010

Assembler uses this during Pass 2 to fill in actual addresses for jumps or labels.


Example Code & Machine Code Translation

Assembly Code:

asm
START: MOV A, B
ADD A, C
JMP START

Machine Code:

css
Opcode1 (MOV A, B)
Opcode2 (ADD A, C)
Opcode3 (JMP to address of START)

Summary

Concept Description
Assembly Language Low-level language using mnemonics
Assembler Translates assembly code to machine code
Symbol Table Keeps track of labels and addresses
Machine Code Output Binary code that CPU executes

Would you like a downloadable PDF with diagrams and exercises or a video-based explanation of this tutorial? I can also add practice problems with solutions for better understanding.

System Programming: System Programming Tutorial-concept of assembly language-Assembler and it’s working with diagram

8086 assembler tutorial for beginners (part 1)

COM 212 INTRO TO SYSTEM PROGRAMMING Book Theory