×
Create a new article
Write your page title here:
We currently have 190 articles on Open Eggbert. Type your article name above or click on one of the titles below and start writing!



Open Eggbert
190Articles

Assembly Language: Difference between revisions

No edit summary
No edit summary
Line 18: Line 18:


=== List examples of some assemblers ===
=== List examples of some assemblers ===
NASM, MASM.
NASM - Free, well documented, can be used on both Linuxc and Windwos
 
MASM - Microsoft Assembler
 
TASM - Borland Turbo Assembler
 
GAS - GNU Assembler


=== Why Assembly languages exist? ===
=== Why Assembly languages exist? ===
Line 80: Line 86:
=== Decimal number system ===
=== Decimal number system ===
The base is 10.
The base is 10.
=== What are the steps of an execution cycle of the processor ===
* Fetching the instruction from memory
* Decoding or identifying the instruction
* Executing the instruction
=== How processor stores and loads the data ===
Storing and loading is done in the reverse-byte sequence
=== Kinds of memory addressing ===
* Absolute address - a direct reference of specific location.
* Segment address (or offset) - starting address of a memory segment with the offset value.
== Assembly syntax ==
=== Parts of an assembly program ===
* data section
* bss section
* text section
=== Data section ===
Used for declaring constants - which do not change at the runtime
The start of this sections is declared as: section.data
=== Bss section ===
Used for declaring variables
The start of this sections is declared as: bxx.data
=== Text section ===
Used for declaring the code.
The start of this sections is declared as:
<code>section.text</code>
<code>global _start</code>
<code>_start:</code>
=== Comments ===
Comments starts with the semicolon (;) character.
One comments cannot be on more lines. Assembly language comments are only one-line.
Comments (;) can start on a new line are after an instruction
=== Types of Assembly Language Statements ===
* Executable instructions or instructions,
* Assembler directives or pseudo-ops, and
* Macros.
Executable instructions, or simply "instructions," direct the processor's actions. Each one includes an operation code (opcode) and corresponds to a single machine language instruction.
Assembler directives, or pseudo-ops, provide guidance to the assembler on aspects of the assembly process. They are non-executable and do not produce machine language instructions.
Macros act as a mechanism for text substitution.


== External links ==
== External links ==
https://www.tutorialspoint.com/assembly_programming/index.htm
https://www.tutorialspoint.com/assembly_programming/index.htm

Revision as of 10:38, 9 November 2024

Only the x86 instruction set is mostly described here.

Basics

What is Assembly Language

Assembly language is a low-level programming language for a computer or other programmable device.

What is the difference between the Assembly language and high-level programming languages

Each assembly languages is specific for a given computer architecture (instruction set).

High level programming language are mostly portable across multiple systems.

How is the source code of an high-level programming language converted to the executable machine code

Via a Compiler

How is the source code of an assembly language converted to the executable machine code

Via an Assembler

List examples of some assemblers

NASM - Free, well documented, can be used on both Linuxc and Windwos

MASM - Microsoft Assembler

TASM - Borland Turbo Assembler

GAS - GNU Assembler

Why Assembly languages exist?

Each computer has a microprocessor with arithmetical, logical and control activities.

Each family of processors has its own set of instructions.

Processors understands only machine language instructions, which are ones and zeros. But develop software only using ones and zeros is too hard and complex. As the solution there are the assembly languages for each the instruction sets, instructions are represented with symbolic code and a more understandable form.

Advantages of understanding the assembly language

You will know:

  • How applications communicate with the operating system, processor and BIOS
  • The ways, data is represented in memory and other external devices
  • Access and execution of instructions by the processor
  • Access and processing data by instructions

Advantages of the assembly language

Less RAM

Less execution time

Suitable for time-critical jobs

List 3 basic parts of the computer hardware related to the computing part

Processor, memory and registers.

Describe shortly processor

Processor executes program instructions.

Describe shortly registers

Registers hold data and address.

Describe shortly memory

Storage for data. The transfer speed much higher than the speed of an HDD or SDD. The transfer speed is lower than the speed of registers.

What is a bit

The smallest unit of the storage is a bit, which can be ON (1) or OFF (0).

What is the name for a group of 8 bits?

Group of 8 related bits is name a byte.

Which data sizes are supported by the processor?

  • Word: a 2-byte data item
  • Doubleword: a 4-byte (32 bit) data item
  • Quadword: an 8-byte (64 bit) data item
  • Paragraph: a 16-byte (128 bit) area
  • Kilobyte: 1024 bytes
  • Megabyte: 1,048,576 bytes

Binary number system

The base is 2.

Hexadecimal number system

The base is 16.

Octal number system

The base is 8.

Decimal number system

The base is 10.

What are the steps of an execution cycle of the processor

  • Fetching the instruction from memory
  • Decoding or identifying the instruction
  • Executing the instruction

How processor stores and loads the data

Storing and loading is done in the reverse-byte sequence

Kinds of memory addressing

  • Absolute address - a direct reference of specific location.
  • Segment address (or offset) - starting address of a memory segment with the offset value.

Assembly syntax

Parts of an assembly program

  • data section
  • bss section
  • text section

Data section

Used for declaring constants - which do not change at the runtime

The start of this sections is declared as: section.data

Bss section

Used for declaring variables

The start of this sections is declared as: bxx.data

Text section

Used for declaring the code.

The start of this sections is declared as:

section.text

global _start

_start:

Comments

Comments starts with the semicolon (;) character.

One comments cannot be on more lines. Assembly language comments are only one-line.

Comments (;) can start on a new line are after an instruction

Types of Assembly Language Statements

  • Executable instructions or instructions,
  • Assembler directives or pseudo-ops, and
  • Macros.

Executable instructions, or simply "instructions," direct the processor's actions. Each one includes an operation code (opcode) and corresponds to a single machine language instruction.

Assembler directives, or pseudo-ops, provide guidance to the assembler on aspects of the assembly process. They are non-executable and do not produce machine language instructions.

Macros act as a mechanism for text substitution.

External links

https://www.tutorialspoint.com/assembly_programming/index.htm